From 3451a6a8f659c1fbe48f7e71d223dc605f7befc5 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 6 May 2024 16:17:08 +0530 Subject: [PATCH] Updated: update the logic to enable/disable the save button on change(#257) --- src/components/AddStaffMemberModal.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/AddStaffMemberModal.vue b/src/components/AddStaffMemberModal.vue index 7dfa099b..5a3c6685 100644 --- a/src/components/AddStaffMemberModal.vue +++ b/src/components/AddStaffMemberModal.vue @@ -225,10 +225,11 @@ export default defineComponent({ return this.getParty(partyId) ? this.getParty(partyId).roleTypeId : '' }, isRoleUpdated() { - return this.parties.some((party: any) => { - const selectedParty = this.selectedPartyValues.find((p: any) => p.partyId === party.partyId); - return selectedParty?.roleTypeId !== party.roleTypeId; - }); + const lengthChanged = this.selectedPartyValues.length !== this.selectedParties.length; + return lengthChanged || this.selectedPartyValues.some((selectedParty: any) => { + const originalParty = this.selectedParties.find((party: any) => party.partyId === selectedParty.partyId); + return originalParty && selectedParty.roleTypeId !== originalParty.roleTypeId; + }); }, }, async mounted() {