From 412d26b0ff6530c531d6735a55ce6e47795b997f Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 23:49:00 +0000 Subject: [PATCH 1/3] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/cases/collections-tab.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/cases/collections-tab.tsx b/src/components/cases/collections-tab.tsx index 6a700a8..7269c42 100644 --- a/src/components/cases/collections-tab.tsx +++ b/src/components/cases/collections-tab.tsx @@ -171,12 +171,13 @@ export function CaseCollectionsTab({ const list = cols ?? []; setCollections(list); setHomeowners(hos ?? []); - // Filter: case_contacts.role = 'homeowner' OR contact.contact_type = 'homeowner' + // Only case-linked contacts whose role OR contact_type is 'homeowner' or 'tenant' + const ALLOWED = new Set(["homeowner", "tenant"]); const hoContacts = (ccs ?? []) .filter((cc: any) => { - const roleMatch = (cc.role || "").toLowerCase() === "homeowner"; - const typeMatch = (cc.contact?.contact_type || "").toLowerCase() === "homeowner"; - return cc.contact && (roleMatch || typeMatch); + const role = (cc.role || "").toLowerCase(); + const type = (cc.contact?.contact_type || "").toLowerCase(); + return cc.contact && (ALLOWED.has(role) || ALLOWED.has(type)); }) .map((cc: any) => ({ ...cc.contact, _link_role: cc.role })); setContactHomeowners(hoContacts); From 7d214637626464e69126646b9ae4d1abd7fb8b48 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 23:49:09 +0000 Subject: [PATCH 2/3] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/cases/collections-tab.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/cases/collections-tab.tsx b/src/components/cases/collections-tab.tsx index 7269c42..6c83181 100644 --- a/src/components/cases/collections-tab.tsx +++ b/src/components/cases/collections-tab.tsx @@ -1146,8 +1146,7 @@ function AddCollectionDialog({ useEffect(() => { if (open) { - const match = findUniqueHomeownerByTitle(caseTitle, available); - setPickerValue(match ? `ho:${match.id}` : ""); + setPickerValue(""); setStatus("none"); setNotes(""); } From 2c25697ac70197ecdf0495a4d9f6607dc96c0d23 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 23:49:29 +0000 Subject: [PATCH 3/3] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/cases/collections-tab.tsx | 33 ++++++++++-------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/components/cases/collections-tab.tsx b/src/components/cases/collections-tab.tsx index 6c83181..8e673da 100644 --- a/src/components/cases/collections-tab.tsx +++ b/src/components/cases/collections-tab.tsx @@ -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 ( @@ -1241,9 +1238,8 @@ function AddCollectionDialog({ Add homeowner collection - 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.
@@ -1251,9 +1247,8 @@ function AddCollectionDialog({ {allOptions.length === 0 ? (

- {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.

) : (