@php $payload = $report->data ?? []; $header = is_array($payload['header'] ?? null) ? $payload['header'] : []; $body = is_array($payload['body'] ?? null) ? $payload['body'] : []; $footer = is_array($payload['footer'] ?? null) ? $payload['footer'] : []; $fireExtinguishers = is_array($body['fire_extinguishers'] ?? null) ? $body['fire_extinguishers'] : []; $emergencyLights = is_array($body['emergency_lights'] ?? null) ? $body['emergency_lights'] : []; $accountName = $report->account ? trim($report->account->company_name . ($report->account->suffix ? ' (' . $report->account->suffix . ')' : '')) : ''; $primaryAddress = optional($report->account)->primaryAddress; $primaryPhone = optional($report->account)->primaryPhone; $addressLine1 = trim((string) ($primaryAddress->line_1 ?? '')); $city = trim((string) ($primaryAddress->city ?? '')); $province = trim((string) ($primaryAddress->state ?? '')); $postalCode = trim((string) ($primaryAddress->zip ?? '')); $phone = trim((string) ($primaryPhone->number ?? '')); $accountSite = $accountName ?: '—'; $addressLine1 = $addressLine1 !== '' ? $addressLine1 : '—'; $city = $city !== '' ? $city : '—'; $province = $province !== '' ? $province : '—'; $postalCode = $postalCode !== '' ? $postalCode : '—'; $phone = $phone !== '' ? $phone : '—'; $serviceDate = $header['service_date'] ?? ''; $startTime = $header['start_time'] ?? ''; $endTime = $header['end_time'] ?? ''; $technician = $header['technician_name'] ?? ''; $contact = $header['contact_name'] ?? ''; $owner = $header['owner_authorized_agent_name'] ?? ''; $ahj = $header['ahj_name'] ?? ''; $frequency = $header['frequency'] ?? ''; $lastServiceDate = $header['last_service_date'] ?? ''; $signedDate = $footer['signed_date'] ?? $serviceDate; $comments = $footer['comments'] ?? ''; $additionalNotes = $footer['additional_notes'] ?? ''; $yesNoMark = function ($value, $target) { return strtolower((string) $value) === strtolower((string) $target) ? '✔' : ''; }; @endphp
@include('pdfs.service-reports.partials.header', [ 'report' => $report, 'title' => 'Portable Extinguishers & Emergency Lighting', ])
Site {{ $accountSite }} Date of Service {{ $serviceDate ?: '—' }}
Contact {{ $contact ?: '—' }} Start Time {{ $startTime ?: '—' }}
Address {{ $addressLine1 }} End Time {{ $endTime ?: '—' }}
City {{ $city }} Service Technician {{ $technician ?: '—' }}
Province {{ $province }} Frequency {{ $frequency ?: '—' }}
Postal Code {{ $postalCode }} Last Service Date {{ $lastServiceDate ?: '—' }}
Phone {{ $phone }} Report No. {{ $report->report_number }}
Mark appropriate: “✔” Pass, or “X” Fail. All FAIL answers shall be explained in comments.
Fire Extinguishers
@php $extRows = count($fireExtinguishers) ? $fireExtinguishers : array_fill(0, 18, []); @endphp @foreach($extRows as $row) @php $sizeType = $row['size_type'] ?? ''; if (($row['size_type'] ?? '') === 'other' && !empty($row['size_type_other'])) { $sizeType = $row['size_type_other']; } @endphp @endforeach
Location Size / Type Hst Date ✔ / X Comments
{{ $row['location'] ?? '' }} {{ $sizeType }} {{ $row['installation_year'] ?? '' }} @if(($row['inspection'] ?? '') === 'pass') ✔ @elseif(($row['inspection'] ?? '') === 'fail') X @endif {{ $row['comments'] ?? '' }}
Comments
{{ $comments ?: ' ' }}
I state that the information on this service report stood correct at the time and place of my inspection. All equipment was tested and serviced where possible in conformance with the applicable code and left in operational condition upon completion of this inspection. Any equipment not operable after service will be detailed in the notes section.
Owner / Authorized Agent:
{{ $owner ?: '—' }}
Date:
{{ $signedDate ?: '—' }}
Technician Stamp
@include('pdfs.service-reports.partials.footer')
@include('pdfs.service-reports.partials.header', [ 'report' => $report, 'title' => 'Portable Extinguishers & Emergency Lighting', ])
Fire Extinguishers
@php $lightRows = count($emergencyLights) ? $emergencyLights : array_fill(0, 28, []); @endphp @foreach($lightRows as $row) @endforeach
Location V-in Unit Size Batt Size # Batts Date Bulbs Pass Fail Comments
{{ $row['location'] ?? '' }} {{ $row['vin'] ?? '' }} {{ $row['unit_size'] ?? '' }} {{ $row['battery_size'] ?? '' }} {{ $row['num_batts'] ?? '' }} {{ $row['installation_year'] ?? '' }} {{ $row['bulbs'] ?? '' }} {{ $yesNoMark($row['inspection'] ?? '', 'pass') }} {{ strtolower((string) ($row['inspection'] ?? '')) === 'fail' ? 'X' : '' }} {{ $row['comments'] ?? '' }}
@include('pdfs.service-reports.partials.footer')
@include('pdfs.service-reports.partials.header', [ 'report' => $report, 'title' => 'Portable Extinguishers & Emergency Lighting', ])
Notes
@php $notesLines = []; if (!empty($additionalNotes)) { $notesLines = preg_split("/\r\n|\n|\r/", (string) $additionalNotes); } @endphp @for($i = 0; $i < 34; $i++)
{{ $notesLines[$i] ?? '' }}
@endfor
@include('pdfs.service-reports.partials.footer')