Inspection Report

@php $pdfVehicle = $inspection->vehicle?->unit_number ?? $inspection->answers->first()?->vehicle_name ?? '—'; $pdfVin = $inspection->vehicle?->vin ?? $inspection->answers->first()?->vin ?? '—'; $pdfDate = $inspection->inspection_date ? $inspection->inspection_date->format('M d, Y H:i') : ($inspection->answers->first()?->created_at?->format('M d, Y H:i') ?? '—'); $pdfStatus = $inspection->status; if ($pdfStatus === null || $pdfStatus === '') { if ($inspection->answers->contains('status', 'fail')) { $pdfStatus = 'fail'; } elseif ($inspection->answers->contains('status', 'fix')) { $pdfStatus = 'fix'; } else { $pdfStatus = $inspection->answers->contains('status', 'pass') ? 'pass' : '—'; } } @endphp

Vehicle: {{ $pdfVehicle }}  |  VIN: {{ $pdfVin }}

@php $pdfMechanic = null; foreach ($inspection->answers->sortByDesc('created_at') as $a) { $m = $a->mechanic; if ($m && $m->id != 1) { $pdfMechanic = $m; break; } } if (!$pdfMechanic && $inspection->mechanic && $inspection->mechanic->id != 1) $pdfMechanic = $inspection->mechanic; @endphp

Inspection date: {{ $pdfDate }}  |  Mechanic: {{ $pdfMechanic?->name ?? '—' }}

Overall status: {{ ucfirst($pdfStatus ?? '—') }} @if($inspection->due_date)  |  Due date: {{ $inspection->due_date->format('M d, Y') }} @endif

Category-wise questions & answers

@forelse($byCategory as $category => $answers)

{{ $category }}

@foreach($answers as $a) @endforeach
Question Answer Notes Photos
{{ $a->question ?: '—' }} {{ ucfirst($a->status ?? '—') }} {{ $a->notes ?: '—' }} @php $answerImgs = $a->images ?? collect(); @endphp @if($answerImgs->isNotEmpty()) @foreach($answerImgs as $img) {{ basename($img->path) }} @endforeach @elseif(is_array($a->photo_paths) && count($a->photo_paths) > 0) @foreach($a->photo_paths as $path) {{ basename($path) }} @endforeach @else — @endif
@empty

No answers recorded for this inspection.

@endforelse