@extends('admin.layouts.home.main') @section('styles') @endsection @section('main')

All Admin Shipments

@php // عمود => قيمة order_by الخاصة به $columns = [ 'admin_shipment_id' => 'ID', 'admin_name' => 'Admin Name', 'vehicle' => 'Vehicle', 'status' => 'Status', 'destination' => 'Destination', 'basic_info' => 'Info', 'start_date' => 'Start Date', 'created_at' => 'Created', 'actions' => 'Action', ]; $currentOrderBy = request('order_by', 'admin_shipment_id'); $currentDirection = request('direction', 'asc'); @endphp @foreach ($columns as $key => $label) @if ($key === 'actions') @elseif($key === 'vehicle') @else @endif @endforeach @forelse($shipments as $sh) @empty @endforelse
{{ $label }} {{ $label }} @if ($currentOrderBy == 'vehicle') @else @endif {{ $label }} @if ($currentOrderBy == $key) @else @endif
ID {{ $sh->admin_shipment_id }} {{ optional($sh->admin)->name ?? '—' }}
{{ optional($sh->admin)->email ?? '' }}
{{ optional($sh->vehicle)->license_plate ?? '—' }} @php $badgeClass = match ($sh->status) { 'active' => 'active', 'canceled' => 'canceled', 'loading delayed', 'unloading delayed' => 'loading', 'ready to load', 'ready to unload' => 'ready', default => '', }; @endphp {{ ucwords($sh->status) }} {{ $sh->destination }} {{ Str::limit($sh->basic_info, 25) }} {{ \Carbon\Carbon::parse($sh->start_date)->format('Y-m-d') }} {{ $sh->created_at ? $sh->created_at->format('Y-m-d') : '—' }}
View Edit
@csrf @method('DELETE')
No admin shipments found.
@foreach ($shipments as $sh) @php $uniqueId = 'card-' . $sh->admin_shipment_id; $badgeClass = match ($sh->status) { 'active' => 'active', 'canceled' => 'canceled', 'loading delayed', 'unloading delayed' => 'loading', 'ready to load', 'ready to unload' => 'ready', default => '', }; @endphp

ID: {{ $sh->admin_shipment_id }}

Admin: {{ optional($sh->admin)->name ?? '—' }}

Vehicle: {{ optional($sh->vehicle)->license_plate ?? '—' }}

Status: {{ ucwords($sh->status) }}

Destination: {{ $sh->destination }}

Info: {{ Str::limit($sh->basic_info, 25) }}

Start Date: {{ \Carbon\Carbon::parse($sh->start_date)->format('Y-m-d') }}

Created: {{ $sh->created_at ? $sh->created_at->format('Y-m-d') : '—' }}

View Edit
@csrf @method('DELETE')
@endforeach
{{-- Pagination & Show entries --}}
{{-- Filter Modal --}} @endsection