diff --git a/mobile/src/api/api.ts b/mobile/src/api/api.ts
index 25930716..fc5c6801 100644
--- a/mobile/src/api/api.ts
+++ b/mobile/src/api/api.ts
@@ -362,6 +362,24 @@ export const confirmReception = async (
}
};
+export const respondToAddressProposal = async (
+ commandId: number,
+ accepted: boolean,
+): Promise<{ success: boolean; message: string }> => {
+ try {
+ const { data } = await apiClient.post(
+ `${V1}/commands/${commandId}/address/respond`,
+ { accepted },
+ );
+ return { success: true, message: data.message || "Réponse enregistrée" };
+ } catch (error: any) {
+ return {
+ success: false,
+ message: error.response?.data?.error || "Erreur lors de la réponse",
+ };
+ }
+};
+
// ============================================
// TRACKING
// ============================================
diff --git a/mobile/src/api/api_types.ts b/mobile/src/api/api_types.ts
index 39e482ff..31a8e7ec 100644
--- a/mobile/src/api/api_types.ts
+++ b/mobile/src/api/api_types.ts
@@ -256,6 +256,10 @@ export interface OrderDetail {
// Métadonnées
payment_method?: string;
notes?: string;
+
+ // Proposition de modification d'adresse
+ proposed_address?: string | null;
+ address_proposal_status?: "none" | "pending" | "accepted" | "rejected";
[key: string]: any;
}
diff --git a/mobile/src/screens/client/OrderTrackingScreen.tsx b/mobile/src/screens/client/OrderTrackingScreen.tsx
index 82b03f34..c04d3a37 100644
--- a/mobile/src/screens/client/OrderTrackingScreen.tsx
+++ b/mobile/src/screens/client/OrderTrackingScreen.tsx
@@ -16,6 +16,7 @@ import {
getOrderETA,
confirmReception,
cancelCommand,
+ respondToAddressProposal,
formatOrderDate,
formatPrice,
calculateOrderTotal,
@@ -267,6 +268,29 @@ export default function OrderTrackingScreen() {
gap: spacing.s,
marginTop: spacing.l,
},
+ proposalBox: {
+ backgroundColor: colors.warning + "18",
+ borderWidth: 1,
+ borderColor: colors.warning,
+ borderRadius: borderRadius.md,
+ padding: spacing.m,
+ marginTop: spacing.m,
+ },
+ proposalTitle: {
+ color: colors.warning,
+ fontSize: fontSize.sm,
+ fontWeight: fontWeight.semibold,
+ marginBottom: spacing.xs,
+ },
+ proposalAddress: {
+ color: colors.textWhite,
+ fontSize: fontSize.md,
+ marginBottom: spacing.m,
+ },
+ proposalActions: {
+ flexDirection: "row",
+ gap: spacing.s,
+ },
modalBody: { gap: spacing.m },
modalText: {
color: colors.textPrimary,
@@ -360,9 +384,7 @@ export default function OrderTrackingScreen() {
const progress = STATUS_PROGRESS[order.status] || 0;
const track = tracking[order.id];
const eta = etas[order.id];
- const canConfirm = ["livre", "arrived"].includes(
- order.status,
- );
+ const canConfirm = order.status === "livre";
const canCancel = [
"pending",
"assigned",
@@ -431,6 +453,46 @@ export default function OrderTrackingScreen() {
color={colors.textMuted}
/>
+ {order.address_proposal_status === "pending" && order.proposed_address && (
+
+
+ 📍 Nouvelle adresse proposée
+
+
+ {order.proposed_address}
+
+
+
+
+ )}
{expanded && (
{track?.livreur_username && (