Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
a7c8a89757
commit
412d26b0ff
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user