Monthly Inspection Report – {{ ($month && $month !== 'all') ? \Carbon\Carbon::parse($month . '-01')->format('F Y') : 'All' }}

Generated on {{ now()->format('M d, Y H:i') }}

@foreach($inspections as $inspection) @php $byCategory = $byInspection[$inspection->id] ?? collect(); $rpMechanic = null; foreach ($inspection->answers->sortByDesc('created_at') as $a) { $m = $a->mechanic; if ($m && $m->id != 1) { $rpMechanic = $m; break; } } if (!$rpMechanic && $inspection->mechanic && $inspection->mechanic->id != 1) $rpMechanic = $inspection->mechanic; @endphp

Vehicle: {{ $inspection->vehicle?->unit_number ?? '—' }} | VIN: {{ $inspection->vehicle?->vin ?? '—' }} | Date: {{ $inspection->inspection_date?->format('M d, Y H:i') ?? '—' }} | Mechanic: {{ $rpMechanic?->name ?? '—' }}

@foreach($byCategory as $categoryName => $answers)

{{ $categoryName }}

@foreach($answers as $answer) @endforeach
QuestionAnswerNotes
{{ is_string($answer->question ?? null) ? $answer->question : ($answer->question?->question_text ?? '—') }} @php $ans = $answer->status ?? $answer->answer ?? ''; @endphp @if($ans === 'pass')Pass @elseif($ans === 'fix')Fix @elseif($ans === 'fail')Fail @else — @endif {{ $answer->notes ?? '—' }}
@endforeach @if($byCategory->isEmpty())

No answers recorded.

@endif
@endforeach @if($inspections->isEmpty())

No inspections in this period.

@endif