Skip to content

Commit

Permalink
Improved: Updated facility groups ui as per the new design (#293).
Browse files Browse the repository at this point in the history
  • Loading branch information
ravilodhi committed Aug 12, 2024
1 parent 8ea3097 commit 6f75144
Show file tree
Hide file tree
Showing 6 changed files with 540 additions and 56 deletions.
26 changes: 20 additions & 6 deletions src/components/FacilityGroupDescriptionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
<ion-icon slot="icon-only" :icon="closeOutline" />
</ion-button>
</ion-buttons>
<ion-title>{{ facilityGroup?.description ? translate('Edit group description') : translate('Add group description') }}</ion-title>
<ion-title>{{ translate('Edit group detail') }}</ion-title>
</ion-toolbar>
</ion-header>

<ion-content>
<ion-item>
<ion-textarea
<ion-input label-placement="floating" v-model="facilityGroupName">
<div slot="label">{{ translate("Name") }} <ion-text color="danger">*</ion-text></div>
</ion-input>
</ion-item>
<ion-item>
<ion-textarea :label="translate('Description')" label-placement="floating"
:placeholder="translate('group description')"
:auto-grow="true"
v-model="facilityGroupDescription"
Expand All @@ -36,7 +41,9 @@ import {
IonFabButton,
IonHeader,
IonIcon,
IonInput,
IonItem,
IonText,
IonTextarea,
IonTitle,
IonToolbar,
Expand All @@ -56,7 +63,6 @@ import { FacilityService } from "@/services/FacilityService";
import { hasError } from '@/adapter';
import emitter from "@/event-bus";
import { showToast } from '@/utils';
import { popoverController } from "@ionic/core";
export default defineComponent({
name: "CustomFieldModal",
Expand All @@ -68,13 +74,16 @@ export default defineComponent({
IonFabButton,
IonHeader,
IonIcon,
IonInput,
IonItem,
IonText,
IonTextarea,
IonTitle,
IonToolbar,
},
data() {
return {
facilityGroupName: this.facilityGroup.facilityGroupName,
facilityGroupDescription: this.facilityGroup.description,
}
},
Expand All @@ -89,17 +98,23 @@ export default defineComponent({
modalController.dismiss({ dismissed: true });
},
async updateFacilityGroupDescription() {
if (this.facilityGroupName.trim().length <= 0) {
showToast(translate('Facility group name cannot be empty'));
return false;
}
emitter.emit('presentLoader')
try {
const resp = await FacilityService.updateFacilityGroup({
facilityGroupId: this.facilityGroup.facilityGroupId,
facilityGroupName: this.facilityGroupName,
description: this?.facilityGroupDescription
})
if (!hasError(resp)) {
showToast(translate('Group description updated.'))
showToast(translate('Group detail updated.'))
const updatedGroups = JSON.parse(JSON.stringify(this.groups))
.map((groupData: any) => {
if (this.facilityGroup.facilityGroupId === groupData.facilityGroupId) {
groupData.facilityGroupName = this.facilityGroupName
groupData.description = this.facilityGroupDescription
}
Expand All @@ -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')
},
Expand Down
21 changes: 15 additions & 6 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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.",
Expand All @@ -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.",
Expand All @@ -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",
Expand Down Expand Up @@ -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.",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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.",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -353,6 +361,7 @@
"Staff": "Staff",
"Start Time": "Start Time",
"State": "State",
"Stay": "Stay",
"Store": "Store",
"Stores": "Stores",
"store name": "store name",
Expand Down
7 changes: 7 additions & 0 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' {
Expand Down Expand Up @@ -107,6 +108,12 @@ const routes: Array<RouteRecordRaw> = [
component: ManageFacilities,
props: true,
beforeEnter: authGuard,
},
{
path: '/create-facility-group',
name: 'Create Facility Group',
component: CreateFacilityGroup,
beforeEnter: authGuard,
}
]

Expand Down
Loading

0 comments on commit 6f75144

Please sign in to comment.