Skip to content

Commit 0c92c82

Browse files
committed
fix: adjusted column values in nav project list
Signed-off-by: Sanjay Babu <sanjaytkbabu@gmail.com>
1 parent 7e85076 commit 0c92c82

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

frontend/src/components/electrification/project/ProjectListNavigatorElectrification.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,20 @@ const { codeDisplay } = codeStore;
8888
style="min-width: 150px"
8989
/>
9090
<Column
91-
field="activity.activity_contact.0.contact.first_name"
91+
field="activity.activityContact.0.contact.firstName"
9292
header="First name"
9393
:sortable="true"
9494
style="min-width: 150px"
9595
/>
9696
<Column
97-
field="activity.activity_contact.0.contact.last_name"
97+
field="activity.activityContact.0.contact.lastName"
9898
header="Last name"
9999
:sortable="true"
100100
style="min-width: 150px"
101101
/>
102102
<Column
103103
field="user.fullName"
104-
header="Assigned-to"
104+
header="Assigned to"
105105
:sortable="true"
106106
style="min-width: 200px"
107107
/>

frontend/src/components/projectCommon/ProjectListNavigator.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
import { useAppStore, useAuthZStore } from '@/store';
2121
import { APPLICATION_STATUS_LIST } from '@/utils/constants/projectCommon';
2222
import { Action, Initiative } from '@/utils/enums/application';
23-
import { ApplicationStatus } from '@/utils/enums/projectCommon';
23+
import { ActivityContactRole, ApplicationStatus } from '@/utils/enums/projectCommon';
2424
import { projectRouteNameKey, projectServiceKey, resourceKey } from '@/utils/keys';
2525
import { toNumber } from '@/utils/utils';
2626
@@ -77,7 +77,7 @@ const selection: Ref<Project | undefined> = ref(undefined);
7777
const selectedFilter: Ref<FilterOption> = ref(FILTER_OPTIONS[0]!);
7878
7979
/**
80-
* Filter projects based on status
80+
* Filter projects based on status and reduce contacts to primary contact only
8181
* Inject a joined location field for housing for proper sorting and searching
8282
*/
8383
const filteredProjects = computed(() => {
@@ -86,12 +86,27 @@ const filteredProjects = computed(() => {
8686
return selectedFilter.value.statuses.includes(element.applicationStatus);
8787
})
8888
.map((x) => {
89+
const primaryContact = x.activity?.activityContact?.find(
90+
(contact) => contact.role === ActivityContactRole.PRIMARY
91+
);
92+
8993
if ('housingProjectId' in x) {
9094
return {
9195
...x,
92-
location: [x.streetAddress, x.locality, x.province].filter((str) => str?.trim()).join(', ')
96+
location: [x.streetAddress, x.locality, x.province].filter((str) => str?.trim()).join(', '),
97+
activity: {
98+
...x.activity,
99+
activityContact: primaryContact ? [primaryContact] : []
100+
}
101+
};
102+
} else
103+
return {
104+
...x,
105+
activity: {
106+
...x.activity,
107+
activityContact: primaryContact ? [primaryContact] : []
108+
}
93109
};
94-
} else return x;
95110
});
96111
});
97112

0 commit comments

Comments
 (0)