From 06b2d5d89f7b33ee2c3e6a984d326dfbb26ba95b Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Fri, 14 Jun 2024 14:31:22 +0530 Subject: [PATCH 1/3] Fixed: On find facility page the updated facility group will show & a toast will show on empty facility group name(#266) --- src/components/FacilityGroupActionsPopover.vue | 11 ++++++++--- src/locales/en.json | 1 + src/views/FindFacilities.vue | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/FacilityGroupActionsPopover.vue b/src/components/FacilityGroupActionsPopover.vue index 2f5c4f92..f17612d8 100644 --- a/src/components/FacilityGroupActionsPopover.vue +++ b/src/components/FacilityGroupActionsPopover.vue @@ -36,6 +36,7 @@ import { showToast } from '@/utils'; import { FacilityService } from "@/services/FacilityService"; import { hasError } from "@/adapter"; import { mapGetters, useStore } from "vuex"; +import { DateTime } from 'luxon'; import logger from "@/logger"; import FacilityGroupDescriptionModal from "@/components/FacilityGroupDescriptionModal.vue"; import GroupTypeModal from "@/components/GroupTypeModal.vue"; @@ -70,6 +71,10 @@ export default defineComponent({ text: translate('Apply'), handler: (data) => { const { facilityGroupName } = data + if (facilityGroupName.length <= 0) { + showToast(translate('Please enter a group name')); + return false; + } popoverController.dismiss(facilityGroupName) } }] @@ -99,9 +104,9 @@ export default defineComponent({ try { //First delete all the Inactive FacilityGroupMember records await this.deleteInactiveFacilityGroupAssociations(this.group.facilityGroupId); - - const resp = await FacilityService.deleteFacilityGroup({ - facilityGroupId: this.group.facilityGroupId + const resp = await FacilityService.updateFacilityGroup({ + facilityGroupId: this.group.facilityGroupId, + thruDate: DateTime.now().toMillis() }) as any if (!hasError(resp)) { diff --git a/src/locales/en.json b/src/locales/en.json index 9d0ee9ba..545c2440 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -270,6 +270,7 @@ "Pickup facilities": "Pickup facilities", "Please contact the administrator.": "Please contact the administrator.", "Please enter a valid value": "Please enter a valid value", + "Please enter a group name": "Please enter a group name", "Please fill all the required fields": "Please fill all the required fields", "Please provide a valid email.": "Please provide a valid email.", "Please provide a password.": "Please provide a password.", diff --git a/src/views/FindFacilities.vue b/src/views/FindFacilities.vue index 190b486e..deb94214 100644 --- a/src/views/FindFacilities.vue +++ b/src/views/FindFacilities.vue @@ -221,12 +221,12 @@ export default defineComponent({ async mounted() { // We only need to fetch those types whose parent is not virtual facility await Promise.all([this.store.dispatch('util/fetchFacilityTypes', { parentTypeId: 'VIRTUAL_FACILITY', parentTypeId_op: 'notEqual', facilityTypeId: 'VIRTUAL_FACILITY', facilityTypeId_op: 'notEqual' }), this.store.dispatch('util/fetchProductStores')]) - await this.fetchFacilityGroups(); }, async ionViewWillEnter() { // fetching facilities information in the ionViewWillEnter hook as when updating facilityGroup or fulfillment limit // from the details page and again coming to the list page, the UI does not gets updated when fetching information in // the mounted hook + await this.fetchFacilityGroups(); this.isScrollingEnabled = false; if(this.router.currentRoute.value?.query?.productStoreId) { this.query.productStoreId = this.router.currentRoute.value.query.productStoreId From 00415801a069d574d3f547d06125e9e7d6928802 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Fri, 14 Jun 2024 14:58:43 +0530 Subject: [PATCH 2/3] Updated: the toast message for empty facility group name(#266) --- src/components/FacilityGroupActionsPopover.vue | 2 +- src/locales/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/FacilityGroupActionsPopover.vue b/src/components/FacilityGroupActionsPopover.vue index f17612d8..0e4f9e7a 100644 --- a/src/components/FacilityGroupActionsPopover.vue +++ b/src/components/FacilityGroupActionsPopover.vue @@ -72,7 +72,7 @@ export default defineComponent({ handler: (data) => { const { facilityGroupName } = data if (facilityGroupName.length <= 0) { - showToast(translate('Please enter a group name')); + showToast(translate('Facility group name cannot be empty')); return false; } popoverController.dismiss(facilityGroupName) diff --git a/src/locales/en.json b/src/locales/en.json index 545c2440..40efd962 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -101,6 +101,7 @@ "Facility external ID updated.": "Facility external ID updated.", "Facility group deleted.": "Facility group deleted.", "Facility group type updated successfully.": "Facility group type updated successfully.", + "Facility group name cannot be empty": "Facility group name cannot be empty", "Facility ID": "Facility ID", "Facility latitude and longitude removed successfully.": "Facility latitude and longitude removed successfully.", "Facility latitude and longitude updated successfully.": "Facility latitude and longitude updated successfully.", @@ -270,7 +271,6 @@ "Pickup facilities": "Pickup facilities", "Please contact the administrator.": "Please contact the administrator.", "Please enter a valid value": "Please enter a valid value", - "Please enter a group name": "Please enter a group name", "Please fill all the required fields": "Please fill all the required fields", "Please provide a valid email.": "Please provide a valid email.", "Please provide a password.": "Please provide a password.", From c208014ac36843827a4b955993a8304a6efd6da1 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 17 Jul 2024 15:05:07 +0530 Subject: [PATCH 3/3] Improved: added trim() on the facilityGroupName(#266) --- src/components/FacilityGroupActionsPopover.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/FacilityGroupActionsPopover.vue b/src/components/FacilityGroupActionsPopover.vue index 0e4f9e7a..ce5e42d8 100644 --- a/src/components/FacilityGroupActionsPopover.vue +++ b/src/components/FacilityGroupActionsPopover.vue @@ -71,11 +71,11 @@ export default defineComponent({ text: translate('Apply'), handler: (data) => { const { facilityGroupName } = data - if (facilityGroupName.length <= 0) { + if (facilityGroupName.trim().length <= 0) { showToast(translate('Facility group name cannot be empty')); return false; } - popoverController.dismiss(facilityGroupName) + popoverController.dismiss(facilityGroupName.trim()) } }] })