feat: add CSV export for approved orders && add non-delivery reason modal for livreurs
This commit is contained in:
@@ -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" };
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user