@extends('layouts.app') @section('title', 'Mes Commandes') @push('styles') @endpush @section('content')
{{-- Header --}}
🛒

Mes Commandes

Historique de vos commandes alimentaires

@if($hasAnyOrders || $hasActiveFilters)
{{ $orders->total() }} commande{{ $orders->total() > 1 ? 's' : '' }} Filtres @if($hasActiveFilters) {{ $activeFiltersCount }} filtre{{ $activeFiltersCount > 1 ? 's' : '' }} actif{{ $activeFiltersCount > 1 ? 's' : '' }} @endif
{{ $hasActiveFilters ? 'Afficher / masquer les filtres' : 'Ouvrir les filtres' }}
@if($hasActiveFilters) Réinitialiser @endif
@endif @if(!$hasAnyOrders) {{-- État vide --}}
🍽️

Aucune commande

Vous n'avez pas encore passé de commande. Découvrez nos cuisiniers locaux !

🔍 Découvrir les cuisiniers
@elseif($orders->isEmpty())
🧾

Aucune commande trouvée

Aucune commande ne correspond aux filtres sélectionnés.

Effacer les filtres
@else
@foreach($orders as $order) @php $statusConfig = [ 'pending' => ['gradient' => 'from-amber-400 to-orange-500', 'bg' => 'bg-amber-100', 'text' => 'text-amber-700', 'icon' => '⏳'], 'accepted' => ['gradient' => 'from-blue-400 to-blue-600', 'bg' => 'bg-blue-100', 'text' => 'text-blue-700', 'icon' => '✓'], 'scheduled' => ['gradient' => 'from-sky-400 to-cyan-500', 'bg' => 'bg-sky-100', 'text' => 'text-sky-700', 'icon' => '📅'], 'preparing' => ['gradient' => 'from-purple-400 to-purple-600', 'bg' => 'bg-purple-100', 'text' => 'text-purple-700', 'icon' => '🔥'], 'ready' => ['gradient' => 'from-green-400 to-emerald-500', 'bg' => 'bg-green-100', 'text' => 'text-green-700', 'icon' => '✅'], 'delivered' => ['gradient' => 'from-emerald-400 to-teal-500', 'bg' => 'bg-emerald-100', 'text' => 'text-emerald-700', 'icon' => '📦'], 'completed' => ['gradient' => 'from-gray-400 to-gray-600', 'bg' => 'bg-gray-100', 'text' => 'text-gray-700', 'icon' => '🏁'], 'cancelled' => ['gradient' => 'from-red-400 to-red-600', 'bg' => 'bg-red-100', 'text' => 'text-red-700', 'icon' => '❌'], ]; $config = $statusConfig[$order->status] ?? $statusConfig['pending']; @endphp
{{-- Barre de couleur --}}
{{-- En-tête compact --}}

{{ $order->prestataire->company_name ?? $order->prestataire->business_name }}

#{{ $order->order_number }} {{ $order->created_at->format('d/m H:i') }}

{{ $order->delivery_type_label }} @if($order->requested_at) Prévue le {{ $order->requested_at->format('d/m/Y \à H:i') }} @endif
{{ number_format($order->total, 2) }}€
{{ $config['icon'] }} {{ $order->status_label }}
{{-- Articles compact --}}
@foreach($order->items->take(3) as $item) {{ $item->quantity }}× {{ Str::limit($item->product_name, 15) }} @endforeach @if($order->items->count() > 3) +{{ $order->items->count() - 3 }} @endif
{{-- Actions compact --}}
👁️ Détails @if($order->isReady()) 📍 Suivre @endif @if($order->isDelivered() && !$order->client_confirmed)
@csrf
@endif
{{-- Alerte commande prête --}} @if($order->isReady())
🎉

Votre commande est prête {{ $order->delivery_type === 'pickup' ? 'à récupérer' : 'et en cours de livraison' }} !

@endif
@endforeach
{{-- Pagination --}} @if($orders->hasPages())
{{ $orders->links() }}
@endif @endif
@endsection