From 592edeb3d1ec385f77eba56e9d21e70224fca2a4 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Tue, 9 Sep 2025 06:10:41 +0000 Subject: [PATCH] Prevent changing status for validated invoices and disable selection Add validation to prevent users from changing the status of an invoice once it has been validated. The UI for validated invoices is also updated to be disabled and visually indicate its non-editable state. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/yiEpJFx --- client/src/pages/Avoirs.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/client/src/pages/Avoirs.tsx b/client/src/pages/Avoirs.tsx index 0ba2482..73fc629 100644 --- a/client/src/pages/Avoirs.tsx +++ b/client/src/pages/Avoirs.tsx @@ -458,6 +458,18 @@ export default function Avoirs() { // Handle status change const handleStatusChange = (avoirId: number, newStatus: string) => { + const avoir = avoirs?.find(a => a?.id === avoirId); + + // Empêcher la modification du statut pour les avoirs validés + if (avoir?.nocodbVerified) { + toast({ + title: "Modification interdite", + description: "Impossible de modifier le statut d'un avoir validé", + variant: "destructive", + }); + return; + } + // Empêcher les managers de mettre le statut en "Reçu" if ((user as any)?.role === 'manager' && newStatus === 'Reçu') { toast({ @@ -467,8 +479,6 @@ export default function Avoirs() { }); return; } - - const avoir = avoirs?.find(a => a?.id === avoirId); if (avoir && avoir.supplierId && avoir.groupId) { editAvoirMutation.mutate({ id: avoirId, @@ -984,8 +994,9 @@ export default function Avoirs() {