edcdba9d53
- HasMedia (Spatie) on WorkOrder with `photos` collection
- eta_at + tracking_token columns; token auto-generated on create
- Public /t/{token} page — tenant-scoped via subdomain, white-label themed
- QR code SVG via chillerlan/php-qrcode (inline modal + download)
- Filament: SpatieMediaLibraryFileUpload + ETA picker + tracking section
- EditWorkOrder header action "Link client (QR)" modal
- Fix: Auditable::dontSubmitEmptyLogs() → dontLogEmptyChanges() (removed in activitylog)
- Tests: TrackingPageTest (4 pass) covering token gen + cross-tenant isolation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
177 lines
7.5 KiB
PHP
177 lines
7.5 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="{{ app()->getLocale() }}">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>#{{ $wo->number }} — {{ $tenant->display_name ?? $tenant->name }}</title>
|
|
@php
|
|
$themeColor = $tenant->settings['theme_color'] ?? '#3B82F6';
|
|
$logoUrl = method_exists($tenant, 'getLogoUrl') ? $tenant->getLogoUrl() : null;
|
|
$faviconUrl = method_exists($tenant, 'getFaviconUrl') ? $tenant->getFaviconUrl() : null;
|
|
$statuses = App\Models\Tenant\WorkOrder::STATUSES;
|
|
$flow = ['new', 'diagnosis', 'agreement', 'approved', 'in_work', 'awaiting_parts', 'ready', 'done'];
|
|
$currentIdx = array_search($wo->status, $flow, true);
|
|
@endphp
|
|
@if ($faviconUrl)
|
|
<link rel="icon" href="{{ $faviconUrl }}">
|
|
@endif
|
|
<style>
|
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: #1f2937; background: #f3f4f6; line-height: 1.5; }
|
|
.wrap { max-width: 720px; margin: 0 auto; padding: 24px 16px 64px; }
|
|
|
|
header { background: {{ $themeColor }}; color: #fff; padding: 28px 16px; text-align: center; }
|
|
header img { max-height: 56px; margin-bottom: 12px; }
|
|
header h1 { font-size: 22px; font-weight: 700; }
|
|
header .num { font-size: 14px; opacity: .85; margin-top: 4px; }
|
|
|
|
.card { background: #fff; border-radius: 12px; padding: 20px; margin-top: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
|
|
.card h2 { font-size: 16px; font-weight: 600; margin-bottom: 14px; color: {{ $themeColor }}; }
|
|
.row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f3f4f6; font-size: 14px; }
|
|
.row:last-child { border-bottom: 0; }
|
|
.row .k { color: #6b7280; }
|
|
.row .v { font-weight: 500; color: #111827; text-align: right; }
|
|
|
|
.status-badge {
|
|
display: inline-block; padding: 6px 14px; border-radius: 999px;
|
|
background: {{ $themeColor }}; color: #fff; font-size: 13px; font-weight: 600;
|
|
}
|
|
|
|
.timeline { list-style: none; padding: 0; }
|
|
.timeline li {
|
|
position: relative; padding: 10px 0 10px 36px; font-size: 14px;
|
|
color: #9ca3af;
|
|
}
|
|
.timeline li::before {
|
|
content: ''; position: absolute; left: 10px; top: 16px;
|
|
width: 12px; height: 12px; border-radius: 50%;
|
|
background: #e5e7eb; border: 2px solid #fff; box-shadow: 0 0 0 2px #e5e7eb;
|
|
}
|
|
.timeline li.done { color: #111827; }
|
|
.timeline li.done::before { background: {{ $themeColor }}; box-shadow: 0 0 0 2px {{ $themeColor }}; }
|
|
.timeline li.current { color: #111827; font-weight: 600; }
|
|
.timeline li.current::before { background: {{ $themeColor }}; box-shadow: 0 0 0 2px {{ $themeColor }}33; }
|
|
.timeline li:not(:last-child)::after {
|
|
content: ''; position: absolute; left: 15px; top: 28px; bottom: -4px;
|
|
width: 2px; background: #e5e7eb;
|
|
}
|
|
.timeline li.done:not(:last-child)::after { background: {{ $themeColor }}; }
|
|
|
|
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
|
|
.photos a { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: #f3f4f6; }
|
|
.photos img { width: 100%; height: 100%; object-fit: cover; }
|
|
|
|
.note { background: #fefce8; border-left: 3px solid #facc15; padding: 12px; border-radius: 4px; font-size: 14px; color: #713f12; }
|
|
.totals { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 2px solid #e5e7eb; margin-top: 12px; }
|
|
.totals .lbl { font-size: 14px; color: #6b7280; }
|
|
.totals .amt { font-size: 22px; font-weight: 700; color: {{ $themeColor }}; }
|
|
footer { text-align: center; padding: 24px 16px; color: #9ca3af; font-size: 12px; }
|
|
|
|
@media (prefers-color-scheme: dark) {
|
|
body { background: #0f172a; color: #e5e7eb; }
|
|
.card { background: #1e293b; box-shadow: none; }
|
|
.row { border-color: #334155; }
|
|
.row .k { color: #94a3b8; }
|
|
.row .v { color: #f1f5f9; }
|
|
.timeline li::before { border-color: #1e293b; box-shadow: 0 0 0 2px #475569; }
|
|
.timeline li.done { color: #e5e7eb; }
|
|
.timeline li:not(:last-child)::after { background: #475569; }
|
|
.note { background: #422006; border-left-color: #ca8a04; color: #fef9c3; }
|
|
footer { color: #64748b; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
@if ($logoUrl)<img src="{{ $logoUrl }}" alt="">@endif
|
|
<h1>{{ $tenant->display_name ?? $tenant->name }}</h1>
|
|
<div class="num">Fișa #{{ $wo->number }}</div>
|
|
</header>
|
|
|
|
<div class="wrap">
|
|
|
|
<div class="card" style="text-align:center;">
|
|
<span class="status-badge">{{ $statuses[$wo->status] ?? $wo->status }}</span>
|
|
@if ($wo->eta_at && in_array($wo->status, ['in_work', 'awaiting_parts', 'approved', 'diagnosis'], true))
|
|
<p style="margin-top:10px;color:#6b7280;font-size:14px;">
|
|
Gata estimat: <strong style="color:#111827">{{ $wo->eta_at->isoFormat('D MMM YYYY, HH:mm') }}</strong>
|
|
</p>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>Detalii</h2>
|
|
@if ($wo->vehicle)
|
|
<div class="row">
|
|
<span class="k">Auto</span>
|
|
<span class="v">{{ trim($wo->vehicle->make . ' ' . $wo->vehicle->model) }}
|
|
@if ($wo->vehicle->plate) · {{ $wo->vehicle->plate }} @endif
|
|
</span>
|
|
</div>
|
|
@endif
|
|
@if ($wo->mileage_in)
|
|
<div class="row"><span class="k">Kilometraj</span><span class="v">{{ number_format($wo->mileage_in, 0, '.', ' ') }} km</span></div>
|
|
@endif
|
|
<div class="row"><span class="k">Deschis</span><span class="v">{{ $wo->opened_at?->isoFormat('D MMM YYYY') }}</span></div>
|
|
@if ($wo->master)
|
|
<div class="row"><span class="k">Maistru</span><span class="v">{{ $wo->master->name }}</span></div>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>Etape</h2>
|
|
<ul class="timeline">
|
|
@foreach ($flow as $i => $st)
|
|
@php
|
|
$cls = '';
|
|
if ($currentIdx !== false && $i < $currentIdx) $cls = 'done';
|
|
elseif ($currentIdx !== false && $i === $currentIdx) $cls = 'current';
|
|
@endphp
|
|
<li class="{{ $cls }}">{{ $statuses[$st] }}</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
|
|
@if ($wo->complaint)
|
|
<div class="card">
|
|
<h2>Ce ne-ai cerut</h2>
|
|
<p style="font-size:14px;white-space:pre-wrap;">{{ $wo->complaint }}</p>
|
|
</div>
|
|
@endif
|
|
|
|
@if ($wo->recommendations)
|
|
<div class="card">
|
|
<h2>Recomandări</h2>
|
|
<div class="note" style="white-space:pre-wrap;">{{ $wo->recommendations }}</div>
|
|
</div>
|
|
@endif
|
|
|
|
@if ($photos->count())
|
|
<div class="card">
|
|
<h2>Fotografii</h2>
|
|
<div class="photos">
|
|
@foreach ($photos as $p)
|
|
<a href="{{ $p->getUrl() }}" target="_blank" rel="noopener">
|
|
<img src="{{ $p->getUrl() }}" alt="" loading="lazy">
|
|
</a>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
@if ((float) $wo->total > 0)
|
|
<div class="card">
|
|
<div class="totals">
|
|
<span class="lbl">Total</span>
|
|
<span class="amt">{{ number_format((float) $wo->total, 2, '.', ' ') }} {{ $tenant->settings['currency'] ?? 'MDL' }}</span>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
<footer>
|
|
Powered by AutoCRM
|
|
</footer>
|
|
</div>
|
|
</body>
|
|
</html>
|