From de3d5e3980521cb7ea0906b3195a7af7cae27ffa Mon Sep 17 00:00:00 2001 From: Ridwa Date: Thu, 8 Aug 2024 19:17:25 +0530 Subject: [PATCH] Fixed: payload is fetched when user toggles from true to false(#253) --- src/views/UserDetails.vue | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/views/UserDetails.vue b/src/views/UserDetails.vue index 26f82b6..58e5c7a 100644 --- a/src/views/UserDetails.vue +++ b/src/views/UserDetails.vue @@ -319,7 +319,7 @@ - {{ translate("Show as picker") }} + {{ translate("Show as picker") }} @@ -998,8 +998,22 @@ export default defineComponent({ "roleTypeIdTo": "WAREHOUSE_PICKER" }) } else { + const response = await UserService.fetchPartyRelationship({ + inputFields: { + partyIdTo: this.selectedUser.partyId, + roleTypeIdTo: 'WAREHOUSE_PICKER', + roleTypeIdTo_op: 'equals' + }, + filterByDate: 'Y', + viewSize: 1, + entityName: 'PartyRelationship', + fieldList: ['partyIdTo', 'roleTypeIdTo', "partyIdFrom", "roleTypeIdFrom", "fromDate"] + }) + const fetchedRelationShip = response.data.docs[0] + console.log(fetchedRelationShip) + resp = await UserService.updatePartyRelationship({ - ...this.selectedUser?.pickerRelationship, + ...fetchedRelationShip, "thruDate": DateTime.now().toMillis() }) } @@ -1012,6 +1026,7 @@ export default defineComponent({ } } catch (error) { showToast(translate('Failed to update user role.')) + console.log(error) logger.error(error) } }, @@ -1074,7 +1089,7 @@ export default defineComponent({ alert.present() }, async updateUserStatus(event: any) { - event.stopImmediatePropagation(); + const isChecked = !event.target.checked let resp;