diff --git a/src/components/forms/letter-generator.tsx b/src/components/forms/letter-generator.tsx index 4e853c7..8c492f7 100644 --- a/src/components/forms/letter-generator.tsx +++ b/src/components/forms/letter-generator.tsx @@ -143,8 +143,8 @@ export function LetterGenerator() { "firm.phone": firm?.contact_phone ?? "", "firm.email": firm?.contact_email ?? "", "firm.website": (firm as any)?.website ?? "", - "owner.name": homeowner ? `${homeowner.first_name} ${homeowner.last_name}`.trim() : "", - "client.name": client?.name ?? "", + "recipient.name": recipient?.name ?? "", + "recipient.company": recipient?.company ?? "", attorney: attorneyName, date: fmtDateLong(date), }; @@ -244,21 +244,13 @@ export function LetterGenerator() { doc.text(fmtDateLong(date), centerX, y, { align: "center" }); y += 28; - // ----- Recipient ----- + // ----- Recipient (from selected contact) ----- doc.setFont(bodyFont, "normal"); doc.setFontSize(bodyFontSize); - ownerMailingLines(homeowner).forEach((l) => { + contactMailingLines(recipient).forEach((l) => { doc.text(l, margin, y); y += lh - 1; }); - if (!homeowner && client) { - doc.text(client.name, margin, y); - y += lh - 1; - clientAddressLines(client).forEach((l) => { - doc.text(l, margin, y); - y += lh - 1; - }); - } // Certified mail line (right-aligned, italic) — only when a number is provided if (certifiedMailNumber.trim() && template.showCertifiedMail !== false) { @@ -351,18 +343,60 @@ export function LetterGenerator() {