@php /** @var \App\Models\StatementOfFact $statementOfFact */ $currentType = old('operation_type', $statementOfFact->operation_type ?? 'discharging'); if (!in_array($currentType, ['discharging', 'loading'])) { $currentType = 'discharging'; } $vPos = old('vessel_positions', $statementOfFact->vessel_positions ?? \App\Models\StatementOfFact::getDefaultVesselPositions($currentType)); $sheets = old('sheets', $statementOfFact->resolved_sheets); $milestones = \App\Models\StatementOfFact::getMilestoneLabels($currentType); $parseTimeVal = function($raw) { if (!$raw) return ''; if (preg_match('/^(\d{1,2})[:.](\d{2})/', $raw, $m)) { return sprintf('%02d:%02d', (int)$m[1], (int)$m[2]); } return $raw; }; $parseDurationVal = function($raw) { return \App\Models\StatementOfFact::normalizeDurationString($raw); }; $parseDateVal = function($raw) { if (!$raw) return ''; if (preg_match('/^(\d{4})-(\d{2})-(\d{2})/', $raw)) { return substr($raw, 0, 10); } if (preg_match('/^(\d{1,2})[\/\-\.](\d{1,2})[\/\-\.](\d{4})/', $raw, $dm)) { return sprintf('%04d-%02d-%02d', (int)$dm[3], (int)$dm[2], (int)$dm[1]); } if (preg_match('/^(\d{1,2})[\/\-\.](\d{1,2})[\/\-\.](\d{2})$/', $raw, $dm)) { $year = 2000 + (int)$dm[3]; return sprintf('%04d-%02d-%02d', $year, (int)$dm[2], (int)$dm[1]); } $ts = strtotime($raw); return $ts ? date('Y-m-d', $ts) : ''; }; $subTitleVal = old('sub_title', $statementOfFact->sub_title ?: \App\Models\StatementOfFact::getSubtitleForType($currentType)); $dailyRemarkOptions = [ 'Comm Shifting CBU / Completed Shifting CBU', 'Comm Loading CBU / Completed Loading CBU', 'Comm Shifting Truck / Completed Shifting Truck', 'Comm Loading Truck / Completed Loading Truck', 'Comm Shifting Bus / Completed Shifting Bus', 'Comm Loading Bus / Completed Loading Bus', 'Comm Shifting HH / Completed Shifting HH', 'Comm Loading HH / Completed Loading HH', 'Comm Shifting Static / Completed Shifting Static', 'Comm Loading Static / Completed Loading Static', 'Comm Shifting Static On Mafi / Completed Shifting Static On Mafi', 'Comm Loading Static On Mafi / Completed Loading Static On Mafi', 'Waiting Document Cargo Hyundai / Completed Waiting Document Cargo Hyundai', 'Waiting Document Cargo Suzuki / Completed Waiting Document Cargo Suzuki', 'Waiting Document Cargo Honda / Completed Waiting Document Cargo Honda', 'Waiting Document Cargo Isuzu / Completed Waiting Document Cargo Isuzu', 'Meal Break', ]; @endphp @if($errors->any())

Periksa kembali isian formulir:

@endif
@csrf @if($method !== 'POST') @method($method) @endif @include('partials.vessel-berthing-pull-bar') {{-- Hidden Operation Type --}} {{-- Top Card: Sheet No & Status --}}
{{-- 1. Sheet No --}}

No lembar default.

{{-- 2. Status Dokumen --}}

Draft atau Selesai.

{{-- Main Document Card (Formatted like the Official Paper Sheet) --}}
{{-- Document Header --}}

STATEMENT OF FACT

{{ $subTitleVal }}

{{ old('sheet_no', $statementOfFact->sheet_no ?? '1') }}
{{-- Section 1: Vessel & Voyage Header Info (Unified 2-Column Grid) --}}
{{-- Left Column --}}
NAME OF VESSEL : MV.
BERTH :
FLAG :
L.O.A / G.R.T : M / TONS
{{-- Right Column --}}
VOY. NO :
SHIPPING LINE :
SHIP AGENT :
STEVEDORING :
{{-- Section 2: VESSEL POSITION (Single Centered Column Milestone Table) --}}

