@php $isLoading = $statementOfFact->isLoading(); $subTitle = $statementOfFact->sub_title ?: \App\Models\StatementOfFact::getSubtitleForType($statementOfFact->operation_type); $milestones = \App\Models\StatementOfFact::getMilestoneLabels($statementOfFact->operation_type ?? 'discharging'); $resolvedSheets = $statementOfFact->resolved_sheets; @endphp
STATEMENT OF FACT - {{ $statementOfFact->vessel_name ?: 'MV' }} Pratinjau Cetak Formulir ({{ $isLoading ? 'Untuk Loading' : 'Untuk Discharging' }}) • {{ count($resolvedSheets) }} Halaman / Sheet
Kembali
@foreach($resolvedSheets as $sheetIndex => $sheet) @php $cargo = $sheet['cargo_discharging'] ?? []; $cargoRows = $cargo['rows'] ?? []; $cargoTotals = $cargo['totals'] ?? []; $dRecords = $sheet['daily_working_records'] ?? []; $sheetNo = $sheet['sheet_no'] ?? ($sheetIndex + 1); @endphp
{{-- Kop Surat Perusahaan --}}
Kop Surat PT. Anugrah Permata Samudra
{{-- Header --}}

STATEMENT OF FACT

{{ $subTitle }}

{{ $sheetNo }}
{{-- Meta Fields --}}
NAME OF VESSEL : MV. {{ $statementOfFact->vessel_name ?: '-' }} VOY. : {{ $statementOfFact->voyage ?: '-' }}
BERTH : {{ $statementOfFact->berth ?: '-' }}
FLAG : {{ $statementOfFact->flag ?: '-' }}
LOA / G.R.T. : {{ $statementOfFact->loa ?: '-' }} Mtrs / {{ $statementOfFact->grt ?: '-' }} M/Tons
SHIPPING LINE : {{ $statementOfFact->shipping_line ?: '-' }}
SHIP AGENT : {{ $statementOfFact->ship_agent ?: '-' }}
STEVEDORING : {{ $statementOfFact->stevedoring ?: '-' }}
{{-- VESSEL POSITION --}}
VESSEL POSITION
@foreach($milestones as $key => $label) @php $mTime = $statementOfFact->getMilestoneValue($key, 'time'); $mDate = $statementOfFact->getMilestoneValue($key, 'date'); @endphp @endforeach
{{ $label }} AT : {{ $mTime ?: '' }} HOURS DATE : {{ $mDate ?: '' }}
{{-- CARGO MANIFEST (Discharging / Loading) --}} @php $rowsToRender = count($cargoRows) > 0 ? $cargoRows : [[]]; @endphp @foreach($rowsToRender as $r) @endforeach
LOADING PORT DISCHARGING PORT CARS
(UNITS)
HH
(UNITS)
TRUCK
(UNITS)
BUS
(UNITS)
PART /
STATIC
TOTAL
( PKGS )
TONS CBM
{!! !empty($r['loading_port']) ? e($r['loading_port']) : ' ' !!} {!! !empty($r['discharging_port']) ? e($r['discharging_port']) : ' ' !!} {!! !empty($r['cars']) ? number_format((float)$r['cars']) : ' ' !!} {!! !empty($r['hh']) ? number_format((float)$r['hh']) : ' ' !!} {!! !empty($r['truck']) ? number_format((float)$r['truck']) : ' ' !!} {!! !empty($r['bus']) ? number_format((float)$r['bus']) : ' ' !!} {!! !empty($r['parts_static']) ? number_format((float)$r['parts_static']) : ' ' !!} {!! !empty($r['total_pkgs']) ? number_format((float)$r['total_pkgs']) : ' ' !!} {!! !empty($r['m_tons']) ? formatDecimal($r['m_tons']) : ' ' !!} {!! !empty($r['cbm']) ? formatDecimal($r['cbm']) : ' ' !!}
TOTAL {{ (float)($cargoTotals['total_cars'] ?? 0) }} {{ (float)($cargoTotals['total_hh'] ?? 0) }} {{ (float)($cargoTotals['total_truck'] ?? 0) }} {{ (float)($cargoTotals['total_bus'] ?? 0) }} {{ (float)($cargoTotals['total_parts_static'] ?? 0) }}  
TOTAL ALL {{ (float)($cargoTotals['grand_pkgs'] ?? 0) }} {{ formatDecimal($cargoTotals['grand_m_tons'] ?? 0, 2, true) }} {{ formatDecimal($cargoTotals['grand_cbm'] ?? 0, 2, true) }}
{{-- DAILY WORKING RECORD (Hanya untuk Discharging) --}} @if(!$isLoading) @php $recordsToRender = count($dRecords) > 0 ? $dRecords : [[]]; @endphp @foreach($recordsToRender as $rec) @php $rowHours = \App\Models\StatementOfFact::resolveRecordHours(is_array($rec) ? $rec : []); $fmtRecordDate = \App\Models\StatementOfFact::formatRecordDate($rec['date'] ?? ($rec['date_day_work'] ?? null), true); @endphp @endforeach
DAILY WORKING RECORD
DATE
DAY WORK
WORKING TIME
FROM TO
HOURS REMARKS
{!! $fmtRecordDate !== '' ? e($fmtRecordDate) : ' ' !!} {!! !empty($rec['working_time']) ? e($rec['working_time']) : ' ' !!} {!! $rowHours !== '' ? e($rowHours) : ' ' !!} {!! !empty($rec['remarks']) || !empty($rec['stopped_remarks']) ? e($rec['remarks'] ?? $rec['stopped_remarks']) : ' ' !!}
TOTAL HOURS {{ \App\Models\StatementOfFact::sumDailyWorkingHours($dRecords) }}  
@endif {{-- SIGNATURES --}}
CHIEF CHECKER
@if($statementOfFact->chief_checker)
({{ $statementOfFact->chief_checker }})
@endif
CHIEF OFFICER
@if($statementOfFact->chief_officer)
({{ $statementOfFact->chief_officer }})
@endif
@endforeach