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
+7
View File
@@ -126,6 +126,13 @@ export const getCommandItems = async (commandId: number) => {
};
};
export const exportApprovedCommandsCSV = async (): Promise<string> => {
const { data } = await apiClient.get(`${V2}/admin/protected/orders/export/csv`, {
responseType: "text",
});
return data as string;
};
export const deleteCommand = async (commandId: number) => {
const { data } = await apiClient.delete(
`${V2}/admin/protected/orders/${commandId}`,
+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" };
}
};