@extends('layouts.dashboard')
@section('page_title', 'Dispatch Board')
@php
$statusFilters = [
'' => 'All',
'pending' => 'Pending',
'open' => 'Open',
'covered' => 'Covered',
'dispatched' => 'Dispatched',
'on_route' => 'On Route',
'delivered' => 'Delivered',
'completed' => 'Completed',
];
$statusLegend = [
['code' => 'pending', 'label' => 'Pending', 'color' => '#94a3b8'],
['code' => 'open', 'label' => 'Open', 'color' => '#e74c3c'],
['code' => 'refused', 'label' => 'Refused', 'color' => '#f39c12'],
['code' => 'covered', 'label' => 'Covered', 'color' => '#16a34a'],
['code' => 'dispatched', 'label' => 'Dispatched', 'color' => '#d97706'],
['code' => 'on_route', 'label' => 'On Route', 'color' => '#d97706'],
['code' => 'unloading', 'label' => '(Un)Loading', 'color' => '#ed64a6'],
['code' => 'in_yard', 'label' => 'In Yard', 'color' => '#805ad5'],
['code' => 'completed', 'label' => 'Completed', 'color' => '#0d9488'],
];
$statusClassFor = function (string $statusName, string $statusCode = ''): string {
return match ($statusName) {
'Pending' => 'st-pending',
'Open' => 'st-open',
'Refused' => 'st-refused',
'Covered' => 'st-covered',
'Dispatched' => 'st-dispatched',
'On Route' => 'st-route',
'(Un)Loading', 'Loading' => 'st-unloading',
'In Yard' => 'st-in-yard',
'Delivered' => 'st-delivered',
'Completed' => 'st-completed',
default => match ($statusCode) {
'pending' => 'st-pending',
'open' => 'st-open',
'refused' => 'st-refused',
'covered' => 'st-covered',
'dispatched' => 'st-dispatched',
'on_route' => 'st-route',
'unloading' => 'st-unloading',
'in_yard' => 'st-in-yard',
'delivered' => 'st-delivered',
'completed' => 'st-completed',
default => 'st-open',
},
};
};
@endphp
@push('styles')
@endpush
@section('content')
@foreach ($statusLegend as $legendItem)
@endforeach
| Load # |
W/O # |
Driver/Carrier |
Ship Date |
Del Date |
Customer |
Origin |
Destination |
Status |
@forelse ($loads as $index => $load)
@php
$class = $statusClassFor($load['status'], $load['status_code']);
$isActive = $index === 0;
@endphp
| {{ $load['load_no'] }} |
{{ $load['wo'] }} |
{{ $load['driver_carrier'] }} |
{{ $load['ship_date'] }} |
{{ $load['delivery_date'] }} |
{{ $load['customer'] }} |
{{ $load['origin'] }} |
{{ $load['destination'] }} |
@if (! $load['is_open_load'])
@else
@endif
|
@empty
| No loads found for the selected filters. |
@endforelse
@push('scripts')
@endpush
@endsection