From f4753b69444af861c9926ef05aba6d6b748ba3d7 Mon Sep 17 00:00:00 2001 From: devinleighsmith <41091511+devinleighsmith@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:08:11 -0700 Subject: [PATCH] psp-8708 fix tenant primary contacts. (#4176) Co-authored-by: Alejandro Sanchez --- .../Models/Search/ContactSummaryModel.cs | 4 +- .../ContactResultComponent.test.tsx.snap | 2 +- .../ContactResultComponent/columns.tsx | 2 +- .../ContactManagerView.test.tsx.snap | 2 +- .../ContactListView.test.tsx.snap | 2 +- .../LeasePages/tenant/AddLeaseTenantForm.tsx | 2 +- .../AddLeaseTenantForm.test.tsx.snap | 6 +-- .../detail/LeasePages/tenant/columns.tsx | 39 +++++++++++++++---- 8 files changed, 41 insertions(+), 18 deletions(-) diff --git a/source/backend/api/Areas/Contacts/Models/Search/ContactSummaryModel.cs b/source/backend/api/Areas/Contacts/Models/Search/ContactSummaryModel.cs index 8ed98791a1..532f45e02b 100644 --- a/source/backend/api/Areas/Contacts/Models/Search/ContactSummaryModel.cs +++ b/source/backend/api/Areas/Contacts/Models/Search/ContactSummaryModel.cs @@ -16,14 +16,14 @@ public class ContactSummaryModel /// public long? PersonId { get; set; } - public PersonModel Person { get; set; } + public Pims.Api.Models.Concepts.Person.PersonModel Person { get; set; } /// /// get/set - The primary key to identify the organization. /// public long? OrganizationId { get; set; } - public OrganizationModel Organization { get; set; } + public Pims.Api.Models.Concepts.Organization.OrganizationModel Organization { get; set; } /// /// get/set - The concurrency row version. diff --git a/source/frontend/src/components/contact/ContactManagerView/ContactResultComponent/__snapshots__/ContactResultComponent.test.tsx.snap b/source/frontend/src/components/contact/ContactManagerView/ContactResultComponent/__snapshots__/ContactResultComponent.test.tsx.snap index 2f4c3317f5..1adce75d23 100644 --- a/source/frontend/src/components/contact/ContactManagerView/ContactResultComponent/__snapshots__/ContactResultComponent.test.tsx.snap +++ b/source/frontend/src/components/contact/ContactManagerView/ContactResultComponent/__snapshots__/ContactResultComponent.test.tsx.snap @@ -550,7 +550,7 @@ exports[`Contact Search Results Table > matches snapshot 1`] = `
- Update/View + Edit/View
diff --git a/source/frontend/src/components/contact/ContactManagerView/ContactResultComponent/columns.tsx b/source/frontend/src/components/contact/ContactManagerView/ContactResultComponent/columns.tsx index 874a3260bc..0eafe6b77e 100644 --- a/source/frontend/src/components/contact/ContactManagerView/ContactResultComponent/columns.tsx +++ b/source/frontend/src/components/contact/ContactManagerView/ContactResultComponent/columns.tsx @@ -121,7 +121,7 @@ const columns: ColumnWithProps[] = [ maxWidth: 50, }, { - Header: 'Update/View', + Header: 'Edit/View', accessor: 'controls' as any, // this column is not part of the data model width: 50, maxWidth: 50, diff --git a/source/frontend/src/components/contact/ContactManagerView/__snapshots__/ContactManagerView.test.tsx.snap b/source/frontend/src/components/contact/ContactManagerView/__snapshots__/ContactManagerView.test.tsx.snap index 084fa6bfbd..677bad4811 100644 --- a/source/frontend/src/components/contact/ContactManagerView/__snapshots__/ContactManagerView.test.tsx.snap +++ b/source/frontend/src/components/contact/ContactManagerView/__snapshots__/ContactManagerView.test.tsx.snap @@ -974,7 +974,7 @@ exports[`ContactManagerView > matches snapshot 1`] = `
- Update/View + Edit/View
diff --git a/source/frontend/src/features/contacts/list/__snapshots__/ContactListView.test.tsx.snap b/source/frontend/src/features/contacts/list/__snapshots__/ContactListView.test.tsx.snap index b7e4077fcd..c07f8532aa 100644 --- a/source/frontend/src/features/contacts/list/__snapshots__/ContactListView.test.tsx.snap +++ b/source/frontend/src/features/contacts/list/__snapshots__/ContactListView.test.tsx.snap @@ -1050,7 +1050,7 @@ exports[`Contact List View > matches snapshot 1`] = `
- Update/View + Edit/View
diff --git a/source/frontend/src/features/leases/detail/LeasePages/tenant/AddLeaseTenantForm.tsx b/source/frontend/src/features/leases/detail/LeasePages/tenant/AddLeaseTenantForm.tsx index b872af4d60..2a9b0dfdea 100644 --- a/source/frontend/src/features/leases/detail/LeasePages/tenant/AddLeaseTenantForm.tsx +++ b/source/frontend/src/features/leases/detail/LeasePages/tenant/AddLeaseTenantForm.tsx @@ -82,7 +82,7 @@ export const AddLeaseTenantForm: React.FunctionComponent< Note: If the tenants you are trying to find were never added to the "contact list" it will not show up. Please add them to the contact list{' '} {here}, then you will be able to see them on the "Add - "Add a Tenant" list. + a Tenant" list. renders as expected 1`] = ` > here - , then you will be able to see them on the "Add "Add a Tenant" list. + , then you will be able to see them on the "Add a Tenant" list.
renders as expected 1`] = `
[] Header: '', accessor: 'isDisabled', align: 'right', - width: 10, - maxWidth: 10, - minWidth: 10, - Cell: (props: CellProps) => - props.row.original.isDisabled ? : , + width: 16, + maxWidth: 16, + minWidth: 16, + Cell: (props: CellProps) => { + const original = props.row.original; + const status = + original.original !== undefined + ? original.original.id.startsWith('O') === true + ? original.original.organization.isDisabled + : original.isDisabled + : original.isDisabled; + return ( + + + + ); + }, }, { Header: '', @@ -58,7 +70,10 @@ const getColumns = (tenantTypes: SelectOption[]): ColumnWithProps[] width: 120, Cell: (props: CellProps) => { const original = props.row.original; - const persons = original?.organizationPersons?.map(op => op.person); + const persons = + original.original !== undefined && isValidId(props?.row?.original?.organizationId) + ? original?.original.organization.organizationPersons?.map(op => op.person) + : original?.organizationPersons?.map(op => op.person); let primaryContact = original.initialPrimaryContact; if (original.primaryContactId !== original.initialPrimaryContact?.id) { primaryContact = original.primaryContactId @@ -129,4 +144,12 @@ const getColumns = (tenantTypes: SelectOption[]): ColumnWithProps[] }, ]; }; + +export const StatusIndicators = styled.div` + color: ${props => props.theme.css.borderOutlineColor}; + &.active { + color: ${props => props.theme.bcTokens.iconsColorSuccess}; + } +`; + export default getColumns;