@extends('layouts.master') @section('css') @include('trucks._call_style') @endsection @section('title') لوحة الشاحنات @stop @section('page-header') @endsection @section('content') @php $lp = Mcamara\LaravelLocalization\Facades\LaravelLocalization::getCurrentLocale(); $fmt = function ($d) { return $d ? $d->format('Y/m/d h:i A') : '—'; }; $emptyCount = $availableCount ?? ($trucks->count() - $loaded); @endphp
@if (count($errors) > 0)
@endif @if (session('trip_ok'))
{{ session('trip_ok') }}
@endif @if (request('new'))
إضافة شحنة جديدةاختار الشاحنة اللي هتحمّلها ودوس «تحميل». الظاهر دلوقتي الشاحنات المتاحة (الفاضية ملك المؤسسة) بس.
عرض كل الشاحنات
@endif {{-- KPIs (بتفلتر لما تدوس عليها) --}}
{{ $trucks->count() }}كل الشاحنات
{{ $emptyCount }}متاحة (ملك المؤسسة)
{{ $loaded }}محمّلة
{{ $overdue }}متأخرة عن التنزيل
@if (($docsAlert ?? 0) > 0)
فيه {{ $docsAlert }} شاحنة التأمين أو الاستمارة بتاعتها منتهية أو قربت تنتهي (خلال 30 يوم) - دوس هنا لعرضها
@endif {{-- الشاحنات الفاضية في كل منطقة --}}
الشاحنات المتاحة حسب المنطقة (ملك المؤسسة)
كل المناطق @foreach ($emptyByRegion as $reg => $cnt) {{ $reg }} {{ $cnt }} @endforeach
{{-- الشاحنات --}}
@forelse ($trucks as $k => $t) @php $trip = $t->activeTrip; $state = $trip ? ($trip->is_overdue ? 'late' : 'loaded') : 'empty'; $region = $trip ? '' : ($t->current_region ?: 'غير محدد'); $search = strtolower($t->plate_number . ' ' . $t->truck_type . ' ' . \App\Models\truck_trip::ownershipLabel($t->ownership) . ' ' . ($trip ? $trip->driver_name . ' ' . optional($trip->driver)->phone . ' ' . $trip->from_region . ' ' . $trip->to_region . ' ' . $trip->load_type . ' ' . $trip->customer_name : $region . ' ' . optional($t->default_driver)->name . ' ' . optional($t->default_driver)->phone)); @endphp
{{ $t->plate_number }}
{{ $t->truck_type ?: 'شاحنة' }}{{ $t->total_load ? ' · ' . $t->total_load : '' }}
@if ($t->insurance_status == 'expired' || $t->insurance_status == 'soon' || $t->istimara_status == 'expired' || $t->istimara_status == 'soon')
@if ($t->insurance_status == 'expired') التأمين منتهي @elseif ($t->insurance_status == 'soon') التأمين ينتهي {{ $t->insurance_expiry->format('Y/m/d') }}@endif @if ($t->istimara_status == 'expired') الاستمارة منتهية @elseif ($t->istimara_status == 'soon') الاستمارة تنتهي {{ $t->istimara_expiry->format('Y/m/d') }}@endif
@endif {{ \App\Models\truck_trip::ownershipLabel($t->ownership) }}
@if ($state == 'empty') فاضية @elseif ($state == 'late') متأخرة @else محمّلة @endif
@if (!$trip)
{{ $region }}{{ $t->current_city ? ' - ' . $t->current_city : '' }}
@include('trucks._call', ['drv' => $t->default_driver, 'name' => null, 'phone' => null]) @else
من{{ $trip->from_region }}{{ $trip->from_city }}
إلى{{ $trip->to_region }}{{ $trip->to_city }}
{{ $trip->load_type }}{{ $trip->load_weight ? ' · ' . $trip->load_weight : '' }}
{{ $fmt($trip->loading_at) }}
{{ $fmt($trip->expected_unloading_at) }}
@if ($trip->customer_name)
{{ $trip->customer_name }}
@endif @if ($trip->waybill_no)
بوليصة {{ $trip->waybill_no }}
@endif @if ($trip->invoice_number)
فاتورة {{ $trip->invoice_number }}
@endif @if ($trip->price > 0)
{{ number_format($trip->price, 2) }} ر.س
@endif @if ($trip->attachment)
المرفق
@endif
@include('trucks._call', ['drv' => $trip->driver, 'name' => $trip->driver_name, 'phone' => null])
{{ csrf_field() }}
@endif
@empty

مفيش شاحنات متسجلة لسه. دوس «إضافة شاحنة».
@endforelse
مفيش نتائج
{{-- ============ مودال تحميل ============ --}} {{-- مودال تم التفريغ (بالخطوات) --}} @include('trucks._unload_quick', ['toast' => false]) {{-- ============ مودال مكان الشاحنة ============ --}} {{-- ============ مودال إضافة شاحنة ============ --}} {{-- شحنة جديدة: اختيار شاحنة فاضية --}} @php $pkTrucks = $trucks->filter(function ($x) { return !$x->activeTrip && $x->ownership === 'own'; }); @endphp @include('trucks._driver_modal') @include('trucks._customer_modal') @include('trucks._region_add') @endsection @section('js') @endsection