From 6bac2590defb2614044d66c92517cddc3c33b8c4 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Wed, 22 Nov 2023 12:51:15 +0530 Subject: [PATCH] Improved: keyboard accessbility for location form --- src/components/AddLocationModal.vue | 15 +++++++++------ src/components/LocationDetailsPopover.vue | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/AddLocationModal.vue b/src/components/AddLocationModal.vue index 116c1dfe..14a3f952 100644 --- a/src/components/AddLocationModal.vue +++ b/src/components/AddLocationModal.vue @@ -12,7 +12,9 @@
- + + {{ translate("Type") }} {{ description }} @@ -114,7 +116,7 @@ export default defineComponent({ closeModal() { modalController.dismiss(); }, - saveFacilityLocation() { + async saveFacilityLocation() { if(!this.locationInfo.aisleId?.trim() || !this.locationInfo.areaId?.trim() || !this.locationInfo.sectionId?.trim() || !this.locationInfo.levelId?.trim()) { showToast(translate('Please fill all the required fields')) return; @@ -122,10 +124,13 @@ export default defineComponent({ // checking for locationSeqId as when adding new facility we won't be having locationSeqId if(this.location?.locationSeqId) { - this.updateFacilityLocation() + await this.updateFacilityLocation() } else { - this.addFacilityLocation() + await this.addFacilityLocation() } + + // fetching facility locations after updating/creating a location + await this.store.dispatch('facility/fetchFacilityLocations', { facilityId: this.current.facilityId }) }, async addFacilityLocation() { const params = { @@ -139,7 +144,6 @@ export default defineComponent({ if(!hasError(resp)) { showToast(translate('Facility location created successfully')) this.closeModal(); - await this.store.dispatch('facility/fetchFacilityLocations') } else { throw resp.data } @@ -161,7 +165,6 @@ export default defineComponent({ if(!hasError(resp)) { showToast(translate('Facility location updated successfully')) this.closeModal(); - await this.store.dispatch('facility/fetchFacilityLocations') } else { throw resp.data } diff --git a/src/components/LocationDetailsPopover.vue b/src/components/LocationDetailsPopover.vue index 2bd249a5..2e4fed31 100644 --- a/src/components/LocationDetailsPopover.vue +++ b/src/components/LocationDetailsPopover.vue @@ -68,7 +68,7 @@ export default defineComponent({ if(!hasError(resp)) { showToast(translate('Facility location removed successfully')) - await this.store.dispatch('facility/fetchFacilityLocations') + await this.store.dispatch('facility/fetchFacilityLocations', { facilityId: this.current.facilityId }) } else { throw resp.data }