@extends('layouts.app') @section('page-title', 'Gestion des Commandes') @section('page-subtitle', 'Liste de toutes vos commandes') @section('content')

📦 Gestion des Commandes

Total: {{ $commandes->count() }} commande(s)

📦 Total Commandes
{{ $commandes->count() }}
✅ Envoyées
{{ $commandes->where('ozone_status', 'sent')->count() }}
⏳ En Attente
{{ $commandes->where('ozone_status', 'pending')->count() }}
💰 Total CA
@php $totalCA = 0; foreach($commandes as $cmd) { $data = is_string($cmd->structured_data) ? json_decode($cmd->structured_data, true) : $cmd->structured_data; $totalCA += floatval($data['Total'] ?? 0); } @endphp {{ number_format($totalCA, 2) }} MAD
@if($commandes->count() > 0)
@foreach($commandes as $commande) @php $data = is_string($commande->structured_data) ? json_decode($commande->structured_data, true) : $commande->structured_data; @endphp
#{{ $commande->row_number }}
{{ $commande->created_at->format('d/m/Y H:i') }}
@if($commande->ozone_status == 'sent') ✅ Envoyée @else ⏳ En attente @endif
👤 Client
{{ $data['Nom du client'] ?? $data['nom'] ?? '-' }}
📞 Téléphone
{{ $data['Téléphone'] ?? $data['tel'] ?? '-' }}
📦 Produit
{{ $data['products'] ?? $data['produit'] ?? '-' }}
🔢 Quantité
{{ $data['quantite'] ?? $data['Quantité'] ?? '1' }}
📍 Ville
{{ $data['Ville'] ?? $data['ville'] ?? '-' }}
💰 Total
{{ $data['Total'] ?? $data['total'] ?? '0' }} MAD
@if($commande->tracking_number)
📦 NUMÉRO DE SUIVI
{{ $commande->tracking_number }}
@endif
@endforeach
@else
📭

Aucune commande

Commencez par ajouter votre première commande

@endif
@endsection @push('scripts') @endpush