From 5c18ee22a9babddac03f45f3a37ff109aec1983e Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Mon, 8 Sep 2025 18:26:47 +0000 Subject: [PATCH 1/6] Update task status display to use a dropdown selector Replaces the static status display with an interactive Select component for easier status updates, allowing users to change status directly from the list view. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/F5ROn6G --- client/src/pages/Avoirs.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/client/src/pages/Avoirs.tsx b/client/src/pages/Avoirs.tsx index 62fe7b9..60455e1 100644 --- a/client/src/pages/Avoirs.tsx +++ b/client/src/pages/Avoirs.tsx @@ -926,12 +926,19 @@ export default function Avoirs() { {avoir.supplier?.name || 'Fournisseur non défini'} -
- {getStatusIcon(avoir.status)} - - {avoir.status} - -
+ #{avoir.invoiceReference || 'Sans référence'} From 152fc2dea19296d0cbbd7e4ae1e87f6f73d4dd0a Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Mon, 8 Sep 2025 18:27:24 +0000 Subject: [PATCH 2/6] Update task status handling and add validation functionality Modify the Avoirs page to allow inline status updates via a dropdown and implement validation logic with a "Validate" button. Admins gain the ability to devalidate entries. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/F5ROn6G --- client/src/pages/Avoirs.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/client/src/pages/Avoirs.tsx b/client/src/pages/Avoirs.tsx index 60455e1..2327e2c 100644 --- a/client/src/pages/Avoirs.tsx +++ b/client/src/pages/Avoirs.tsx @@ -336,6 +336,25 @@ export default function Avoirs() { setIsDeleteDialogOpen(true); }; + // Handle status change + const handleStatusChange = (avoirId: number, newStatus: string) => { + const avoir = avoirs.find(a => a.id === avoirId); + if (avoir) { + editAvoirMutation.mutate({ + id: avoirId, + data: { + supplierId: avoir.supplierId, + groupId: avoir.groupId, + invoiceReference: avoir.invoiceReference || "", + amount: avoir.amount, + comment: avoir.comment || "", + commercialProcessed: avoir.commercialProcessed, + status: newStatus as "En attente de demande" | "Demandé" | "Reçu", + } + }); + } + }; + // 🔍 FONCTION DE VÉRIFICATION DE FACTURE (comme rapprochement) const verifyAvoirInvoiceMutation = useMutation({ mutationFn: async ({ avoirId, invoiceReference, forceRefresh }: { avoirId: number; invoiceReference?: string; forceRefresh?: boolean }) => { From 2f4e3dcbd583b6f04f858d42d0d1acea746e6b81 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Mon, 8 Sep 2025 18:28:01 +0000 Subject: [PATCH 3/6] Improve task status management and validation workflows Automatically trigger invoice verification after successful upload and introduce a validation workflow with approve/decline buttons for admins. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/F5ROn6G --- client/src/pages/Avoirs.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/src/pages/Avoirs.tsx b/client/src/pages/Avoirs.tsx index 2327e2c..32d2ff5 100644 --- a/client/src/pages/Avoirs.tsx +++ b/client/src/pages/Avoirs.tsx @@ -577,6 +577,13 @@ export default function Avoirs() { description: "Avoir traité avec succès via le webhook", }); + // Vérification automatique de la facture après envoi réussi + if (selectedAvoirForUpload.invoiceReference?.trim()) { + setTimeout(() => { + handleVerifyAvoirInvoice(selectedAvoirForUpload, true); + }, 1000); // Délai de 1 seconde pour laisser le temps aux données de se synchroniser + } + // Reset des données setSelectedAvoirForUpload(null); setSelectedFile(null); From 52f585d1b1b9ce6d545c006b71bf026274576cbc Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Mon, 8 Sep 2025 18:28:59 +0000 Subject: [PATCH 4/6] Add ability to validate and devalidate task statuses Adds functionality to validate and devalidate task items. Includes buttons for validation and devalidation, with validated items visually distinguished. Admins can devalidate items. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/F5ROn6G --- client/src/pages/Avoirs.tsx | 70 ++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/client/src/pages/Avoirs.tsx b/client/src/pages/Avoirs.tsx index 32d2ff5..4219efb 100644 --- a/client/src/pages/Avoirs.tsx +++ b/client/src/pages/Avoirs.tsx @@ -355,6 +355,47 @@ export default function Avoirs() { } }; + // Handle validation/devalidation + const handleValidateAvoir = (avoirId: number) => { + const avoir = avoirs.find(a => a.id === avoirId); + if (avoir) { + editAvoirMutation.mutate({ + id: avoirId, + data: { + supplierId: avoir.supplierId, + groupId: avoir.groupId, + invoiceReference: avoir.invoiceReference || "", + amount: avoir.amount, + comment: avoir.comment || "", + commercialProcessed: avoir.commercialProcessed, + status: avoir.status as "En attente de demande" | "Demandé" | "Reçu", + nocodbVerified: true, + nocodbVerifiedAt: new Date(), + } + }); + } + }; + + const handleDevalidateAvoir = (avoirId: number) => { + const avoir = avoirs.find(a => a.id === avoirId); + if (avoir) { + editAvoirMutation.mutate({ + id: avoirId, + data: { + supplierId: avoir.supplierId, + groupId: avoir.groupId, + invoiceReference: avoir.invoiceReference || "", + amount: avoir.amount, + comment: avoir.comment || "", + commercialProcessed: avoir.commercialProcessed, + status: avoir.status as "En attente de demande" | "Demandé" | "Reçu", + nocodbVerified: false, + nocodbVerifiedAt: null, + } + }); + } + }; + // 🔍 FONCTION DE VÉRIFICATION DE FACTURE (comme rapprochement) const verifyAvoirInvoiceMutation = useMutation({ mutationFn: async ({ avoirId, invoiceReference, forceRefresh }: { avoirId: number; invoiceReference?: string; forceRefresh?: boolean }) => { @@ -947,7 +988,7 @@ export default function Avoirs() { const canEditDelete = ['admin', 'directeur'].includes((user as any)?.role); return ( - + {avoir.supplier?.name || 'Fournisseur non défini'} @@ -1043,6 +1084,33 @@ export default function Avoirs() { )} + + {/* Bouton Valider - apparaît si vérification réussie et pas encore validé */} + {avoirVerificationResults[avoir.id]?.exists && !avoir.nocodbVerified && ( + + )} + + {/* Bouton Dévalider - pour admins sur avoirs validés */} + {avoir.nocodbVerified && canEditDelete && ( + + )} + {canEditDelete && ( <>