From 6f75144aaec077e578f5d832eaf83cea4bcf00d9 Mon Sep 17 00:00:00 2001 From: Ravi Lodhi Date: Mon, 12 Aug 2024 18:17:46 +0530 Subject: [PATCH] Improved: Updated facility groups ui as per the new design (#293). --- .../FacilityGroupDescriptionModal.vue | 26 +- src/locales/en.json | 21 +- src/router/index.ts | 7 + src/views/CreateFacilityGroup.vue | 226 +++++++++++++++ src/views/FindGroups.vue | 262 +++++++++++++++++- src/views/ManageFacilities.vue | 54 ++-- 6 files changed, 540 insertions(+), 56 deletions(-) create mode 100644 src/views/CreateFacilityGroup.vue 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..00081290 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", @@ -77,9 +77,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 +99,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 +118,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", @@ -152,6 +153,7 @@ "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 +165,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 +185,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 +205,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 +270,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.", @@ -317,7 +325,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 +346,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 +361,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/views/CreateFacilityGroup.vue b/src/views/CreateFacilityGroup.vue new file mode 100644 index 00000000..31e4be5f --- /dev/null +++ b/src/views/CreateFacilityGroup.vue @@ -0,0 +1,226 @@ + + + + diff --git a/src/views/FindGroups.vue b/src/views/FindGroups.vue index d674c84b..18dd41a1 100644 --- a/src/views/FindGroups.vue +++ b/src/views/FindGroups.vue @@ -3,9 +3,119 @@ {{ translate("Groups") }} + + + {{ translate("Facility groups") }} + + + {{ translate("Parent group associations") }} + + + + + + + + + + + + + + + + + @@ -74,20 +183,23 @@ :loading-text="translate('Loading')" /> + -
+ --> \ No newline at end of file diff --git a/src/views/ManageFacilities.vue b/src/views/ManageFacilities.vue index 6a0e05b0..a7c942a7 100644 --- a/src/views/ManageFacilities.vue +++ b/src/views/ManageFacilities.vue @@ -136,35 +136,32 @@ await this.fetchMemberFacilities(); await this.getFilteredFacilities(); }, - methods: { - async beforeRouteLeave() { - if(!this.toast) 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; - }, + async beforeRouteLeave() { + 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 +276,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,13 +292,11 @@ 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 () { const facilitiesToAdd = this.selectedFacilities.filter((facility: any) => !facility.fromDate) @@ -346,7 +340,7 @@ } 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))