@extends('layouts.app') @section('page-title', 'Liste des Commandes') @section('page-subtitle', 'Gestion de toutes vos commandes et expéditions') @section('content')
🔑 Code: {{ $user->user_code }} | 💾 Total: {{ $sheetData->count() }} commande(s)
@if(Auth::user()->isAdmin()) @endif @if(Auth::user()->isAdmin()) @endif
@if(Auth::user()->isAdmin()) @if(empty($user->ozone_customer_id) || empty($user->ozone_api_key))
⚠️
Configuration OzoneExpress manquante! Ajoutez vos identifiants ici →
@else
Configuration OzoneExpress active! Vous pouvez utiliser toutes les fonctionnalités d'expédition.
@endif
📝
Instructions Google Sheets: Ajoutez votre code {{ $user->user_code }} dans la cellule A1 de votre feuille Google Sheets.
@endif
📦 Total des Commandes
{{ $sheetData->count() }}
✅ Envoyées
{{ $sheetData->where('ozone_status', 'sent')->count() }}
⏳ En Attente
{{ $sheetData->where('ozone_status', 'pending')->count() }}
🔄 Dernière MAJ
@if($sheetData->max('updated_at')) {{ \Carbon\Carbon::parse($sheetData->max('updated_at'))->format('d/m H:i') }} @else N/A @endif
@if($sheetData->count() > 0)
@if(Auth::user()->isAdmin()) @endif @php $firstRow = $sheetData->first(); $headers = []; if ($firstRow) { if (is_array($firstRow->headers)) { $headers = $firstRow->headers; } elseif (is_string($firstRow->headers)) { $decoded = json_decode($firstRow->headers, true); $headers = (is_array($decoded) ? $decoded : []); } if (empty($headers) && $firstRow->structured_data) { if (is_array($firstRow->structured_data)) { $headers = array_keys($firstRow->structured_data); } elseif (is_string($firstRow->structured_data)) { $decoded = json_decode($firstRow->structured_data, true); if (is_array($decoded)) { $headers = array_keys($decoded); } } } } @endphp @foreach($sheetData as $row) @php $rowData = $row->structured_data; if (is_string($rowData)) { $rowData = json_decode($rowData, true) ?? []; } @endphp @if(Auth::user()->isAdmin()) @endif @endforeach
# 🚚 Service 👤 Client 📞 Téléphone 📍 Adresse 💰 Montant 📦 Suivi 📊 Statut 📝 Notes ⚙️ Actions
{{ $row->row_number }} {{ $rowData['Nom du client'] ?? $rowData['nom'] ?? '-' }} {{ $rowData['Téléphone'] ?? $rowData['tel'] ?? '-' }} {{ $rowData['Adresse'] ?? $rowData['adresse'] ?? '-' }} {{ $rowData['Total'] ?? $rowData['prix'] ?? '-' }} @if($row->tracking_number)
🇲🇦 {{ $row->tracking_number }}
@else - @endif
@if($row->ozone_status == 'sent') ✅ Envoyé @else ⏳ Attente @endif
@if($row->tracking_number) @else @endif @if($row->tracking_number) @else @endif @if(Auth::user()->isAdmin() && $row->ozone_status != 'sent') @endif @if($row->tracking_number) @else @endif
@else
📭

Aucune commande

Commencez par ajouter votre première commande

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