Skip to content

Commit

Permalink
Merge pull request #261 from R-Sourabh/#257-save-button
Browse files Browse the repository at this point in the history
Fixed: Save button will enable only when any change happen in the modal(#257)
  • Loading branch information
ymaheshwari1 authored Jul 18, 2024
2 parents ddc5a57 + 2b675c5 commit 9edf34b
Showing 1 changed file with 9 additions and 2 deletions.
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

0 comments on commit 9edf34b

Please sign in to comment.