diff --git a/client/src/pages/Invoices.tsx b/client/src/pages/Invoices.tsx index 81f965f..8473fb1 100644 --- a/client/src/pages/Invoices.tsx +++ b/client/src/pages/Invoices.tsx @@ -115,11 +115,9 @@ export default function Invoices() { const handleSelectAll = (checked: boolean) => { if (checked) { - // Select only invoices with score 100 - const eligibleIds = (filteredInvoices || []) - .filter(inv => (inv.qualityScore || 0) === 100) - .map(inv => inv.id); - setSelectedIds(eligibleIds); + // Select all invoices (no restriction) + const allIds = (filteredInvoices || []).map(inv => inv.id); + setSelectedIds(allIds); } else { setSelectedIds([]); } @@ -174,6 +172,11 @@ export default function Invoices() { const isEligibleForExport = (invoice: any) => { return (invoice.qualityScore || 0) === 100; }; + + const hasOnlyEligibleSelected = selectedIds.length > 0 && selectedIds.every(id => { + const invoice = invoices?.find(inv => inv.id === id); + return invoice && isEligibleForExport(invoice); + }); const allEligibleSelected = (filteredInvoices?.length || 0) > 0 && (filteredInvoices || []).filter(inv => isEligibleForExport(inv)).every(inv => selectedIds.includes(inv.id)); @@ -198,8 +201,9 @@ export default function Invoices() {