Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-19 23:49:29 +00:00
co-authored by renee-png
parent 7d21463762
commit 2c25697ac7
+14 -19
View File
@@ -1221,19 +1221,16 @@ function AddCollectionDialog({
onCreated();
};
const hoOptions = available.map((h) => ({
value: `ho:${h.id}`,
label: `${h.last_name}, ${h.first_name}${h.unit_number ? ` — Unit ${h.unit_number}` : ""}`,
keywords: `${h.first_name} ${h.last_name} ${h.unit_number ?? ""}`,
group: "HOA homeowners",
}));
const ctOptions = contactOptions.map(({ contact, first, last }) => ({
value: `ct:${contact.id}`,
label: `${last || contact.name}${first ? `, ${first}` : ""} — Case contact`,
keywords: `${first} ${last} ${contact.name} ${contact.email ?? ""}`,
group: "Case contacts (homeowner)",
}));
const allOptions = [...hoOptions, ...ctOptions];
const ctOptions = contactOptions.map(({ contact, first, last }) => {
const roleLabel = (contact._link_role || contact.contact_type || "homeowner").toLowerCase();
const niceRole = roleLabel.charAt(0).toUpperCase() + roleLabel.slice(1);
return {
value: `ct:${contact.id}`,
label: `${last || contact.name}${first ? `, ${first}` : ""} — ${niceRole}`,
keywords: `${first} ${last} ${contact.name} ${contact.email ?? ""}`,
};
});
const allOptions = ctOptions;
return (
<Dialog open={open} onOpenChange={onOpenChange}>
@@ -1241,9 +1238,8 @@ function AddCollectionDialog({
<DialogHeader>
<DialogTitle className="font-serif">Add homeowner collection</DialogTitle>
<DialogDescription>
Attach a homeowner to this matter. You can pick from this HOA's
homeowners or any case contact tagged as a homeowner. Each
homeowner can only have one collection per case.
Pick a case contact tagged as a homeowner or tenant. Link contacts
on the Contacts tab of this case to make them available here.
</DialogDescription>
</DialogHeader>
<div className="space-y-3">
@@ -1251,9 +1247,8 @@ function AddCollectionDialog({
<Label>Homeowner</Label>
{allOptions.length === 0 ? (
<p className="text-sm text-muted-foreground italic mt-1">
{homeowners.length === 0 && contactHomeowners.length === 0
? "No homeowners yet. Use 'New homeowner' or link a homeowner contact to this case."
: "All available homeowners already have a collection on this matter."}
No case contacts tagged as homeowner or tenant. Add one on the
Contacts tab of this case.
</p>
) : (
<SearchableSelect