From 8d429d44a74bdb35b987f1ca364cf25b883464a1 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 28 May 2024 16:31:49 +0530 Subject: [PATCH 1/8] Improved: router flow while create product store process (#6) --- src/router/index.ts | 6 +++++- src/views/AddConfigurations.vue | 5 ++--- src/views/CreateProductStore.vue | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 1b8b936..110cd5b 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -57,7 +57,11 @@ const routes: Array = [ { path: "/add-configurations/:productStoreId", name: "AddConfigurations", - component: AddConfigurations + component: AddConfigurations, + beforeEnter: (to, from, next) => { + if(from.path === "/create-product-store") next() + else router.push(from.path) + } }, { path: "/product-store-details/:productStoreId", diff --git a/src/views/AddConfigurations.vue b/src/views/AddConfigurations.vue index a1dd035..acb7405 100644 --- a/src/views/AddConfigurations.vue +++ b/src/views/AddConfigurations.vue @@ -2,7 +2,7 @@ - + {{ translate("Add configurations") }} @@ -105,7 +105,7 @@ async function setupProductStore() { const resp = await ProductStoreService.updateProductStore(payload); if(!hasError(resp)) { showToast(translate("Product store configurations updated successfully.")) - router.push(`/product-store-details/${productStore.value.productStoreId}`); + router.replace(`/product-store-details/${productStore.value.productStoreId}`); } else { throw resp.data; } @@ -113,7 +113,6 @@ async function setupProductStore() { logger.error(error) showToast(translate("Failed to add configurations to the product store.")) } - } diff --git a/src/views/CreateProductStore.vue b/src/views/CreateProductStore.vue index 465a92d..f9d307e 100644 --- a/src/views/CreateProductStore.vue +++ b/src/views/CreateProductStore.vue @@ -126,7 +126,7 @@ async function manageConfigurations() { } showToast(translate("Product store created successfully.")) - router.push(`add-configurations/${productStoreId}`); + router.replace(`add-configurations/${productStoreId}`); } else { throw resp.data; } From 199e24130b3439a4f7b8a5a51c986c2e09ee4f6d Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 28 May 2024 16:44:23 +0530 Subject: [PATCH 2/8] Improved: helper text message for the product store id input (#6) --- src/locales/en.json | 1 + src/views/CreateProductStore.vue | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/locales/en.json b/src/locales/en.json index e8626db..d6a6d56 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -85,6 +85,7 @@ "Product store created successfully.": "Product store created successfully.", "Product store configurations updated successfully.": "Product store configurations updated successfully.", "Product store ID cannot be more than 20 characters.": "Product store ID cannot be more than 20 characters.", + "Product store ID represents an unique ID for your product store": "Product store ID represents an unique ID for your product store", "Product store name": "Product store name", "Product store name can't be empty.": "Product store name can't be empty.", "Product store name updated successfully.": "Product store name updated successfully.", diff --git a/src/views/CreateProductStore.vue b/src/views/CreateProductStore.vue index f9d307e..5069909 100644 --- a/src/views/CreateProductStore.vue +++ b/src/views/CreateProductStore.vue @@ -21,7 +21,7 @@ - + From 6b7398d4f4eec3322ca1cf616c9fdf70183b55d5 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 28 May 2024 16:46:55 +0530 Subject: [PATCH 3/8] Fixed: store name getting updated with only spaces (#6) --- src/views/ProductStoreDetails.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/ProductStoreDetails.vue b/src/views/ProductStoreDetails.vue index 23bcc13..61cafde 100644 --- a/src/views/ProductStoreDetails.vue +++ b/src/views/ProductStoreDetails.vue @@ -437,7 +437,7 @@ async function renameProductStore() { { text: translate("Confirm"), handler: async(data) => { - if(!data.storeName) { + if(!data.storeName.trim()) { showToast(translate("Product store name can't be empty.")); return false; } From 375f7a8c6950b950d2bac962b5dc3157b20601ed Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Tue, 28 May 2024 19:17:58 +0530 Subject: [PATCH 4/8] Improved: logic to don't save trailing spaces in the tag and storeName (#6) --- src/views/ProductStoreDetails.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/views/ProductStoreDetails.vue b/src/views/ProductStoreDetails.vue index 61cafde..a676eec 100644 --- a/src/views/ProductStoreDetails.vue +++ b/src/views/ProductStoreDetails.vue @@ -442,10 +442,10 @@ async function renameProductStore() { return false; } - if(data.storeName === productStore.value.storeName) return; + if(data.storeName.trim() === productStore.value.storeName) return; const updatedStore = JSON.parse(JSON.stringify(productStore.value)); - updatedStore.storeName = data.storeName; + updatedStore.storeName = data.storeName.trim(); try { const resp = await ProductStoreService.updateProductStore(updatedStore); @@ -482,23 +482,23 @@ async function createUpdateTag(enumId: string) { { text: settingEnums[enumId]?.settingValue ? translate("Update") : translate("Add"), handler: async(data) => { - if(!data.tag) { + if(!data.tag.trim()) { showToast(translate("Tags can't be empty.")); return false; } - if(data.tag === settingEnums[enumId]?.settingValue) return; + if(data.tag.trim() === settingEnums[enumId]?.settingValue) return; let payload; if(settingEnums[enumId]?.productStoreId) { payload = settingEnums[enumId]; - payload.settingValue = data.tag; + payload.settingValue = data.tag.trim(); } else { payload = { fromDate: DateTime.now().toMillis(), productStoreId: productStore.value.productStoreId, settingTypeEnumId: enumId, - settingValue: data.tag + settingValue: data.tag.trim() } } From 68599f554698a8515aeda8681d4938dc477e06b1 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 29 May 2024 12:43:07 +0530 Subject: [PATCH 5/8] Improved: used client and atp baseUrl for fetching available timeZones (#6) --- src/services/UserService.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/UserService.ts b/src/services/UserService.ts index e136c77..009e637 100644 --- a/src/services/UserService.ts +++ b/src/services/UserService.ts @@ -49,9 +49,12 @@ const getUserProfile = async (token: any): Promise => { } const getAvailableTimeZones = async (): Promise => { - return api({ + const url = store.getters["user/getBaseUrl"] + const baseURL = url.startsWith('http') ? url.includes('/rest/s1/admin') ? url.replace("admin", "available-to-promise") : `${url}/rest/s1/available-to-promise/` : `https://${url}.hotwax.io/rest/s1/available-to-promise/`; + return client({ url: "user/getAvailableTimeZones", method: "get", + baseURL, cache: true }); } From dedfa71b7e4c7a7e0eaff771f8c06c522a7e9d57 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 29 May 2024 12:49:14 +0530 Subject: [PATCH 6/8] Improved: showed server error message dynamically on store creation (#6) --- src/views/CreateProductStore.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/CreateProductStore.vue b/src/views/CreateProductStore.vue index 5069909..bedc347 100644 --- a/src/views/CreateProductStore.vue +++ b/src/views/CreateProductStore.vue @@ -131,7 +131,7 @@ async function manageConfigurations() { throw resp.data; } } catch(error: any) { - showToast(translate("Failed to create product store.")) + showToast(translate(error.response?.data?.errors ? error.response.data.errors : "Failed to create product store.")) logger.error(error); } } From 17151aa222885eba44be8107fd8baa8a67b35849 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 29 May 2024 15:47:57 +0530 Subject: [PATCH 7/8] Improved: label for facility count and shipping method to change according to singular count (#6) --- src/locales/en.json | 2 ++ src/views/ProductStore.vue | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index d6a6d56..ab1fdfa 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -36,6 +36,7 @@ "Display current physical quantity expected at locations while inventory counting.": "Display current physical quantity expected at locations while inventory counting.", "Edit": "Edit", "facilities": "{count} facilities", + "facility": "{count} facility", "Failed to create product store.": "Failed to create product store.", "Failed to remove tag.": "Failed to remove tag.", "Failed to update product store name.": "Failed to update product store name.", @@ -105,6 +106,7 @@ "Send notification to Shopify": "Send notification to Shopify", "Settings": "Settings", "Setup product store": "Setup product store", + "shipping method": "{count} shipping method", "shipping methods": "{count} shipping methods", "Shipment method": "Shipment method", "Shipping facility tag": "Shipping facility tag", diff --git a/src/views/ProductStore.vue b/src/views/ProductStore.vue index 25bc92e..2865ced 100644 --- a/src/views/ProductStore.vue +++ b/src/views/ProductStore.vue @@ -19,14 +19,14 @@
- {{ translate("facilities", { count: store.facilityCount }) }} + {{ translate(store.facilityCount > 1 ? "facilities" : "facility", { count: store.facilityCount }) }}
- {{ translate("shipping methods", { count: store.shipmentMethodCount }) }} + {{ translate(store.shipmentMethodCount > 1 ? "shipping methods" : "shipping method", { count: store.shipmentMethodCount }) }}
From e1c108f782899f2a7ea6953f6a431096f3b44faa Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 29 May 2024 15:57:44 +0530 Subject: [PATCH 8/8] Improved: brokering icon, added placeholder on the ion-select (#6) --- src/locales/en.json | 3 ++- src/views/ProductStoreDetails.vue | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index ab1fdfa..9660c8d 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -47,7 +47,7 @@ "Go to OMS": "Go to OMS", "Hold pre-order physical inventory": "Hold pre-order physical inventory", "ID": "ID", - "Id prefix": "Id prefix", + "ID prefix": "ID prefix", "Identifier": "Identifier", "Import": "Import", "Inventory": "Inventory", @@ -101,6 +101,7 @@ "Search time zones": "Search time zones", "Soft Allocation": "Soft Allocation", "Secondary identifier": "Secondary identifier", + "Select": "Select", "Select operating countries": "Select operating countries", "Select time zone": "Select time zone", "Send notification to Shopify": "Send notification to Shopify", diff --git a/src/views/ProductStoreDetails.vue b/src/views/ProductStoreDetails.vue index a676eec..fbce0e8 100644 --- a/src/views/ProductStoreDetails.vue +++ b/src/views/ProductStoreDetails.vue @@ -28,7 +28,7 @@
- + {{ translate("Order brokering") }} @@ -52,7 +52,7 @@ - + @@ -245,7 +245,7 @@ - + {{ group.facilityGroupName }} @@ -268,7 +268,7 @@ - + {{ identifier.description }} @@ -283,13 +283,13 @@ - + {{ option }} - + {{ option }} @@ -316,7 +316,7 @@ - + {{ shipmentMethod.description ? shipmentMethod.description : shipmentMethod.shipmentMethodTypeId }} @@ -347,7 +347,7 @@