Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented: support to add, remove and display parties associated to a facility in staff sement (#12) #19

Merged
merged 16 commits into from
Nov 23, 2023

Conversation

amansinghbais
Copy link
Contributor

Related Issues

Closes #12

Short Description and Why It's Useful

  • Logic and services to display all parties associated to a facility in staff segment.
  • Improved code of addStaffMemberModal to allowing selection and updation of parties.
  • Abitlity to add new party to an facility with role.
  • Ability to change role of an already associated party.
  • Ability to remove a party from the facility.

Screenshots of Visual Changes before/after (If There Are Any)

Contribution and Currently Important Rules Acceptance

src/store/modules/facility/actions.ts Show resolved Hide resolved
src/store/modules/util/actions.ts Outdated Show resolved Hide resolved
src/store/modules/util/actions.ts Outdated Show resolved Hide resolved
src/views/FacilityDetails.vue Outdated Show resolved Hide resolved
src/views/FacilityDetails.vue Outdated Show resolved Hide resolved
src/components/AddStaffMemberModal.vue Outdated Show resolved Hide resolved
src/components/AddStaffMemberModal.vue Show resolved Hide resolved
src/store/modules/util/actions.ts Outdated Show resolved Hide resolved
src/store/modules/util/actions.ts Outdated Show resolved Hide resolved
src/store/modules/util/getters.ts Outdated Show resolved Hide resolved
@@ -8,6 +8,7 @@ import RootState from '@/store/RootState'
const utilModule: Module<UtilState, RootState> = {
namespaced: true,
state: {
roles: [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
roles: [],
partyRoles: [],

</ion-label>
<ion-select interface="popover" :placeholder="translate('Select')" :value="getPartyRoleTypeId(party.partyId)" @ion-change="updateSelectedParties($event, party.partyId)" required>
<ion-select-option v-for="(description, roleTypeId) in partyRoles" :key='roleTypeId' :value="roleTypeId">{{ description }}</ion-select-option>
</ion-select>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve Indentation

</ion-content>

<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab @click="saveParties" vertical="bottom" horizontal="end" slot="fixed">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move click event on fab-button

return
}

const roles = {} as any
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const roles = {} as any
const partyRoles = {} as any

Comment on lines 210 to 211
if(this.isPartySelected(selectedPartyId)) {
party = this.selectedPartyValues.find((party: any) => party.partyId === selectedPartyId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(this.isPartySelected(selectedPartyId)) {
party = this.selectedPartyValues.find((party: any) => party.partyId === selectedPartyId)
party = this.isPartySelected(selectedPartyId)
if(party?.partyId) {

this.selectedPartyValues.push({...party, roleTypeId: selectedRoleTypeId})
}
},
isPartySelected(partyId: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the name of method starts with is it means that the method will return a boolean, but here in this case it returns the complete object of the party, so improve the name to something like getParty

Comment on lines 213 to 218
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)
this.selectedPartyValues.push({...party, roleTypeId: selectedRoleTypeId})
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
this.selectedPartyValues.push({...party, roleTypeId: selectedRoleTypeId})
}
this.selectedPartyValues = this.selectedPartyValues.filter((party: any) => party.partyId !== selectedPartyId)
if(selectedRoleTypeId) {
this.selectedPartyValues.push({...party, roleTypeId: selectedRoleTypeId})
}

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 : ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return this.selectedPartyValues.find((party: any) => party.partyId === partyId) ? this.selectedPartyValues.find((party: any) => party.partyId === partyId).roleTypeId : ''
return this.isPartySelected(partyId) ? this.isPartySelected(partyId).roleTypeId : ''

try {
const resp = await UtilService.fetchPartyRoles(params)
if (!hasError(resp)) {
resp.data.docs.map((doc:any) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resp.data.docs.map((doc:any) => {
resp.data.docs.map((role:any) => {

@amansinghbais amansinghbais changed the title Implemented: support to add, remove display parties associated to a party in staff segment (#12) Implemented: support to add, remove and display parties associated to a facility in staff sement (#12) Nov 23, 2023
@ravilodhi ravilodhi merged commit 8d686cc into hotwax:main Nov 23, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support to add, remove and display all the parties associated with the facility
3 participants