Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: On find facility page the updated facility group will show & a toast will show on empty facility group name(#266) #270

Merged
merged 4 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading