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
Category-wise questions & answers
@forelse($byCategory as $category => $answers)
{{ $category }}
| Question |
Answer |
Notes |
Photos |
@foreach($answers as $a)
| {{ $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
|
@endforeach
@empty
No answers recorded for this inspection.
@endforelse