diff --git a/frontend-admin/src/screens/delivery/DashboardScreen.tsx b/frontend-admin/src/screens/delivery/DashboardScreen.tsx index 47d11af8..017da507 100644 --- a/frontend-admin/src/screens/delivery/DashboardScreen.tsx +++ b/frontend-admin/src/screens/delivery/DashboardScreen.tsx @@ -446,6 +446,18 @@ export default function DashboardScreen() { } }; + const handleArrivedDelivery = async (deliveryId: number) => { + const lat = lastCoords?.lat || 0; + const lng = lastCoords?.lng || 0; + const res = await updateDeliveryStatus(deliveryId, "arrived", lat, lng); + if (res.success) { + showSuccess("Succès", "Statut mis à jour : arrivé à destination"); + loadData(); + } else { + showError("Erreur", res.error || "Erreur"); + } + }; + const handleCompleteDelivery = async (deliveryId: number) => { const lat = lastCoords?.lat || 0; const lng = lastCoords?.lng || 0; @@ -474,6 +486,7 @@ export default function DashboardScreen() { const isActive = item.status === "in_progress" || item.status === "en_route" || + item.status === "arrived" || item.status === "assigned"; return ( @@ -494,7 +507,9 @@ export default function DashboardScreen() { item.status === "completed" || item.status === "livre" ? "Terminée" - : item.status === "in_progress" || + : item.status === "arrived" + ? "Arrivé" + : item.status === "in_progress" || item.status === "en_route" ? "En cours" : "En attente" @@ -503,7 +518,9 @@ export default function DashboardScreen() { item.status === "completed" || item.status === "livre" ? colors.success - : item.status === "in_progress" || + : item.status === "arrived" + ? colors.accent + : item.status === "in_progress" || item.status === "en_route" ? colors.warning : colors.info @@ -629,6 +646,16 @@ export default function DashboardScreen() { )} {(item.status === "in_progress" || item.status === "en_route") && ( +