From dd0a8ca702fd56aad35cb48fa5129a57fbab60b9 Mon Sep 17 00:00:00 2001
From: michaelschal <35957947-michaelschal@users.noreply.replit.com>
Date: Wed, 10 Sep 2025 08:02:06 +0000
Subject: [PATCH] Add reconciliation comments for improved task tracking
Update the BL reconciliation page to use a new endpoint for creating reconciliation comments, replacing the previous note functionality. This change involves updating the mutation, success and error handlers, and button disabled states to reflect the new comment creation process.
Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 95e8aab4-f39f-4b48-aa57-a759ec15ba3d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/95e8aab4-f39f-4b48-aa57-a759ec15ba3d/BOWXK9F
---
client/src/pages/BLReconciliation.tsx | 31 +++++++++++++++------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/client/src/pages/BLReconciliation.tsx b/client/src/pages/BLReconciliation.tsx
index 05dcbe3..bc82ee8 100644
--- a/client/src/pages/BLReconciliation.tsx
+++ b/client/src/pages/BLReconciliation.tsx
@@ -143,16 +143,19 @@ export default function BLReconciliation() {
}
});
- // Mutation pour mettre à jour les notes
- const updateNoteMutation = useMutation({
- mutationFn: async ({ deliveryId, notes }: { deliveryId: number; notes: string }) => {
- const response = await apiRequest(`/api/deliveries/${deliveryId}/notes`, 'PUT', { notes });
+ // Mutation pour créer un nouveau commentaire de rapprochement
+ const createCommentMutation = useMutation({
+ mutationFn: async ({ deliveryId, content }: { deliveryId: number; content: string }) => {
+ const response = await apiRequest(`/api/deliveries/${deliveryId}/reconciliation-comments`, 'POST', {
+ content,
+ type: 'info'
+ });
return response;
},
onSuccess: () => {
toast({
- title: "Commentaire sauvegardé",
- description: "Le commentaire a été mis à jour avec succès",
+ title: "Commentaire ajouté",
+ description: "Le commentaire a été ajouté avec succès",
});
// Rafraîchir les données
queryClient.invalidateQueries({ queryKey: ['/api/deliveries/bl'] });
@@ -160,10 +163,10 @@ export default function BLReconciliation() {
handleCloseCommentModal();
},
onError: (error) => {
- console.error('Erreur sauvegarde commentaire:', error);
+ console.error('Erreur ajout commentaire:', error);
toast({
title: "Erreur",
- description: "Impossible de sauvegarder le commentaire",
+ description: "Impossible d'ajouter le commentaire",
variant: "destructive",
});
}
@@ -171,11 +174,11 @@ export default function BLReconciliation() {
// Fonction pour sauvegarder le commentaire
const handleSaveComment = () => {
- if (!selectedDeliveryForComment) return;
+ if (!selectedDeliveryForComment || !commentText.trim()) return;
- updateNoteMutation.mutate({
+ createCommentMutation.mutate({
deliveryId: selectedDeliveryForComment.id,
- notes: commentText
+ content: commentText
});
};
@@ -1440,16 +1443,16 @@ export default function BLReconciliation() {
{!selectedDeliveryForComment?.reconciled && (
)}