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
This commit is contained in:
michaelschal committed 2025-09-08 18:27:24 +00:00
1 parent 5c18ee22a9
commit 152fc2dea1
1 file changed
+19
+19
View File
@@ -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 }) => {