VESSEL POSITION

@foreach($milestones as $key => $label) @php $resolvedHrs = $statementOfFact->getMilestoneValue($key, 'hrs') ?: ($vPos[$key.'_hrs'] ?? ($vPos[$key]['time'] ?? ($vPos[$key.'_time'] ?? ''))); $resolvedDate = $statementOfFact->getMilestoneValue($key, 'date') ?: ($vPos[$key.'_date'] ?? ($vPos[$key]['date'] ?? '')); $hrsVal = $parseTimeVal(old("vessel_positions.{$key}_hrs", $resolvedHrs)); $dateVal = $parseDateVal(old("vessel_positions.{$key}_date", $resolvedDate)); @endphp
{{ $label }} {{-- Dual Mode Time Input --}}
AT :
HOURS
{{-- Date Input with Picker --}}
DATE :
@endforeach
{{-- MULTI-SHEET TABS & PANES (Sections 3 & 4) --}}
{{-- Tabs Navigation --}}
@foreach($sheets as $sIdx => $sh) @endforeach
{{-- Panes Container --}}
@foreach($sheets as $sIdx => $sh) @php $sCargo = $sh['cargo_discharging'] ?? \App\Models\StatementOfFact::getDefaultCargoDischarging(); $sCargoRows = $sCargo['rows'] ?? []; if (empty($sCargoRows)) { $sCargoRows = \App\Models\StatementOfFact::getDefaultCargoDischarging()['rows']; } $sCargoTotals = $sCargo['totals'] ?? []; $sDailyRecords = $sh['daily_working_records'] ?? \App\Models\StatementOfFact::getDefaultDailyWorkingRecords(); if (empty($sDailyRecords)) { $sDailyRecords = \App\Models\StatementOfFact::getDefaultDailyWorkingRecords(); } @endphp
{{-- Section 3: CARGO MANIFEST TABLE --}}
{{ $currentType === 'loading' ? 'CARGO LOADING MANIFEST' : 'CARGO DISCHARGING MANIFEST' }}
@foreach($sCargoRows as $rIdx => $r) @endforeach {{-- Row: TOTAL (Units Sums) --}} @foreach(['cars', 'hh', 'truck', 'bus', 'parts_static'] as $uCol) @endforeach {{-- Row: TOTAL ALL (Grand Totals for PKGS, TONS, CBM) --}}
LOADING PORT DISCHARGING PORT CARS
(UNITS)
HH
(UNITS)
TRUCK
(UNITS)
BUS
(UNITS)
PART /
STATIC
TOTAL
( PKGS )
TONS CBM #
TOTAL
TOTAL ALL
{{-- Section 4: DAILY WORKING RECORD TABLE (Khusus Discharging) --}}
DAILY WORKING RECORD
@foreach($sDailyRecords as $dIdx => $dr) @endforeach
DATE
DAY WORK
WORKING TIME
FROM — TO
HOURS REMARKS #
@php $dateVal = $parseDateVal($dr['date'] ?? ($dr['date_day_work'] ?? '')); @endphp @php $rawWorkingTime = $dr['working_time'] ?? ''; $workingFromVal = ''; $workingToVal = ''; if ($rawWorkingTime && preg_match_all('/(\d{1,2}[:.]\d{2})/', $rawWorkingTime, $wtm)) { $workingFromVal = $parseTimeVal($wtm[1][0] ?? ''); $workingToVal = $parseTimeVal($wtm[1][1] ?? ''); } @endphp
-
@php $hoursVal = $parseDurationVal(\App\Models\StatementOfFact::resolveRecordHours(is_array($dr) ? $dr : [])); @endphp @php $currentRemark = $dr['remarks'] ?? ($dr['stopped_remarks'] ?? ''); @endphp
TOTAL HOURS 0 jam 0 menit
@endforeach
{{-- Keterangan Tambahan --}}
{{-- Submit Action Bar --}}
Batal