Skip to content

Commit

Permalink
Merge pull request #329 from R-Sourabh/#258-group-modal-null
Browse files Browse the repository at this point in the history
Fixed: Modal will display `Other` as group type for unlinked facility groups(#258)
  • Loading branch information
ravilodhi authored Nov 7, 2024
2 parents b85a522 + af1bd6d commit 5fff35e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/AddFacilityGroupModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5fff35e

Please sign in to comment.