@extends('layouts.driver') @section('title', 'توصيلاتي') @section('content') {{-- Stats (real numbers from controller) --}}
{{ $stats['assigned'] + $stats['in_progress'] }}
توصيلات اليوم
{{ $stats['upcoming'] }}
القادمة
{{ $stats['today_done'] }}
تمت اليوم
{{-- Today's revenue summary --}} @if($stats['today_done'] > 0)
إجمالي توصيلات اليوم
{{ number_format($stats['today_revenue'], 2) }} ج.م
@endif {{-- ───────────────────────────────────────────────── Section 1: TODAY's deliveries (actionable) ───────────────────────────────────────────────── --}}
توصيلات اليوم {{ $todayDeliveries->count() }}
@forelse($todayDeliveries as $d) @php $isOverdue = $d->order->delivery_date && $d->order->delivery_date->lt(now()->startOfDay()); @endphp
@switch($d->status) @case('assigned') معيّن @break @case('in_progress') قيد التنفيذ @break @default {{ $d->status }} @endswitch {{ $d->order->order_number }}
@if($isOverdue)
متأخر — كان موعدها {{ $d->order->delivery_date->format('d/m/Y') }}
@elseif($d->order->delivery_date)
موعد التسليم: اليوم
@endif
{{ $d->order->customer->name }}
{{ $d->order->customer->phone }}
{{ Str::limit($d->order->customer->address ?? '-', 60) }}
{{ number_format((float) $d->order->net_total, 2) }} ج.م @if($d->order->customer->location_lat && $d->order->customer->location_lng) الاتجاهات @endif
@if($d->status === 'assigned') @elseif($d->status === 'in_progress')
@endif
@empty
لا توجد توصيلات لليوم

يومك خفيف! 🎉

@endforelse {{-- ───────────────────────────────────────────────── Section 2: UPCOMING deliveries (read-only) ───────────────────────────────────────────────── --}} @if($upcomingDeliveries->count() > 0)
التوصيلات القادمة {{ $upcomingDeliveries->count() }}
للعرض فقط
@php $currentDate = null; @endphp @foreach($upcomingDeliveries as $d) @php $deliveryDate = $d->order->delivery_date; $dateLabel = $deliveryDate?->format('Y-m-d'); $diffDays = $deliveryDate?->diffInDays(now()->startOfDay()); @endphp @if($dateLabel !== $currentDate) @php $currentDate = $dateLabel; @endphp
{{ $deliveryDate?->translatedFormat('l - d/m/Y') }} ({{ $diffDays === 1 ? 'بكرة' : "بعد {$diffDays} يوم" }})
@endif
قادم {{ $d->order->order_number }}
{{ $d->order->customer->name }}
{{ $d->order->customer->phone }}
{{ Str::limit($d->order->customer->address ?? '-', 60) }}
{{ number_format((float) $d->order->net_total, 2) }} ج.م الأزرار ستفعل في موعدها
@endforeach @endif {{-- Complete-delivery modal --}} @endsection @push('styles') @endpush @push('scripts') @endpush