Enable administrators to revert task validation status

Update the validation button logic to allow administrators to revert task status from "Received" to "Requested" or devalidate verified tasks.

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/yiEpJFx
This commit is contained in:
michaelschal committed 2025-09-09 11:04:48 +00:00
1 parent 65cde59d67
commit 9347bb98d9
2 files changed
+14 -4

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+14 -4
View File
@@ -1085,14 +1085,24 @@ export default function Avoirs() {
</Button>
)}
{/* Bouton Dévalider */}
{avoir.nocodbVerified && canEditDelete && (
{/* Bouton Dévalider - Pour admin: sur avoirs validés OU statut Reçu */}
{canEditDelete && (
(avoir.nocodbVerified ||
((user as any)?.role === 'admin' && avoir.status === 'Reçu'))
) && (
<Button
variant="outline"
size="sm"
className="h-8 w-8 p-0 text-orange-600 hover:text-orange-700 hover:bg-orange-50"
title="Dévalider l'avoir"
onClick={() => handleDevalidateAvoir(avoir.id)}
title={avoir.nocodbVerified ? "Dévalider l'avoir" : "Remettre en statut Demandé"}
onClick={() => {
if (avoir.nocodbVerified) {
handleDevalidateAvoir(avoir.id);
} else if ((user as any)?.role === 'admin' && avoir.status === 'Reçu') {
// Pour les avoirs non-validés mais avec statut Reçu, changer le statut
handleStatusChange(avoir.id, 'Demandé');
}
}}
>
<XCircle className="h-4 w-4" />
</Button>