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] 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 ( -