@section('page-title', 'Statement Of Fact: ' . ($statementOfFact->vessel_name ?: 'MV. -')) @php $isLoading = $statementOfFact->isLoading(); $opTypeLabel = $isLoading ? 'Untuk Loading' : 'Untuk Discharging'; $opTypeBadgeClass = $isLoading ? 'bg-amber-100 text-amber-800 border-amber-200' : 'bg-blue-100 text-blue-800 border-blue-200'; $resolvedSheets = $statementOfFact->resolved_sheets; $sheetCount = count($resolvedSheets); $milestones = \App\Models\StatementOfFact::getMilestoneLabels($statementOfFact->operation_type ?? 'discharging'); $subTitle = $statementOfFact->sub_title ?: \App\Models\StatementOfFact::getSubtitleForType($statementOfFact->operation_type); @endphp
Kembali ke daftar Statement Of Fact

Statement Of Fact: {{ $statementOfFact->vessel_name ?: 'MV. -' }}

{{ $opTypeLabel }} @if($sheetCount > 1) {{ $sheetCount }} Sheets @endif @if($statementOfFact->status === 'completed') Completed @else Draft @endif

Voyage: {{ $statementOfFact->voyage ?: '-' }} • Dermaga: {{ $statementOfFact->berth ?: '-' }}

@if(auth()->user()?->canModule('checker', 'edit')) Edit @endif Cetak / Print
@if(session('success'))
{{ session('success') }}
@endif
@if($sheetCount > 1)
Sheets: @foreach($resolvedSheets as $idx => $s) @endforeach
@endif {{-- Main Document Card (Matches Official Statement Of Fact Paper Sheet) --}}
{{-- Title Header --}}

STATEMENT OF FACT

{{ $subTitle }}

{{-- Sheet Number Box on top right --}}
@foreach($resolvedSheets as $idx => $s) {{ $s['sheet_no'] ?? ($idx + 1) }} @endforeach
{{-- Vessel & Port Details --}}
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 ?: '-' }}
{{-- Section: VESSEL POSITION --}}

VESSEL POSITION

@php $fmtMilestoneDate = function($val) { if (!$val) return ''; if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $val)) { return date('d/m/Y', strtotime($val)); } if (preg_match('/^\d{1,2}[\/\-\.]\d{1,2}[\/\-\.]\d{4}$/', $val)) { return $val; } $ts = strtotime($val); return $ts ? date('d/m/Y', $ts) : $val; }; @endphp
@foreach($milestones as $key => $label) @php $mTime = $statementOfFact->getMilestoneValue($key, 'time'); $mDate = $statementOfFact->getMilestoneValue($key, 'date'); @endphp
{{ $label }}
AT : {{ $mTime ?: '-' }} HOURS
DATE : {{ $fmtMilestoneDate($mDate) ?: '-' }}
@endforeach
@foreach($resolvedSheets as $sIdx => $sheet) @php $sheetCargo = $sheet['cargo_discharging'] ?? []; $sheetCargoRows = $sheetCargo['rows'] ?? []; $sheetCargoTotals = $sheetCargo['totals'] ?? []; $sheetDRecords = $sheet['daily_working_records'] ?? []; @endphp
@if(!empty($sheet['date']))
Sheet: {{ $sheet['sheet_no'] ?? ($sIdx + 1) }} Tanggal: {{ $sheet['date'] }}
@endif {{-- Section: CARGO MANIFEST TABLE (Discharging / Loading) --}}
{{ $isLoading ? 'CARGO LOADING MANIFEST' : 'CARGO DISCHARGING MANIFEST' }}
@forelse($sheetCargoRows as $row) @empty @endforelse {{-- TOTAL ROW (Vehicle Subtotals) --}} {{-- TOTAL ALL ROW (Grand Totals PKGS, TONS, CBM) --}}
LOADING PORT DISCHARGING PORT CARS
(UNITS)
HH
(UNITS)
TRUCK
(UNITS)
BUS
(UNITS)
PART /
STATIC
TOTAL
( PKGS )
TONS CBM
{{ $row['loading_port'] ?? '-' }} {{ $row['discharging_port'] ?? '-' }} {{ number_format((float)($row['cars'] ?? 0)) }} {{ number_format((float)($row['hh'] ?? 0)) }} {{ number_format((float)($row['truck'] ?? 0)) }} {{ number_format((float)($row['bus'] ?? 0)) }} {{ number_format((float)($row['parts_static'] ?? 0)) }} {{ number_format((float)($row['total_pkgs'] ?? 0)) }} {{ formatDecimal($row['m_tons'] ?? 0, 2, true) }} {{ formatDecimal($row['cbm'] ?? 0, 2, true) }}
Tidak ada data kargo manifest pada sheet ini
TOTAL {{ number_format((float)($sheetCargoTotals['total_cars'] ?? 0)) }} {{ number_format((float)($sheetCargoTotals['total_hh'] ?? 0)) }} {{ number_format((float)($sheetCargoTotals['total_truck'] ?? 0)) }} {{ number_format((float)($sheetCargoTotals['total_bus'] ?? 0)) }} {{ number_format((float)($sheetCargoTotals['total_parts_static'] ?? 0)) }}
TOTAL ALL {{ number_format((float)($sheetCargoTotals['grand_pkgs'] ?? 0)) }} {{ formatDecimal($sheetCargoTotals['grand_m_tons'] ?? 0, 2, true) }} {{ formatDecimal($sheetCargoTotals['grand_cbm'] ?? 0, 2, true) }}
{{-- Section: DAILY WORKING RECORD (Hanya untuk Discharging) --}} @if(!$isLoading)
@forelse($sheetDRecords as $record) @php $rowHours = \App\Models\StatementOfFact::resolveRecordHours(is_array($record) ? $record : []); @endphp @empty @endforelse
DAILY WORKING RECORD
DATE
DAY WORK
WORKING TIME
FROM TO
HOURS REMARKS
{{ \App\Models\StatementOfFact::formatRecordDate($record['date'] ?? ($record['date_day_work'] ?? null)) }} {{ $record['working_time'] ?? '-' }} {{ $rowHours !== '' ? $rowHours : '-' }} {{ $record['remarks'] ?? ($record['stopped_remarks'] ?? '-') }}
Tidak ada catatan harian kerja pada sheet ini
TOTAL HOURS {{ \App\Models\StatementOfFact::sumDailyWorkingHours($sheetDRecords) }}
@endif
@endforeach