Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
45432d77d6
commit
6a9f7dbbef
@@ -224,6 +224,43 @@ export function FormFieldsFillPanel({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (f.type === "contact") {
|
||||
const selectedId = contactIdByField[f.key] ?? "";
|
||||
const selected = contacts.find((c) => c.id === selectedId);
|
||||
return (
|
||||
<div key={f.key} className="space-y-1">
|
||||
{labelEl}
|
||||
<Select
|
||||
value={selectedId}
|
||||
onValueChange={(val) => {
|
||||
setContactIdByField((p) => ({ ...p, [f.key]: val }));
|
||||
const c = contacts.find((x) => x.id === val);
|
||||
set(f.key, contactMailingLines(c).join("\n"));
|
||||
}}
|
||||
>
|
||||
<SelectTrigger className="h-9">
|
||||
<SelectValue placeholder="Select contact (court, counsel, vendor…)" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{contacts.map((c) => {
|
||||
const sub = [c.contact_type, c.company].filter(Boolean).join(" • ");
|
||||
return (
|
||||
<SelectItem key={c.id} value={c.id}>
|
||||
{c.name}
|
||||
{sub ? ` — ${sub}` : ""}
|
||||
</SelectItem>
|
||||
);
|
||||
})}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{selected && (
|
||||
<pre className="text-[11px] text-muted-foreground whitespace-pre-wrap font-sans border rounded p-2 bg-muted/30">
|
||||
{contactMailingLines(selected).join("\n")}
|
||||
</pre>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
// text (default)
|
||||
return (
|
||||
<div key={f.key}>
|
||||
|
||||
Reference in New Issue
Block a user