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

Fixed: Save button will enable only when any change happen in the modal(#257) #261

Merged
merged 4 commits into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/components/AddStaffMemberModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</ion-content>

<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button @click="saveParties">
<ion-fab-button :disabled="!isRoleUpdated()" @click="saveParties">
<ion-icon :icon="saveOutline" />
</ion-fab-button>
</ion-fab>
Expand Down Expand Up @@ -223,7 +223,14 @@ export default defineComponent({
},
getPartyRoleTypeId(partyId: string) {
return this.getParty(partyId) ? this.getParty(partyId).roleTypeId : ''
}
},
isRoleUpdated() {
const arePartiesUpdated = this.selectedPartyValues.length !== this.selectedParties.length;
return arePartiesUpdated || this.selectedPartyValues.some((selectedParty: any) => {
const originalParty = this.selectedParties.find((party: any) => party.partyId === selectedParty.partyId);
return originalParty && selectedParty.roleTypeId !== originalParty.roleTypeId;
});
},
},
async mounted() {
await this.findParties()
Expand Down
Loading