From 15a8c86684d51c59fb76854050335140c2d824c2 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 16:09:37 +0000 Subject: [PATCH 1/8] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/invoices/generate-invoice-dialog.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/invoices/generate-invoice-dialog.tsx b/src/components/invoices/generate-invoice-dialog.tsx index 17144b7..5967e8c 100644 --- a/src/components/invoices/generate-invoice-dialog.tsx +++ b/src/components/invoices/generate-invoice-dialog.tsx @@ -42,6 +42,7 @@ export function GenerateInvoiceDialog({ open, onOpenChange, clientId, clientName const [dueDays, setDueDays] = useState("30"); const [notes, setNotes] = useState(""); const [isRetainer, setIsRetainer] = useState(false); + const [splitPerCase, setSplitPerCase] = useState(false); const [loading, setLoading] = useState(false); const [saving, setSaving] = useState(false); From bad5139cd37c64733442a042bd27b142f30d3eb7 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 16:09:50 +0000 Subject: [PATCH 2/8] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- .../invoices/generate-invoice-dialog.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/components/invoices/generate-invoice-dialog.tsx b/src/components/invoices/generate-invoice-dialog.tsx index 5967e8c..118d7ec 100644 --- a/src/components/invoices/generate-invoice-dialog.tsx +++ b/src/components/invoices/generate-invoice-dialog.tsx @@ -153,6 +153,24 @@ export function GenerateInvoiceDialog({ open, onOpenChange, clientId, clientName navigate({ to: "/invoices/$invoiceId", params: { invoiceId: inv.id } }); return; } + if (splitPerCase && selectedIds.length > 1) { + const results: { id: string; number: string }[] = []; + for (const cid of selectedIds) { + const r = await generateInvoiceForClient({ + clientId, + caseIds: [cid], + createdBy: user.id, + taxRate: (Number(taxPct) || 0) / 100, + dueDays: Number(dueDays) || 30, + notes: notes || undefined, + }); + results.push({ id: r.invoiceId, number: r.invoiceNumber }); + } + toast.success(`${results.length} invoices created`); + onOpenChange(false); + navigate({ to: "/invoices" }); + return; + } const { invoiceId, invoiceNumber } = await generateInvoiceForClient({ clientId, caseIds: selectedIds, From 8b4318f9c325a35c34330a41517463ad6d6097d3 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 16:10:14 +0000 Subject: [PATCH 3/8] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- .../invoices/generate-invoice-dialog.tsx | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/src/components/invoices/generate-invoice-dialog.tsx b/src/components/invoices/generate-invoice-dialog.tsx index 118d7ec..02d48ef 100644 --- a/src/components/invoices/generate-invoice-dialog.tsx +++ b/src/components/invoices/generate-invoice-dialog.tsx @@ -235,8 +235,27 @@ export function GenerateInvoiceDialog({ open, onOpenChange, clientId, clientName ) : ( <>
- -
+
+ +
+ + ยท + +
+
+
{cases.map((c) => (
+ {selectedIds.length > 1 && ( + + )} +
@@ -269,7 +304,9 @@ export function GenerateInvoiceDialog({ open, onOpenChange, clientId, clientName
-
Estimated total
+
+ {splitPerCase && selectedIds.length > 1 ? "Combined total" : "Estimated total"} +
{formatCurrency(total)}
{tax > 0 &&
{formatCurrency(subtotal)} + {formatCurrency(tax)} tax
}
From 707964f31cdda637494516763009ada69dec6aff Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 16:10:24 +0000 Subject: [PATCH 4/8] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/invoices/generate-invoice-dialog.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/invoices/generate-invoice-dialog.tsx b/src/components/invoices/generate-invoice-dialog.tsx index 02d48ef..4f883d5 100644 --- a/src/components/invoices/generate-invoice-dialog.tsx +++ b/src/components/invoices/generate-invoice-dialog.tsx @@ -328,7 +328,11 @@ export function GenerateInvoiceDialog({ open, onOpenChange, clientId, clientName disabled={saving || (!isRetainer && (cases.length === 0 || selectedIds.length === 0))} > {saving ? : } - {isRetainer ? "Create retainer invoice" : "Generate draft invoice"} + {isRetainer + ? "Create retainer invoice" + : splitPerCase && selectedIds.length > 1 + ? `Generate ${selectedIds.length} draft invoices` + : "Generate draft invoice"} From c575407d122ad636ee0da1716de4fca394c81f25 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 16:10:33 +0000 Subject: [PATCH 5/8] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/collections.$collectionId.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/collections.$collectionId.tsx b/src/routes/collections.$collectionId.tsx index 40c6ca8..2a1e6f9 100644 --- a/src/routes/collections.$collectionId.tsx +++ b/src/routes/collections.$collectionId.tsx @@ -35,6 +35,7 @@ import { CaseTimeTab } from "@/components/cases/time-tab"; import { CaseExpensesTab } from "@/components/cases/expenses-tab"; import { CaseStatusTab } from "@/components/cases/status-tab"; import { CaseInvoicesTab } from "@/components/cases/invoices-tab"; +import { GenerateInvoiceDialog } from "@/components/invoices/generate-invoice-dialog"; import { CaseLitigationTab } from "@/components/cases/litigation-tab"; import { CaseCustomFieldsTab } from "@/components/cases/custom-fields-tab"; import { formatDate } from "@/lib/format"; @@ -55,6 +56,7 @@ import { Clock, DollarSign, Receipt, + FilePlus, Phone, Tag, } from "lucide-react"; From 346a20fff3745a561239d053e83d9fdbdc1feb59 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 16:10:43 +0000 Subject: [PATCH 6/8] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/collections.$collectionId.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/routes/collections.$collectionId.tsx b/src/routes/collections.$collectionId.tsx index 2a1e6f9..3ba77d1 100644 --- a/src/routes/collections.$collectionId.tsx +++ b/src/routes/collections.$collectionId.tsx @@ -103,6 +103,7 @@ function CollectionDetailRoute() { const [escalating, setEscalating] = useState(false); const [addTaskOpen, setAddTaskOpen] = useState(false); const [reload, setReload] = useState(0); + const [invoiceOpen, setInvoiceOpen] = useState(false); useEffect(() => { let active = true; From cba9381d8b0c438f6e386613a877d2b0228ebd4c Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 16:10:55 +0000 Subject: [PATCH 7/8] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/collections.$collectionId.tsx | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/routes/collections.$collectionId.tsx b/src/routes/collections.$collectionId.tsx index 3ba77d1..a2484c4 100644 --- a/src/routes/collections.$collectionId.tsx +++ b/src/routes/collections.$collectionId.tsx @@ -292,14 +292,21 @@ function CollectionDetailRoute() { return ( - +
+ + {collection.case?.client?.id && ( + + )} +
{/* Tabs: Workflow (collections-specific) + same case tabs */} From 0ed2eea613471d14d3a89493b5a2877006aa38d5 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 16:11:08 +0000 Subject: [PATCH 8/8] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/collections.$collectionId.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/routes/collections.$collectionId.tsx b/src/routes/collections.$collectionId.tsx index a2484c4..3b63c37 100644 --- a/src/routes/collections.$collectionId.tsx +++ b/src/routes/collections.$collectionId.tsx @@ -516,6 +516,16 @@ function CollectionDetailRoute() { userId={user?.id} onSaved={refreshTasks} /> + + {collection.case?.client?.id && ( + + )}
);