@extends('layouts.portal')
@section('title', $consignment->tracking_code . ' — Salihiya World Cargo')
@section('page-title', $consignment->tracking_code)
@section('content')
@php
$statuses = [
'received' => [
'label' => 'Received',
'icon' => 'arrow-down-tray',
],
'departed' => [
'label' => 'Departed',
'icon' => 'paper-airplane',
],
'in_transit' => [
'label' => 'In Transit',
'icon' => 'truck',
],
'arrived' => [
'label' => 'Arrived',
'icon' => 'flag',
],
'customs_clearance' => [
'label' => 'Customs Clearance',
'icon' => 'shield-check',
],
'ready_for_pickup' => [
'label' => 'Ready for Pickup',
'icon' => 'inbox-arrow-down',
],
'delivered' => [
'label' => 'Delivered',
'icon' => 'check-circle',
],
];
$statusKeys = array_keys($statuses);
$currentIndex = array_search($consignment->status, $statusKeys);
@endphp
Back to Dashboard
{{-- ── Left Column ─────────────────────────────────────── --}}
{{-- Info card --}}
Tracking Code
{{ $consignment->tracking_code }}
{{ $consignment->shipment->type === 'air' ? '✈ AIR FREIGHT' : '🚢 SEA FREIGHT' }}
@php
$fields = [
['label' => 'Description', 'value' => $consignment->description],
['label' => 'Destination', 'value' => $consignment->destination],
['label' => 'Cartons', 'value' => $consignment->ctns . ' CTN'],
['label' => 'CBM', 'value' => $consignment->cbm . ' m³'],
];
if ($consignment->actual_weight) {
$fields[] = ['label' => 'Weight', 'value' => $consignment->actual_weight . ' kg'];
}
if ($consignment->shipment->eta) {
$fields[] = ['label' => 'ETA', 'value' => $consignment->shipment->eta->format('M d, Y')];
}
if ($consignment->shipment->vessel_or_flight) {
$fields[] = [
'label' => $consignment->shipment->type === 'sea' ? 'Vessel' : 'Flight',
'value' => $consignment->shipment->vessel_or_flight
];
}
if ($consignment->shipment->reference) {
$fields[] = [
'label' => $consignment->shipment->type === 'sea' ? 'Container No.' : 'AWB',
'value' => $consignment->shipment->reference
];
}
@endphp
@foreach($fields as $field)
{{ $field['label'] }}
{{ $field['value'] }}
@endforeach
@if($consignment->remarks)
Remarks
{{ $consignment->remarks }}
@endif
{{-- ── Right Column: Timeline ─────────────────────────── --}}
Shipment Timeline
@foreach($statuses as $key => $info)
@php
$stepIndex = array_search($key, $statusKeys);
$done = $stepIndex <= $currentIndex;
$current = $key === $consignment->status;
$historyEntry = $consignment->statusHistories->where('status', $key)->last();
@endphp
@php
$bgColor = $done
? '#2c2860'
: ($current ? '#eef2ff' : '#f0eef8');
$iconColor = $done
? '#ffffff'
: ($current ? '#2c2860' : '#c4c0d8');
$ring = $current
? '0 0 0 3px rgba(44,40,96,0.15)'
: 'none';
$lineColor = $done
? 'linear-gradient(to bottom, #2c2860, #c7d2fe)'
: '#e5e7eb';
@endphp
{{-- Line + dot --}}
{{-- Circle --}}
{{-- Connector line --}}
@if(!$loop->last)
@endif
{{-- Content --}}
{{ $info['label'] }}
@if($current)
NOW
@endif
@if($historyEntry)
{{ $historyEntry->created_at->format('M d, Y · H:i') }}
@if($historyEntry->note)
"{{ $historyEntry->note }}"
@endif
@endif
@endforeach
@endsection