Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-18 19:10:32 +00:00
co-authored by renee-png
parent 94191d88f9
commit b2ef7bf21b
+33
View File
@@ -195,7 +195,38 @@ function PleadingNewPage() {
if (c && !c.counties.includes(county)) setCounty(c.counties[0]);
};
const varMap = useMemo(() => buildVarMap(varCtx), [varCtx]);
const sub = (s: string) => applyVars(s, varMap);
const subFootnotes = (fns: PleadingFootnote[]) => fns.map((f) => ({ ...f, text: sub(f.text) }));
const subServiceList = (list: ServiceContact[]) =>
list.map((c) => ({
...c,
name: sub(c.name),
role: c.role ? sub(c.role) : c.role,
company: c.company ? sub(c.company) : c.company,
email: c.email ? sub(c.email) : c.email,
phone: c.phone ? sub(c.phone) : c.phone,
address: c.address ? sub(c.address) : c.address,
}));
const input = {
courtType, circuit, county,
plaintiffs: sub(plaintiffs),
defendants: sub(defendants),
caseNumber: sub(caseNumber),
title: sub(title),
bodyHtml: sub(bodyHtml),
footnotes: subFootnotes(footnotes),
footerLeft: sub(footerLeft),
footerCenter: sub(footerCenter),
footerRight: sub(footerRight),
signature: buildSignature(),
serviceList: subServiceList(serviceList),
serviceListTitle: sub(serviceListTitle),
};
// Raw input (no substitution) for saving the source so tokens persist
const rawInput = {
courtType, circuit, county,
plaintiffs, defendants, caseNumber,
title, bodyHtml, footnotes,
@@ -203,6 +234,8 @@ function PleadingNewPage() {
signature: buildSignature(),
serviceList,
serviceListTitle,
clientId: clientId || null,
caseId: caseId || null,
};
const headerLine1 = `IN THE ${courtType} COURT OF THE ${circuit} JUDICIAL CIRCUIT,`;