Checkpoint: Ajout du filtre "À compléter" dans Factures BAP : affiche toutes les factures dont le bouton BAP n'est pas actif (score < 100%, champs manquants, déjà exportée ou abonnement). Bouton ambré avec compteur dynamique.

This commit is contained in:
Manus
2026-04-14 08:19:14 -04:00
parent 4090678f6f
commit 776324f315

View File

@@ -349,6 +349,7 @@ export default function InvoicesBAP() {
if (statusFilter === "export_error" && inv.exportStatus !== "export_error") return false; if (statusFilter === "export_error" && inv.exportStatus !== "export_error") return false;
if (statusFilter === "bap_validated" && inv.bapValidated !== 1) return false; if (statusFilter === "bap_validated" && inv.bapValidated !== 1) return false;
if (statusFilter === "bap_pending" && inv.bapValidated === 1) return false; if (statusFilter === "bap_pending" && inv.bapValidated === 1) return false;
if (statusFilter === "to_complete" && isEligibleForBAPValidation(inv)) return false;
} }
return true; return true;
@@ -361,6 +362,7 @@ export default function InvoicesBAP() {
export_error: invoices?.filter(inv => inv.exportStatus === "export_error").length || 0, export_error: invoices?.filter(inv => inv.exportStatus === "export_error").length || 0,
bap_validated: invoices?.filter(inv => inv.bapValidated === 1).length || 0, bap_validated: invoices?.filter(inv => inv.bapValidated === 1).length || 0,
bap_pending: invoices?.filter(inv => inv.bapValidated !== 1).length || 0, bap_pending: invoices?.filter(inv => inv.bapValidated !== 1).length || 0,
to_complete: invoices?.filter(inv => !isEligibleForBAPValidation(inv)).length || 0,
}; };
// Old filter logic (to be removed) // Old filter logic (to be removed)
@@ -665,6 +667,14 @@ export default function InvoicesBAP() {
> >
En attente BAP ({statusCounts.bap_pending}) En attente BAP ({statusCounts.bap_pending})
</Button> </Button>
<Button
variant={statusFilter === "to_complete" ? "default" : "outline"}
onClick={() => setStatusFilter("to_complete")}
size="sm"
className={statusFilter === "to_complete" ? "bg-amber-600 hover:bg-amber-700" : "border-amber-400 text-amber-700 hover:bg-amber-50"}
>
À compléter ({statusCounts.to_complete})
</Button>
</div> </div>
{/* Table */} {/* Table */}