From 23ca4e1a4e8d474464cb44c0043f0f0e201ab69a Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 18:59:22 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/invoices.index.tsx | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/routes/invoices.index.tsx b/src/routes/invoices.index.tsx index 2157e94..30e9a12 100644 --- a/src/routes/invoices.index.tsx +++ b/src/routes/invoices.index.tsx @@ -114,24 +114,15 @@ function InvoicesIndex() { useEffect(() => { loadUnbilled(); }, []); - const filtered = useMemo(() => { - return invoices.filter((i) => { - if (status !== "all" && i.status !== status) return false; - if (!q) return true; - const s = q.toLowerCase(); - return ( - i.invoice_number?.toLowerCase().includes(s) || - i.client?.name?.toLowerCase().includes(s) || - i.case?.case_number?.toLowerCase().includes(s) - ); - }); - }, [invoices, q, status]); + const filtered = invoices; const totals = useMemo(() => { const outstanding = filtered.reduce((s, i) => s + (Number(i.total) - Number(i.amount_paid)), 0); const paid = filtered.reduce((s, i) => s + Number(i.amount_paid), 0); - return { outstanding, paid, count: filtered.length }; - }, [filtered]); + return { outstanding, paid, count: totalCount }; + }, [filtered, totalCount]); + + const totalPages = Math.max(1, Math.ceil(totalCount / PAGE_SIZE)); // Classify each row: unbilled (no invoice_id), marked (linked to placeholder), real (linked to real invoice — not shown) const isPlaceholder = (invId: string | null) => !!invId && placeholderIds.has(invId);