From af995a97bec3bd9066e68de9dd8b531703f90f69 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Sat, 28 Sep 2024 18:49:25 +0530 Subject: [PATCH 01/27] Implemented: NetSuite Integration Management UI(#37) --- src/App.vue | 8 +- src/components/Departments.vue | 102 +++++++++++ src/components/DiscountsModal.vue | 47 +++++ src/components/Facilities.vue | 102 +++++++++++ src/components/InventoryVariances.vue | 89 ++++++++++ src/components/Menu.vue | 114 ++++++++++++ src/components/PaymentMethods.vue | 98 +++++++++++ src/components/PriceLevelModal.vue | 63 +++++++ src/components/ProductStoreModal.vue | 47 +++++ src/components/SalesChannel.vue | 98 +++++++++++ src/components/SftpModal.vue | 55 ++++++ src/components/ShipmentMethods.vue | 120 +++++++++++++ src/components/TransferInventoryModal.vue | 55 ++++++ src/router/index.ts | 96 +++++++--- src/theme/variables.css | 5 + src/views/NetSuite.vue | 202 ++++++++++++++++++++++ src/views/ProductStore.vue | 3 +- src/views/Tabs.vue | 54 ------ 18 files changed, 1274 insertions(+), 84 deletions(-) create mode 100644 src/components/Departments.vue create mode 100644 src/components/DiscountsModal.vue create mode 100644 src/components/Facilities.vue create mode 100644 src/components/InventoryVariances.vue create mode 100644 src/components/Menu.vue create mode 100644 src/components/PaymentMethods.vue create mode 100644 src/components/PriceLevelModal.vue create mode 100644 src/components/ProductStoreModal.vue create mode 100644 src/components/SalesChannel.vue create mode 100644 src/components/SftpModal.vue create mode 100644 src/components/ShipmentMethods.vue create mode 100644 src/components/TransferInventoryModal.vue create mode 100644 src/views/NetSuite.vue delete mode 100644 src/views/Tabs.vue diff --git a/src/App.vue b/src/App.vue index 7cb209a..9d15df6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,12 +1,16 @@ + \ No newline at end of file diff --git a/src/components/DiscountsModal.vue b/src/components/DiscountsModal.vue new file mode 100644 index 0000000..08c8b1f --- /dev/null +++ b/src/components/DiscountsModal.vue @@ -0,0 +1,47 @@ + + \ No newline at end of file diff --git a/src/components/Facilities.vue b/src/components/Facilities.vue new file mode 100644 index 0000000..5dea213 --- /dev/null +++ b/src/components/Facilities.vue @@ -0,0 +1,102 @@ + + + \ No newline at end of file diff --git a/src/components/InventoryVariances.vue b/src/components/InventoryVariances.vue new file mode 100644 index 0000000..178a707 --- /dev/null +++ b/src/components/InventoryVariances.vue @@ -0,0 +1,89 @@ + + + \ No newline at end of file diff --git a/src/components/Menu.vue b/src/components/Menu.vue new file mode 100644 index 0000000..b811feb --- /dev/null +++ b/src/components/Menu.vue @@ -0,0 +1,114 @@ + + + + + \ No newline at end of file diff --git a/src/components/PaymentMethods.vue b/src/components/PaymentMethods.vue new file mode 100644 index 0000000..a6ac7e0 --- /dev/null +++ b/src/components/PaymentMethods.vue @@ -0,0 +1,98 @@ + + + \ No newline at end of file diff --git a/src/components/PriceLevelModal.vue b/src/components/PriceLevelModal.vue new file mode 100644 index 0000000..2cc0826 --- /dev/null +++ b/src/components/PriceLevelModal.vue @@ -0,0 +1,63 @@ + + \ No newline at end of file diff --git a/src/components/ProductStoreModal.vue b/src/components/ProductStoreModal.vue new file mode 100644 index 0000000..5a81fdb --- /dev/null +++ b/src/components/ProductStoreModal.vue @@ -0,0 +1,47 @@ + + \ No newline at end of file diff --git a/src/components/SalesChannel.vue b/src/components/SalesChannel.vue new file mode 100644 index 0000000..7e1fdaf --- /dev/null +++ b/src/components/SalesChannel.vue @@ -0,0 +1,98 @@ + + + \ No newline at end of file diff --git a/src/components/SftpModal.vue b/src/components/SftpModal.vue new file mode 100644 index 0000000..4578ff0 --- /dev/null +++ b/src/components/SftpModal.vue @@ -0,0 +1,55 @@ + + \ No newline at end of file diff --git a/src/components/ShipmentMethods.vue b/src/components/ShipmentMethods.vue new file mode 100644 index 0000000..924b251 --- /dev/null +++ b/src/components/ShipmentMethods.vue @@ -0,0 +1,120 @@ + + + \ No newline at end of file diff --git a/src/components/TransferInventoryModal.vue b/src/components/TransferInventoryModal.vue new file mode 100644 index 0000000..80601e4 --- /dev/null +++ b/src/components/TransferInventoryModal.vue @@ -0,0 +1,55 @@ + + \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 98830d4..41120e7 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,10 +1,18 @@ import { createRouter, createWebHistory } from "@ionic/vue-router"; import { RouteRecordRaw } from "vue-router"; import store from "@/store" -import Tabs from "@/views/Tabs.vue" import CreateProductStore from "@/views/CreateProductStore.vue"; import AddConfigurations from "@/views/AddConfigurations.vue"; import ProductStoreDetails from "@/views/ProductStoreDetails.vue"; +import ProductStore from "@/views/ProductStore.vue"; +import NetSuite from "@/views/NetSuite.vue"; +import Settings from "@/views/Settings.vue" +import ShipmentMethods from "@/components/ShipmentMethods.vue" +import Facilities from "@/components/Facilities.vue"; +import InventoryVariances from "@/components/InventoryVariances.vue"; +import PaymentMethods from "@/components/PaymentMethods.vue"; +import SalesChannel from "@/components/SalesChannel.vue"; +import Departments from "@/components/Departments.vue"; import { DxpLogin, useAuthStore } from "@hotwax/dxp-components"; import { loader } from '@/user-utils'; @@ -31,28 +39,62 @@ const loginGuard = (to: any, from: any, next: any) => { const routes: Array = [ { path: "/", - redirect: "/tabs/product-store" + redirect: "/product-store" }, { - path: "/tabs", - component: Tabs, - children: [ - { - path: "", - redirect: "/tabs/product-store" - }, - { - path: "product-store", - name: "ProductStore", - component: () => import("@/views/ProductStore.vue") - }, - { - path: "settings", - name: "Settings", - component: () => import("@/views/Settings.vue") - } - ], - beforeEnter: authGuard + path: '/product-store', + name: 'ProductStore', + component: ProductStore, + beforeEnter: authGuard, + }, + { + path: "/product-store-details/:productStoreId", + name: "ProductStoreDetails", + component: ProductStoreDetails, + props: true, + beforeEnter: authGuard, + }, + { + path: "/netsuite", + name: "NetSuite", + component: NetSuite, + beforeEnter: authGuard, + }, + { + path: "/netsuite/shipment-methods", + name: "ShipmentMethods", + component: ShipmentMethods, + beforeEnter: authGuard, + }, + { + path: "/netsuite/facilities", + name: "Facilities", + component: Facilities, + beforeEnter: authGuard, + }, + { + path: "/netsuite/inventory-variances", + name: "InventoryVariances", + component: InventoryVariances, + beforeEnter: authGuard, + }, + { + path: "/netsuite/payment-methods", + name: "PaymentMethods", + component: PaymentMethods, + beforeEnter: authGuard, + }, + { + path: "/netsuite/sales-channel", + name: "SalesChannel", + component: SalesChannel, + beforeEnter: authGuard, + }, + { + path: "/netsuite/departments", + name: "Departments", + component: Departments, + beforeEnter: authGuard, }, { path: "/create-product-store", @@ -69,18 +111,18 @@ const routes: Array = [ else router.push(from.path) } }, - { - path: "/product-store-details/:productStoreId", - name: "ProductStoreDetails", - component: ProductStoreDetails, - props: true - }, { path: "/login", name: "Login", component: DxpLogin, beforeEnter: loginGuard }, + { + path: "/settings", + name: "Settings", + component: Settings, + beforeEnter: authGuard + }, ] const router = createRouter({ diff --git a/src/theme/variables.css b/src/theme/variables.css index 3a60b78..b707c89 100644 --- a/src/theme/variables.css +++ b/src/theme/variables.css @@ -271,6 +271,11 @@ ion-input.name { --background: var(--ion-color-light) } +ion-text { + font-size: 22px; + padding: var(--spacer-xs) 0px 0px 10px; +} + .pointer { cursor: pointer; } diff --git a/src/views/NetSuite.vue b/src/views/NetSuite.vue new file mode 100644 index 0000000..21fb806 --- /dev/null +++ b/src/views/NetSuite.vue @@ -0,0 +1,202 @@ + + + + + \ No newline at end of file diff --git a/src/views/ProductStore.vue b/src/views/ProductStore.vue index f2e6233..6fb998c 100644 --- a/src/views/ProductStore.vue +++ b/src/views/ProductStore.vue @@ -2,6 +2,7 @@ + {{ translate("Product store") }} @@ -43,7 +44,7 @@ - - From e9b8e7188cd7d31b8a2878ae8d4460955389cef7 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 30 Sep 2024 16:45:48 +0530 Subject: [PATCH 02/27] Improved: added some changes in template & alter some css(#37) --- src/App.vue | 8 +- src/components/Departments.vue | 25 ++-- src/components/DiscountsModal.vue | 10 +- src/components/Facilities.vue | 25 +--- src/components/InventoryVariances.vue | 27 ++-- src/components/PaymentMethods.vue | 123 ++++++++-------- src/components/PriceLevelModal.vue | 6 +- src/components/ProductStoreModal.vue | 16 ++- src/components/SalesChannel.vue | 19 +-- src/components/SftpModal.vue | 20 +-- src/components/ShipmentMethods.vue | 163 ++++++++++------------ src/components/TransferInventoryModal.vue | 17 +-- src/theme/variables.css | 9 ++ src/views/NetSuite.vue | 117 ++++++++++------ 14 files changed, 288 insertions(+), 297 deletions(-) diff --git a/src/App.vue b/src/App.vue index 9d15df6..62dd949 100644 --- a/src/App.vue +++ b/src/App.vue @@ -82,4 +82,10 @@ onUnmounted(() => { resetConfig() }) - \ No newline at end of file + + + diff --git a/src/components/Departments.vue b/src/components/Departments.vue index 039ea42..e22ff1e 100644 --- a/src/components/Departments.vue +++ b/src/components/Departments.vue @@ -11,16 +11,16 @@
- + Map departments with NetSuite

Learn more about mapping departments with NetSuite to make sure orders are attributed correctly.

- +
-
+
@@ -35,7 +35,7 @@

Shopify

-
+
2 @@ -45,13 +45,13 @@
- + 150

orders

-
+
@@ -71,7 +71,7 @@ NetSuite id - + 150

orders

@@ -87,16 +87,7 @@ import { translate } from '@hotwax/dxp-components'; \ No newline at end of file diff --git a/src/components/DiscountsModal.vue b/src/components/DiscountsModal.vue index 08c8b1f..3b6971a 100644 --- a/src/components/DiscountsModal.vue +++ b/src/components/DiscountsModal.vue @@ -11,21 +11,20 @@ - - + Learn more about discounts in NetSuite - + - + - + @@ -33,7 +32,6 @@ - \ No newline at end of file diff --git a/src/components/InventoryVariances.vue b/src/components/InventoryVariances.vue index 178a707..ddcf69b 100644 --- a/src/components/InventoryVariances.vue +++ b/src/components/InventoryVariances.vue @@ -10,7 +10,7 @@
- + Inventory variances synced to NetSuite

Select exactly which inventory variances should be synced to NetSuite

@@ -18,6 +18,7 @@ next sync in 15 minutes
+
@@ -31,7 +32,7 @@

variances in 7 days

-
+
15 @@ -45,7 +46,8 @@
-
+ +
Variance Enum Name @@ -58,8 +60,8 @@

variances in 7 days

- - NetSuite id + + Transfer inventory @@ -72,18 +74,19 @@ \ No newline at end of file diff --git a/src/components/PaymentMethods.vue b/src/components/PaymentMethods.vue index a6ac7e0..cdbcfcf 100644 --- a/src/components/PaymentMethods.vue +++ b/src/components/PaymentMethods.vue @@ -8,72 +8,72 @@ - -
- - - - Map payment methods with NetSuite -

For an order to sync with NetSuite, the payment method on that order must be mapped to a NetSuite shipment method ID.

-
- -
-
+ +
+ + + + Map payment methods with NetSuite +

For an order to sync with NetSuite, the payment method on that order must be mapped to a NetSuite shipment method ID.

+
+ +
+
-
- - - Payment Method Name -

Payment Method Id

-
-
+
+ + + Payment Method Name +

Payment Method Id

+
+
- - Shopify Mapping ID -

variances in 7 days

-
- -
- - 2 - - -

NetSuite payment method ID

+ Shopify Mapping ID +

variances in 7 days

-
- - 150 -

orders

-
-
+
+ + 2 + + + +

NetSuite payment method ID

+
+
+ + + 150 +

orders

+
+
+ +
+ + + Payment Method Name +

Payment Method Id

+
+
-
- - Payment Method Name -

Payment Method Id

+ Shopify Mapping ID +

variances in 7 days

-
- - - Shopify Mapping ID -

variances in 7 days

-
- - - - NetSuite id - - - 150 -

orders

-
-
- - + + + NetSuite id + + + + 150 +

orders

+
+
+
+ \ No newline at end of file diff --git a/src/components/PriceLevelModal.vue b/src/components/PriceLevelModal.vue index 2cc0826..2f55166 100644 --- a/src/components/PriceLevelModal.vue +++ b/src/components/PriceLevelModal.vue @@ -12,15 +12,15 @@ - + Learn more about price levels in NetSuite - + - + diff --git a/src/components/ProductStoreModal.vue b/src/components/ProductStoreModal.vue index 5a81fdb..bbc2d79 100644 --- a/src/components/ProductStoreModal.vue +++ b/src/components/ProductStoreModal.vue @@ -12,23 +12,25 @@ - + Learn more about mapping product stores to subsidiaries - + - + + Male Female Not decided yet - - - + + + + @@ -37,7 +39,7 @@ \ No newline at end of file diff --git a/src/components/SftpModal.vue b/src/components/SftpModal.vue index 4578ff0..19ad255 100644 --- a/src/components/SftpModal.vue +++ b/src/components/SftpModal.vue @@ -12,30 +12,30 @@ - + Learn more about NetSuite SFTP configuration. - + - + - + - + - + - + - + - + @@ -45,7 +45,7 @@ \ No newline at end of file diff --git a/src/components/TransferInventoryModal.vue b/src/components/TransferInventoryModal.vue index 80601e4..20f4588 100644 --- a/src/components/TransferInventoryModal.vue +++ b/src/components/TransferInventoryModal.vue @@ -11,31 +11,26 @@ - - + Learn more about creating inventory transfers from inventory variances - + - + Facility wise inventory transfer

If each facility has its own dedicated inventory transfer location for this variance, configure the transfer location from the facility configuration section

- - + + - - -

Variance Enum ID

-
- + diff --git a/src/theme/variables.css b/src/theme/variables.css index b707c89..b4b8b25 100644 --- a/src/theme/variables.css +++ b/src/theme/variables.css @@ -271,11 +271,20 @@ ion-input.name { --background: var(--ion-color-light) } +.list-item > ion-item:first-child { + width: 100%; +} + ion-text { font-size: 22px; padding: var(--spacer-xs) 0px 0px 10px; } +.header { + display: grid; + grid-template-columns: repeat(2, 1fr); +} + .pointer { cursor: pointer; } diff --git a/src/views/NetSuite.vue b/src/views/NetSuite.vue index 21fb806..5fae171 100644 --- a/src/views/NetSuite.vue +++ b/src/views/NetSuite.vue @@ -11,41 +11,36 @@
-
+
- - 4 + + 4 - - -

Orders pending sync

-
+ + Orders pending sync
- - 15 + + 15 - - -

Customers pending sync

-
+ + Customers pending sync
- - 2 + + 2 - - -

Products pending sync

-
+ + Products pending sync
-
+ +
Configuration -
+
SFTP @@ -59,35 +54,37 @@ - + Shipping methods - + Facilities -
+
+
Products and Inventory -
+
- + Inventory variances -
+
+
Orders and fulfillment -
+
- + Payment method @@ -105,22 +102,23 @@ - + Departments - + Sales Channel -
+
+
Transfer orders -
+
Transfer order fulfillment @@ -133,23 +131,50 @@ -
+
-
-
\ No newline at end of file From 443c2a59a3d4a962533b07b625054fdf387d95a7 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 7 Oct 2024 14:54:43 +0530 Subject: [PATCH 03/27] Improved: removed the ion-card from netsuite page & improved the css(#37) --- src/theme/variables.css | 5 - src/views/NetSuite.vue | 235 ++++++++++++++++++---------------------- 2 files changed, 106 insertions(+), 134 deletions(-) diff --git a/src/theme/variables.css b/src/theme/variables.css index b4b8b25..6ce7da2 100644 --- a/src/theme/variables.css +++ b/src/theme/variables.css @@ -275,11 +275,6 @@ ion-input.name { width: 100%; } -ion-text { - font-size: 22px; - padding: var(--spacer-xs) 0px 0px 10px; -} - .header { display: grid; grid-template-columns: repeat(2, 1fr); diff --git a/src/views/NetSuite.vue b/src/views/NetSuite.vue index 5fae171..0ac1f6c 100644 --- a/src/views/NetSuite.vue +++ b/src/views/NetSuite.vue @@ -9,131 +9,105 @@
- -
-
- - - 4 - - - Orders pending sync - - - - - 15 - - - Customers pending sync - - - - - 2 - - - Products pending sync - - + +
+ + + 4 + + + Orders pending sync + + + + + 15 + + + Customers pending sync + + + + + 2 + + + Products pending sync + + +
+ +
+

Configuration

+
+ + SFTP + + + + Product Store + + + + Shipping methods + + + + Facilities + +
- -
- Configuration -
- - - SFTP - - - - - - Product Store - - - - - - Shipping methods - - - - - - Facilities - - - -
-
- -
- Products and Inventory -
- - - Inventory variances - - - -
-
- -
- Orders and fulfillment -
- - - Payment method - - - - - - Price level - - - - - - Discounts - - - - - - Departments - - - - - - Sales Channel - - - -
-
- -
- Transfer orders -
- - - Transfer order fulfillment - - - - - - Transfer order receipt - - - -
-
-
+
+ +
+

Products and Inventory

+
+ + Inventory variances + + +
+
+ +
+

Orders and fulfillment

+
+ + Payment method + + + + Price level + + + + Discounts + + + + Departments + + + + Sales Channel + + +
+
+ +
+

Transfer orders

+
+ + Transfer order fulfillment + + + + Transfer order receipt + + +
+
@@ -206,22 +180,25 @@ async function openDiscountsModal() { \ No newline at end of file From 671ed5176bc23bf474e43cb63a3b64e5eeb2e8f1 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 20 Nov 2024 13:02:55 +0530 Subject: [PATCH 04/27] Implemented: Created the NetSuite store for managing NetSuite states and added the NetSuite service (#37) --- src/locales/en.json | 42 ++++++++++++ src/services/NetSuiteService.ts | 26 +++++++ src/store/RootState.ts | 1 + src/store/index.ts | 6 +- src/store/modules/netSuite/NetSuiteState.ts | 5 ++ src/store/modules/netSuite/actions.ts | 71 ++++++++++++++++++++ src/store/modules/netSuite/getters.ts | 16 +++++ src/store/modules/netSuite/index.ts | 20 ++++++ src/store/modules/netSuite/mutation-types.ts | 4 ++ src/store/modules/netSuite/mutations.ts | 16 +++++ 10 files changed, 205 insertions(+), 2 deletions(-) create mode 100644 src/services/NetSuiteService.ts create mode 100644 src/store/modules/netSuite/NetSuiteState.ts create mode 100644 src/store/modules/netSuite/actions.ts create mode 100644 src/store/modules/netSuite/getters.ts create mode 100644 src/store/modules/netSuite/index.ts create mode 100644 src/store/modules/netSuite/mutation-types.ts create mode 100644 src/store/modules/netSuite/mutations.ts diff --git a/src/locales/en.json b/src/locales/en.json index 82a5bae..d2e679b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -2,6 +2,7 @@ "Add": "Add", "Add a custom prefix to HotWax order IDs: 10001": "Add a custom prefix to HotWax order IDs: 10001", "Add configurations": "Add configurations", + "Add more shipment methods": "Add more shipment methods", "Analyzing the question to answer your question.": "Analyzing the question to answer your question.", "Answer based on resources": "Answer based on {count} resources", "App": "App", @@ -22,6 +23,7 @@ "Choosing a product identifier allows you to view products with your preferred identifiers.": "Choosing a product identifier allows you to view products with your preferred identifiers.", "Click the backdrop to dismiss.": "Click the backdrop to dismiss.", "Company name": "Company name", + "Configuration": "Configuration", "Configurations": "Configurations", "Configure cancellation threshold for unfulfilled orders based on a specified number of days.": "Configure cancellation threshold for unfulfilled orders based on a specified number of days.", "Configure inventory computation for pre-sell items based on inventory channels and pre-sell queues.": "Configure inventory computation for pre-sell items based on inventory channels and pre-sell queues.", @@ -35,19 +37,27 @@ "Create new product store": "Create new product store", "Create new tag": "Create new tag", "Create product store": "Create product store", + "Customers pending sync": "Customers pending sync", "days count": "days count", + "Departments": "Departments", "Delivery address": "Delivery address", "Delivery method": "Delivery method", + "Discounts": "Discounts", "Display current physical quantity expected at locations while inventory counting.": "Display current physical quantity expected at locations while inventory counting.", + "Don't see a shipment method?": "Don't see a shipment method?", "Edit": "Edit", + "Facilities": "Facilities", "facilities": "{count} facilities", "facility": "{count} facility", + "Facility wise inventory transfer": "Facility wise inventory transfer", "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.", "Failed to update product store settings.": "Failed to update product store settings.", "Fetching resources...": "Fetching resources...", "Fetching time zones": "Fetching time zones", + "For an order to sync with NetSuite, the payment method on that order must be mapped to a NetSuite shipment method ID.": "For an order to sync with NetSuite, the payment method on that order must be mapped to a NetSuite shipment method ID.", + "For an order to sync with NetSuite, the shipment method on that order must be mapped to a NetSuite shipment method ID.": "For an order to sync with NetSuite, the shipment method on that order must be mapped to a NetSuite shipment method ID.", "Fulfillment": "Fulfillment", "Global identifier": "Global identifier", "Go to OMS": "Go to OMS", @@ -59,16 +69,28 @@ "ID": "ID", "ID prefix": "ID prefix", "Identifier": "Identifier", + "If each facility has its own dedicated inventory transfer location for this variance, configure the transfer location from the facility configuration section": "If each facility has its own dedicated inventory transfer location for this variance, configure the transfer location from the facility configuration section", + "If you don’t see a shipment method on this page that you know you’ve setup in HotWax Commerce, it may not be linked to the Product Store your NetSuite account is linked too.": "If you don’t see a shipment method on this page that you know you’ve setup in HotWax Commerce, it may not be linked to the Product Store your NetSuite account is linked too.", "Import": "Import", "Inventory": "Inventory", "Inventory reservation": "Inventory reservation", "Inventory view": "Inventory view", + "Inventory variances": "Inventory variances", + "Inventory variances synced to NetSuite": "Inventory variances synced to NetSuite", + "Learn more about NetSuite SFTP configuration.": "Learn more about NetSuite SFTP configuration.", + "Learn more about mapping product stores to subsidiaries": "Learn more about mapping product stores to subsidiaries", + "Learn more about creating inventory transfers from inventory variances": "Learn more about creating inventory transfers from inventory variances", "Login": "Login", "Logging in...": "Logging in...", "Logout": "Logout", + "Map payment methods with NetSuite": "Map payment methods with NetSuite", + "Map shipment methods to NetSuite": "Map shipment methods to NetSuite", "Manage configurations": "Manage configurations", "Minimum shipment threshold": "Minimum shipment threshold", "Name": "Name", + "NetSuite": "NetSuite", + "NetSuite ID": "NetSuite ID", + "NetSuite transfer location": "NetSuite transfer location", "No answer found.": "No answer found.", "No page found.": "No page found.", "No product store found.": "No product store found.", @@ -80,22 +102,31 @@ "Operating countries": "Operating countries", "Operating in": "Operating in", "Order": "Order", + "orders": "orders", + "Orders and fulfillment": "Orders and fulfillment", "Order brokering": "Order brokering", "Order edit permissions": "Order edit permissions", + "Orders pending sync": "Orders pending sync", "Order splitting": "Order splitting", "Orders tagged with this tag will undergo line item check for fulfillment facility selection.": "Orders tagged with this tag will undergo line item check for fulfillment facility selection.", "Partial order rejection": "Partial order rejection", "Password": "Password", + "Payment method": "Payment method", + "Payment methods": "Payment methods", "Pick up location": "Pick up location", "Pre-order computation": "Pre-order computation", "Pre-order group": "Pre-order group", "Preferred identifier": "Preferred identifier", "prefix": "prefix", "Preselected facility tag": "Preselected facility tag", + "Price level": "Price level", "Primary identifier": "Primary identifier", "Product": "Product", "Product Identifier": "Product Identifier", + "Products pending sync": "Products pending sync", + "Product Store": "Product Store", "Product store": "Product store", + "Products and Inventory": "Products and Inventory", "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.", @@ -109,6 +140,7 @@ "Returns": "Returns", "Re-route fulfillment": "Re-route fulfillment", "Routing": "Routing", + "Sales Channel": "Sales Channel", "Sales order ID prefix": "Sales order ID prefix", "Save billing information": "Save billing information", "Search country": "Search country", @@ -121,9 +153,13 @@ "Select": "Select", "Select operating countries": "Select operating countries", "Select time zone": "Select time zone", + "Select exactly which inventory variances should be synced to NetSuite": "Select exactly which inventory variances should be synced to NetSuite", "Send notification to Shopify": "Send notification to Shopify", "Settings": "Settings", "Setup product store": "Setup product store", + "SFTP": "SFTP", + "Shipment methods": "Shipment methods", + "Shipping methods": "Shipping methods", "shipping method": "{count} shipping method", "shipping methods": "{count} shipping methods", "Shipment method": "Shipment method", @@ -145,8 +181,14 @@ "threshold": "threshold", "Time zone updated successfully": "Time zone updated successfully", "Timezone": "Timezone", + "Transfer Inventory": "Transfer Inventory", + "Transfer inventory": "Transfer inventory", + "Transfer orders": "Transfer orders", + "Transfer order fulfillment": "Transfer order fulfillment", + "Transfer order receipt": "Transfer order receipt", "Update": "Update", "Update tracking information upon order shipment in Shopify.": "Update tracking information upon order shipment in Shopify.", "Username": "Username", + "variances in 7 days": "variances in 7 days", "Version:": "Version: {appVersion}" } \ No newline at end of file diff --git a/src/services/NetSuiteService.ts b/src/services/NetSuiteService.ts new file mode 100644 index 0000000..06e3da7 --- /dev/null +++ b/src/services/NetSuiteService.ts @@ -0,0 +1,26 @@ +import api from "@/api" +import logger from "@/logger"; +import { hasError } from "@/utils"; + + +const fetchProductStoreShipmentMethods = async (productStoreId: any): Promise => { + return api({ + url: `productStores/${productStoreId}/shipmentMethods`, + method: "get", + }) +} + +const fetchPaymentMethods = async (payload: any): Promise => { + return api({ + url: "paymentMethodTypes", + method: "get", + params: payload + }); +} + + +export const NetSuiteService = { + fetchProductStoreShipmentMethods, + fetchPaymentMethods + +} \ No newline at end of file diff --git a/src/store/RootState.ts b/src/store/RootState.ts index 96d542e..4e4bdc4 100644 --- a/src/store/RootState.ts +++ b/src/store/RootState.ts @@ -2,4 +2,5 @@ export default interface RootState { user: any; util: any; productStore: any; + netSuite: any; } \ No newline at end of file diff --git a/src/store/index.ts b/src/store/index.ts index f7966f9..bbf61f7 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -7,6 +7,7 @@ import createPersistedState from "vuex-persistedstate"; import userModule from "./modules/user"; import productStoreModule from "./modules/productStore"; import utilModule from "./modules/util" +import netSuiteModule from "./modules/netSuite" // TODO check how to register it from the components only // Handle same module registering multiple time on page refresh @@ -15,7 +16,7 @@ import utilModule from "./modules/util" const state: any = {} const persistState = createPersistedState({ - paths: ["user", "util", "productStore"], + paths: ["user", "util", "productStore", "netSuite"], fetchBeforeUse: true }) @@ -29,7 +30,8 @@ const store = createStore({ modules: { "user": userModule, "productStore": productStoreModule, - "util": utilModule + "util": utilModule, + "netSuite": netSuiteModule }, }) diff --git a/src/store/modules/netSuite/NetSuiteState.ts b/src/store/modules/netSuite/NetSuiteState.ts new file mode 100644 index 0000000..fcb6d87 --- /dev/null +++ b/src/store/modules/netSuite/NetSuiteState.ts @@ -0,0 +1,5 @@ +export default interface NetSuiteState { + inventoryVariances: []; + productStoreShipmentMethods: {} + paymentMethods: {} +} \ No newline at end of file diff --git a/src/store/modules/netSuite/actions.ts b/src/store/modules/netSuite/actions.ts new file mode 100644 index 0000000..3014476 --- /dev/null +++ b/src/store/modules/netSuite/actions.ts @@ -0,0 +1,71 @@ +import { ActionTree } from "vuex" +import RootState from "@/store/RootState" +import * as types from "./mutation-types" +import { hasError } from "@/utils" +import logger from "@/logger" +import NetSuiteState from "./NetSuiteState" +import { NetSuiteService } from "@/services/NetSuiteService" +import { UtilService } from "@/services/UtilService" + +const actions: ActionTree = { + + async fetchInventoryVariances({ commit }) { + let inventoryVariances = [] as any; + try { + const payload = { + enumTypeId: ["REPORT_AN_ISSUE", "RPRT_NO_VAR_LOG"], + enumTypeId_op: "in", + pageSize: 20, + } + + const resp = await UtilService.fetchEnums(payload) + + if(!hasError(resp)) { + inventoryVariances = resp.data + } else { + throw resp.data + } + } catch (err) { + logger.error(err) + } + + commit(types.NET_SUITE_INVENTORY_VARIANCES_UPDATED, inventoryVariances) + }, + async fetchPaymentMethods({ commit }) { + let paymentMethods = [] as any; + + try { + const resp = await NetSuiteService.fetchPaymentMethods({ pageSize: 100 }); + + if(!hasError(resp)) { + paymentMethods = resp.data; + } else { + throw resp.data; + } + } catch(error: any) { + logger.error(error); + } + commit(types.NET_SUITE_PAYMENT_METHODS_UPDATED, paymentMethods); + }, + async fetchProductStoreShipmentMethods({ state, commit }, payload) { + // let currentCarrier = JSON.parse(JSON.stringify(state.current)) + let productStoreShipmentMethods = [] as any; + // let pageIndex = 0 + let resp; + + try { + resp = await NetSuiteService.fetchProductStoreShipmentMethods("STORE") + if (!hasError(resp) && resp.data) { + productStoreShipmentMethods = resp.data + } else { + throw resp.data + } + } catch(error) { + logger.error(error); + } + commit(types.NET_SUITE_PRODUCT_STORE_SHIPMENT_METHODS_UPDATED, productStoreShipmentMethods) + }, + +} + +export default actions; \ No newline at end of file diff --git a/src/store/modules/netSuite/getters.ts b/src/store/modules/netSuite/getters.ts new file mode 100644 index 0000000..163bb82 --- /dev/null +++ b/src/store/modules/netSuite/getters.ts @@ -0,0 +1,16 @@ +import { GetterTree } from "vuex" +import RootState from "@/store/RootState" +import NetSuiteState from "./NetSuiteState"; + +const getters: GetterTree = { + getInventoryVariances(state) { + return state.inventoryVariances ? state.inventoryVariances : [] + }, + getProductStoreShipmentMehtods(state) { + return state.productStoreShipmentMethods + }, + getPaymentMehtods(state) { + return state.paymentMethods + } +} +export default getters; \ No newline at end of file diff --git a/src/store/modules/netSuite/index.ts b/src/store/modules/netSuite/index.ts new file mode 100644 index 0000000..343a908 --- /dev/null +++ b/src/store/modules/netSuite/index.ts @@ -0,0 +1,20 @@ +import actions from "./actions" +import getters from "./getters" +import mutations from "./mutations" +import { Module } from "vuex" +import RootState from "@/store/RootState" +import NetSuiteState from "./NetSuiteState" + +const netSuiteModule: Module = { + namespaced: true, + state: { + inventoryVariances: [], + productStoreShipmentMethods: {}, + paymentMethods: {} + }, + getters, + actions, + mutations, +} + +export default netSuiteModule; \ No newline at end of file diff --git a/src/store/modules/netSuite/mutation-types.ts b/src/store/modules/netSuite/mutation-types.ts new file mode 100644 index 0000000..015e070 --- /dev/null +++ b/src/store/modules/netSuite/mutation-types.ts @@ -0,0 +1,4 @@ +export const SN_NET_SUITE = "netSuite" +export const NET_SUITE_INVENTORY_VARIANCES_UPDATED = "/INVENTORY_VARIANCES_UPDATED" +export const NET_SUITE_PRODUCT_STORE_SHIPMENT_METHODS_UPDATED = "/PRODUCT_STORE_SHIPMENT_METHODS_UPDATED" +export const NET_SUITE_PAYMENT_METHODS_UPDATED = "/PAYMENT_METHODS_UPDATED" \ No newline at end of file diff --git a/src/store/modules/netSuite/mutations.ts b/src/store/modules/netSuite/mutations.ts new file mode 100644 index 0000000..509b5a9 --- /dev/null +++ b/src/store/modules/netSuite/mutations.ts @@ -0,0 +1,16 @@ +import { MutationTree } from "vuex" +import * as types from "./mutation-types" +import NetSuiteState from "./NetSuiteState" + +const mutations: MutationTree = { + [types.NET_SUITE_INVENTORY_VARIANCES_UPDATED] (state, payload) { + state.inventoryVariances = payload + }, + [types.NET_SUITE_PRODUCT_STORE_SHIPMENT_METHODS_UPDATED] (state, payload) { + state.productStoreShipmentMethods = payload + }, + [types.NET_SUITE_PAYMENT_METHODS_UPDATED] (state, payload) { + state.paymentMethods = payload + } +} +export default mutations; \ No newline at end of file From e17d912947a64b95de8fe30094b0bd3d3985d623 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Tue, 26 Nov 2024 20:01:50 +0530 Subject: [PATCH 05/27] Implemented: Made shipment method, payment method page dynamic, added services for integration & shopify type mappings(#37) --- src/components/Departments.vue | 93 -------- src/components/DiscountsModal.vue | 30 ++- src/components/InventoryVariances.vue | 92 -------- src/components/PaymentMethods.vue | 89 -------- src/components/PriceLevelModal.vue | 50 +++-- src/components/ProductStoreModal.vue | 39 +++- src/components/SalesChannel.vue | 89 -------- src/components/SftpModal.vue | 46 +++- src/components/ShipmentMethods.vue | 111 --------- src/components/TransferInventoryModal.vue | 30 ++- src/locales/en.json | 24 ++ src/router/index.ts | 10 +- src/services/NetSuiteService.ts | 46 +++- src/services/UtilService.ts | 9 + src/store/modules/netSuite/NetSuiteState.ts | 9 +- src/store/modules/netSuite/actions.ts | 91 +++++++- src/store/modules/netSuite/getters.ts | 9 + src/store/modules/netSuite/index.ts | 7 +- src/store/modules/netSuite/mutation-types.ts | 5 +- src/store/modules/netSuite/mutations.ts | 9 + src/store/modules/util/UtilState.ts | 1 + src/store/modules/util/actions.ts | 16 ++ src/store/modules/util/getters.ts | 3 + src/store/modules/util/index.ts | 1 + src/store/modules/util/mutation-types.ts | 1 + src/store/modules/util/mutations.ts | 3 + src/views/Departments.vue | 120 ++++++++++ src/views/InventoryVariances.vue | 99 ++++++++ src/views/NetSuite.vue | 78 ++++--- src/views/PaymentMethods.vue | 208 +++++++++++++++++ src/views/SalesChannel.vue | 119 ++++++++++ src/views/ShipmentMethods.vue | 224 +++++++++++++++++++ 32 files changed, 1179 insertions(+), 582 deletions(-) delete mode 100644 src/components/Departments.vue delete mode 100644 src/components/InventoryVariances.vue delete mode 100644 src/components/PaymentMethods.vue delete mode 100644 src/components/SalesChannel.vue delete mode 100644 src/components/ShipmentMethods.vue create mode 100644 src/views/Departments.vue create mode 100644 src/views/InventoryVariances.vue create mode 100644 src/views/PaymentMethods.vue create mode 100644 src/views/SalesChannel.vue create mode 100644 src/views/ShipmentMethods.vue diff --git a/src/components/Departments.vue b/src/components/Departments.vue deleted file mode 100644 index e22ff1e..0000000 --- a/src/components/Departments.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - \ No newline at end of file diff --git a/src/components/DiscountsModal.vue b/src/components/DiscountsModal.vue index 3b6971a..f5454f4 100644 --- a/src/components/DiscountsModal.vue +++ b/src/components/DiscountsModal.vue @@ -6,7 +6,7 @@ - {{ translate('Discounts') }} + {{ translate("Discounts") }} @@ -14,32 +14,46 @@ - Learn more about discounts in NetSuite + {{ translate("Learn more about discounts in NetSuite") }} - + - + - + + \ No newline at end of file diff --git a/src/components/InventoryVariances.vue b/src/components/InventoryVariances.vue deleted file mode 100644 index ddcf69b..0000000 --- a/src/components/InventoryVariances.vue +++ /dev/null @@ -1,92 +0,0 @@ - - - \ No newline at end of file diff --git a/src/components/PaymentMethods.vue b/src/components/PaymentMethods.vue deleted file mode 100644 index cdbcfcf..0000000 --- a/src/components/PaymentMethods.vue +++ /dev/null @@ -1,89 +0,0 @@ - - - \ No newline at end of file diff --git a/src/components/PriceLevelModal.vue b/src/components/PriceLevelModal.vue index 2f55166..fdb8209 100644 --- a/src/components/PriceLevelModal.vue +++ b/src/components/PriceLevelModal.vue @@ -6,7 +6,7 @@ - {{ translate('Price level') }} + {{ translate("Price level") }} @@ -14,31 +14,31 @@ - Learn more about price levels in NetSuite + {{ translate("Learn more about price levels in NetSuite") }} - + - Frequently used - + {{ translate("Frequently used") }} + - + - Base leave -

Defaults to product price set in NetSuite

+ {{ translate("Base leave") }} +

{{ translate("Defaults to product price set in NetSuite") }}

- + - Custom -

Use the price a product was sold at in the order.

+ {{ translate("Custom") }} +

{{ translate("Use the price a product was sold at in the order.") }}

@@ -46,18 +46,42 @@
- + + \ No newline at end of file diff --git a/src/components/ProductStoreModal.vue b/src/components/ProductStoreModal.vue index bbc2d79..887a0d6 100644 --- a/src/components/ProductStoreModal.vue +++ b/src/components/ProductStoreModal.vue @@ -6,7 +6,7 @@ - {{ translate('Product Store') }} + {{ translate("Product Store") }} @@ -14,36 +14,57 @@ - Learn more about mapping product stores to subsidiaries + {{ translate("Learn more about mapping product stores to subsidiaries") }} - - Male - Female - Not decided yet + + + {{ store.storeName ? store.storeName : store.productStoreId }} + - + - + \ No newline at end of file diff --git a/src/components/SalesChannel.vue b/src/components/SalesChannel.vue deleted file mode 100644 index e67a44c..0000000 --- a/src/components/SalesChannel.vue +++ /dev/null @@ -1,89 +0,0 @@ - - - \ No newline at end of file diff --git a/src/components/SftpModal.vue b/src/components/SftpModal.vue index 19ad255..f126c98 100644 --- a/src/components/SftpModal.vue +++ b/src/components/SftpModal.vue @@ -14,42 +14,68 @@ - Learn more about NetSuite SFTP configuration. + {{ translate("Learn more about NetSuite SFTP configuration.") }} - + - + - + - + - + - + - + + \ No newline at end of file diff --git a/src/components/ShipmentMethods.vue b/src/components/ShipmentMethods.vue deleted file mode 100644 index 21f8974..0000000 --- a/src/components/ShipmentMethods.vue +++ /dev/null @@ -1,111 +0,0 @@ - - - \ No newline at end of file diff --git a/src/components/TransferInventoryModal.vue b/src/components/TransferInventoryModal.vue index 20f4588..44dd9c7 100644 --- a/src/components/TransferInventoryModal.vue +++ b/src/components/TransferInventoryModal.vue @@ -6,7 +6,7 @@ - {{ translate('Transfer Inventory') }} + {{ translate("Transfer Inventory") }} @@ -14,7 +14,7 @@ - Learn more about creating inventory transfers from inventory variances + {{ translate("Learn more about creating inventory transfers from inventory variances") }} @@ -22,29 +22,39 @@ - Facility wise inventory transfer -

If each facility has its own dedicated inventory transfer location for this variance, configure the transfer location from the facility configuration section

+ {{ translate("Facility wise inventory transfer") }} +

{{ translate("If each facility has its own dedicated inventory transfer location for this variance, configure the transfer location from the facility configuration section") }}

- + - + + \ No newline at end of file diff --git a/src/locales/en.json b/src/locales/en.json index d2e679b..0b83d4d 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -3,9 +3,14 @@ "Add a custom prefix to HotWax order IDs: 10001": "Add a custom prefix to HotWax order IDs: 10001", "Add configurations": "Add configurations", "Add more shipment methods": "Add more shipment methods", + "Add Netsuite Id": "Add Netsuite Id", + "Add Netsuite department Id": "Add Netsuite department Id", + "Add Netsuite sales channel Id": "Add Netsuite sales channel Id", + "Add Netsuite payment method Id": "Add Netsuite payment method Id", "Analyzing the question to answer your question.": "Analyzing the question to answer your question.", "Answer based on resources": "Answer based on {count} resources", "App": "App", + "Apply": "Apply", "Approval": "Approval", "Approve on import": "Approve on import", "Ask": "Ask", @@ -14,6 +19,7 @@ "Auto approve orders": "Auto approve orders", "Auto cancellations days": "Auto cancellations days", "Auto order cancellation": "Auto order cancellation", + "Base leave": "Base leave", "Brokering": "Brokering", "Built:": "Built: {builtTime}", "Cancel": "Cancel", @@ -37,7 +43,9 @@ "Create new product store": "Create new product store", "Create new tag": "Create new tag", "Create product store": "Create product store", + "Custom": "Custom", "Customers pending sync": "Customers pending sync", + "Defaults to product price set in NetSuite": "Defaults to product price set in NetSuite", "days count": "days count", "Departments": "Departments", "Delivery address": "Delivery address", @@ -58,6 +66,7 @@ "Fetching time zones": "Fetching time zones", "For an order to sync with NetSuite, the payment method on that order must be mapped to a NetSuite shipment method ID.": "For an order to sync with NetSuite, the payment method on that order must be mapped to a NetSuite shipment method ID.", "For an order to sync with NetSuite, the shipment method on that order must be mapped to a NetSuite shipment method ID.": "For an order to sync with NetSuite, the shipment method on that order must be mapped to a NetSuite shipment method ID.", + "Frequently used": "Frequently used", "Fulfillment": "Fulfillment", "Global identifier": "Global identifier", "Go to OMS": "Go to OMS", @@ -78,18 +87,32 @@ "Inventory variances": "Inventory variances", "Inventory variances synced to NetSuite": "Inventory variances synced to NetSuite", "Learn more about NetSuite SFTP configuration.": "Learn more about NetSuite SFTP configuration.", + "Learn more about discounts in NetSuite": "Learn more about discounts in NetSuite", + "Learn more about price levels in NetSuite": "Learn more about price levels in NetSuite", "Learn more about mapping product stores to subsidiaries": "Learn more about mapping product stores to subsidiaries", "Learn more about creating inventory transfers from inventory variances": "Learn more about creating inventory transfers from inventory variances", + "Learn more about mapping departments with NetSuite to make sure orders are attributed correctly.": "Learn more about mapping departments with NetSuite to make sure orders are attributed correctly.", + "Learn more about mapping sales channels with NetSuite to make sure orders are attributed correctly.": "Learn more about mapping sales channels with NetSuite to make sure orders are attributed correctly.", "Login": "Login", "Logging in...": "Logging in...", "Logout": "Logout", "Map payment methods with NetSuite": "Map payment methods with NetSuite", "Map shipment methods to NetSuite": "Map shipment methods to NetSuite", + "Map departments with NetSuite": "Map departments with NetSuite", + "Map sales channel with NetSuite": "Map sales channel with NetSuite", "Manage configurations": "Manage configurations", "Minimum shipment threshold": "Minimum shipment threshold", "Name": "Name", "NetSuite": "NetSuite", "NetSuite ID": "NetSuite ID", + "NetSuite id": "NetSuite id", + "NetSuite Id updated successfully.": "NetSuite Id updated successfully.", + "NetSuite department ID": "NetSuite department ID", + "NetSuite department Id updated successfully.": "NetSuite department Id updated successfully.", + "NetSuite payment method ID": "NetSuite payment method ID", + "NetSuite payment method Id updated successfully.": "NetSuite payment method Id updated successfully.", + "NetSuite sales channel": "NetSuite sales channel", + "NetSuite sales channel Id updated successfully.": "NetSuite sales channel Id updated successfully.", "NetSuite transfer location": "NetSuite transfer location", "No answer found.": "No answer found.", "No page found.": "No page found.", @@ -189,6 +212,7 @@ "Update": "Update", "Update tracking information upon order shipment in Shopify.": "Update tracking information upon order shipment in Shopify.", "Username": "Username", + "Use the price a product was sold at in the order.": "Use the price a product was sold at in the order.", "variances in 7 days": "variances in 7 days", "Version:": "Version: {appVersion}" } \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 41120e7..69ce5bd 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -7,12 +7,12 @@ import ProductStoreDetails from "@/views/ProductStoreDetails.vue"; import ProductStore from "@/views/ProductStore.vue"; import NetSuite from "@/views/NetSuite.vue"; import Settings from "@/views/Settings.vue" -import ShipmentMethods from "@/components/ShipmentMethods.vue" import Facilities from "@/components/Facilities.vue"; -import InventoryVariances from "@/components/InventoryVariances.vue"; -import PaymentMethods from "@/components/PaymentMethods.vue"; -import SalesChannel from "@/components/SalesChannel.vue"; -import Departments from "@/components/Departments.vue"; +import ShipmentMethods from "@/views/ShipmentMethods.vue" +import InventoryVariances from "@/views/InventoryVariances.vue"; +import PaymentMethods from "@/views/PaymentMethods.vue"; +import SalesChannel from "@/views/SalesChannel.vue"; +import Departments from "@/views/Departments.vue"; import { DxpLogin, useAuthStore } from "@hotwax/dxp-components"; import { loader } from '@/user-utils'; diff --git a/src/services/NetSuiteService.ts b/src/services/NetSuiteService.ts index 06e3da7..4926cb2 100644 --- a/src/services/NetSuiteService.ts +++ b/src/services/NetSuiteService.ts @@ -18,9 +18,51 @@ const fetchPaymentMethods = async (payload: any): Promise => { }); } +const fetchIntegrationTypeMappings = async (payload: any): Promise => { + return api({ + url: "integrationTypeMappings", + method: "get", + params: payload + }) +} + +const fetchShopifyTypeMappings = async (payload: any): Promise => { + return api({ + url: "shopifyShops/typeMappings", + method: "get", + params: payload + }) +} + +const addIntegrationTypeMappings = async (payload: any): Promise => { + return api({ + url: "integrationTypeMappings", + method: "post", + data: payload + }) +} + +const updateIntegrationTypeMappings = async (payload: any, integrationMappingId: any): Promise => { + return api({ + url: `integrationTypeMappings/${integrationMappingId}`, + method: "post", + data: payload + }) +} + +const deleteNetsuiteId = async (payload: any): Promise => { + return api({ + url: `integrationTypeMappings/${payload}`, + method: "delete" + }) +} export const NetSuiteService = { fetchProductStoreShipmentMethods, - fetchPaymentMethods - + fetchPaymentMethods, + fetchIntegrationTypeMappings, + fetchShopifyTypeMappings, + addIntegrationTypeMappings, + updateIntegrationTypeMappings, + deleteNetsuiteId } \ No newline at end of file diff --git a/src/services/UtilService.ts b/src/services/UtilService.ts index 6ef0958..4c66688 100644 --- a/src/services/UtilService.ts +++ b/src/services/UtilService.ts @@ -16,6 +16,14 @@ const fetchFacilityGroups = async (payload: any): Promise => { }); } +const fetchFacilities = async (payload: any): Promise => { + return api({ + url: "facilities", + method: "get", + params: payload + }) +} + const fetchOperatingCountries = async (payload: any): Promise => { return api({ url: "countries", @@ -52,6 +60,7 @@ export const UtilService = { fetchDBICCountries, fetchEnums, fetchFacilityGroups, + fetchFacilities, fetchOperatingCountries, fetchOrganization, fetchShipmentMethodTypes diff --git a/src/store/modules/netSuite/NetSuiteState.ts b/src/store/modules/netSuite/NetSuiteState.ts index fcb6d87..7aeeb7e 100644 --- a/src/store/modules/netSuite/NetSuiteState.ts +++ b/src/store/modules/netSuite/NetSuiteState.ts @@ -1,5 +1,8 @@ export default interface NetSuiteState { - inventoryVariances: []; - productStoreShipmentMethods: {} - paymentMethods: {} + inventoryVariances: any; + productStoreShipmentMethods: any + paymentMethods: any + salesChannel: any + integrationTypeMappings: any + shopifyTypeMappings: any } \ No newline at end of file diff --git a/src/store/modules/netSuite/actions.ts b/src/store/modules/netSuite/actions.ts index 3014476..da0fee5 100644 --- a/src/store/modules/netSuite/actions.ts +++ b/src/store/modules/netSuite/actions.ts @@ -19,7 +19,6 @@ const actions: ActionTree = { } const resp = await UtilService.fetchEnums(payload) - if(!hasError(resp)) { inventoryVariances = resp.data } else { @@ -31,6 +30,29 @@ const actions: ActionTree = { commit(types.NET_SUITE_INVENTORY_VARIANCES_UPDATED, inventoryVariances) }, + + async fetchSalesChannel({ commit }) { + let salesChannel = [] as any; + try { + const payload = { + enumTypeId: ["ORDER_SALES_CHANNEL"], + enumTypeId_op: "in", + pageSize: 10, + } + + const resp = await UtilService.fetchEnums(payload) + if(!hasError(resp)) { + salesChannel = resp.data + } else { + throw resp.data + } + } catch (err) { + logger.error(err) + } + + commit(types.NET_SUITE_SALES_CHANNEL_UPDATED, salesChannel) + }, + async fetchPaymentMethods({ commit }) { let paymentMethods = [] as any; @@ -47,14 +69,14 @@ const actions: ActionTree = { } commit(types.NET_SUITE_PAYMENT_METHODS_UPDATED, paymentMethods); }, + async fetchProductStoreShipmentMethods({ state, commit }, payload) { - // let currentCarrier = JSON.parse(JSON.stringify(state.current)) - let productStoreShipmentMethods = [] as any; - // let pageIndex = 0 + let productStoreShipmentMethods = [] as any; let resp; try { resp = await NetSuiteService.fetchProductStoreShipmentMethods("STORE") + if (!hasError(resp) && resp.data) { productStoreShipmentMethods = resp.data } else { @@ -65,7 +87,66 @@ const actions: ActionTree = { } commit(types.NET_SUITE_PRODUCT_STORE_SHIPMENT_METHODS_UPDATED, productStoreShipmentMethods) }, + async fetchIntegrationTypeMappings({ commit }, integrationTypeId) { + let integrationTypeMappings = [] as any + let resp; -} + try { + const payload = { + integrationTypeId: integrationTypeId, + pageSize: 100 + } + + resp = await NetSuiteService.fetchIntegrationTypeMappings(payload) + if (!hasError(resp) && resp.data) { + const responseData = resp.data + integrationTypeMappings = responseData.reduce((integrationTypeId: any, integrationTypeMappings: any) => { + const typeId = integrationTypeMappings.integrationTypeId; + + if (!integrationTypeId[typeId]) { + integrationTypeId[typeId] = []; + } + integrationTypeId[typeId].push(integrationTypeMappings); + return integrationTypeId; + }, {}); + } else { + throw resp.data + } + } catch(error) { + logger.error(error); + } + commit(types.NET_SUITE_INTEGRATION_TYPE_MAPPINGS_UPDATED, integrationTypeMappings) + }, + async fetchShopifyTypeMappings({commit}, mappedTypeId) { + let shopifyTypeMappings = [] as any + let resp; + + try { + const payload = { + mappedTypeId: mappedTypeId, + pageSize: 100 + } + + resp = await NetSuiteService.fetchShopifyTypeMappings(payload) + if (!hasError(resp) && resp.data) { + const responseData = resp.data + shopifyTypeMappings = responseData.reduce((mappedTypeId: any, shopifyTypeMappings: any) => { + const typeId = shopifyTypeMappings.mappedTypeId; + + if (!mappedTypeId[typeId]) { + mappedTypeId[typeId] = []; + } + mappedTypeId[typeId].push(shopifyTypeMappings); + return mappedTypeId; + }, {}); + } else { + throw resp.data + } + } catch(error) { + logger.error(error); + } + commit(types.NET_SUITE_SHOPIFY_TYPE_MAPPINGS_UPDATED, shopifyTypeMappings) + } +} export default actions; \ No newline at end of file diff --git a/src/store/modules/netSuite/getters.ts b/src/store/modules/netSuite/getters.ts index 163bb82..5ad44e0 100644 --- a/src/store/modules/netSuite/getters.ts +++ b/src/store/modules/netSuite/getters.ts @@ -11,6 +11,15 @@ const getters: GetterTree = { }, getPaymentMehtods(state) { return state.paymentMethods + }, + getSalesChannel(state) { + return state.salesChannel + }, + getIntegrationTypeMappings: (state) => (typeId: any) => { + return state.integrationTypeMappings[typeId] ? state.integrationTypeMappings[typeId] : [] + }, + getShopifyTypeMappings: (state) => (typeId: any) => { + return state.shopifyTypeMappings[typeId] ? state.shopifyTypeMappings[typeId] : [] } } export default getters; \ No newline at end of file diff --git a/src/store/modules/netSuite/index.ts b/src/store/modules/netSuite/index.ts index 343a908..baaea17 100644 --- a/src/store/modules/netSuite/index.ts +++ b/src/store/modules/netSuite/index.ts @@ -9,8 +9,11 @@ const netSuiteModule: Module = { namespaced: true, state: { inventoryVariances: [], - productStoreShipmentMethods: {}, - paymentMethods: {} + productStoreShipmentMethods: [], + paymentMethods: [], + salesChannel: [], + integrationTypeMappings: [], + shopifyTypeMappings: [] }, getters, actions, diff --git a/src/store/modules/netSuite/mutation-types.ts b/src/store/modules/netSuite/mutation-types.ts index 015e070..0750200 100644 --- a/src/store/modules/netSuite/mutation-types.ts +++ b/src/store/modules/netSuite/mutation-types.ts @@ -1,4 +1,7 @@ export const SN_NET_SUITE = "netSuite" export const NET_SUITE_INVENTORY_VARIANCES_UPDATED = "/INVENTORY_VARIANCES_UPDATED" export const NET_SUITE_PRODUCT_STORE_SHIPMENT_METHODS_UPDATED = "/PRODUCT_STORE_SHIPMENT_METHODS_UPDATED" -export const NET_SUITE_PAYMENT_METHODS_UPDATED = "/PAYMENT_METHODS_UPDATED" \ No newline at end of file +export const NET_SUITE_PAYMENT_METHODS_UPDATED = "/PAYMENT_METHODS_UPDATED" +export const NET_SUITE_SALES_CHANNEL_UPDATED = "/SALES_CHANNEL_UPDATED" +export const NET_SUITE_INTEGRATION_TYPE_MAPPINGS_UPDATED = "/INTEGRATION_TYPE_MAPPINGS_UPDATED" +export const NET_SUITE_SHOPIFY_TYPE_MAPPINGS_UPDATED = "/SHOPIFY_TYPE_MAPPINGS_UPDATED" \ No newline at end of file diff --git a/src/store/modules/netSuite/mutations.ts b/src/store/modules/netSuite/mutations.ts index 509b5a9..c0b7a77 100644 --- a/src/store/modules/netSuite/mutations.ts +++ b/src/store/modules/netSuite/mutations.ts @@ -11,6 +11,15 @@ const mutations: MutationTree = { }, [types.NET_SUITE_PAYMENT_METHODS_UPDATED] (state, payload) { state.paymentMethods = payload + }, + [types.NET_SUITE_SALES_CHANNEL_UPDATED] (state, payload) { + state.salesChannel = payload + }, + [types.NET_SUITE_INTEGRATION_TYPE_MAPPINGS_UPDATED] (state, payload) { + state.integrationTypeMappings = payload + }, + [types.NET_SUITE_SHOPIFY_TYPE_MAPPINGS_UPDATED] (state, payload) { + state.shopifyTypeMappings = payload } } export default mutations; \ No newline at end of file diff --git a/src/store/modules/util/UtilState.ts b/src/store/modules/util/UtilState.ts index 79bd87e..bf17cc1 100644 --- a/src/store/modules/util/UtilState.ts +++ b/src/store/modules/util/UtilState.ts @@ -1,5 +1,6 @@ export default interface UtilState { facilityGroups: any; + facilities: any; operatingCountries: any; dbicCountries: any; productIdentifiers: any; diff --git a/src/store/modules/util/actions.ts b/src/store/modules/util/actions.ts index fa1bd2e..d2233a1 100644 --- a/src/store/modules/util/actions.ts +++ b/src/store/modules/util/actions.ts @@ -25,6 +25,22 @@ const actions: ActionTree = { commit(types.UTIL_FACILITY_GROUPS_UPDATED, facilityGroups); }, + async fetchFacilities({ state, commit }) { + let facilities = [] as any, resp; + + try { + resp = await UtilService.fetchFacilities({ pageSize: 100 }) + if(!hasError(resp) && resp.data) { + facilities = resp.data + } else { + throw resp.data + } + } catch(error) { + logger.error(error); + } + commit(types.UTIL_FACILITIES_UPDATED, facilities) + }, + async fetchDBICCountries({ commit }) { let countries = [] as any; diff --git a/src/store/modules/util/getters.ts b/src/store/modules/util/getters.ts index 6cb3c03..ece8d95 100644 --- a/src/store/modules/util/getters.ts +++ b/src/store/modules/util/getters.ts @@ -6,6 +6,9 @@ const getters: GetterTree = { getFacilityGroups(state) { return state.facilityGroups }, + getFacilities(state) { + return state.facilities + }, getOperatingCountries(state) { return state.operatingCountries; }, diff --git a/src/store/modules/util/index.ts b/src/store/modules/util/index.ts index 4f4aabd..52c5f3c 100644 --- a/src/store/modules/util/index.ts +++ b/src/store/modules/util/index.ts @@ -9,6 +9,7 @@ const utilModule: Module = { namespaced: true, state: { facilityGroups: [], + facilities: [], operatingCountries: [], dbicCountries: {}, productIdentifiers: [], diff --git a/src/store/modules/util/mutation-types.ts b/src/store/modules/util/mutation-types.ts index 8d48782..4f2a326 100644 --- a/src/store/modules/util/mutation-types.ts +++ b/src/store/modules/util/mutation-types.ts @@ -1,5 +1,6 @@ export const SN_UTIL = "util" export const UTIL_FACILITY_GROUPS_UPDATED = SN_UTIL + "/FACILITY_GROUPS_UPDATED" +export const UTIL_FACILITIES_UPDATED = SN_UTIL + "/FACILITIES_UPDATED" export const UTIL_OPERATING_COUNTRIES_UPDATED = SN_UTIL + "/OPERATING_COUNTRIES_UPDATED" export const UTIL_DBIC_COUNTRIES_UPDATED = SN_UTIL + "/DBIC_COUNTRIES_UPDATED" export const UTIL_PRODUCT_IDENTIFIERS_UPDATED = SN_UTIL + "/PRODUCT_IDENTIFIERS_UPDATED" diff --git a/src/store/modules/util/mutations.ts b/src/store/modules/util/mutations.ts index e85404f..79f087b 100644 --- a/src/store/modules/util/mutations.ts +++ b/src/store/modules/util/mutations.ts @@ -6,6 +6,9 @@ const mutations: MutationTree = { [types.UTIL_FACILITY_GROUPS_UPDATED] (state, payload) { state.facilityGroups = payload }, + [types.UTIL_FACILITIES_UPDATED] (state, payload) { + state.facilities = payload + }, [types.UTIL_OPERATING_COUNTRIES_UPDATED] (state, payload) { state.operatingCountries = payload }, diff --git a/src/views/Departments.vue b/src/views/Departments.vue new file mode 100644 index 0000000..b11c362 --- /dev/null +++ b/src/views/Departments.vue @@ -0,0 +1,120 @@ + + + \ No newline at end of file diff --git a/src/views/InventoryVariances.vue b/src/views/InventoryVariances.vue new file mode 100644 index 0000000..ff01998 --- /dev/null +++ b/src/views/InventoryVariances.vue @@ -0,0 +1,99 @@ + + + + + \ No newline at end of file diff --git a/src/views/NetSuite.vue b/src/views/NetSuite.vue index 0ac1f6c..fb30088 100644 --- a/src/views/NetSuite.vue +++ b/src/views/NetSuite.vue @@ -16,7 +16,7 @@ 4 - Orders pending sync + {{ translate("Orders pending sync") }} @@ -24,7 +24,7 @@ 15 - Customers pending sync + {{ translate("Customers pending sync") }} @@ -32,78 +32,78 @@ 2 - Products pending sync + {{ ("Products pending sync") }}
-

Configuration

+

{{ translate("Configuration") }}

- - SFTP + + {{ translate("SFTP") }} - - Product Store - - - - Shipping methods - - - - Facilities + + {{ translate("Product Store") }}
- +
-

Products and Inventory

+

{{ translate("Products and Inventory") }}

- - Inventory variances + + {{ translate("Inventory variances") }} + + + + {{ translate("Facilities") }}
- +
-

Orders and fulfillment

+

{{ translate("Orders and fulfillment") }}

- - Payment method + + {{ translate("Shipping methods") }} - - Price level + + {{ translate("Payment method") }} - - Discounts + + {{ translate("Price level") }} - - Departments + + {{ translate("Discounts") }} - - Sales Channel + + {{ translate("Departments") }} + + + + {{ translate("Sales Channel") }}
-

Transfer orders

+

{{ translate("Transfer orders") }}

- - Transfer order fulfillment + + {{ translate("Transfer order fulfillment") }} - - Transfer order receipt + + {{ translate("Transfer order receipt") }}
@@ -121,11 +121,9 @@ import SftpModal from "@/components/SftpModal.vue"; import ProductStoreModal from "@/components/ProductStoreModal.vue"; import PriceLevelModal from "@/components/PriceLevelModal.vue"; import DiscountsModal from "@/components/DiscountsModal.vue"; -import SalesChannel from "@/components/SalesChannel.vue"; const router = useRouter(); - function openShipmentMethod() { router.push("/netsuite/shipment-methods") } @@ -185,7 +183,7 @@ ion-card { } .item-box::part(native) { - border-radius: 8px; + --border-radius: 8px; } section { diff --git a/src/views/PaymentMethods.vue b/src/views/PaymentMethods.vue new file mode 100644 index 0000000..1fd7d8b --- /dev/null +++ b/src/views/PaymentMethods.vue @@ -0,0 +1,208 @@ + + + \ No newline at end of file diff --git a/src/views/SalesChannel.vue b/src/views/SalesChannel.vue new file mode 100644 index 0000000..e0fbfec --- /dev/null +++ b/src/views/SalesChannel.vue @@ -0,0 +1,119 @@ + + + \ No newline at end of file diff --git a/src/views/ShipmentMethods.vue b/src/views/ShipmentMethods.vue new file mode 100644 index 0000000..447124e --- /dev/null +++ b/src/views/ShipmentMethods.vue @@ -0,0 +1,224 @@ + + + \ No newline at end of file From 195f0764e796879e3f1ff0cf2fc78d7a1e93c6d4 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Tue, 3 Dec 2024 15:28:31 +0530 Subject: [PATCH 06/27] Implemented: integrated APIs for adding, updating & removing the netsuite Id(#37) --- src/components/DiscountsModal.vue | 80 +++++++++-- src/components/PriceLevelModal.vue | 51 ++++--- src/components/ProductStoreModal.vue | 44 ++++-- src/components/SftpModal.vue | 63 +++++--- src/components/TransferInventoryModal.vue | 47 +++++- src/composables/useNetSuiteComposables.d.ts | 8 ++ src/composables/useNetSuiteComposables.ts | 127 +++++++++++++++++ src/locales/en.json | 28 +++- src/services/NetSuiteService.ts | 52 +++++-- src/services/UtilService.ts | 18 +++ src/store/modules/netSuite/NetSuiteState.ts | 2 + src/store/modules/netSuite/actions.ts | 67 ++++++++- src/store/modules/netSuite/getters.ts | 6 + src/store/modules/netSuite/index.ts | 6 +- src/store/modules/netSuite/mutation-types.ts | 4 +- src/store/modules/netSuite/mutations.ts | 6 + .../modules/productStore/ProductStoreState.ts | 1 + src/store/modules/productStore/actions.ts | 4 + src/store/modules/productStore/getters.ts | 3 + src/store/modules/productStore/index.ts | 3 +- .../modules/productStore/mutation-types.ts | 3 +- src/store/modules/productStore/mutations.ts | 3 + src/store/modules/util/actions.ts | 3 +- src/views/Departments.vue | 99 ++++++++++--- src/views/InventoryVariances.vue | 82 +++++++++-- src/views/NetSuite.vue | 27 ++-- src/views/PaymentMethods.vue | 117 ++------------- src/views/SalesChannel.vue | 77 +++++++--- src/views/ShipmentMethods.vue | 134 +++--------------- tsconfig.json | 1 + 30 files changed, 793 insertions(+), 373 deletions(-) create mode 100644 src/composables/useNetSuiteComposables.d.ts create mode 100644 src/composables/useNetSuiteComposables.ts diff --git a/src/components/DiscountsModal.vue b/src/components/DiscountsModal.vue index f5454f4..da1f827 100644 --- a/src/components/DiscountsModal.vue +++ b/src/components/DiscountsModal.vue @@ -20,15 +20,15 @@ - + - + - + @@ -40,20 +40,78 @@ import { ref } from 'vue'; import { IonButton, IonButtons, IonContent, IonFab, IonFabButton, IonHeader, IonIcon, IonInput, IonItem, IonLabel, IonTitle, IonToolbar, modalController } from "@ionic/vue"; import { closeOutline, informationCircleOutline, openOutline, saveOutline } from 'ionicons/icons'; import { translate } from '@hotwax/dxp-components'; +import { useStore } from "vuex"; +import { computed, onMounted } from "vue"; +import { showToast } from '@/utils'; +import { useNetSuiteComposables } from "@/composables/useNetSuiteComposables"; -const orderLevelDiscount = ref(''); -const itemLevelDiscount = ref(''); + + +const store = useStore(); + +const { addNetSuiteId, updateNetSuiteId } = useNetSuiteComposables("NETSUITE_DISC_MTHD") + +const integrationTypeMappings = computed(() => store.getters["netSuite/getIntegrationTypeMappings"]("NETSUITE_DISC_MTHD")) + +const orderLevelDiscount = ref(""); +const itemLevelDiscount = ref(""); + +const mappingKeys = { + order: "SHOPIFY_DISC", + item: "SHOPIFY_ITEM_DISC" +}; + +onMounted(async () => { + await store.dispatch("netSuite/fetchIntegrationTypeMappings", "NETSUITE_DISC_MTHD") + + // Set orderLevelDiscount and itemLevelDiscount based on their corresponding mapping keys in integration type mappings. + integrationTypeMappings.value.forEach((mapping: any) => { + if (mapping.mappingKey === mappingKeys.order) { + orderLevelDiscount.value = mapping.mappingValue; + } else if (mapping.mappingKey === mappingKeys.item) { + itemLevelDiscount.value = mapping.mappingValue; + } + }); +}) function closeModal() { modalController.dismiss({ dismissed: true }); } -function saveDiscountItemIds() { - const payload = { - orderLevelDiscount: orderLevelDiscount.value, - itemLevelDiscount: itemLevelDiscount.value, - }; - +async function editNetSuiteDiscountItemIds() { + if (!orderLevelDiscount.value && !itemLevelDiscount.value) { + showToast(translate("Please enter a valid NetSuite ID")); + return; + } + + await updateMapping(mappingKeys.order, orderLevelDiscount.value); + await updateMapping(mappingKeys.item, itemLevelDiscount.value); + closeModal(); } + +async function updateMapping(mappingKey: any, mappingValue: any) { + const integrationMappings = integrationTypeMappings.value; + const currentMapping = integrationMappings.find((mapping: any) => mapping.mappingKey === mappingKey); + + if (currentMapping?.mappingValue === mappingValue) { + showToast(translate("Please update the NetSuite ID")); + return; + } + + if (mappingValue) { + const payload = { + integrationTypeId: "NETSUITE_DISC_MTHD", + mappingKey, + mappingValue, + }; + + if (currentMapping?.integrationMappingId) { + await updateNetSuiteId(payload, currentMapping.integrationMappingId); + } else { + await addNetSuiteId(payload); + } + } +} + \ No newline at end of file diff --git a/src/components/PriceLevelModal.vue b/src/components/PriceLevelModal.vue index fdb8209..6cffed5 100644 --- a/src/components/PriceLevelModal.vue +++ b/src/components/PriceLevelModal.vue @@ -20,14 +20,14 @@ - + {{ translate("Frequently used") }} - + - + {{ translate("Base leave") }}

{{ translate("Defaults to product price set in NetSuite") }}

@@ -35,7 +35,7 @@
- + {{ translate("Custom") }}

{{ translate("Use the price a product was sold at in the order.") }}

@@ -54,34 +54,41 @@ \ No newline at end of file diff --git a/src/components/ProductStoreModal.vue b/src/components/ProductStoreModal.vue index 887a0d6..0b46d1b 100644 --- a/src/components/ProductStoreModal.vue +++ b/src/components/ProductStoreModal.vue @@ -20,7 +20,7 @@
- + {{ store.storeName ? store.storeName : store.productStoreId }} @@ -28,29 +28,34 @@ - + - + + \ No newline at end of file diff --git a/src/components/SftpModal.vue b/src/components/SftpModal.vue index f126c98..9545e42 100644 --- a/src/components/SftpModal.vue +++ b/src/components/SftpModal.vue @@ -20,23 +20,24 @@ - + - + - + - + - + - + + @@ -50,32 +51,48 @@ import { ref } from 'vue'; import { IonButton, IonButtons, IonContent, IonFab, IonFabButton, IonHeader, IonIcon, IonInput, IonItem, IonLabel, IonTitle, IonToolbar, modalController } from "@ionic/vue"; import { closeOutline, informationCircleOutline, openOutline, saveOutline } from 'ionicons/icons'; import { translate } from '@hotwax/dxp-components'; +import { NetSuiteService } from '@/services/NetSuiteService'; +import { hasError, showToast } from '@/utils'; +import emitter from "@/event-bus"; +import logger from "@/logger"; const sftpFormData = ref({ - guid: '', - server: '', - userId: '', - port: '', - hostKey: '', - defaultDirectory: '' + guid: "", + server: "", + userId: "", + port: "", + hostKey: "", + defaultDirectory: "" }); function closeModal() { modalController.dismiss({ dismissed: true }); } -function saveSftpConfig() { - const payload = { - guid: sftpFormData.value.guid, - server: sftpFormData.value.server, - userId: sftpFormData.value.userId, - port: sftpFormData.value.port, - hostKey: sftpFormData.value.hostKey, - defaultDirectory: sftpFormData.value.defaultDirectory - }; +async function saveSftpConfig() { + try { + const payload = { + guid: sftpFormData.value.guid, + server: sftpFormData.value.server, + userId: sftpFormData.value.userId, + port: sftpFormData.value.port, + hostKey: sftpFormData.value.hostKey, + defaultDirectory: sftpFormData.value.defaultDirectory + }; + + const resp = await NetSuiteService.updateSftpConfig(payload); + + if(!hasError(resp)) { + showToast("SFTP configurations updated successfully") + } else { + throw resp.data; + } + } catch(error: any) { + logger.error(error); + showToast(translate("Failed to update SFTP configurations")) + } + emitter.emit("dismissLoader") closeModal(); - // Here you would typically call the API to save the data - // For now, we just log the payload } \ No newline at end of file diff --git a/src/components/TransferInventoryModal.vue b/src/components/TransferInventoryModal.vue index 44dd9c7..76009fc 100644 --- a/src/components/TransferInventoryModal.vue +++ b/src/components/TransferInventoryModal.vue @@ -28,11 +28,11 @@ - + - + @@ -44,17 +44,50 @@ import { IonButton, IonButtons, IonContent, IonFab, IonFabButton, IonHeader, IonIcon, IonInput, IonItem, IonLabel, IonTitle, IonToolbar, modalController } from "@ionic/vue"; import { businessOutline, closeOutline, informationCircleOutline, openOutline, saveOutline } from 'ionicons/icons'; import { translate } from '@hotwax/dxp-components'; -import { defineProps, ref } from 'vue'; +import { defineProps, onMounted, ref } from 'vue'; +import { useNetSuiteComposables } from "@/composables/useNetSuiteComposables"; +import { showToast } from "@/utils"; -const props = defineProps(["varianceEnumId"]); -const transferLocationId = ref(''); +const { addNetSuiteId, updateNetSuiteId } = useNetSuiteComposables("NETSUITE_VAR_TRAN"); -function saveTransferInventory() { +const props = defineProps(["varianceEnumId", "integrationMapping"]); + +const transferLocationId = ref(""); + +onMounted(async() => { + if (props.integrationMapping?.mappingValue) { + transferLocationId.value = props.integrationMapping?.mappingValue; + } +}) + +// Validates the input data, saves or updates NetSuite facility ID for inventory transfers associated with the integration type ID: NETSUITE_VAR_TRAN. +async function saveTransferInventoryNetSuiteId() { + if(!transferLocationId.value) { + showToast("Please enter a valid NetSuite ID"); + return false; + } + + if(props.integrationMapping?.mappingValue === transferLocationId.value) { + showToast("Please update the NetSuite ID"); + return false; + } + + const payload = { + integrationTypeId: "NETSUITE_VAR_TRAN", + mappingKey: props.varianceEnumId, + mappingValue: transferLocationId.value + }; + + if(props.integrationMapping.integrationMappingId) { + await updateNetSuiteId(payload, props.integrationMapping.integrationMappingId) + } else { + await addNetSuiteId(payload) + } closeModal(); } function closeModal() { - modalController.dismiss({ dismissed: true, transferLocationId: transferLocationId.value }); + modalController.dismiss({ dismissed: true }); } \ No newline at end of file diff --git a/src/composables/useNetSuiteComposables.d.ts b/src/composables/useNetSuiteComposables.d.ts new file mode 100644 index 0000000..d209264 --- /dev/null +++ b/src/composables/useNetSuiteComposables.d.ts @@ -0,0 +1,8 @@ +declare module "@/composables/useNetSuiteComposables" { + export function useNetSuiteComposables(integrationTypeId: string): { + editNetSuiteId: (mappingKey: any, integrationMapping: any) => Promise; + addNetSuiteId: (payload: any) => Promise; + updateNetSuiteId: (payload: any, integrationMappingId: any) => Promise; + removeNetSuiteId: (integrationMappingId: any) => Promise; + }; +} \ No newline at end of file diff --git a/src/composables/useNetSuiteComposables.ts b/src/composables/useNetSuiteComposables.ts new file mode 100644 index 0000000..5d56562 --- /dev/null +++ b/src/composables/useNetSuiteComposables.ts @@ -0,0 +1,127 @@ +import { showToast, hasError } from '@/utils'; +import emitter from "@/event-bus"; +import logger from '@/logger'; +import { NetSuiteService } from '@/services/NetSuiteService'; +import { useStore } from "vuex"; +import { alertController } from '@ionic/vue'; +import { translate } from '@hotwax/dxp-components'; + +export function useNetSuiteComposables(integrationTypeId: any) { + + const store = useStore(); + + // This function opens an alert dialog to edit the NetSuite ID, taking a mapping key and the current integration mapping as parameters. + const editNetSuiteId = async (mappingKey: any, integrationMapping: any) => { + const alert = await alertController.create({ + header: translate("Add NetSuite ID"), + inputs: [{ + name: "netSuiteId", + value: integrationMapping?.integrationMappingId ? integrationMapping.mappingValue : "" + }], + buttons: [ + { + text: translate("Cancel"), + role: "cancel" + }, + { + text: translate("Apply"), + handler: async (data) => { + const netSuiteId = data.netSuiteId.trim(); + + if (!netSuiteId) { + showToast(translate("Please enter a valid NetSuite ID")); + return false; + } + + if (integrationMapping?.mappingValue === netSuiteId) { + showToast(translate("Please update the NetSuite ID")); + return false; + } + + const payload = { + integrationTypeId: integrationTypeId, + mappingKey: mappingKey, + mappingValue: netSuiteId + }; + + if (integrationMapping?.integrationMappingId) { + await updateNetSuiteId(payload, integrationMapping.integrationMappingId); + } else { + await addNetSuiteId(payload); + } + } + } + ] + }); + await alert.present(); + }; + + // This function adds a new NetSuite ID mapping, using a payload that contains the integration type ID, mapping key, and mapping value. + const addNetSuiteId = async (payload: any) => { + emitter.emit("presentLoader"); + let resp; + + try { + resp = await NetSuiteService.addIntegrationTypeMappings(payload); + if (!hasError(resp)) { + showToast(translate("NetSuite Id updated successfully")); + if(payload.integrationTypeId !== "NETSUITE_DISC_MTHD") { + await store.dispatch("netSuite/fetchIntegrationTypeMappings", integrationTypeId); + } + } else { + throw resp.data; + } + } catch (err) { + logger.error(err); + } + emitter.emit('dismissLoader'); + }; + + // This function updates an existing NetSuite ID mapping, taking a payload for the update and the integration mapping Id that needs to be updated. + const updateNetSuiteId = async (payload: any, integrationMappingId: any) => { + emitter.emit("presentLoader"); + let resp; + + try { + resp = await NetSuiteService.updateIntegrationTypeMappings(payload, integrationMappingId); + if (!hasError(resp)) { + showToast(translate("NetSuite Id updated successfully")); + if(payload.integrationTypeId !== "NETSUITE_DISC_MTHD") { + await store.dispatch("netSuite/fetchIntegrationTypeMappings", integrationTypeId); + } + } else { + throw resp.data; + } + } catch (err) { + logger.error(err); + } + emitter.emit('dismissLoader'); + }; + + // This function removes a NetSuite ID mapping based on its integration mapping Id, which is passed as a parameter. + const removeNetSuiteId = async (integrationMappingId: any) => { + emitter.emit('presentLoader'); + let resp; + + try { + resp = await NetSuiteService.removeIntegrationMappingValue(integrationMappingId); + console.log(resp, integrationMappingId); + if (!hasError(resp)) { + showToast(translate("NetSuite Id removed successfully")); + await store.dispatch("netSuite/fetchIntegrationTypeMappings", integrationTypeId); + } else { + throw resp.data; + } + } catch (err) { + logger.error(err); + } + emitter.emit('dismissLoader'); + }; + + return { + editNetSuiteId, + addNetSuiteId, + updateNetSuiteId, + removeNetSuiteId + }; +} \ No newline at end of file diff --git a/src/locales/en.json b/src/locales/en.json index 0b83d4d..9ca9aae 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -2,6 +2,7 @@ "Add": "Add", "Add a custom prefix to HotWax order IDs: 10001": "Add a custom prefix to HotWax order IDs: 10001", "Add configurations": "Add configurations", + "Address or domain of the SFTP server": "Address or domain of the SFTP server", "Add more shipment methods": "Add more shipment methods", "Add Netsuite Id": "Add Netsuite Id", "Add Netsuite department Id": "Add Netsuite department Id", @@ -16,10 +17,12 @@ "Ask": "Ask", "Ask...": "Ask...", "Ask me anything?": "Ask me anything?", + "Authentication key": "Authentication key", "Auto approve orders": "Auto approve orders", "Auto cancellations days": "Auto cancellations days", "Auto order cancellation": "Auto order cancellation", "Base leave": "Base leave", + "Base Price": "Base Price", "Brokering": "Brokering", "Built:": "Built: {builtTime}", "Cancel": "Cancel", @@ -45,6 +48,8 @@ "Create product store": "Create product store", "Custom": "Custom", "Customers pending sync": "Customers pending sync", + "DEFAULT DIRECTORY": "DEFAULT DIRECTORY", + "Default is 22": "Default is 22", "Defaults to product price set in NetSuite": "Defaults to product price set in NetSuite", "days count": "days count", "Departments": "Departments", @@ -73,7 +78,9 @@ "Go to Launchpad": "Go to Launchpad", "go to page": "go to page", "go to section": "go to section", + "GUID": "GUID", "Help": "Help", + "HOST KEY": "HOST KEY", "Hold pre-order physical inventory": "Hold pre-order physical inventory", "ID": "ID", "ID prefix": "ID prefix", @@ -86,6 +93,7 @@ "Inventory view": "Inventory view", "Inventory variances": "Inventory variances", "Inventory variances synced to NetSuite": "Inventory variances synced to NetSuite", + "Item level discounts": "Item level discounts", "Learn more about NetSuite SFTP configuration.": "Learn more about NetSuite SFTP configuration.", "Learn more about discounts in NetSuite": "Learn more about discounts in NetSuite", "Learn more about price levels in NetSuite": "Learn more about price levels in NetSuite", @@ -107,8 +115,12 @@ "NetSuite ID": "NetSuite ID", "NetSuite id": "NetSuite id", "NetSuite Id updated successfully.": "NetSuite Id updated successfully.", + "NetSuite Id removed successfully": "NetSuite Id removed successfully", + "NetSuite facility ID": "NetSuite facility ID", + "NetSuite discount item ID": "NetSuite discount item ID", "NetSuite department ID": "NetSuite department ID", - "NetSuite department Id updated successfully.": "NetSuite department Id updated successfully.", + "NetSuite department Id updated successfully": "NetSuite department Id updated successfully", + "NetSuite department Id removed successfully": "NetSuite department Id removed successfully", "NetSuite payment method ID": "NetSuite payment method ID", "NetSuite payment method Id updated successfully.": "NetSuite payment method Id updated successfully.", "NetSuite sales channel": "NetSuite sales channel", @@ -129,6 +141,7 @@ "Orders and fulfillment": "Orders and fulfillment", "Order brokering": "Order brokering", "Order edit permissions": "Order edit permissions", + "Order level discount": "Order level discount", "Orders pending sync": "Orders pending sync", "Order splitting": "Order splitting", "Orders tagged with this tag will undergo line item check for fulfillment facility selection.": "Orders tagged with this tag will undergo line item check for fulfillment facility selection.", @@ -137,6 +150,9 @@ "Payment method": "Payment method", "Payment methods": "Payment methods", "Pick up location": "Pick up location", + "Please enter a valid NetSuite ID": "Please enter a valid NetSuite ID", + "Please update the NetSuite ID": "Please update the NetSuite ID", + "PORT": "PORT", "Pre-order computation": "Pre-order computation", "Pre-order group": "Pre-order group", "Preferred identifier": "Preferred identifier", @@ -169,6 +185,7 @@ "Search country": "Search country", "Search time zones": "Search time zones", "Soft Allocation": "Soft Allocation", + "SERVER": "SERVER", "Search": "Search", "Search...": "Search...", "Searching your query.": "Searching your query.", @@ -181,6 +198,7 @@ "Settings": "Settings", "Setup product store": "Setup product store", "SFTP": "SFTP", + "SFTP username": "SFTP username", "Shipment methods": "Shipment methods", "Shipping methods": "Shipping methods", "shipping method": "{count} shipping method", @@ -194,6 +212,7 @@ "Split orders into multiple groups and fulfill them from different fulfillment centers.": "Split orders into multiple groups and fulfill them from different fulfillment centers.", "Store billing information associated with orders in OMS.": "Store billing information associated with orders in OMS.", "Store pickup": "Store pickup", + "Subsidiary": "Subsidiary", "Tags can't be empty.": "Tags can't be empty.", "Tag removed successfully.": "Tag removed successfully.", "Tag will hold the preselected fulfillment facility value.": "Tag will hold the preselected fulfillment facility value.", @@ -204,6 +223,7 @@ "threshold": "threshold", "Time zone updated successfully": "Time zone updated successfully", "Timezone": "Timezone", + "Transfer location": "Transfer location", "Transfer Inventory": "Transfer Inventory", "Transfer inventory": "Transfer inventory", "Transfer orders": "Transfer orders", @@ -211,8 +231,12 @@ "Transfer order receipt": "Transfer order receipt", "Update": "Update", "Update tracking information upon order shipment in Shopify.": "Update tracking information upon order shipment in Shopify.", + "Unique SFTP identifier": "Unique SFTP identifier", "Username": "Username", + "USER ID": "USER ID", + "Usually 1": "Usually 1", "Use the price a product was sold at in the order.": "Use the price a product was sold at in the order.", "variances in 7 days": "variances in 7 days", - "Version:": "Version: {appVersion}" + "Version:": "Version: {appVersion}", + "/home/-sftp/netsuite/": "/home/-sftp/netsuite/" } \ No newline at end of file diff --git a/src/services/NetSuiteService.ts b/src/services/NetSuiteService.ts index 4926cb2..0486f55 100644 --- a/src/services/NetSuiteService.ts +++ b/src/services/NetSuiteService.ts @@ -1,6 +1,4 @@ import api from "@/api" -import logger from "@/logger"; -import { hasError } from "@/utils"; const fetchProductStoreShipmentMethods = async (productStoreId: any): Promise => { @@ -18,17 +16,25 @@ const fetchPaymentMethods = async (payload: any): Promise => { }); } -const fetchIntegrationTypeMappings = async (payload: any): Promise => { +const fetchfacilitiesIdentifications = async (payload: any): Promise => { return api({ - url: "integrationTypeMappings", + url: "facilities/identifications", method: "get", params: payload }) } -const fetchShopifyTypeMappings = async (payload: any): Promise => { +const updateFacilityIdentification = async (payload: any): Promise => { return api({ - url: "shopifyShops/typeMappings", + url: "facilities/identifications", + method: "post", + data: payload + }) +} + +const fetchIntegrationTypeMappings = async (payload: any): Promise => { + return api({ + url: "integrationTypeMappings", method: "get", params: payload }) @@ -50,19 +56,49 @@ const updateIntegrationTypeMappings = async (payload: any, integrationMappingId: }) } -const deleteNetsuiteId = async (payload: any): Promise => { +const fetchShopifyTypeMappings = async (payload: any): Promise => { + return api({ + url: "shopifyShops/typeMappings", + method: "get", + params: payload + }) +} + +const removeIntegrationMappingValue = async (payload: any): Promise => { return api({ url: `integrationTypeMappings/${payload}`, method: "delete" }) } +// TODO: need to add dynamic api to update the sftp configs. +const updateSftpConfig = async (payload: any): Promise => { + return api({ + url: "updateSftp", + method: "post", + data: payload + }) +} + +const addEnumCode = async (payload: any): Promise => { + return api({ + url: "enums", + method: "post", + data: payload + }) +} + + export const NetSuiteService = { fetchProductStoreShipmentMethods, fetchPaymentMethods, + fetchfacilitiesIdentifications, + updateFacilityIdentification, fetchIntegrationTypeMappings, fetchShopifyTypeMappings, addIntegrationTypeMappings, updateIntegrationTypeMappings, - deleteNetsuiteId + removeIntegrationMappingValue, + updateSftpConfig, + addEnumCode } \ No newline at end of file diff --git a/src/services/UtilService.ts b/src/services/UtilService.ts index 4c66688..abba00b 100644 --- a/src/services/UtilService.ts +++ b/src/services/UtilService.ts @@ -40,6 +40,22 @@ const fetchEnums = async (payload: any): Promise => { }); } +const fetchEnumGroups = async (payload: any): Promise => { + return api({ + url: `enumGroups/${payload.enumerationGroupId}/members`, + method: "get", + params: payload + }); +} + +const addEnumToEnumGroup = async (payload: any): Promise => { + return api({ + url: `enumGroups/${payload.enumerationGroupId}/members`, + method: "post", + data: payload + }) +} + const fetchShipmentMethodTypes = async (payload: any): Promise => { return api({ url: "shipmentMethodTypes", @@ -59,6 +75,8 @@ const fetchOrganization = async (payload: any): Promise => { export const UtilService = { fetchDBICCountries, fetchEnums, + fetchEnumGroups, + addEnumToEnumGroup, fetchFacilityGroups, fetchFacilities, fetchOperatingCountries, diff --git a/src/store/modules/netSuite/NetSuiteState.ts b/src/store/modules/netSuite/NetSuiteState.ts index 7aeeb7e..dfa6742 100644 --- a/src/store/modules/netSuite/NetSuiteState.ts +++ b/src/store/modules/netSuite/NetSuiteState.ts @@ -5,4 +5,6 @@ export default interface NetSuiteState { salesChannel: any integrationTypeMappings: any shopifyTypeMappings: any + facilitiesIdentifications: any + enumsInEnumGroup: any } \ No newline at end of file diff --git a/src/store/modules/netSuite/actions.ts b/src/store/modules/netSuite/actions.ts index da0fee5..0f5988c 100644 --- a/src/store/modules/netSuite/actions.ts +++ b/src/store/modules/netSuite/actions.ts @@ -3,6 +3,7 @@ import RootState from "@/store/RootState" import * as types from "./mutation-types" import { hasError } from "@/utils" import logger from "@/logger" +import store from "@/store" import NetSuiteState from "./NetSuiteState" import { NetSuiteService } from "@/services/NetSuiteService" import { UtilService } from "@/services/UtilService" @@ -13,7 +14,7 @@ const actions: ActionTree = { let inventoryVariances = [] as any; try { const payload = { - enumTypeId: ["REPORT_AN_ISSUE", "RPRT_NO_VAR_LOG"], + enumTypeId: "IID_REASON", enumTypeId_op: "in", pageSize: 20, } @@ -31,13 +32,66 @@ const actions: ActionTree = { commit(types.NET_SUITE_INVENTORY_VARIANCES_UPDATED, inventoryVariances) }, + async fetchEnumGroups({commit}) { + let enumsInEnumGroup = [] as any; + try { + const payload = { + enumerationGroupId: "NETSUITE_IIV_REASON", + enumerationGroupId_op: "in", + pageSize: 20, + } + + const resp = await UtilService.fetchEnumGroups(payload) + + if(!hasError(resp) && resp.data) { + // TODO: need to remove this filter check , after api change of not giving expired results. + enumsInEnumGroup = resp.data.filter((item: any) => !item.thruDate).reduce((enumId: any, item: any) => { + enumId[item.enumerationId] = { + fromDate: item.fromDate, + enumerationGroupId: item.enumerationGroupId, + }; + return enumId; + }, {}); + } else { + throw resp.data + } + } catch (err) { + logger.error(err) + } + + commit(types.NET_SUITE_ENUM_GROUPS_UPDATED, enumsInEnumGroup) + }, + + async fetchFacilitiesIdentifications({ commit }) { + let facilitiesIdentifications = [] as any; + try { + const payload = { + facilityIdenTypeId: "ORDR_ORGN_DPT", + facilityIdenTypeId_op: "in", + pageSize: 20, + } + + const resp = await NetSuiteService.fetchfacilitiesIdentifications(payload) + if(!hasError(resp)) { + // TODO: need to handle the case of removing the facility from the faciliyIdentofication, need to add the thruDate in the payload + facilitiesIdentifications = resp.data.filter((item: any) => !item.thruDate) + } else { + throw resp.data + } + } catch (err) { + logger.error(err) + } + + commit(types.NET_SUITE_FACILITIES_IDENTIFICATIONS_UPDATED, facilitiesIdentifications) + }, + async fetchSalesChannel({ commit }) { let salesChannel = [] as any; try { const payload = { - enumTypeId: ["ORDER_SALES_CHANNEL"], + enumTypeId: "ORDER_SALES_CHANNEL", enumTypeId_op: "in", - pageSize: 10, + pageSize: 100, } const resp = await UtilService.fetchEnums(payload) @@ -75,7 +129,8 @@ const actions: ActionTree = { let resp; try { - resp = await NetSuiteService.fetchProductStoreShipmentMethods("STORE") + const productStoreId = store.getters["productStore/getSelectedProductStore"] + resp = await NetSuiteService.fetchProductStoreShipmentMethods(productStoreId) if (!hasError(resp) && resp.data) { productStoreShipmentMethods = resp.data @@ -87,6 +142,7 @@ const actions: ActionTree = { } commit(types.NET_SUITE_PRODUCT_STORE_SHIPMENT_METHODS_UPDATED, productStoreShipmentMethods) }, + async fetchIntegrationTypeMappings({ commit }, integrationTypeId) { let integrationTypeMappings = [] as any let resp; @@ -106,6 +162,7 @@ const actions: ActionTree = { if (!integrationTypeId[typeId]) { integrationTypeId[typeId] = []; } + integrationTypeId[typeId].push(integrationTypeMappings); return integrationTypeId; }, {}); @@ -117,6 +174,7 @@ const actions: ActionTree = { } commit(types.NET_SUITE_INTEGRATION_TYPE_MAPPINGS_UPDATED, integrationTypeMappings) }, + async fetchShopifyTypeMappings({commit}, mappedTypeId) { let shopifyTypeMappings = [] as any let resp; @@ -136,6 +194,7 @@ const actions: ActionTree = { if (!mappedTypeId[typeId]) { mappedTypeId[typeId] = []; } + mappedTypeId[typeId].push(shopifyTypeMappings); return mappedTypeId; }, {}); diff --git a/src/store/modules/netSuite/getters.ts b/src/store/modules/netSuite/getters.ts index 5ad44e0..8d156ab 100644 --- a/src/store/modules/netSuite/getters.ts +++ b/src/store/modules/netSuite/getters.ts @@ -15,6 +15,12 @@ const getters: GetterTree = { getSalesChannel(state) { return state.salesChannel }, + getFacilitiesIdentifications: (state) => { + return state.facilitiesIdentifications + }, + getEnumGroups: (state) => (enumId: any) => { + return state.enumsInEnumGroup[enumId] + }, getIntegrationTypeMappings: (state) => (typeId: any) => { return state.integrationTypeMappings[typeId] ? state.integrationTypeMappings[typeId] : [] }, diff --git a/src/store/modules/netSuite/index.ts b/src/store/modules/netSuite/index.ts index baaea17..bb80832 100644 --- a/src/store/modules/netSuite/index.ts +++ b/src/store/modules/netSuite/index.ts @@ -12,8 +12,10 @@ const netSuiteModule: Module = { productStoreShipmentMethods: [], paymentMethods: [], salesChannel: [], - integrationTypeMappings: [], - shopifyTypeMappings: [] + facilitiesIdentifications: [], + enumsInEnumGroup: [], + shopifyTypeMappings: [], + integrationTypeMappings: [] }, getters, actions, diff --git a/src/store/modules/netSuite/mutation-types.ts b/src/store/modules/netSuite/mutation-types.ts index 0750200..e161aa1 100644 --- a/src/store/modules/netSuite/mutation-types.ts +++ b/src/store/modules/netSuite/mutation-types.ts @@ -4,4 +4,6 @@ export const NET_SUITE_PRODUCT_STORE_SHIPMENT_METHODS_UPDATED = "/PRODUCT_STORE_ export const NET_SUITE_PAYMENT_METHODS_UPDATED = "/PAYMENT_METHODS_UPDATED" export const NET_SUITE_SALES_CHANNEL_UPDATED = "/SALES_CHANNEL_UPDATED" export const NET_SUITE_INTEGRATION_TYPE_MAPPINGS_UPDATED = "/INTEGRATION_TYPE_MAPPINGS_UPDATED" -export const NET_SUITE_SHOPIFY_TYPE_MAPPINGS_UPDATED = "/SHOPIFY_TYPE_MAPPINGS_UPDATED" \ No newline at end of file +export const NET_SUITE_SHOPIFY_TYPE_MAPPINGS_UPDATED = "/SHOPIFY_TYPE_MAPPINGS_UPDATED" +export const NET_SUITE_FACILITIES_IDENTIFICATIONS_UPDATED = "/FACILITIES_IDENTIFICATIONS_UPDATED" +export const NET_SUITE_ENUM_GROUPS_UPDATED = "/ENUM_GROUPS_UPDATED" \ No newline at end of file diff --git a/src/store/modules/netSuite/mutations.ts b/src/store/modules/netSuite/mutations.ts index c0b7a77..741f3c6 100644 --- a/src/store/modules/netSuite/mutations.ts +++ b/src/store/modules/netSuite/mutations.ts @@ -20,6 +20,12 @@ const mutations: MutationTree = { }, [types.NET_SUITE_SHOPIFY_TYPE_MAPPINGS_UPDATED] (state, payload) { state.shopifyTypeMappings = payload + }, + [types.NET_SUITE_FACILITIES_IDENTIFICATIONS_UPDATED] (state, payload) { + state.facilitiesIdentifications = payload + }, + [types.NET_SUITE_ENUM_GROUPS_UPDATED] (state, payload) { + state.enumsInEnumGroup = payload } } export default mutations; \ No newline at end of file diff --git a/src/store/modules/productStore/ProductStoreState.ts b/src/store/modules/productStore/ProductStoreState.ts index f5e62cc..89e2eee 100644 --- a/src/store/modules/productStore/ProductStoreState.ts +++ b/src/store/modules/productStore/ProductStoreState.ts @@ -3,4 +3,5 @@ export default interface ProductStoreState { currentStoreSettings: any; productStores: any; company: any; + selectedProductStore: any } \ No newline at end of file diff --git a/src/store/modules/productStore/actions.ts b/src/store/modules/productStore/actions.ts index ae9cb0e..3b6c862 100644 --- a/src/store/modules/productStore/actions.ts +++ b/src/store/modules/productStore/actions.ts @@ -116,6 +116,10 @@ const actions: ActionTree = { async clearProductStoreState({ commit }) { commit(types.PRODUCT_STORE_CLEARED); }, + + async updateSelectedProductStore({ commit }, selectedProductStore) { + commit(types.PRODUCT_STORE_SELECTED_PRODUCT_STORE_UPDATED, selectedProductStore); + } } export default actions; \ No newline at end of file diff --git a/src/store/modules/productStore/getters.ts b/src/store/modules/productStore/getters.ts index 75031d0..dc2d9e7 100644 --- a/src/store/modules/productStore/getters.ts +++ b/src/store/modules/productStore/getters.ts @@ -15,5 +15,8 @@ const getters: GetterTree = { getCompany(state) { return state.company }, + getSelectedProductStore(state) { + return state.selectedProductStore + } } export default getters; \ No newline at end of file diff --git a/src/store/modules/productStore/index.ts b/src/store/modules/productStore/index.ts index cfacb7d..4eca4c8 100644 --- a/src/store/modules/productStore/index.ts +++ b/src/store/modules/productStore/index.ts @@ -11,7 +11,8 @@ const productStoreModule: Module = { current: {}, currentStoreSettings: {}, productStores: [], - company: {} + company: {}, + selectedProductStore: [] }, getters, actions, diff --git a/src/store/modules/productStore/mutation-types.ts b/src/store/modules/productStore/mutation-types.ts index 77a8d2f..b2d0b0e 100644 --- a/src/store/modules/productStore/mutation-types.ts +++ b/src/store/modules/productStore/mutation-types.ts @@ -3,4 +3,5 @@ export const PRODUCT_STORE_CURRENT_UPDATED = "/CURRENT_UPDATED" export const PRODUCT_STORE_CURRENT_SETTINGS_UPDATED = "/CURRENT_SETTINGS_UPDATED" export const PRODUCT_STORE_STORES_UPDATED = "/STORES_UPDATED" export const PRODUCT_STORE_COMPANY_UPDATED = "/COMPANY_UPDATED" -export const PRODUCT_STORE_CLEARED = "/CLEARED" \ No newline at end of file +export const PRODUCT_STORE_CLEARED = "/CLEARED" +export const PRODUCT_STORE_SELECTED_PRODUCT_STORE_UPDATED = "/SELECTED_PRODUCT_STORE_UPDATED" \ No newline at end of file diff --git a/src/store/modules/productStore/mutations.ts b/src/store/modules/productStore/mutations.ts index a581a8d..2dbf0c5 100644 --- a/src/store/modules/productStore/mutations.ts +++ b/src/store/modules/productStore/mutations.ts @@ -21,5 +21,8 @@ const mutations: MutationTree = { state.productStores = [] state.company = {} }, + [types.PRODUCT_STORE_SELECTED_PRODUCT_STORE_UPDATED] (state, payload) { + state.selectedProductStore = payload + } } export default mutations; \ No newline at end of file diff --git a/src/store/modules/util/actions.ts b/src/store/modules/util/actions.ts index d2233a1..f816b21 100644 --- a/src/store/modules/util/actions.ts +++ b/src/store/modules/util/actions.ts @@ -31,7 +31,8 @@ const actions: ActionTree = { try { resp = await UtilService.fetchFacilities({ pageSize: 100 }) if(!hasError(resp) && resp.data) { - facilities = resp.data + // need to change this check later. + facilities = resp.data.filter((facility: any) => facility.externalId) } else { throw resp.data } diff --git a/src/views/Departments.vue b/src/views/Departments.vue index b11c362..1493d8c 100644 --- a/src/views/Departments.vue +++ b/src/views/Departments.vue @@ -35,12 +35,12 @@ Shopify Mapping ID

Shopify

- - \ No newline at end of file diff --git a/src/views/PaymentMethods.vue b/src/views/PaymentMethods.vue index 0818152..1834613 100644 --- a/src/views/PaymentMethods.vue +++ b/src/views/PaymentMethods.vue @@ -16,11 +16,11 @@ {{ translate("Map payment methods with NetSuite") }}

{{ translate("For an order to sync with NetSuite, the payment method on that order must be mapped to a NetSuite shipment method ID.") }}

- +
-
+
{{ paymentMethod.description }} @@ -35,9 +35,9 @@ - +
\ No newline at end of file From 9c2424cee26d711bdece2d5d06ed3eb761f19641 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Fri, 21 Feb 2025 12:38:55 +0530 Subject: [PATCH 16/27] Improved: Added support for mapping a facility with a Shopify shop location and integrated an API for updating the enumCode of an enum(#37) --- src/services/NetSuiteService.ts | 20 ++++++++++---- src/store/modules/netSuite/NetSuiteState.ts | 1 + src/store/modules/netSuite/actions.ts | 28 +++++++++++++++----- src/store/modules/netSuite/getters.ts | 3 +++ src/store/modules/netSuite/index.ts | 1 + src/store/modules/netSuite/mutation-types.ts | 1 + src/store/modules/netSuite/mutations.ts | 3 +++ src/views/Departments.vue | 11 ++++---- src/views/PaymentMethods.vue | 4 +-- src/views/SalesChannel.vue | 12 +++------ src/views/ShipmentMethods.vue | 2 +- 11 files changed, 58 insertions(+), 28 deletions(-) diff --git a/src/services/NetSuiteService.ts b/src/services/NetSuiteService.ts index 4eaec5b..f18cb04 100644 --- a/src/services/NetSuiteService.ts +++ b/src/services/NetSuiteService.ts @@ -17,7 +17,7 @@ const fetchPaymentMethods = async (payload: any): Promise => { const fetchfacilitiesIdentifications = async (payload: any): Promise => { return api({ - url: "facilities/identifications", + url: "oms/facilities/identifications", method: "get", params: payload }) @@ -77,6 +77,15 @@ const fetchShopifyShopsCarrierShipments = async (payload: any): Promise => params: payload }) } + +const fetchShopifyShopLocation = async (payload: any): Promise => { + return api({ + url: "oms/shopifyShops/locations", + method: "get", + params: payload + }) +} + // TODO: need to add dynamic api to update the sftp configs. const updateSftpConfig = async (payload: any): Promise => { return api({ @@ -86,24 +95,25 @@ const updateSftpConfig = async (payload: any): Promise => { }) } -const addEnumCode = async (payload: any): Promise => { +const updateEnumCode = async (payload: any): Promise => { return api({ - url: "admin/enums", - method: "post", + url: `admin/enums/${payload.enumId}`, + method: "put", data: payload }) } export const NetSuiteService = { - addEnumCode, addIntegrationTypeMappings, fetchIntegrationTypeMappings, fetchPaymentMethods, fetchProductStoreShipmentMethods, fetchShopifyTypeMappings, fetchShopifyShopsCarrierShipments, + fetchShopifyShopLocation, fetchfacilitiesIdentifications, removeIntegrationMappingValue, + updateEnumCode, updateFacilityIdentification, updateIntegrationTypeMappings, updateSftpConfig diff --git a/src/store/modules/netSuite/NetSuiteState.ts b/src/store/modules/netSuite/NetSuiteState.ts index a3b082a..5d75759 100644 --- a/src/store/modules/netSuite/NetSuiteState.ts +++ b/src/store/modules/netSuite/NetSuiteState.ts @@ -6,6 +6,7 @@ export default interface NetSuiteState { integrationTypeMappings: any shopifyTypeMappings: any shopifyShopsCarrierShipments: any + shopifyShopLocations: any facilitiesIdentifications: any enumsInEnumGroup: any } \ No newline at end of file diff --git a/src/store/modules/netSuite/actions.ts b/src/store/modules/netSuite/actions.ts index 344accb..1c6fd02 100644 --- a/src/store/modules/netSuite/actions.ts +++ b/src/store/modules/netSuite/actions.ts @@ -28,7 +28,6 @@ const actions: ActionTree = { } catch (err) { logger.error(err) } - commit(types.NET_SUITE_INVENTORY_VARIANCES_UPDATED, inventoryVariances) }, @@ -46,7 +45,7 @@ const actions: ActionTree = { if(!hasError(resp) && resp.data) { // TODO: need to remove this filter check , after api change of not giving expired results. enumsInEnumGroup = resp.data.filter((item: any) => !item.thruDate).reduce((enumId: any, item: any) => { - enumId[item.enumerationId] = { + enumId[item.enumId] = { fromDate: item.fromDate, enumerationGroupId: item.enumerationGroupId, }; @@ -58,7 +57,6 @@ const actions: ActionTree = { } catch (err) { logger.error(err) } - commit(types.NET_SUITE_ENUM_GROUPS_UPDATED, enumsInEnumGroup) }, @@ -81,7 +79,6 @@ const actions: ActionTree = { } catch (err) { logger.error(err) } - commit(types.NET_SUITE_FACILITIES_IDENTIFICATIONS_UPDATED, facilitiesIdentifications) }, @@ -103,7 +100,6 @@ const actions: ActionTree = { } catch (err) { logger.error(err) } - commit(types.NET_SUITE_SALES_CHANNEL_UPDATED, salesChannel) }, @@ -179,12 +175,12 @@ const actions: ActionTree = { commit(types.NET_SUITE_INTEGRATION_TYPE_MAPPINGS_UPDATED, integrationTypeMappings) }, - async shopifyShopsCarrierShipments({commit}) { + async fetchShopifyShopsCarrierShipments({commit}) { let resp, shopifyShopsCarrierShipments; try { const resp = await NetSuiteService.fetchShopifyShopsCarrierShipments({ pageSize: 100 }); - if (!hasError(resp)) { + if(!hasError(resp)) { shopifyShopsCarrierShipments = resp.data.reduce((shipmentMethods: any, shipmentMethod: any) => { shipmentMethods[shipmentMethod.shipmentMethodTypeId] = { carrierPartyId: shipmentMethod.carrierPartyId, @@ -201,6 +197,24 @@ const actions: ActionTree = { commit(types.NET_SUITE_SHOPIFY_SHOPS_CARRIER_SHIPMENTS_UPDATED, shopifyShopsCarrierShipments); }, + async fetchShopifyShopLocation({commit}) { + let resp, shopifyShopLocations; + try { + resp = await NetSuiteService.fetchShopifyShopLocation({ pageSize: 100 }); + if(!hasError(resp)) { + shopifyShopLocations = resp.data.reduce((shopifyShop: any, shopifyShopLocation: any) => { + shopifyShop[shopifyShopLocation.facilityId] = shopifyShopLocation.shopifyLocationId + return shopifyShop; + }, {}); + } else { + throw resp.data; + } + } catch(error: any) { + logger.error(error); + } + commit(types.NET_SUITE_SHOPIFY_SHOPS_LOCATIONS_UPDATED, shopifyShopLocations); + }, + async fetchShopifyTypeMappings({commit}, mappedTypeId) { let shopifyTypeMappings = [] as any let resp; diff --git a/src/store/modules/netSuite/getters.ts b/src/store/modules/netSuite/getters.ts index 9179720..629ad02 100644 --- a/src/store/modules/netSuite/getters.ts +++ b/src/store/modules/netSuite/getters.ts @@ -29,6 +29,9 @@ const getters: GetterTree = { }, getShopifyShopsCarrierShipments: (state) => (shipmentMethodTypeId: any) => { return state.shopifyShopsCarrierShipments[shipmentMethodTypeId] ? state.shopifyShopsCarrierShipments[shipmentMethodTypeId] : [] + }, + getShopifyShopLocation: (state) => (facilityId: any) => { + return state.shopifyShopLocations[facilityId] } } export default getters; \ No newline at end of file diff --git a/src/store/modules/netSuite/index.ts b/src/store/modules/netSuite/index.ts index 9e5cf1a..2793cb0 100644 --- a/src/store/modules/netSuite/index.ts +++ b/src/store/modules/netSuite/index.ts @@ -16,6 +16,7 @@ const netSuiteModule: Module = { enumsInEnumGroup: [], shopifyTypeMappings: [], shopifyShopsCarrierShipments: [], + shopifyShopLocations:[], integrationTypeMappings: [] }, getters, diff --git a/src/store/modules/netSuite/mutation-types.ts b/src/store/modules/netSuite/mutation-types.ts index 73f2cbd..4d821cd 100644 --- a/src/store/modules/netSuite/mutation-types.ts +++ b/src/store/modules/netSuite/mutation-types.ts @@ -6,5 +6,6 @@ export const NET_SUITE_SALES_CHANNEL_UPDATED = "/SALES_CHANNEL_UPDATED" export const NET_SUITE_INTEGRATION_TYPE_MAPPINGS_UPDATED = "/INTEGRATION_TYPE_MAPPINGS_UPDATED" export const NET_SUITE_SHOPIFY_TYPE_MAPPINGS_UPDATED = "/SHOPIFY_TYPE_MAPPINGS_UPDATED" export const NET_SUITE_SHOPIFY_SHOPS_CARRIER_SHIPMENTS_UPDATED = "/SHOPIFY_SHOPS_CARRIER_SHIPMENTS_UPDATED" +export const NET_SUITE_SHOPIFY_SHOPS_LOCATIONS_UPDATED = "/SHOPIFY_SHOPS_LOCATIONS_UPDATED" export const NET_SUITE_FACILITIES_IDENTIFICATIONS_UPDATED = "/FACILITIES_IDENTIFICATIONS_UPDATED" export const NET_SUITE_ENUM_GROUPS_UPDATED = "/ENUM_GROUPS_UPDATED" \ No newline at end of file diff --git a/src/store/modules/netSuite/mutations.ts b/src/store/modules/netSuite/mutations.ts index 858119d..8e9194e 100644 --- a/src/store/modules/netSuite/mutations.ts +++ b/src/store/modules/netSuite/mutations.ts @@ -24,6 +24,9 @@ const mutations: MutationTree = { [types.NET_SUITE_SHOPIFY_SHOPS_CARRIER_SHIPMENTS_UPDATED] (state, payload) { state.shopifyShopsCarrierShipments = payload }, + [types.NET_SUITE_SHOPIFY_SHOPS_LOCATIONS_UPDATED] (state, payload) { + state.shopifyShopLocations = payload + }, [types.NET_SUITE_FACILITIES_IDENTIFICATIONS_UPDATED] (state, payload) { state.facilitiesIdentifications = payload }, diff --git a/src/views/Departments.vue b/src/views/Departments.vue index 479d674..77801fc 100644 --- a/src/views/Departments.vue +++ b/src/views/Departments.vue @@ -30,11 +30,10 @@ - - +