feat: add CSV export for approved orders && add non-delivery reason modal for livreurs

This commit is contained in:
2026-05-03 13:23:20 +02:00
parent a273484659
commit 7dc2686f6c
8 changed files with 233 additions and 14 deletions
+31
View File
@@ -367,3 +367,34 @@ export const unlinkLivreurTelegram = async (): Promise<void> => {
/* ignore */
}
};
export type IssueType =
| "client_absent"
| "wrong_address"
| "refused_delivery"
| "no_access"
| "other";
export const ISSUE_LABELS: Record<IssueType, string> = {
client_absent: "Client absent",
wrong_address: "Adresse incorrecte",
refused_delivery: "Livraison refusée",
no_access: "Accès impossible",
other: "Autre",
};
export const reportDeliveryIssue = async (
deliveryId: number,
issueType: IssueType,
description: string,
): Promise<{ success: boolean; error?: string }> => {
try {
await apiClient.post(`${API}/deliveries/${deliveryId}/issue`, {
issue_type: issueType,
description,
});
return { success: true };
} catch (e: any) {
return { success: false, error: e?.response?.data?.error || "Erreur" };
}
};