diff --git a/src/components/AddStaffMemberModal.vue b/src/components/AddStaffMemberModal.vue
index 7c02f9d5..345876d9 100644
--- a/src/components/AddStaffMemberModal.vue
+++ b/src/components/AddStaffMemberModal.vue
@@ -14,7 +14,7 @@
- {{ party.groupName ? party.groupName : `${party.firstName} ${party.lastName}` }}
+ {{ party.fullName }}
@@ -25,11 +25,11 @@
- {{ party.groupName ? party.groupName : `${party.firstName} ${party.lastName}` }}
+ {{ party.fullName }}
{{ party.partyId }}
- {{ role.description }}
+ {{ description }}
@@ -146,8 +146,12 @@ export default defineComponent({
try {
const resp = await FacilityService.getPartyRoleAndPartyDetails(payload)
if(!hasError(resp)) {
- this.parties = resp.data.docs
+ let parties = resp.data.docs
+ parties.map((party: any) => {
+ party.fullName = party.groupName ? party.groupName : `${party.firstName} ${party.lastName}`
+ })
+ this.parties = parties
} else {
throw resp.data
}
@@ -184,7 +188,7 @@ export default defineComponent({
if(this.isPartySelected(selectedPartyId)) {
party = this.selectedPartyValues.find((party: any) => party.partyId === selectedPartyId)
- if(selectedRoleTypeId === 'none') {
+ if(selectedRoleTypeId === '') {
this.selectedPartyValues = this.selectedPartyValues.filter((party: any) => party.partyId !== selectedPartyId)
} else if(selectedPartyId !== party.roleTypeId) {
this.selectedPartyValues = this.selectedPartyValues.filter((party: any) => party.partyId !== selectedPartyId)
@@ -199,7 +203,7 @@ export default defineComponent({
return this.selectedPartyValues.find((party: any) => party.partyId === partyId)
},
getPartyRoleTypeId(partyId: string) {
- return this.selectedPartyValues.find((party: any) => party.partyId === partyId) ? this.selectedPartyValues.find((party: any) => party.partyId === partyId).roleTypeId : 'none'
+ return this.selectedPartyValues.find((party: any) => party.partyId === partyId) ? this.selectedPartyValues.find((party: any) => party.partyId === partyId).roleTypeId : ''
}
},
async mounted() {
diff --git a/src/store/modules/facility/actions.ts b/src/store/modules/facility/actions.ts
index 93269cb8..4f0e9479 100644
--- a/src/store/modules/facility/actions.ts
+++ b/src/store/modules/facility/actions.ts
@@ -182,6 +182,10 @@ const actions: ActionTree = {
if(!hasError(resp) && resp.data.count) {
parties = resp.data.docs
+
+ parties.map((party: any) => {
+ party.fullName = party.groupName ? party.groupName : `${party.firstName} ${party.lastName}`
+ });
} else {
throw resp.data
}
diff --git a/src/store/modules/util/actions.ts b/src/store/modules/util/actions.ts
index e4ee22a8..5473f0ff 100644
--- a/src/store/modules/util/actions.ts
+++ b/src/store/modules/util/actions.ts
@@ -69,7 +69,7 @@ const actions: ActionTree = {
return
}
- let roles = []
+ const roles = {} as any
const params = {
inputFields: {
roleTypeGroupId: 'FACILITY_PARTY_ROLE'
@@ -84,20 +84,17 @@ const actions: ActionTree = {
try {
const resp = await UtilService.fetchRoles(params)
if (!hasError(resp)) {
- roles = resp.data.docs
+ resp.data.docs.map((doc:any) => {
+ roles[doc.roleTypeId] = doc.description
+ })
// pushing none explicitly to show on UI
- roles.push({
- roleTypeId: 'none',
- parentTypeId: 'none',
- description: 'None',
- })
+ roles[''] = 'none'
} else {
throw resp.data
}
} catch (error) {
- showToast(translate('Something went wrong'));
- console.error(error)
+ logger.error(error)
}
commit(types.UTIL_ROLES_UPDATED, roles)
diff --git a/src/views/FacilityDetails.vue b/src/views/FacilityDetails.vue
index 8bbd1df2..bcb9a5f0 100644
--- a/src/views/FacilityDetails.vue
+++ b/src/views/FacilityDetails.vue
@@ -296,13 +296,13 @@
- {{ party.groupName ? party.groupName : `${party.firstName} ${party.lastName}` }}
+ {{ party.fullName }}
{{ party.partyId }}
- {{ getRoleTypeDesc(party.roleTypeId) }}
+ {{ roles[party.roleTypeId] }}
{{ translate("role") }}
@@ -476,8 +476,7 @@ export default defineComponent({
props: ["facilityId"],
async ionViewWillEnter() {
await this.store.dispatch('facility/fetchCurrentFacility', { facilityId: this.facilityId })
- await this.store.dispatch('facility/getFacilityParties', { facilityId: this.facilityId })
- await this.store.dispatch('util/fetchRoles')
+ await Promise.all([ this.store.dispatch('facility/getFacilityParties', { facilityId: this.facilityId }), this.store.dispatch('util/fetchRoles')])
this.isLoading = false
},
methods: {
@@ -608,9 +607,6 @@ export default defineComponent({
logger.error(err)
}
},
- getRoleTypeDesc(id: any) {
- return this.roles.find((role: any) => role.roleTypeId === id)?.description
- },
async changeOrderLimitPopover(ev: Event) {
const popover = await popoverController.create({
component: OrderLimitPopover,