{{-- ========================================================================= --}}
{{-- MAIN PAPER SHEET DOCUMENT (Shared between View & Print Mode) --}}
{{-- ========================================================================= --}}
{{-- Kop Surat Perusahaan (Tampil pada Form Cetak / Print seperti Form Checker) --}}
{{-- Document Header --}}
{{ $planning->stage_title ?: 'FINAL PLANNING' }}
{{ $planning->no_planning }}
{{-- Section 1: Vessel & Voyage Header Info (Unified 2-Column Grid) --}}
{{-- Left Column --}}
NAME OF VESSEL
:
{{ $planning->vessel ?: ($planning->nama_kapal ?: '-') }}
VOY. NO
:
{{ $planning->no_voyage ?: '-' }}
PRINCIPAL
:
{{ $planning->principal ?: '-' }}
SHIPPING AGENT
:
{{ $planning->shipping_agent ?: '-' }}
{{-- Right Column --}}
BERTH
:
{{ $planning->dermaga ?: 'IKT' }}
OPERATION
:
{{ $planning->kegiatan ?: 'Stevedoring' }}
PORT OF ORIGIN
:
{{ $portOrigin ?: '-' }}
NEXT PORT
:
{{ $portDestination ?: '-' }}
{{-- ========================================================================= --}}
{{-- SECTION 2A: DATA CARGO - DISCHARGING --}}
{{-- ========================================================================= --}}
DATA CARGO - DISCHARGING
({{ count($dischargingCargoRows) }} Item)
| NO |
CARGO NAME |
TYPE |
DISCHARGING |
STEVEDORING |
CARGODORING |
NOMINATIVE OWNER |
@forelse($dischargingCargoRows as $cRow)
@php
$steve = strtoupper(trim((string)($cRow['stevedoring'] ?? '')));
$cargo = strtoupper(trim((string)($cRow['cargodoring'] ?? '')));
$isUncertain = ($steve === 'UNCERTAIN' || $cargo === 'UNCERTAIN');
$isNonAps = !$isUncertain && ((!empty($steve) && !in_array($steve, ['APS', '-', '0'])) || (!empty($cargo) && !in_array($cargo, ['APS', '-', '0'])));
$isAps = !$isUncertain && !$isNonAps && ($steve === 'APS' || $cargo === 'APS');
$markClass = '';
$markStyle = '';
if ($isNonAps) {
$markClass = 'marked-non-aps';
$markStyle = 'background-color: #fee2e2 !important; color: #dc2626 !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
} elseif ($isUncertain) {
$markClass = 'marked-uncertain';
$markStyle = 'background-color: #e2e8f0 !important; color: #64748b !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
} elseif ($isAps) {
$markClass = 'marked-aps';
$markStyle = 'background-color: #dcfce7 !important; color: #166534 !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
}
// Stevedoring cell style
$steveClass = '';
$steveStyle = '';
if ($steve === 'UNCERTAIN') {
$steveClass = 'marked-uncertain';
$steveStyle = 'background-color: #e2e8f0 !important; color: #64748b !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
} elseif (!empty($steve) && !in_array($steve, ['APS', '-', '0'])) {
$steveClass = 'marked-non-aps';
$steveStyle = 'background-color: #fee2e2 !important; color: #dc2626 !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
} elseif ($steve === 'APS') {
$steveClass = 'marked-aps';
$steveStyle = 'background-color: #dcfce7 !important; color: #166534 !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
}
// Cargodoring cell style
$cargoClass = '';
$cargoStyle = '';
if ($cargo === 'UNCERTAIN') {
$cargoClass = 'marked-uncertain';
$cargoStyle = 'background-color: #e2e8f0 !important; color: #64748b !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
} elseif (!empty($cargo) && !in_array($cargo, ['APS', '-', '0'])) {
$cargoClass = 'marked-non-aps';
$cargoStyle = 'background-color: #fee2e2 !important; color: #dc2626 !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
} elseif ($cargo === 'APS') {
$cargoClass = 'marked-aps';
$cargoStyle = 'background-color: #dcfce7 !important; color: #166534 !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
}
@endphp
|
{{ $cRow['item_no'] }}
|
{{ $cRow['cargo'] }}
|
{{ (!empty($cRow['cargo_type']) && $cRow['cargo_type'] !== '-') ? $cRow['cargo_type'] : '-' }}
|
@if(!empty($cRow['discharging']))
{{ number_format($cRow['discharging']) }} {{ $cRow['unit'] ?? 'UNITS' }}
@else
-
@endif
|
{{ (!empty($cRow['stevedoring']) && $cRow['stevedoring'] !== '-' && $cRow['stevedoring'] !== '0') ? $cRow['stevedoring'] : '-' }}
|
{{ (!empty($cRow['cargodoring']) && $cRow['cargodoring'] !== '-' && $cRow['cargodoring'] !== '0') ? $cRow['cargodoring'] : '-' }}
|
{{ $cRow['consignee'] }}
|
@empty
|
Tidak ada data cargo discharging.
|
@endforelse
|
TOTAL DISCHARGING
|
@if($totalDischargingPkgs > 0 && $totalDischargingUnits > 0)
{{ number_format($totalDischargingUnits) }} UNITS + {{ number_format($totalDischargingPkgs) }} PKGS
@elseif($totalDischargingPkgs > 0)
{{ number_format($totalDischargingPkgs) }} PKGS
@else
{{ number_format($totalDischarging) }} UNITS
@endif
|
{{ number_format($totalDischarging) }} TOTAL DISCHARGING
|
{{-- ========================================================================= --}}
{{-- SECTION 2B: DATA CARGO - LOADING (JIKA ADA) --}}
{{-- ========================================================================= --}}
@if(count($loadingCargoRows) > 0)
DATA CARGO - LOADING
({{ count($loadingCargoRows) }} Item)
| NO |
CARGO NAME |
TYPE |
LOADING |
STEVEDORING |
CARGODORING |
NOMINATIVE OWNER |
@foreach($loadingCargoRows as $lRow)
@php
$lSteve = strtoupper(trim((string)($lRow['stevedoring'] ?? '')));
$lCargo = strtoupper(trim((string)($lRow['cargodoring'] ?? '')));
$lIsUncertain = ($lSteve === 'UNCERTAIN' || $lCargo === 'UNCERTAIN');
$lIsNonAps = !$lIsUncertain && ((!empty($lSteve) && !in_array($lSteve, ['APS', '-', '0'])) || (!empty($lCargo) && !in_array($lCargo, ['APS', '-', '0'])));
$lIsAps = !$lIsUncertain && !$lIsNonAps && ($lSteve === 'APS' || $lCargo === 'APS');
$lMarkClass = '';
$lMarkStyle = '';
if ($lIsNonAps) {
$lMarkClass = 'marked-non-aps';
$lMarkStyle = 'background-color: #fee2e2 !important; color: #dc2626 !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
} elseif ($lIsUncertain) {
$lMarkClass = 'marked-uncertain';
$lMarkStyle = 'background-color: #e2e8f0 !important; color: #64748b !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
} elseif ($lIsAps) {
$lMarkClass = 'marked-aps';
$lMarkStyle = 'background-color: #dcfce7 !important; color: #166534 !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
}
// Stevedoring cell style
$lSteveClass = '';
$lSteveStyle = '';
if ($lSteve === 'UNCERTAIN') {
$lSteveClass = 'marked-uncertain';
$lSteveStyle = 'background-color: #e2e8f0 !important; color: #64748b !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
} elseif (!empty($lSteve) && !in_array($lSteve, ['APS', '-', '0'])) {
$lSteveClass = 'marked-non-aps';
$lSteveStyle = 'background-color: #fee2e2 !important; color: #dc2626 !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
} elseif ($lSteve === 'APS') {
$lSteveClass = 'marked-aps';
$lSteveStyle = 'background-color: #dcfce7 !important; color: #166534 !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
}
// Cargodoring cell style
$lCargoClass = '';
$lCargoStyle = '';
if ($lCargo === 'UNCERTAIN') {
$lCargoClass = 'marked-uncertain';
$lCargoStyle = 'background-color: #e2e8f0 !important; color: #64748b !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
} elseif (!empty($lCargo) && !in_array($lCargo, ['APS', '-', '0'])) {
$lCargoClass = 'marked-non-aps';
$lCargoStyle = 'background-color: #fee2e2 !important; color: #dc2626 !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
} elseif ($lCargo === 'APS') {
$lCargoClass = 'marked-aps';
$lCargoStyle = 'background-color: #dcfce7 !important; color: #166534 !important; font-weight: bold !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;';
}
@endphp
|
{{ $lRow['item_no'] }}
|
{{ $lRow['cargo'] }}
|
{{ (!empty($lRow['cargo_type']) && $lRow['cargo_type'] !== '-') ? $lRow['cargo_type'] : '-' }}
|
@if(!empty($lRow['loading']))
{{ number_format($lRow['loading']) }} {{ $lRow['unit'] ?? 'UNITS' }}
@else
-
@endif
|
{{ (!empty($lRow['stevedoring']) && $lRow['stevedoring'] !== '-' && $lRow['stevedoring'] !== '0') ? $lRow['stevedoring'] : '-' }}
|
{{ (!empty($lRow['cargodoring']) && $lRow['cargodoring'] !== '-' && $lRow['cargodoring'] !== '0') ? $lRow['cargodoring'] : '-' }}
|
{{ $lRow['consignee'] }}
|
@endforeach
|
TOTAL LOADING
|
@if($totalLoadingPkgs > 0 && $totalLoadingUnits > 0)
{{ number_format($totalLoadingUnits) }} UNITS + {{ number_format($totalLoadingPkgs) }} PKGS
@elseif($totalLoadingPkgs > 0)
{{ number_format($totalLoadingPkgs) }} PKGS
@else
{{ number_format($totalLoading) }} UNITS
@endif
|
{{ number_format($totalLoading) }} TOTAL LOADING
|
@endif
{{-- ========================================================================= --}}
{{-- SECTION 3A: TOTAL KATEGORI CARGO --}}
{{-- ========================================================================= --}}
TOTAL KATEGORI CARGO
SUMMARY BY CATEGORY
| TYPE CARGO |
DISCHARGING |
LOADING |
TOTAL |
@foreach([
'mobil_cbu' => 'CBU',
'truck' => 'TRUCK',
'bus' => 'BUS',
'hh' => 'HEAVY HIGH (HH)',
'part' => 'PART',
'mafi' => 'MAFI',
] as $catKey => $catLabel)
|
{{ $catLabel }}
|
{{ number_format((int) ($totalCargoSummary[$catKey]['discharging'] ?? 0)) }}
|
{{ number_format((int) ($totalCargoSummary[$catKey]['loading'] ?? 0)) }}
|
{{ number_format((int) ($totalCargoSummary[$catKey]['total'] ?? 0)) }}
|
@endforeach
| TOTAL |
{{ number_format($grandSumDisch) }}
|
{{ number_format($grandSumLoad) }}
|
{{ number_format($grandSumTotal) }}
|
{{-- ========================================================================= --}}
{{-- SECTION 3B: SPECIAL HANDLING CARGO --}}
{{-- ========================================================================= --}}
SPECIAL HANDLING CARGO
({{ $planning->specialHandlings ? $planning->specialHandlings->count() : 0 }} Item)
| NO |
CARGO TYPE |
NOMINATIVE OWNER |
ISSUE |
HANDLING PLAN |
NOTE |
@if($planning->specialHandlings && $planning->specialHandlings->isNotEmpty())
@foreach($planning->specialHandlings as $shIdx => $sh)
|
{{ $shIdx + 1 }}
|
{{ $sh->cargo_type ?: '-' }}
|
{{ $sh->nominative_owner ?: '-' }}
|
{{ $sh->issue ?: '-' }}
|
{{ $sh->handling_plan ?: '-' }}
|
{{ $sh->note ?: '-' }}
|
@endforeach
@else
|
TIDAK ADA SPECIAL HANDLING CARGO
|
@endif
{{-- ========================================================================= --}}
{{-- SECTION 4: DATA OPERATING VESSEL --}}
{{-- ========================================================================= --}}
DATA OPERATING VESSEL
PLAN SCHEDULE
| DATA OPERATING VESSEL |
PLAN DATE |
PLAN TIME |
@foreach($opRows as $r)
|
{{ $r['name'] }}
|
@if($r['has_date'])
{{ !empty($r['plan_date']) ? \Carbon\Carbon::parse($r['plan_date'])->format('d/m/Y') : '-' }}
@else
-
@endif
|
{{ !empty($r['plan_time']) ? $r['plan_time'] : '-' }}
|
@endforeach
{{-- ========================================================================= --}}
{{-- SECTION 5A: SEQUENCING CARGO OPERATION - DISCHARGING --}}
{{-- ========================================================================= --}}
SEQUENCING CARGO OPERATION - DISCHARGING
STD PERFORMANCE
| Discharging STD Proformance |
Discharging qty (Unit/pkgs) |
Approximately STD Duration Time
(hrs:min)
|
@foreach($seqDischargingRows as $row)
@php
$stdRateDisplay = !empty($row['std_performance']) ? ($row['std_performance'] . ' ' . ($row['std_unit'] ?? 'Unit/hrs')) : '';
@endphp
|
{{ $row['category'] ?? '-' }}
@if($stdRateDisplay)
({{ $stdRateDisplay }})
@endif
|
{{ (!empty($row['qty']) && $row['qty'] !== '0') ? $row['qty'] : '-' }}
|
{{ (!empty($row['std_duration_time']) && $row['std_duration_time'] !== '-') ? $row['std_duration_time'] : '00:00' }}
|
Hrs
|
@endforeach
| TOTAL |
{{ $seqDischargingTotals['std_duration_time'] ?? '0:00' }}
|
{{ $seqDischargingTotals['std_duration_formatted'] ?? '0hr00min' }}
|
{{-- ========================================================================= --}}
{{-- SECTION 5B: SEQUENCING CARGO OPERATION - LOADING (JIKA ADA) --}}
{{-- ========================================================================= --}}
@if($hasSeqLoading)
SEQUENCING CARGO OPERATION - LOADING
STD PERFORMANCE
| Loading STD Proformance |
Loading qty (Unit/pkgs) |
Approximately STD Duration Time
(hrs:min)
|
@foreach($seqLoadingRows as $row)
@php
$stdRateDisplay = !empty($row['std_performance']) ? ($row['std_performance'] . ' ' . ($row['std_unit'] ?? 'Unit/hrs')) : '';
@endphp
|
{{ $row['category'] ?? '-' }}
@if($stdRateDisplay)
({{ $stdRateDisplay }})
@endif
|
{{ (!empty($row['qty']) && $row['qty'] !== '0') ? $row['qty'] : '-' }}
|
{{ (!empty($row['std_duration_time']) && $row['std_duration_time'] !== '-') ? $row['std_duration_time'] : '00:00' }}
|
Hrs
|
@endforeach
| TOTAL |
{{ $seqLoadingTotals['std_duration_time'] ?? '0:00' }}
|
{{ $seqLoadingTotals['std_duration_formatted'] ?? '0hr00min' }}
|
@endif
{{-- ========================================================================= --}}
{{-- SECTION 5C: SEQUENCING CARGO OPERATION - SHIFTING (JIKA ADA) --}}
{{-- ========================================================================= --}}
@if($hasSeqShifting)
SEQUENCING CARGO OPERATION - SHIFTING
SHIFTING OPERATION
| Shifting |
Shifting qty (Unit/pkgs) |
@foreach($seqShiftingRows as $row)
|
{{ $row['category'] ?? '-' }}
|
{{ (!empty($row['qty']) && $row['qty'] !== '0') ? $row['qty'] : '-' }}
|
@endforeach
| TOTAL |
{{ (!empty($seqShiftingTotals['total_qty']) && $seqShiftingTotals['total_qty'] !== '0') ? number_format((float)$seqShiftingTotals['total_qty']) : '-' }}
|
@endif
{{-- ========================================================================= --}}
{{-- SECTION 6: OPERATION STRATEGIC --}}
{{-- ========================================================================= --}}
OPERATION STRATEGIC
PLAN DURATION
| OPERATION STRATEGIC (PLAN) |
PLAN DURATION TIME |
| Total Approximately Duration Time |
{{ $opStrat['total_approx_duration'] ?: '-' }} |
Hrs |
| Waiting Cargo / Document |
{{ $opStrat['waiting_cargo_doc'] ?: '-' }} |
Hrs |
| Idle Time / Stop Operation |
{{ $opStrat['idle_time'] ?: '-' }} |
Hrs |
| Shifting |
{{ $opStrat['shifting'] ?: '-' }} |
Hrs |
| MEAL BREAK |
{{ $opStrat['meal_break'] ?: '-' }} |
Hrs |
| AVAILABLE TIME |
{{ $opStrat['available_time'] ?: '-' }} |
Hrs |
{{-- ========================================================================= --}}
{{-- SECTION 7: DEPLOYMENT / MAN POWER --}}
{{-- ========================================================================= --}}
DEPLOYMENT / MAN POWER
UNIT: MEN
| DEPLOYMENT |
MAN POWER (PLAN) |
|
OPERATIONAL :
|
@foreach($opManpower as $row)
@php
$planDisplay = (!empty($row['man_power']) && $row['man_power'] !== '0') ? ($row['man_power'] . ' Men') : '-';
@endphp
|
- {{ strtoupper($row['role'] ?? '') }}
|
{{ $planDisplay }}
|
@endforeach
|
LOGISTIC :
|
@foreach($logManpower as $row)
@php
$planDisplay = (!empty($row['man_power']) && $row['man_power'] !== '0') ? ($row['man_power'] . ' Men') : '-';
@endphp
|
- {{ strtoupper($row['role'] ?? '') }}
|
{{ $planDisplay }}
|
@endforeach
| TOTAL MAN POWER |
{{ ($mpTotals['total_man_power'] ?? 0) > 0 ? ($mpTotals['total_man_power'] . ' Men') : '-' }}
|
{{-- ========================================================================= --}}
{{-- SECTION 8: MECHANICAL EQUIPMENT --}}
{{-- ========================================================================= --}}
MECHANICAL EQUIPMENT
PLANNING UTILIZATION
| NO |
EQUIPMENT ITEM |
CAPACITY |
UNIT |
PLAN (UNIT) |
SHIFT/RIT PLAN |
REMARKS / NOTE |
@foreach($eqData as $eqIdx => $eq)
@php
$subItems = $eq['sub_items'] ?? [];
$subCount = count($subItems);
@endphp
@foreach($subItems as $subIdx => $sub)
@if($subIdx === 0)
|
{{ $eq['no'] ?? ($eqIdx + 1) }}
|
{{ $eq['item'] ?? '-' }}
|
@endif
{{ $sub['capacity'] ?? '-' }}
|
{{ $sub['unit'] ?? '-' }}
|
{{ !empty($sub['planning_unit']) ? $sub['planning_unit'] : '-' }}
|
{{ !empty($sub['shift_rit_rencana']) ? $sub['shift_rit_rencana'] : '-' }}
|
{{ !empty($sub['note']) ? $sub['note'] : '-' }}
|
@endforeach
@endforeach
{{-- ========================================================================= --}}
{{-- SECTION 9: ESTIMATE BUDGET (BELOW MECHANICAL EQUIPMENT) --}}
{{-- ========================================================================= --}}
ESTIMATE BUDGET
IDR (RUPIAH)
| COST CATEGORY |
PERSONNEL FEE |
SUPPORTING FEE |
| OPERATIONAL |
{{ $formatRupiah($budOp['personnel_fee'] ?? '') }} |
{{ $formatRupiah($budOp['supporting_fee'] ?? '') }} |
| LOGISTIC |
{{ $formatRupiah($budLog['personnel_fee'] ?? '') }} |
{{ $formatRupiah($budLog['supporting_fee'] ?? '') }} |
| SUBTOTAL |
{{ $formatRupiah($budTotals['sum_personnel_fee'] ?? 0) }} |
{{ $formatRupiah($budTotals['sum_supporting_fee'] ?? 0) }} |
| GRAND TOTAL |
{{ $formatRupiah($budTotals['total_budget'] ?? 0) }}
|
@if($isPrintMode)
{{-- ========================================================================= --}}
{{-- SECTION 10: SIGNATURE / LEMBAR PENGESAHAN (HANYA PADA FORM CETAK) --}}
{{-- ========================================================================= --}}
JAKARTA, {{ now()->translatedFormat('d F Y') }}
@endif