Skip to content

Commit

Permalink
Improved: keyboard accessbility for location form
Browse files Browse the repository at this point in the history
  • Loading branch information
ymaheshwari1 committed Nov 22, 2023
1 parent 4543c12 commit 6bac259
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/components/AddLocationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

<ion-content>
<form @keyup.enter="saveFacilityLocation">
<ion-item>
<!-- Using stop for enter key as when using keyboard for opening the select we need to use enter and the same key submits the form
so to prevent form submission on using enter key on select used stop -->
<ion-item @keyup.enter.stop>
<ion-label>{{ translate("Type") }}</ion-label>
<ion-select interface="popover" :placeholder="translate('Select')" v-model="locationInfo.locationTypeEnumId">
<ion-select-option v-for="(description, type) in locationTypes" :key="type" :value="type">{{ description }}</ion-select-option>
Expand Down Expand Up @@ -114,18 +116,21 @@ 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;
}
// 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 = {
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/LocationDetailsPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 6bac259

Please sign in to comment.