From f45d25e73d69c86f5955857d2ba5ea1f07f0e171 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Thu, 24 Oct 2024 18:00:53 +0530 Subject: [PATCH 1/2] Fixed: Modal will display `Other` as group type for unlinked facility groups(#258) --- src/components/AddFacilityGroupModal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AddFacilityGroupModal.vue b/src/components/AddFacilityGroupModal.vue index c6a36e85..b1fc566c 100644 --- a/src/components/AddFacilityGroupModal.vue +++ b/src/components/AddFacilityGroupModal.vue @@ -16,7 +16,7 @@
- {{ getFacilityGroupTypeDesc(typeId) }} + {{ typeId === "null" ? translate('Others') : getFacilityGroupTypeDesc(typeId) }} {{ group.facilityGroupName }} From af1bd6dc00b6b23d9a9b02e2c79b209d10c679a9 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Thu, 7 Nov 2024 18:52:19 +0530 Subject: [PATCH 2/2] Improved: Updated the logic of display 'Others' as group type for null facilityGroupTypeId(#258) --- src/components/AddFacilityGroupModal.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/AddFacilityGroupModal.vue b/src/components/AddFacilityGroupModal.vue index b1fc566c..e20ba736 100644 --- a/src/components/AddFacilityGroupModal.vue +++ b/src/components/AddFacilityGroupModal.vue @@ -16,7 +16,7 @@ - {{ typeId === "null" ? translate('Others') : getFacilityGroupTypeDesc(typeId) }} + {{ getFacilityGroupTypeDesc(typeId) }} {{ group.facilityGroupName }} @@ -210,12 +210,13 @@ export default defineComponent({ if(!hasError(resp) && resp.data?.docs?.length > 0) { this.filteredFacilityGroupsByType = this.facilityGroupsByType = resp.data.docs.reduce((groupsByType: any, group: any) => { - if(groupsByType[group.facilityGroupTypeId]) { - groupsByType[group.facilityGroupTypeId].push(group) + const groupTypeId = !group.facilityGroupTypeId ? "Others" : group.facilityGroupTypeId; + + if(groupsByType[groupTypeId]) { + groupsByType[groupTypeId].push(group) } else { - groupsByType[group.facilityGroupTypeId] = [group] + groupsByType[groupTypeId] = [group] } - return groupsByType }, {}) } else {