From bdb60f613b6e26728138ecb3b70be8bd1eb9d9f9 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 18:45:12 +0000 Subject: [PATCH 1/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/docx-pleading.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib/docx-pleading.ts b/src/lib/docx-pleading.ts index 30f4c6b..b687f02 100644 --- a/src/lib/docx-pleading.ts +++ b/src/lib/docx-pleading.ts @@ -36,6 +36,15 @@ export interface PleadingSignature { imageType?: "png" | "jpg" | "jpeg"; } +export interface ServiceContact { + name: string; + role?: string; + company?: string; + email?: string; + phone?: string; + address?: string; // multi-line +} + export interface PleadingInput { courtType: "CIRCUIT" | "COUNTY"; circuit: string; // e.g. "ELEVENTH" @@ -51,6 +60,8 @@ export interface PleadingInput { footerCenter?: string; footerRight?: string; // user text prepended to "Page X of Y" signature?: PleadingSignature; + serviceList?: ServiceContact[]; + serviceListTitle?: string; } const FONT = "Bookman Old Style"; From 2ade5e8fb529af48ffe881c58f6b0568a3117f44 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 18:45:29 +0000 Subject: [PATCH 2/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/docx-pleading.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/lib/docx-pleading.ts b/src/lib/docx-pleading.ts index b687f02..484f737 100644 --- a/src/lib/docx-pleading.ts +++ b/src/lib/docx-pleading.ts @@ -386,6 +386,32 @@ export function buildPleadingDoc(input: PleadingInput): Document { }); } + // Service list (optional) — rendered on a fresh page at end + const serviceList = (input.serviceList || []).filter((c) => c.name.trim().length > 0); + if (serviceList.length > 0) { + const slTitle = (input.serviceListTitle || "SERVICE LIST").toUpperCase(); + bodyParagraphs.push( + new Paragraph({ + pageBreakBefore: true, + alignment: AlignmentType.CENTER, + children: [run(slTitle, { bold: true })], + }), + ); + bodyParagraphs.push(emptyP()); + serviceList.forEach((c, idx) => { + bodyParagraphs.push(p(c.name, { bold: true })); + if (c.role || c.company) { + bodyParagraphs.push(p([c.role, c.company].filter(Boolean).join(", "))); + } + if (c.address) { + c.address.split("\n").forEach((line) => bodyParagraphs.push(p(line))); + } + if (c.phone) bodyParagraphs.push(p(`Tel: ${c.phone}`)); + if (c.email) bodyParagraphs.push(p(`Email: ${c.email}`)); + if (idx < serviceList.length - 1) bodyParagraphs.push(emptyP()); + }); + } + return new Document({ styles: { default: { document: { run: { font: FONT, size: SIZE } } }, From 04fdf3d34028e1c5bce7795b8b768df7f7f10a33 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 18:45:47 +0000 Subject: [PATCH 3/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/pdf-pleading.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/lib/pdf-pleading.ts b/src/lib/pdf-pleading.ts index 6243f1e..51252b3 100644 --- a/src/lib/pdf-pleading.ts +++ b/src/lib/pdf-pleading.ts @@ -328,6 +328,34 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string } } + // Service list — fresh page at end + const serviceList = (input.serviceList || []).filter((c) => c.name.trim().length > 0); + if (serviceList.length > 0) { + pdf.addPage(); + y = MARGIN; + const slTitle = (input.serviceListTitle || "SERVICE LIST").toUpperCase(); + setFont(pdf, { bold: true }); + drawLine(pdf, [{ text: slTitle, style: { bold: true } }], MARGIN, y, "center", CONTENT_W, true); + y += LINE_H * 2; + setFont(pdf, {}); + serviceList.forEach((c, idx) => { + const block: string[] = []; + block.push(c.name); + const sub = [c.role, c.company].filter(Boolean).join(", "); + if (sub) block.push(sub); + if (c.address) c.address.split("\n").forEach((l) => block.push(l)); + if (c.phone) block.push(`Tel: ${c.phone}`); + if (c.email) block.push(`Email: ${c.email}`); + block.forEach((line, i) => { + ensureSpace(LINE_H); + setFont(pdf, { bold: i === 0 }); + pdf.text(line, MARGIN, y); + y += LINE_H; + }); + if (idx < serviceList.length - 1) y += LINE_H * 0.5; + }); + } + const total = pdf.getNumberOfPages(); for (let i = 1; i <= total; i++) { pdf.setPage(i); From 4867f8c309c49542de7ffe553d6d4b1bd69fd1de 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 18:46:00 +0000 Subject: [PATCH 4/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/pdf-pleading.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/pdf-pleading.ts b/src/lib/pdf-pleading.ts index 51252b3..7804c85 100644 --- a/src/lib/pdf-pleading.ts +++ b/src/lib/pdf-pleading.ts @@ -335,7 +335,7 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string y = MARGIN; const slTitle = (input.serviceListTitle || "SERVICE LIST").toUpperCase(); setFont(pdf, { bold: true }); - drawLine(pdf, [{ text: slTitle, style: { bold: true } }], MARGIN, y, "center", CONTENT_W, true); + pdf.text(slTitle, PAGE_W / 2, y, { align: "center" }); y += LINE_H * 2; setFont(pdf, {}); serviceList.forEach((c, idx) => { From 4d88d9a76256df5cb10a1e4bd7bd3bb253c03561 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 18:46:11 +0000 Subject: [PATCH 5/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/documents.pleading.new.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/routes/documents.pleading.new.tsx b/src/routes/documents.pleading.new.tsx index 87f933b..598cd1c 100644 --- a/src/routes/documents.pleading.new.tsx +++ b/src/routes/documents.pleading.new.tsx @@ -13,13 +13,14 @@ import { import { Switch } from "@/components/ui/switch"; import { FL_CIRCUITS } from "@/lib/florida"; import { Packer } from "docx"; -import { buildPleadingDoc, downloadPleading, type PleadingFootnote, type PleadingSignature } from "@/lib/docx-pleading"; +import { buildPleadingDoc, downloadPleading, type PleadingFootnote, type PleadingSignature, type ServiceContact } from "@/lib/docx-pleading"; import { downloadPleadingPdf } from "@/lib/pdf-pleading"; import { RichTextEditor } from "@/components/documents/rich-text-editor"; +import { ContactPickerPopover } from "@/components/clients/contact-picker-popover"; import { supabase } from "@/integrations/supabase/client"; import { useAuth } from "@/lib/auth"; import { toast } from "sonner"; -import { Download, FileText, Save, Loader2, Plus, Trash2, PenLine } from "lucide-react"; +import { Download, FileText, Save, Loader2, Plus, Trash2, PenLine, Users } from "lucide-react"; export const Route = createFileRoute("/documents/pleading/new")({ component: PleadingNewPage, From 06e708d9cd91447e1ad63ca47eaa8fa264f26de9 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 18:46:18 +0000 Subject: [PATCH 6/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/documents.pleading.new.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/documents.pleading.new.tsx b/src/routes/documents.pleading.new.tsx index 598cd1c..a7a69ff 100644 --- a/src/routes/documents.pleading.new.tsx +++ b/src/routes/documents.pleading.new.tsx @@ -47,6 +47,8 @@ function PleadingNewPage() { const [footerRight, setFooterRight] = useState(""); const [docName, setDocName] = useState("Pleading"); const [saving, setSaving] = useState(false); + const [serviceList, setServiceList] = useState([]); + const [serviceListTitle, setServiceListTitle] = useState("SERVICE LIST"); // Attorney signature (loaded from profile) const [includeSignature, setIncludeSignature] = useState(true); From 3c81be64d8431d3c5e31c7470f37ca481db2c0e9 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 18:46:26 +0000 Subject: [PATCH 7/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/documents.pleading.new.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/documents.pleading.new.tsx b/src/routes/documents.pleading.new.tsx index a7a69ff..211086e 100644 --- a/src/routes/documents.pleading.new.tsx +++ b/src/routes/documents.pleading.new.tsx @@ -127,6 +127,8 @@ function PleadingNewPage() { if (typeof p.footerLeft === "string") setFooterLeft(p.footerLeft); if (typeof p.footerCenter === "string") setFooterCenter(p.footerCenter); if (typeof p.footerRight === "string") setFooterRight(p.footerRight); + if (Array.isArray(p.serviceList)) setServiceList(p.serviceList); + if (typeof p.serviceListTitle === "string") setServiceListTitle(p.serviceListTitle); setDocName(`${data.name} (copy)`); toast.success("Loaded saved pleading"); })(); From 4471cefc9301e9c2b2cdde002286c623c83dc0d2 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 18:46:36 +0000 Subject: [PATCH 8/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/documents.pleading.new.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/documents.pleading.new.tsx b/src/routes/documents.pleading.new.tsx index 211086e..5a4c5ed 100644 --- a/src/routes/documents.pleading.new.tsx +++ b/src/routes/documents.pleading.new.tsx @@ -151,6 +151,8 @@ function PleadingNewPage() { title, bodyHtml, footnotes, footerLeft, footerCenter, footerRight, signature: buildSignature(), + serviceList, + serviceListTitle, }; const headerLine1 = `IN THE ${courtType} COURT OF THE ${circuit} JUDICIAL CIRCUIT,`; From 00b9bcadd9f3326e5e35c12598c1845c57131907 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 18:47:00 +0000 Subject: [PATCH 9/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/documents.pleading.new.tsx | 136 +++++++++++++++++++++++++- 1 file changed, 135 insertions(+), 1 deletion(-) diff --git a/src/routes/documents.pleading.new.tsx b/src/routes/documents.pleading.new.tsx index 5a4c5ed..a8dc10c 100644 --- a/src/routes/documents.pleading.new.tsx +++ b/src/routes/documents.pleading.new.tsx @@ -444,7 +444,141 @@ function PleadingNewPage() { - {/* Footer */} + {/* Service list (optional) */} + + +
+
+ +

+ Optional. If you add any contacts, a dedicated page is appended to the pleading listing each one. +

+
+ { + setServiceList((prev) => [ + ...prev, + { + name: c.name, + role: c.title || undefined, + company: c.company || undefined, + email: c.email || undefined, + phone: c.phone || undefined, + address: "", + }, + ]); + }} + /> +
+ +
+ + setServiceListTitle(e.target.value)} + placeholder="SERVICE LIST" + /> +
+ + {serviceList.length === 0 ? ( +
+ No contacts added. Use “Add from contacts” to include a service list page. +
+ ) : ( +
+ {serviceList.map((c, idx) => ( +
+
+
+ + setServiceList((prev) => + prev.map((x, i) => (i === idx ? { ...x, name: e.target.value } : x)), + ) + } + /> + + setServiceList((prev) => + prev.map((x, i) => (i === idx ? { ...x, role: e.target.value } : x)), + ) + } + /> + + setServiceList((prev) => + prev.map((x, i) => (i === idx ? { ...x, company: e.target.value } : x)), + ) + } + /> + + setServiceList((prev) => + prev.map((x, i) => (i === idx ? { ...x, email: e.target.value } : x)), + ) + } + /> + + setServiceList((prev) => + prev.map((x, i) => (i === idx ? { ...x, phone: e.target.value } : x)), + ) + } + /> +