{{-- Mes courses : les réservations de chauffeur passées depuis la carte des transporteurs. Reprend le langage visuel de « Mes locations », les deux étant des demandes qui suivent le même cycle (attente → accord → paiement). --}}

{{ __('messages.my_courses') }}

@if(session('booking_success'))
{{ session('booking_success') }}
@endif @if(session('booking_error'))
{{ session('booking_error') }}
@endif @forelse(($chauffeurBookings ?? []) as $booking)

{{ $booking->chauffeur?->company ?: trim(($booking->chauffeur?->first_name ?? '') . ' ' . ($booking->chauffeur?->last_name ?? '')) ?: '—' }}

@if($booking->isMealDelivery()) {{ $booking->range_label ?: __('chauffeur.delivery_range_label') }}@if($booking->order) · {{ __('chauffeur.delivery_order_label') }} {{ $booking->order->order_number }}@endif · @endif @if($booking->isImmediate()) {{ __('chauffeur.booking_mode_now') }} @else {{ $booking->scheduled_at?->translatedFormat('l j F Y — H\hi') }} @endif · {{ __('messages.requested_on') }} {{ $booking->created_at->format('d.m.Y') }}

@php $displayStatus = $booking->displayStatus(); @endphp {{ __('chauffeur.booking_status_' . $displayStatus) }}
{{ $booking->isMealDelivery() ? __('chauffeur.delivery_pickup_restaurant') : __('chauffeur.booking_pickup') }} {{ $booking->pickup_address }} @if($booking->dropoff_address) {{ __('chauffeur.booking_dropoff') }} {{ $booking->dropoff_address }} @endif @if($booking->estimated_km) {{ __('messages.carriers_booking_distance') }} {{ number_format((float) $booking->estimated_km, 1, ',', ' ') }} km @endif @php // Livraison d'un plat : le client paie la commande entière. $courseAmount = $booking->isDishDelivery() ? app(\App\Services\DishCarrierDeliveryService::class)->bookingAmountEur($booking) : $booking->amountDue(); @endphp @if($courseAmount) {{ __('chauffeur.booking_amount') }} {{ number_format($courseAmount, 2, ',', ' ') }} {{ $booking->currency }} @endif
@if($booking->status === \App\Models\ChauffeurBooking::STATUS_ACCEPTED && !$booking->paymentWindowExpired()) {{ __('messages.rental_pay_now') }} @if($booking->payment_deadline)

{{ __('messages.rental_pay_before') }} {{ $booking->payment_deadline->format('d.m.Y H:i') }}

@endif @elseif($booking->status === \App\Models\ChauffeurBooking::STATUS_PENDING)

{{ __('messages.carriers_booking_awaiting_driver') }} @if($booking->chauffeur_deadline) — {{ __('chauffeur.booking_answer_before', ['time' => $booking->chauffeur_deadline->translatedFormat('j M H:i')]) }} @endif

@elseif($booking->status === \App\Models\ChauffeurBooking::STATUS_DECLINED && ! $booking->isDishDelivery())

{{ __('chauffeur.mail_booking_declined_intro') }}

{{ __('chauffeur.mail_booking_declined_cta') }} @endif {{-- Le téléphone du chauffeur est utile dès la demande, pas seulement une fois payée : le client peut avoir besoin de le joindre pour préciser un point de rendez-vous avant même sa réponse. --}} @if(in_array($booking->status, [ \App\Models\ChauffeurBooking::STATUS_PENDING, \App\Models\ChauffeurBooking::STATUS_ACCEPTED, \App\Models\ChauffeurBooking::STATUS_PAID, ], true))
{{ __('chauffeur.booking_driver') }} {{ $booking->chauffeur?->company ?: trim(($booking->chauffeur?->first_name ?? '') . ' ' . ($booking->chauffeur?->last_name ?? '')) }} @if($booking->chauffeur?->phone)
{{ __('chauffeur.booking_phone') }} {{ $booking->chauffeur->phone }} @endif @if($booking->chauffeur?->vehicle_model || $booking->chauffeur?->vehicle_plate)
{{ __('chauffeur.booking_vehicle') }} {{ trim(($booking->chauffeur->vehicle_model ?? '') . ' ' . ($booking->chauffeur->vehicle_plate ?? '')) }} @endif {{-- Appeler le chauffeur (sur un téléphone, le lien « tel: » ouvre l'application d'appel), ou rejoindre directement le suivi en direct de la course sur la carte des transporteurs. --}} @php // Course terminée : plus de chauffeur à joindre ni de trajet à // suivre, les deux boutons disparaissent. $rideOver = (bool) $booking->completed_at; $driverCallUrl = $rideOver ? null : phone_tel_uri($booking->chauffeur?->phone, $booking->chauffeur?->country); $followOnMap = ! $rideOver && $booking->followableOnMap(); @endphp @if($driverCallUrl || $followOnMap) @endif
@endif {{-- Navigation, une fois la course réellement commencée : suivre le trajet dans le GPS du téléphone, départ et arrivée préremplis, ou rester sur le site. Même choix que dans le panneau de suivi de la carte. --}} @php $navLinks = ($booking->isPaid() && $booking->started_at && ! $booking->completed_at) ? $booking->navigationLinks() : null; @endphp @if($navLinks)

{{ __('messages.carriers_track_nav_question') }}

@endif {{-- Livraison par le restaurant : facturée avec la commande. --}} @if($booking->isPaid() && ! $booking->isRestaurantDelivery()) {{ __('chauffeur.invoice_download') }} @endif
@empty

{{ __('messages.carriers_booking_empty') }}

@endforelse