@php $account = $report->account; $accountName = $account ? trim(($account->company_name ?? '') . (($account->suffix ?? null) ? ' (' . $account->suffix . ')' : '')) : ''; $reportTitle = 'Fire Alarm System Report'; $header = data_get($report, 'data.header', []); $body = data_get($report, 'data.body', []); $footer = data_get($report, 'data.footer', []); $deviceGroups = data_get($body, 'device_record', []); $page1Sections = [ 'summary' => 'Summary', 'after_test_checklist' => 'After Test Checklist', 'inspection_checklist' => 'Fire Alarm System Inspection', ]; $page2Sections = [ 'control_unit_tests' => 'Control Unit Tests', 'control_unit_inspection' => 'Control Unit Inspection', ]; $page3Sections = [ 'annunciator_tests' => 'Annunciator & Remote Trouble Test', 'power_supply_tests' => 'Power Supply Inspection', 'trouble_signal_tests' => 'Trouble Signal Unit Test', 'emergency_power_tests' => 'Emergency Power Supply Test', 'voice_comm_tests' => 'Voice Communication Inspection', 'ancillary_tests' => 'Ancillary Device Circuit Test', ]; $technicianContact = null; $technicianStampUrl = null; $mark = function ($value) { return !empty($value) ? 'X' : ''; }; $technicianId = $header['technician_contact_id'] ?? null; if ($technicianId) { $technicianContact = \App\Models\Contact::find($technicianId); if ($technicianContact) { $stampMedia = $technicianContact->getFirstMedia('technician_stamp'); if ($stampMedia) { $technicianStampUrl = $stampMedia->getPath(); } } } @endphp
@include('pdfs.service-reports.partials.header', [ 'report' => $report, 'title' => $reportTitle, ])
Report No. {{ $report->report_number }} Status {{ strtoupper($report->status ?? 'draft') }}
Date {{ data_get($header, 'service_date', '') }} Last Service Date {{ data_get($header, 'last_service_date', '') }}
Owner / Authorized Agent {{ data_get($header, 'owner_name', '') }} AHJ {{ data_get($header, 'ahj_name', '') }}
Technician {{ data_get($header, 'technician_name', '') }} Total Hours {{ data_get($header, 'total_hours', '') }}
Start Time {{ data_get($header, 'start_time', '') }} End Time {{ data_get($header, 'end_time', '') }}
Manufacturer {{ data_get($header, 'manufacturer', '') }} Model {{ data_get($header, 'model', '') }}
Serial Number {{ data_get($header, 'serial_number', '') }} Panel Location {{ data_get($header, 'panel_location', '') }}
Signal Receiving Centre {{ data_get($header, 'signal_receiving_centre', '') }} Direct Connection {{ data_get($header, 'direct_connection', '') }}
@foreach($page1Sections as $sectionKey => $sectionLabel) @php $rows = data_get($body, $sectionKey, []); @endphp
{{ $sectionLabel }}
@forelse($rows as $row) @empty @endforelse
Question Pass Fail N/A Repaired
{{ data_get($row, 'label', '') }} {{ data_get($row, 'answer') === 'pass' ? 'X' : '' }} {{ data_get($row, 'answer') === 'fail' ? 'X' : '' }} {{ data_get($row, 'answer') === 'na' ? 'X' : '' }} {{ !empty(data_get($row, 'repaired')) ? 'X' : '' }}
No items recorded.
@endforeach
@include('pdfs.service-reports.partials.footer')
@include('pdfs.service-reports.partials.header', [ 'report' => $report, 'title' => $reportTitle, ])
@foreach($page2Sections as $sectionKey => $sectionLabel) @php $rows = data_get($body, $sectionKey, []); @endphp
{{ $sectionLabel }}
@forelse($rows as $row) @empty @endforelse
Question Pass Fail N/A Repaired
{{ data_get($row, 'label', '') }} {{ data_get($row, 'answer') === 'pass' ? 'X' : '' }} {{ data_get($row, 'answer') === 'fail' ? 'X' : '' }} {{ data_get($row, 'answer') === 'na' ? 'X' : '' }} {{ !empty(data_get($row, 'repaired')) ? 'X' : '' }}
No items recorded.
@endforeach
@include('pdfs.service-reports.partials.footer')
@include('pdfs.service-reports.partials.header', [ 'report' => $report, 'title' => $reportTitle, ])
@foreach($page3Sections as $sectionKey => $sectionLabel) @php $rows = data_get($body, $sectionKey, []); @endphp
{{ $sectionLabel }}
@forelse($rows as $row) @empty @endforelse
Question Pass Fail N/A Repaired
{{ data_get($row, 'label', '') }} {{ data_get($row, 'answer') === 'pass' ? 'X' : '' }} {{ data_get($row, 'answer') === 'fail' ? 'X' : '' }} {{ data_get($row, 'answer') === 'na' ? 'X' : '' }} {{ !empty(data_get($row, 'repaired')) ? 'X' : '' }}
No items recorded.
@endforeach
@include('pdfs.service-reports.partials.footer')
@include('pdfs.service-reports.partials.header', [ 'report' => $report, 'title' => $reportTitle, ])
Individual Device Record
A. Correctly installed    B. Requires service, repairs, missing, or cleaning    C. Alarm operation confirmed    D. Annunciator indication confirmed    E. Zone circuit number or address    F. Smoke detector sensitivity testing
@forelse($deviceGroups as $group) @foreach(data_get($group, 'devices', []) as $device) @endforeach @empty @endforelse
Device Location A B C D E F Comments
{{ data_get($group, 'location_name', '') }}
{{ data_get($device, 'device', '') }} {{ data_get($device, 'sub_location', '') }} {{ $mark(data_get($device, 'a')) }} {{ $mark(data_get($device, 'b')) }} {{ $mark(data_get($device, 'c')) }} {{ $mark(data_get($device, 'd')) }} {{ data_get($device, 'e', '') }} {{ $mark(data_get($device, 'f')) }} {{ data_get($device, 'comments', '') }}
No device records entered.
Comments
@include('pdfs.service-reports.partials.footer')