From 54bdac580c05e3309fcca9f0105bf3d21106a9e4 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Fri, 15 Aug 2025 22:24:15 +0000 Subject: [PATCH] Update delivery reconciliation to make the bill of lading number optional Modify BL reconciliation logic to remove the mandatory bill of lading number requirement and streamline the API request for updating delivery details. Replit-Commit-Author: Agent Replit-Commit-Session-Id: a3de0820-9397-41b2-b000-7931ee9c29de Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a3de0820-9397-41b2-b000-7931ee9c29de/KlZPL3P --- client/src/pages/BLReconciliation.tsx | 32 ++++++++++----------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/client/src/pages/BLReconciliation.tsx b/client/src/pages/BLReconciliation.tsx index e406ce3..5822bb4 100644 --- a/client/src/pages/BLReconciliation.tsx +++ b/client/src/pages/BLReconciliation.tsx @@ -90,11 +90,15 @@ export default function BLReconciliation() { // Auto-remplissage si facture trouvée via BL if (result.exists && result.matchType === 'bl_number' && result.invoiceReference) { - // Auto-remplir les champs dans la livraison - updateDeliveryMutation.mutate({ - id: variables.deliveryId, + // Auto-remplir les champs dans la livraison via API + apiRequest(`/api/deliveries/${variables.deliveryId}`, "PUT", { invoiceReference: result.invoiceReference, invoiceAmount: result.invoiceAmount + }).then(() => { + queryClient.invalidateQueries({ queryKey: ['/api/deliveries/bl'] }); + queryClient.invalidateQueries({ queryKey: ['/api/deliveries'] }); + }).catch((error) => { + console.error('Erreur auto-remplissage:', error); }); } @@ -263,17 +267,11 @@ export default function BLReconciliation() { setIsModalOpen(false); }; - const handleSaveReconciliation = async (data: any) => { + const handleSaveReconciliation = async () => { try { - await apiRequest(`/api/deliveries/${selectedDelivery.id}`, "PUT", data); - - toast({ - title: "Succès", - description: "Données de rapprochement mises à jour", - }); - // Invalidation cache + refetch forcé pour mise à jour immédiate queryClient.invalidateQueries({ queryKey: ['/api/deliveries/bl'] }); + queryClient.invalidateQueries({ queryKey: ['/api/deliveries'] }); refetch(); handleCloseModal(); } catch (error) { @@ -720,18 +718,12 @@ export default function BLReconciliation() { {(delivery.group?.nocodbTableName || delivery.group?.nocodbConfigId || delivery.group?.webhookUrl) && (