-
Notifications
You must be signed in to change notification settings - Fork 17
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
Conversation
src/store/modules/util/index.ts
Outdated
@@ -8,6 +8,7 @@ import RootState from '@/store/RootState' | |||
const utilModule: Module<UtilState, RootState> = { | |||
namespaced: true, | |||
state: { | |||
roles: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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> |
There was a problem hiding this comment.
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"> |
There was a problem hiding this comment.
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
src/store/modules/util/actions.ts
Outdated
return | ||
} | ||
|
||
const roles = {} as any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const roles = {} as any | |
const partyRoles = {} as any |
if(this.isPartySelected(selectedPartyId)) { | ||
party = this.selectedPartyValues.find((party: any) => party.partyId === selectedPartyId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) { |
There was a problem hiding this comment.
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
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}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 : '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 : '' |
src/store/modules/util/actions.ts
Outdated
try { | ||
const resp = await UtilService.fetchPartyRoles(params) | ||
if (!hasError(resp)) { | ||
resp.data.docs.map((doc:any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resp.data.docs.map((doc:any) => { | |
resp.data.docs.map((role:any) => { |
Related Issues
Closes #12
Short Description and Why It's Useful
Screenshots of Visual Changes before/after (If There Are Any)
Contribution and Currently Important Rules Acceptance