From 53adf807c9669c735d1126a03e6b3324717463fa 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 02:14:06 +0000 Subject: [PATCH 1/7] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/forms-shared.ts | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/lib/forms-shared.ts b/src/lib/forms-shared.ts index 88bf9c1..153548e 100644 --- a/src/lib/forms-shared.ts +++ b/src/lib/forms-shared.ts @@ -26,6 +26,45 @@ export interface HomeownerLite { opening_balance: number; } +export interface ContactLite { + id: string; + name: string; + contact_type: string; + company: string | null; + title: string | null; + address_line1: string | null; + address_line2: string | null; + city: string | null; + state: string | null; + postal_code: string | null; + email: string | null; + phone: string | null; +} + +export async function fetchContacts(): Promise { + const { data } = await supabase + .from("contacts") + .select( + "id,name,contact_type,company,title,address_line1,address_line2,city,state,postal_code,email,phone", + ) + .is("archived_at", null) + .order("name"); + return (data ?? []) as ContactLite[]; +} + +export function contactMailingLines(c: ContactLite | null | undefined): string[] { + if (!c) return []; + const lines: string[] = []; + if (c.name) lines.push(c.name); + if (c.title) lines.push(c.title); + if (c.company) lines.push(c.company); + if (c.address_line1) lines.push(c.address_line1); + if (c.address_line2) lines.push(c.address_line2); + const cityLine = [c.city, c.state, c.postal_code].filter(Boolean).join(", "); + if (cityLine) lines.push(cityLine); + return lines; +} + export async function fetchClients(): Promise { const { data } = await supabase .from("clients") From 8c8d91cb5fc980abdaf37c6521ab344d0d3c59af 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 02:14:14 +0000 Subject: [PATCH 2/7] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/forms-shared.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/forms-shared.ts b/src/lib/forms-shared.ts index 153548e..61174a5 100644 --- a/src/lib/forms-shared.ts +++ b/src/lib/forms-shared.ts @@ -183,7 +183,8 @@ export type FormFieldType = | "dropdown" | "county" | "client" - | "homeowner"; + | "homeowner" + | "contact"; export interface FormFieldDef { key: string; From ee02a0746f9cabca400bf1753590548b6ecd3e0a 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 02:14:23 +0000 Subject: [PATCH 3/7] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/form-field-defs-dialog.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/forms/form-field-defs-dialog.tsx b/src/components/forms/form-field-defs-dialog.tsx index d13f3cf..7e38423 100644 --- a/src/components/forms/form-field-defs-dialog.tsx +++ b/src/components/forms/form-field-defs-dialog.tsx @@ -33,6 +33,7 @@ const TYPE_LABEL: Record = { county: "Florida County", client: "Client / Association", homeowner: "Homeowner", + contact: "Contact (court, counsel, etc.)", }; function slug(s: string): string { From f19a4454b1fca9cb1cd5c4a99e0d3418af402331 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 02:14:31 +0000 Subject: [PATCH 4/7] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/form-fields-fill-panel.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/forms/form-fields-fill-panel.tsx b/src/components/forms/form-fields-fill-panel.tsx index 307fcb3..cfbb86d 100644 --- a/src/components/forms/form-fields-fill-panel.tsx +++ b/src/components/forms/form-fields-fill-panel.tsx @@ -12,8 +12,11 @@ import { import { fetchClients, fetchHomeowners, + fetchContacts, + contactMailingLines, type ClientLite, type HomeownerLite, + type ContactLite, type FormFieldDef, } from "@/lib/forms-shared"; import { FL_COUNTIES } from "@/lib/florida"; From 45432d77d64d372119b4bf4a4de9eb7df868265d 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 02:14:41 +0000 Subject: [PATCH 5/7] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/form-fields-fill-panel.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/forms/form-fields-fill-panel.tsx b/src/components/forms/form-fields-fill-panel.tsx index cfbb86d..acf9316 100644 --- a/src/components/forms/form-fields-fill-panel.tsx +++ b/src/components/forms/form-fields-fill-panel.tsx @@ -32,14 +32,20 @@ export function FormFieldsFillPanel({ }) { const [clients, setClients] = useState([]); const [homeownersByClient, setHomeownersByClient] = useState>({}); + const [contacts, setContacts] = useState([]); // Track which client a homeowner field is filtered by (per-field-key) const [hoClientByField, setHoClientByField] = useState>({}); + // Track which contact id is selected per contact-field-key + const [contactIdByField, setContactIdByField] = useState>({}); useEffect(() => { if (fields.some((f) => f.type === "client" || f.type === "homeowner")) { fetchClients().then(setClients); } + if (fields.some((f) => f.type === "contact")) { + fetchContacts().then(setContacts); + } }, [fields]); const set = (key: string, v: string) => onChange({ ...values, [key]: v }); From 6a9f7dbbef1f5ced6d175fcc549daf724495483f 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 02:14:56 +0000 Subject: [PATCH 6/7] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- .../forms/form-fields-fill-panel.tsx | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/components/forms/form-fields-fill-panel.tsx b/src/components/forms/form-fields-fill-panel.tsx index acf9316..2655d68 100644 --- a/src/components/forms/form-fields-fill-panel.tsx +++ b/src/components/forms/form-fields-fill-panel.tsx @@ -224,6 +224,43 @@ export function FormFieldsFillPanel({ ); } + if (f.type === "contact") { + const selectedId = contactIdByField[f.key] ?? ""; + const selected = contacts.find((c) => c.id === selectedId); + return ( +
+ {labelEl} + + {selected && ( +
+                  {contactMailingLines(selected).join("\n")}
+                
+ )} +
+ ); + } // text (default) return (
From 433dbe4ba0d948dbfd996727fa505d36cead264d 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 02:15:12 +0000 Subject: [PATCH 7/7] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/custom-form-builder.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index 1c52bb9..e8575d3 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -630,19 +630,22 @@ export function CustomFormBuilder() { ? AlignmentType.JUSTIFIED : AlignmentType.LEFT; const indentTwips = Math.round((seg.indent || 0) * 15); // ~px → twips (1px≈15twip) + const lines = applyVariables(seg.text, ctx).split("\n"); children.push( new DocxParagraph({ alignment: align, indent: indentTwips ? { left: indentTwips } : undefined, - children: [ - new TextRun({ - text: applyVariables(seg.text, ctx), + children: lines.flatMap((line, idx) => { + const run = new TextRun({ + text: line, font: fontFamily, size: fontSize * 2, italics: seg.caption, bold: !!seg.heading && seg.heading > 0, - }), - ], + break: idx > 0 ? 1 : undefined, + }); + return [run]; + }), }), ); }