diff --git a/src/components/FacilityGroupActionsPopover.vue b/src/components/FacilityGroupActionsPopover.vue deleted file mode 100644 index ce5e42d8..00000000 --- a/src/components/FacilityGroupActionsPopover.vue +++ /dev/null @@ -1,163 +0,0 @@ - - - - - {{ group.facilityGroupName }} - - - {{ translate("Rename") }} - - - {{ group?.description ? translate("Edit description") : translate("Add description") }} - - - {{ translate("Select type") }} - - - {{ translate("Delete") }} - - - - - - \ No newline at end of file diff --git a/src/components/FacilityGroupDescriptionModal.vue b/src/components/FacilityGroupDescriptionModal.vue index 0b649d2a..807d6385 100644 --- a/src/components/FacilityGroupDescriptionModal.vue +++ b/src/components/FacilityGroupDescriptionModal.vue @@ -6,13 +6,18 @@ - {{ facilityGroup?.description ? translate('Edit group description') : translate('Add group description') }} + {{ translate('Edit group detail') }} - + {{ translate("Name") }} * + + + + { if (this.facilityGroup.facilityGroupId === groupData.facilityGroupId) { + groupData.facilityGroupName = this.facilityGroupName groupData.description = this.facilityGroupDescription } @@ -109,9 +124,8 @@ export default defineComponent({ } } catch (error) { - showToast(translate('Failed to update group description.')) + showToast(translate('Failed to update group detail.')) } - popoverController.dismiss(); this.closeModal(); emitter.emit('dismissLoader') }, diff --git a/src/locales/en.json b/src/locales/en.json index 837ffb50..da3075af 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -4,7 +4,6 @@ "Add description": "Add description", "Add Group": "Add Group", "Add locations to facility": "Add locations to facility", - "Add group description": "Add group description", "Staff member": "Staff member", "Add Store": "Add Store", "Add Store Address": "Add Store Address", @@ -22,6 +21,7 @@ "aisle": "aisle", "All": "All", "Allow pickup": "Allow pickup", + "Any edits made on this page will be lost.": "Any edits made on this page will be lost.", "App": "App", "Apply": "Apply", "Archive": "Archive", @@ -52,7 +52,9 @@ "Contact number": "Contact number", "Country": "Country", "Create ": "Create ", + "Create a new group": "Create a new group", "Create Distribution Center login": "Create Distribution Center login", + "Create group": "Create group", "Create login credentials": "Create login credentials", "Create Outlet Store": "Create Outlet Store", "Create Outlet Store login": "Create Outlet Store login", @@ -77,9 +79,11 @@ "Distribution Center": "Distribution Center", "Edit description": "Edit description", "Failed to associate calendar to the facility.": "Failed to associate calendar to the facility.", + "Failed to associate group to parent group." : "Failed to associate group to parent group.", + "Failed to remove group from parent group.": "Failed to remove group from parent group.", "Filters": "Filters", "Edit": "Edit", - "Edit group description": "Edit group description", + "Edit details": "Edit details", "Edit location": "Edit location", "End Time": "End Time", "Facility group created.": "Facility group created.", @@ -97,13 +101,13 @@ "Facility created successfully.": "Facility created successfully.", "Facility configurations created successfully.": "Facility configurations created successfully.", "Facility contact updated successfully.": "Facility contact updated successfully.", - "Facility deselected. Click the save button to remove it from the group.": "Facility deselected. Click the save button to remove it from the group.", "Facility details": "Facility details", "Facility External ID": "Facility External ID", "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 groups": "Facility groups", "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.", @@ -116,7 +120,6 @@ "Facility name is required.": "Facility name is required.", "Facility Management": "Facility Management", "Facility renamed successfully.": "Facility renamed successfully.", - "Facility selected. Click the save button to add it to the group.": "Facility selected. Click the save button to add it to the group.", "Facility SubType": "Facility SubType", "Facility Type": "Facility Type", "Facility zipcode": "Facility zipcode", @@ -149,9 +152,9 @@ "Failed to remove facility mapping": "Failed to remove facility mapping", "Failed to remove party from facility.": "Failed to remove party from facility.", "Failed to remove shopify mapping": "Failed to remove shopify mapping", - "Failed to rename facility group.": "Failed to rename facility group.", "Failed to rename parking.": "Failed to rename parking.", "Failed to update facility group type.": "Failed to update facility group type.", + "Failed to update group detail.": "Failed to update group detail.", "Failed to update some groups for facility": "Failed to update some groups for facility", "Facility type updated": "Facility type updated", "Failed to unarchive parking.": "Failed to unarchive parking.", @@ -163,7 +166,6 @@ "Failed to update facility type.": "Failed to update facility type.", "Failed to update fulfillment capacity for ": "Failed to update fulfillment capacity for {facilityName}", "Failed to update fulfillment setting": "Failed to update fulfillment setting", - "Failed to update group description.": "Failed to update group description.", "Failed to update primary product store": "Failed to update primary product store", "Failed to update sell inventory online setting": "Failed to update sell inventory online setting", "Failed to update shopify mapping": "Failed to update shopify mapping", @@ -184,13 +186,16 @@ "Go to Launchpad": "Go to Launchpad", "Go to OMS": "Go to OMS", "Group": "Group", + "Group associated to parent group.": "Group associated to parent group.", "Group associated to system group types.": "Group associated to system group types.", + "Group detail updated.": "Group detail updated.", "Group type": "Group type", "Group unlinked from facility": "Group unlinked from facility", "groups": "{count} groups", "Groups": "Groups", "group description": "group description", "Group description updated.": "Group description updated.", + "Group removed from parent group.": "Group removed from parent group.", "Identification": "Identification", "Include all": "Include all", "Internal ID": "Internal ID", @@ -201,6 +206,8 @@ "Language": "Language", "Latitude": "Latitude", "Latitude & Longitude": "Latitude & Longitude", + "LEAVE": "LEAVE", + "Leave page": "Leave page", "Level": "Level", "level": "level", "Link to groups": "Link to groups", @@ -264,6 +271,8 @@ "Outlet Store logins": "Outlet Store logins", "Outlet Warehouse login": "Outlet Warehouse login", "Outlet Warehouse logins": "Outlet Warehouse logins", + "Parent group associations": "Parent group associations", + "Parent groups": "Parent groups", "Parking": "Parking", "Parking archived successfully.": "Parking archived successfully.", "Parking renamed successfully.": "Parking renamed successfully.", @@ -289,7 +298,9 @@ "primary store": "primary store", "Product Store": "Product Store", "Product Stores": "Product Stores", + "Product store": "Product store", "Product stores": "Product stores", + "product stores": "{count} product stores", "Product stores updated successfully.": "Product stores updated successfully.", "Quick edit": "Quick edit", "Reason:": "Reason:", @@ -317,7 +328,6 @@ "Save configurations": "Save configurations", "Section": "Section", "section": "section", - "System groups": "System groups", "Select": "Select", "Select a saved calendar of store hours or create a new calendar": "Select a saved calendar of store hours or create a new calendar", "Select country": "Select country", @@ -339,6 +349,7 @@ "Settings": "Settings", "Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.": "Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.", "Setup Store": "Setup Store", + "Selected groups": "Selected groups", "Selected TimeZone": "Selected TimeZone", "Shipping name": "Shipping name", "Shopify": "Shopify", @@ -353,6 +364,7 @@ "Staff": "Staff", "Start Time": "Start Time", "State": "State", + "Stay": "Stay", "Store": "Store", "Stores": "Stores", "store name": "store name", diff --git a/src/router/index.ts b/src/router/index.ts index 89508be1..127ef4e1 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -12,6 +12,7 @@ import AddFacilityAddress from '@/views/AddFacilityAddress.vue'; import AddFacilityConfig from '@/views/AddFacilityConfig.vue'; import Tabs from '@/components/Tabs.vue' import ManageFacilities from '@/views/ManageFacilities.vue'; +import CreateFacilityGroup from '@/views/CreateFacilityGroup.vue'; // Defining types for the meta values declare module 'vue-router' { @@ -107,6 +108,12 @@ const routes: Array = [ component: ManageFacilities, props: true, beforeEnter: authGuard, + }, + { + path: '/create-facility-group', + name: 'Create Facility Group', + component: CreateFacilityGroup, + beforeEnter: authGuard, } ] diff --git a/src/store/modules/facility/actions.ts b/src/store/modules/facility/actions.ts index ceb152c0..e103f4bd 100644 --- a/src/store/modules/facility/actions.ts +++ b/src/store/modules/facility/actions.ts @@ -724,6 +724,9 @@ const actions: ActionTree = { } total = resp.data.count } else { + if (payload.viewIndex === 0 ) { + groups = [] + } throw resp.data } } catch (error) { diff --git a/src/views/CreateFacilityGroup.vue b/src/views/CreateFacilityGroup.vue new file mode 100644 index 00000000..99f9f334 --- /dev/null +++ b/src/views/CreateFacilityGroup.vue @@ -0,0 +1,257 @@ + + + + + + {{ translate("New group") }} + + + + + + + + {{ translate('Create a new group') }} + + + + + + {{ translate("Name") }} * + + + + + + + + + {{ facilityGroupType.description ? facilityGroupType.description : facilityGroupType.facilityGroupTypeId }} + + + + + + + {{ productStore.storeName ? productStore.storeName : productStore.productStoreId }} + + + + + + + + + + + + {{ translate("Create group") }} + + + + + + + + + + + diff --git a/src/views/FindGroups.vue b/src/views/FindGroups.vue index d674c84b..ed1b8d17 100644 --- a/src/views/FindGroups.vue +++ b/src/views/FindGroups.vue @@ -3,66 +3,98 @@ {{ translate("Groups") }} + + + {{ translate("Facility groups") }} + + + {{ translate("Parent group associations") }} + + - - - - - - {{ translate('System groups') }} - - - - - {{ group.facilityGroupName ? group.facilityGroupName : group.facilityGroupId }} - - - - - - - - + + + + + + + - - {{ group.facilityGroupName }} + {{ group.facilityGroupId }} + {{ group.facilityGroupName }} + {{ group.description }} - {{ group.facilityGroupTypeId }} - - - - - + + {{ translate('Group type') }} + + {{ group.facilityGroupTypeId ? getFacilityGroupTypeDescription(group.facilityGroupTypeId) ? getFacilityGroupTypeDescription(group.facilityGroupTypeId) : group.facilityGroupTypeId : "-" }} + + + + {{ translate('Product stores') }} {{ group.productStoreCount || 0 }} - - + {{ translate('Facilities') }} - - {{ group.facilityCount }} - - - - - - {{ group.description }} + + {{ group.facilityCount}} + - + + {{translate('Edit details')}} + + {{ translate("No groups found") }} - - + + + + + + + {{ translate("Parent groups") }} + + + + {{ groupType.description ? groupType.description : groupType.facilityGroupTypeId }} + + {{ getAssociatedFacilityGroupIds(groupType.facilityGroupTypeId).length }} + + + + + {{ getFacilityGroupTypeDescription(currentFacilityGroupTypeId) }} + + + {{ translate('Selected groups') }} : 10 + + + + + {{ group.facilityGroupName }} + {{ group.facilityGroupId }} + + + {{ group.facilityCount }} + + + + {{ translate("No groups found") }} + + + + - - + + + @@ -86,8 +119,10 @@ \ No newline at end of file diff --git a/src/views/ManageFacilities.vue b/src/views/ManageFacilities.vue index 6a0e05b0..b47e5270 100644 --- a/src/views/ManageFacilities.vue +++ b/src/views/ManageFacilities.vue @@ -34,9 +34,9 @@ - + {{ translate('Total facilities selected for group', {total: selectedFacilities.length, facilityGroupName: currentFacilityGroup.facilityGroupName ? currentFacilityGroup.facilityGroupName : facilityGroupId}) }} - + {{ translate('Manage sequence') }} @@ -96,6 +96,7 @@ import { hasError } from '@/adapter'; import logger from '@/logger'; import { DateTime } from "luxon"; + import emitter from "@/event-bus"; export default defineComponent({ name: 'FindGroups', @@ -127,44 +128,46 @@ selectedFacilities: [] as any, toast: null as any, currentFacilityGroup: {} as any, - isFacilityMembersModified: false + isFacilityMembersModified: false, + isSavingDetail: false } }, props: ['facilityGroupId'], async mounted() { + emitter.emit('presentLoader') await Promise.all([this.fetchFacilities(), this.fetchFacilityGroup()]) await this.fetchMemberFacilities(); await this.getFilteredFacilities(); + emitter.emit('dismissLoader') }, - methods: { - async beforeRouteLeave() { - if(!this.toast) return + async beforeRouteLeave() { + if (this.isSavingDetail) return; - let canLeave = false; - const alert = await alertController.create({ - header: translate("Leave page"), - message: translate("Any edits made on this page will be lost."), - buttons: [ - { - text: translate("STAY"), - handler: () => { - canLeave = false; - }, + let canLeave = false; + const alert = await alertController.create({ + header: translate("Leave page"), + message: translate("Any edits made on this page will be lost."), + buttons: [ + { + text: translate("STAY"), + handler: () => { + canLeave = false; }, - { - text: translate("LEAVE"), - handler: () => { - canLeave = true; - this.toast.dismiss() - }, + }, + { + text: translate("LEAVE"), + handler: () => { + canLeave = true; }, - ], - }); + }, + ], + }); - alert.present() - await alert.onDidDismiss() - return canLeave - }, + alert.present() + await alert.onDidDismiss() + return canLeave + }, + methods: { getFilteredFacilities() { let nonMemberFacilities = this.facilities ? this.facilities : [] as any; const selectedFacilityIds = this.selectedFacilities ? new Set(this.selectedFacilities.map((facility:any) => facility.facilityId)) as any : []; @@ -279,7 +282,6 @@ this.selectedFacilities = [...this.selectedFacilities, {...facility, sequenceNum}] this.getFilteredFacilities(); this.isFacilityMembersModified = true; - showToast(translate("Facility selected. Click the save button to add it to the group.")) }, selectAll() { let sequenceNum = 1; @@ -296,15 +298,14 @@ this.selectedFacilities = [...this.selectedFacilities, ...facilitiesWithSequences] this.getFilteredFacilities(); this.isFacilityMembersModified = true; - showToast(translate("Facility selected. Click the save button to add it to the group.")) }, async removeFacility(facility: any) { this.selectedFacilities = this.selectedFacilities.filter((selectedFacility: any) => selectedFacility.facilityId !== facility.facilityId); this.getFilteredFacilities(); this.isFacilityMembersModified = true; - showToast(translate("Facility deselected. Click the save button to remove it from the group.")) }, async save () { + this.isSavingDetail = true const facilitiesToAdd = this.selectedFacilities.filter((facility: any) => !facility.fromDate) const selectedFacilityIds = this.selectedFacilities ? new Set(this.selectedFacilities.map((facility:any) => facility.facilityId)) as any : []; const facilitiesToRemove = this.memberFacilities.filter((facility: any) => !selectedFacilityIds.has(facility.facilityId)) @@ -344,9 +345,8 @@ } else { showToast(translate("Member facilities updated successfully.")) } - this.fetchMemberFacilities(); this.isFacilityMembersModified = false; - this.$router.push({ path: `/tabs/find-groups` }) + this.router.push({ path: `/tabs/find-groups` }) }, async doReorder(event: CustomEvent) { const previousSeq = JSON.parse(JSON.stringify(this.selectedFacilities))
{{ group.facilityGroupId }}
{{ group.description }}
{{ translate("No groups found") }}