chore: add button for livreur

This commit is contained in:
2026-03-05 17:01:51 +01:00
parent 7cfb395af1
commit 532584edb2
@@ -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") && (
<Button
title="J'arrive"
onPress={() => handleArrivedDelivery(item.id)}
style={{
marginTop: spacing.s,
backgroundColor: colors.warning,
}}
/>
)}
{item.status === "arrived" && (
<Button
title="Terminer la livraison"
onPress={() => handleCompleteDelivery(item.id)}