diff --git a/.env.example b/.env.example index 7f479ecb0..490126298 100644 --- a/.env.example +++ b/.env.example @@ -16,3 +16,4 @@ VUE_APP_NOTIF_APP_ID=BOPIS VUE_APP_NOTIF_ENUM_TYPE_ID=NOTIF_BOPIS VUE_APP_FIREBASE_CONFIG={"apiKey": "","authDomain": "","databaseURL": "","projectId": "","storageBucket": "","messagingSenderId": "","appId": ""} VUE_APP_FIREBASE_VAPID_KEY="" +VUE_APP_PRODUCT_STORE_SETTING_ENUMS={"ENABLE_TRACKING": {"enumId": "ENABLE_TRACKING","enumName": "Enable tracking","enumTypeId": "PROD_STR_STNG","description": "Enable tracking in BOPIS app"}, "PRINT_PACKING_SLIPS": {"enumId": "PRINT_PACKING_SLIPS","enumName": "Generate packing slips","enumTypeId": "PROD_STR_STNG","description": "Generate packing slips in BOPIS app"}, "PRINT_PICKLISTS": {"enumId": "wPRINT_PICKLISTS","enumName": "Print picklists","enumTypeId": "PROD_STR_STNG","description": "Print picklists in BOPIS app"}, "SHOW_SHIPPING_ORDERS": {"enumId": "SHOW_SHIPPING_ORDERS","enumName": "Show shipping orders","enumTypeId": "PROD_STR_STNG","description": "Show shipping orders in BOPIS app"}} diff --git a/package-lock.json b/package-lock.json index b68376f24..295c70a85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.2.6", - "@hotwax/dxp-components": "^1.15.3", + "@hotwax/dxp-components": "^1.15.4", "@hotwax/oms-api": "^1.14.0", "@ionic/core": "^7.6.0", "@ionic/vue": "^7.6.0", @@ -2807,9 +2807,9 @@ "integrity": "sha512-zpUjGoY7LBlKeiP0V7tonrmoey8HQ5THQmyixQ+IDtrjmEJNBjynW/Ef3gC0FUNNPuVqxWPZdT5CVgaETLGTwg==" }, "node_modules/@hotwax/dxp-components": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.15.3.tgz", - "integrity": "sha512-D8PXmlDV1TJNlDt0p2mydXBvWJrNWqiRASYPNy0YiiaMaMUALvGD1Ak6w+4mCsFuadiWcbxBtFyBFfAMDWULIQ==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.15.4.tgz", + "integrity": "sha512-dlgexo/QBLnLlPkq1zwfWBIPiVtmZKsRcPcCAwe+eFz9qPwyQORdzKb6YjX1WgtRU72GYMv345eA+HuaSY6H5w==", "dependencies": { "@hotwax/oms-api": "^1.8.1", "@ionic/core": "^7.6.0", diff --git a/package.json b/package.json index fb2e3329b..584ed8d34 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.2.6", - "@hotwax/dxp-components": "^1.15.3", + "@hotwax/dxp-components": "^1.15.4", "@hotwax/oms-api": "^1.14.0", "@ionic/core": "^7.6.0", "@ionic/vue": "^7.6.0", diff --git a/src/adapter/index.ts b/src/adapter/index.ts index 84c1b1122..db46dfd69 100644 --- a/src/adapter/index.ts +++ b/src/adapter/index.ts @@ -6,7 +6,6 @@ import { getNotificationUserPrefTypeIds, getProductIdentificationPref, getUserFacilities, - getUserPreference, hasError, initialise, logout, @@ -14,7 +13,6 @@ import { resetConfig, setProductIdentificationPref, setUserLocale, - setUserPreference, storeClientRegistrationToken, subscribeTopic, unsubscribeTopic, @@ -32,7 +30,6 @@ export { getNotificationUserPrefTypeIds, getProductIdentificationPref, getUserFacilities, - getUserPreference, hasError, initialise, logout, @@ -40,7 +37,6 @@ export { resetConfig, setProductIdentificationPref, setUserLocale, - setUserPreference, storeClientRegistrationToken, subscribeTopic, unsubscribeTopic, diff --git a/src/authorization/Actions.ts b/src/authorization/Actions.ts index bba9872c3..5b22cee24 100644 --- a/src/authorization/Actions.ts +++ b/src/authorization/Actions.ts @@ -3,4 +3,10 @@ export default { 'APP_REJECT_ORDER': 'APP_REJECT_ORDER', 'APP_RF_CONFIG_UPDATE': 'APP_RF_CONFIG_UPDATE', 'APP_PARTIAL_ORDER_REJECTION_CONFIG_UPDATE': 'APP_PARTIAL_ORDER_REJECTION_CONFIG_UPDATE', + 'APP_PRODUCT_IDENTIFIER_UPDATE': 'APP_PRODUCT_IDENTIFIER_UPDATE', + 'APP_ENABLE_TRACKING_PREF_UPDATE': 'APP_ENABLE_TRACKING_PREF_UPDATE', + 'APP_PRINT_PICKLIST_PREF_UPDATE': 'APP_PRINT_PICKLIST_PREF_UPDATE', + 'APP_PRINT_PACKING_SLIP_PREF_UPDATE': 'APP_PRINT_PACKING_SLIP_PREF_UPDATE', + 'APP_SHOW_SHIPPING_ORD_PREF_UPDATE': 'APP_SHOW_SHIPPING_ORD_PREF_UPDATE', + 'APP_COMMERCE_VIEW': 'APP_COMMERCE_VIEW' } \ No newline at end of file diff --git a/src/authorization/Rules.ts b/src/authorization/Rules.ts index 553910f8a..360c453d6 100644 --- a/src/authorization/Rules.ts +++ b/src/authorization/Rules.ts @@ -8,5 +8,11 @@ export default { "APP_RF_CONFIG_UPDATE": "COMMON_ADMIN", "APP_PARTIAL_ORDER_REJECTION_CONFIG_UPDATE": "COMMON_ADMIN", "APP_STOREFULFILLMENT_ADMIN": "STOREFULFILLMENT_ADMIN", + "APP_PRODUCT_IDENTIFIER_UPDATE": "COMMON_ADMIN", + "APP_ENABLE_TRACKING_PREF_UPDATE": "COMMON_ADMIN", + "APP_PRINT_PICKLIST_PREF_UPDATE": "COMMON_ADMIN", + "APP_PRINT_PACKING_SLIP_PREF_UPDATE": "COMMON_ADMIN", + "APP_SHOW_SHIPPING_ORD_PREF_UPDATE": "COMMON_ADMIN", + "APP_COMMERCE_VIEW": "COMMERCEUSER_VIEW", "BOPIS_APP_VIEW": "BOPIS_APP_VIEW" } as any \ No newline at end of file diff --git a/src/locales/en.json b/src/locales/en.json index 08f810ecb..142cf145a 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -45,6 +45,7 @@ "Failed to load packing slip": "Failed to load packing slip", "Failed to update configuration": "Failed to update configuration", "Failed to print shipping label and packing slip": "Failed to print shipping label and packing slip", + "Failed to update product store setting.": "Failed to update product store setting.", "First name": "First name", "Generate packing slips": "Generate packing slips", "Generate shipping documents": "Generate shipping documents", diff --git a/src/locales/es.json b/src/locales/es.json index f2a9378f9..a440e2d3b 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -43,6 +43,7 @@ "Failed to load packing slip": "Error al cargar el documento de embalaje", "Failed to update configuration": "No se pudo actualizar la configuración", "Failed to print shipping label and packing slip": "Error al imprimir la etiqueta de envío y la hoja de embalaje", + "Failed to update product store setting.": "Failed to update product store setting.", "First name": "Nombre", "Generate packing slips": "Generar documentos de embalaje", "Generate shipping documents": "Generar documentos de envío", diff --git a/src/locales/ja.json b/src/locales/ja.json index 00518d45d..56404f3c3 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -43,6 +43,7 @@ "Failed to load packing slip": "納品書の読み込みに失敗しました", "Failed to update configuration": "設定の更新に失敗しました", "Failed to print shipping label and packing slip": "出荷ラベルと納品書の印刷に失敗しました。", + "Failed to update product store setting.":"Failed to update product store setting.", "First name": "名", "Generate packing slips": "内容明細票の作成", "Generate shipping documents": "出荷書類を生成する", diff --git a/src/main.ts b/src/main.ts index ac45a9496..2860cc564 100644 --- a/src/main.ts +++ b/src/main.ts @@ -28,7 +28,7 @@ import "@hotwax/apps-theme"; import store from './store' -import permissionPlugin from '@/authorization'; +import permissionPlugin, { Actions, hasPermission } from '@/authorization'; import permissionRules from '@/authorization/Rules'; import permissionActions from '@/authorization/Actions'; @@ -54,6 +54,7 @@ const app = createApp(App) actions: permissionActions }) .use(dxpComponents, { + Actions, addNotification, appLoginUrl: process.env.VUE_APP_LOGIN_URL as string, appFirebaseConfig: JSON.parse(process.env.VUE_APP_FIREBASE_CONFIG), @@ -70,6 +71,7 @@ const app = createApp(App) setUserLocale, storeClientRegistrationToken, getAvailableTimeZones, + hasPermission, setUserTimeZone }); diff --git a/src/services/UtilService.ts b/src/services/UtilService.ts index f2b5f1749..fc5877bec 100644 --- a/src/services/UtilService.ts +++ b/src/services/UtilService.ts @@ -1,4 +1,5 @@ import { api } from '@/adapter'; +import { hasError } from '@/adapter'; const fetchRejectReasons = async (query: any): Promise => { return api({ @@ -57,12 +58,74 @@ const fetchReservedQuantity = async (query: any): Promise => { }); } +const getProductStoreSettings = async (payload: any): Promise => { + return api({ + url: "performFind", + method: "post", + data: payload + }); +} + +const createProductStoreSetting = async (payload: any): Promise => { + return api({ + url: "service/createProductStoreSetting", + method: "post", + data: payload + }); +} + +const updateProductStoreSetting = async (payload: any): Promise => { + return api({ + url: "service/updateProductStoreSetting", + method: "post", + data: payload + }); +} + +const createEnumeration = async (payload: any): Promise => { + return api({ + url: "/service/createEnumeration", + method: "post", + data: payload + }) +} + +const isEnumExists = async (enumId: string): Promise => { + try { + const resp = await api({ + url: 'performFind', + method: 'POST', + data: { + entityName: "Enumeration", + inputFields: { + enumId + }, + viewSize: 1, + fieldList: ["enumId"], + noConditionFind: 'Y' + } + }) as any + + if (!hasError(resp) && resp.data.docs.length) { + return true + } + return false + } catch (err) { + return false + } +} + export const UtilService = { + createEnumeration, + createProductStoreSetting, fetchFacilityTypeInformation, fetchPartyInformation, fetchPaymentMethodTypeDesc, fetchRejectReasons, fetchStatusDesc, + getProductStoreSettings, + isEnumExists, resetPicker, + updateProductStoreSetting, fetchReservedQuantity } \ No newline at end of file diff --git a/src/store/modules/user/UserState.ts b/src/store/modules/user/UserState.ts index c6b125cfa..1a911b12c 100644 --- a/src/store/modules/user/UserState.ts +++ b/src/store/modules/user/UserState.ts @@ -3,7 +3,6 @@ export default interface UserState { current: any; currentFacility: object; instanceUrl: string; - preference: any; permissions: any; currentEComStore: any; partialOrderRejectionConfig: any @@ -12,4 +11,5 @@ export default interface UserState { firebaseDeviceId: string; hasUnreadNotifications: boolean; allNotificationPrefs: any; + bopisProductStoreSettings: any; } \ No newline at end of file diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index a14105a07..abdebfade 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -1,4 +1,5 @@ import { UserService } from '@/services/UserService' +import { UtilService } from '@/services/UtilService' import { ActionTree } from 'vuex' import RootState from '@/store/RootState' import store from '@/store'; @@ -6,14 +7,12 @@ import UserState from './UserState' import * as types from './mutation-types' import { showToast } from '@/utils' import { - getUserPreference, getNotificationEnumIds, getNotificationUserPrefTypeIds, getUserFacilities, hasError, logout, resetConfig, - setUserPreference, storeClientRegistrationToken, updateInstanceUrl, updateToken @@ -84,7 +83,6 @@ const actions: ActionTree = { // TODO Use a separate API for getting facilities, this should handle user like admin accessing the app const currentFacility = userProfile.facilities.length > 0 ? userProfile.facilities[0] : {}; const currentEComStore = await UserService.getCurrentEComStore(token, currentFacility?.facilityId); - const userPreference = await getUserPreference(token, getters['getBaseUrl'], 'BOPIS_PREFERENCE') /* ---- Guard clauses ends here --- */ @@ -98,7 +96,6 @@ const actions: ActionTree = { commit(types.USER_INFO_UPDATED, userProfile); commit(types.USER_CURRENT_FACILITY_UPDATED, currentFacility); commit(types.USER_CURRENT_ECOM_STORE_UPDATED, currentEComStore) - commit(types.USER_PREFERENCE_UPDATED, userPreference) commit(types.USER_PERMISSIONS_UPDATED, appPermissions); commit(types.USER_TOKEN_CHANGED, { newToken: token }) @@ -108,6 +105,7 @@ const actions: ActionTree = { //fetching partial order rejection config for BOPIS orders await dispatch("getPartialOrderRejectionConfig"); await dispatch("fetchAllNotificationPrefs"); + await dispatch("fetchBopisProductStoreSettings"); } catch (err: any) { // If any of the API call in try block has status code other than 2xx it will be handled in common catch block. @@ -281,14 +279,6 @@ const actions: ActionTree = { await dispatch("getPartialOrderRejectionConfig"); }, - setUserPreference( {state, commit }, payload){ - commit(types.USER_PREFERENCE_UPDATED, payload) - setUserPreference({ - 'userPrefTypeId': 'BOPIS_PREFERENCE', - 'userPrefValue': JSON.stringify(state.preference) - }); - }, - addNotification({ state, commit }, payload) { const notifications = JSON.parse(JSON.stringify(state.notifications)) notifications.push({ ...payload.notification, time: DateTime.now().toMillis() }) @@ -337,6 +327,137 @@ const actions: ActionTree = { commit(types.USER_ALL_NOTIFICATION_PREFS_UPDATED, allNotificationPrefs) }, + async fetchBopisProductStoreSettings({ commit, dispatch }) { + const productStoreSettings = JSON.parse(process.env.VUE_APP_PRODUCT_STORE_SETTING_ENUMS); + const settingValues = {} as any; + + const payload = { + "inputFields": { + "productStoreId": this.state.user.currentEComStore.productStoreId, + "settingTypeEnumId": Object.keys(productStoreSettings), + "settingTypeEnumId_op": "in" + }, + "filterByDate": 'Y', + "entityName": "ProductStoreSetting", + "fieldList": ["settingTypeEnumId", "settingValue", "fromDate"] + } + + try { + const resp = await UtilService.getProductStoreSettings(payload) as any + if(!hasError(resp)) { + resp.data.docs.map((setting: any) => { + settingValues[setting.settingTypeEnumId] = setting.settingValue === "true" + }) + } else { + throw resp.data; + } + } catch(err) { + logger.error(err) + } + + const enumIdsToCreate = Object.keys(productStoreSettings).filter((settingTypeEnumId) => !Object.keys(settingValues).includes(settingTypeEnumId)); + + await Promise.allSettled(enumIdsToCreate.map(async (enumId: any) => { + await dispatch("createProductStoreSetting", productStoreSettings[enumId]) + })) + + enumIdsToCreate.map((enumId: any) => settingValues[enumId] = false) + + commit(types.USER_BOPIS_PRODUCT_STORE_SETTINGS_UPDATED, settingValues) + }, + + async createProductStoreSetting({ commit }, enumeration) { + const fromDate = Date.now() + + try { + if(!await UtilService.isEnumExists(enumeration.enumId)) { + const resp = await UtilService.createEnumeration({ + "enumId": enumeration.enumId, + "enumTypeId": "PROD_STR_STNG", + "description": enumeration.description, + "enumName": enumeration.enumName + }) + + if(hasError(resp)) { + throw resp.data; + } + } + + const params = { + fromDate, + "productStoreId": this.state.user.currentEComStore.productStoreId, + "settingTypeEnumId": enumeration.enumId, + "settingValue": "false" + } + + await UtilService.createProductStoreSetting(params) as any + } catch(err) { + logger.error(err) + } + + return fromDate; + }, + + async setProductStoreSetting({ commit, dispatch, state }, payload) { + const productStoreSettings = JSON.parse(process.env.VUE_APP_PRODUCT_STORE_SETTING_ENUMS); + let prefValue = state.bopisProductStoreSettings[payload.enumId] + const eComStoreId = this.state.user.currentEComStore.productStoreId; + + // when selecting none as ecom store, not updating the pref as it's not possible to save pref with empty productStoreId + if(!eComStoreId) { + showToast(translate("Unable to update product store setting.")) + return; + } + + let fromDate; + + try { + const resp = await UtilService.getProductStoreSettings({ + "inputFields": { + "productStoreId": this.state.user.currentEComStore.productStoreId, + "settingTypeEnumId": payload.enumId + }, + "filterByDate": 'Y', + "entityName": "ProductStoreSetting", + "fieldList": ["fromDate"], + "viewSize": 1 + }) as any + if(!hasError(resp)) { + fromDate = resp.data.docs[0]?.fromDate + } + } catch(err) { + logger.error(err) + } + + if(!fromDate) { + fromDate = await dispatch("createProductStoreSetting", productStoreSettings[payload.enumId]); + } + + const params = { + "fromDate": fromDate, + "productStoreId": eComStoreId, + "settingTypeEnumId": payload.enumId, + "settingValue": `${payload.value}` + } + + try { + const resp = await UtilService.updateProductStoreSetting(params) as any + + if((!hasError(resp))) { + prefValue = payload.value + } else { + throw resp.data; + } + } catch(err) { + showToast(translate("Failed to update product store setting.")) + logger.error(err) + } + + const settingValues = JSON.parse(JSON.stringify(state.bopisProductStoreSettings)) + settingValues[payload.enumId] = prefValue + commit(types.USER_BOPIS_PRODUCT_STORE_SETTINGS_UPDATED, settingValues) + }, + async updateNotificationPreferences({ commit }, payload) { commit(types.USER_NOTIFICATIONS_PREFERENCES_UPDATED, payload) }, diff --git a/src/store/modules/user/getters.ts b/src/store/modules/user/getters.ts index e29565e33..95c206363 100644 --- a/src/store/modules/user/getters.ts +++ b/src/store/modules/user/getters.ts @@ -27,18 +27,6 @@ const getters: GetterTree = { const baseUrl = process.env.VUE_APP_BASE_URL; return baseUrl ? baseUrl : state.instanceUrl; }, - showShippingOrders (state) { - return state.preference.showShippingOrders; - }, - printPicklistPref (state) { - return state.preference.printPicklistPref; - }, - configurePicker (state) { - return state.preference.configurePicker; - }, - showPackingSlip (state) { - return state.preference.showPackingSlip; - }, getCurrency (state) { return state.currentEComStore.defaultCurrencyUomId ? state.currentEComStore.defaultCurrencyUomId : 'USD'; }, @@ -65,6 +53,10 @@ const getters: GetterTree = { }, getAllNotificationPrefs(state) { return state.allNotificationPrefs - } + }, + getBopisProductStoreSettings: (state) => (enumId: string) => { + return state.bopisProductStoreSettings[enumId] + }, + } export default getters; \ No newline at end of file diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index aa957af30..45a5cd6ce 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -12,12 +12,6 @@ const userModule: Module = { current: {}, currentFacility: {}, instanceUrl: '', - preference: { - showShippingOrders: false, - showPackingSlip: false, - configurePicker: false, - printPicklistPref: false - }, currentEComStore: {}, partialOrderRejectionConfig: {}, permissions: [], @@ -25,7 +19,8 @@ const userModule: Module = { notificationPrefs: [], firebaseDeviceId: '', hasUnreadNotifications: true, - allNotificationPrefs: [] + allNotificationPrefs: [], + bopisProductStoreSettings: {} }, getters, actions, diff --git a/src/store/modules/user/mutation-types.ts b/src/store/modules/user/mutation-types.ts index d9eb6fba7..1342b50ff 100644 --- a/src/store/modules/user/mutation-types.ts +++ b/src/store/modules/user/mutation-types.ts @@ -4,7 +4,6 @@ export const USER_END_SESSION = SN_USER + '/END_SESSION' export const USER_INFO_UPDATED = SN_USER + '/INFO_UPDATED' export const USER_CURRENT_FACILITY_UPDATED = SN_USER + '/CURRENT_FACILITY_UPDATED' export const USER_INSTANCE_URL_UPDATED = SN_USER + '/INSTANCE_URL_UPDATED' -export const USER_PREFERENCE_UPDATED = SN_USER + '/PREFERENCE_UPDATED' export const USER_CURRENT_ECOM_STORE_UPDATED = SN_USER + '/CURRENT_ECOM_STORE_UPDATED' export const USER_PERMISSIONS_UPDATED = SN_USER + '/PERMISSIONS_UPDATED' export const USER_PARTIAL_ORDER_REJECTION_CONFIG_UPDATED = SN_USER + '/PARTIAL_ORDER_REJECTION_CONFIG_UPDATED' @@ -12,4 +11,5 @@ export const USER_NOTIFICATIONS_UPDATED = SN_USER + '/NOTIFICATIONS_UPDATED' export const USER_NOTIFICATIONS_PREFERENCES_UPDATED = SN_USER + '/NOTIFICATIONS_PREFERENCES_UPDATED' export const USER_ALL_NOTIFICATION_PREFS_UPDATED = SN_USER + '/ALL_NOTIFICATION_PREFS_UPDATED' export const USER_FIREBASE_DEVICEID_UPDATED = SN_USER + '/FIREBASE_DEVICEID_UPDATED' -export const USER_UNREAD_NOTIFICATIONS_STATUS_UPDATED = SN_USER + '/UNREAD_NOTIFICATIONS_STATUS_UPDATED' \ No newline at end of file +export const USER_UNREAD_NOTIFICATIONS_STATUS_UPDATED = SN_USER + '/UNREAD_NOTIFICATIONS_STATUS_UPDATED' +export const USER_BOPIS_PRODUCT_STORE_SETTINGS_UPDATED = SN_USER + '/BOPIS_PRODUCT_STORE_SETTINGS_UPDATED' \ No newline at end of file diff --git a/src/store/modules/user/mutations.ts b/src/store/modules/user/mutations.ts index 0b51de6e2..287960439 100644 --- a/src/store/modules/user/mutations.ts +++ b/src/store/modules/user/mutations.ts @@ -11,13 +11,8 @@ const mutations: MutationTree = { state.current = {} state.currentFacility = {} state.permissions = [] - state.preference= { - showShippingOrders: false, - showPackingSlip: false, - configurePicker: false, - printPicklistPref: false - }, - state.allNotificationPrefs = [] + state.allNotificationPrefs = [], + state.bopisProductStoreSettings = {} }, [types.USER_INFO_UPDATED] (state, payload) { state.current = payload @@ -28,9 +23,6 @@ const mutations: MutationTree = { [types.USER_INSTANCE_URL_UPDATED] (state, payload) { state.instanceUrl = payload; }, - [types.USER_PREFERENCE_UPDATED] (state, payload) { - state.preference = {...state.preference, ...payload}; - }, [types.USER_CURRENT_ECOM_STORE_UPDATED] (state, payload) { state.currentEComStore = payload }, @@ -54,6 +46,9 @@ const mutations: MutationTree = { }, [types.USER_ALL_NOTIFICATION_PREFS_UPDATED] (state, payload) { state.allNotificationPrefs = payload + }, + [types.USER_BOPIS_PRODUCT_STORE_SETTINGS_UPDATED] (state, payload) { + state.bopisProductStoreSettings = payload } } diff --git a/src/views/Settings.vue b/src/views/Settings.vue index 5f64e1a37..c138ca871 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -123,8 +123,8 @@ {{ translate('View shipping orders along with pickup orders.') }} - - {{ translate("Show shipping orders") }} + + {{ translate("Show shipping orders") }} @@ -137,8 +137,8 @@ {{ translate('Packing slips help customer reconcile their order against the delivered items.') }} - - {{ translate("Generate packing slips") }} + + {{ translate("Generate packing slips") }} @@ -151,11 +151,11 @@ {{ translate('Track who picked orders by entering picker IDs when packing an order.') }} - - {{ translate("Enable tracking") }} + + {{ translate("Enable tracking") }} - - {{ translate("Print picklists") }} + + {{ translate("Print picklists") }} @@ -276,6 +276,7 @@ export default defineComponent({ notificationPrefs: 'user/getNotificationPrefs', allNotificationPrefs: 'user/getAllNotificationPrefs', printPicklistPref: "user/printPicklistPref", + getBopisProductStoreSettings: "user/getBopisProductStoreSettings" }) }, mounted() { @@ -328,17 +329,8 @@ export default defineComponent({ goToLaunchpad() { window.location.href = `${process.env.VUE_APP_LOGIN_URL}` }, - setShowShippingOrdersPreference (ev: any) { - this.store.dispatch('user/setUserPreference', { showShippingOrders: ev.detail.checked }) - }, - setShowPackingSlipPreference (ev: any){ - this.store.dispatch('user/setUserPreference', { showPackingSlip: ev.detail.checked }) - }, - setConfigurePickerPreference (ev: any){ - this.store.dispatch('user/setUserPreference', { configurePicker: ev.detail.checked }) - }, - setPrintPicklistPreference (ev: any){ - this.store.dispatch('user/setUserPreference', { printPicklistPref: ev.detail.checked }) + setBopisProductStoreSettings (ev: any, enumId: any) { + this.store.dispatch('user/setProductStoreSetting', { enumId, value: ev.detail.checked }) }, getDateTime(time: any) { return DateTime.fromMillis(time).toLocaleString(DateTime.DATETIME_MED);