Skip to content

Commit

Permalink
Merge pull request #270 from R-Sourabh/#266-Facility-group-filter
Browse files Browse the repository at this point in the history
Fixed: On find facility page the updated facility group will show & a toast will show on empty facility group name(#266)
  • Loading branch information
ymaheshwari1 authored Jul 18, 2024
2 parents 9edf34b + c208014 commit 478d441
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/components/FacilityGroupActionsPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -70,7 +71,11 @@ export default defineComponent({
text: translate('Apply'),
handler: (data) => {
const { facilityGroupName } = data
popoverController.dismiss(facilityGroupName)
if (facilityGroupName.trim().length <= 0) {
showToast(translate('Facility group name cannot be empty'));
return false;
}
popoverController.dismiss(facilityGroupName.trim())
}
}]
})
Expand Down Expand Up @@ -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)) {
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion src/views/FindFacilities.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 478d441

Please sign in to comment.