diff --git a/src/services/UserService.ts b/src/services/UserService.ts index 1c57f10b..cd3f9b1e 100644 --- a/src/services/UserService.ts +++ b/src/services/UserService.ts @@ -341,6 +341,14 @@ const getNewRejectionApiConfig = async (payload: any): Promise => { }); } +const getDisableShipNowConfig = async (payload: any): Promise => { + return api({ + url: "performFind", + method: "get", + params: payload, + }); +} + const createPartialOrderRejectionConfig = async (payload: any): Promise => { return api({ url: "service/createProductStoreSetting", @@ -389,6 +397,7 @@ export const UserService = { deleteFieldMapping, login, getCollateralRejectionConfig, + getDisableShipNowConfig, getEComStores, getFacilityDetails, getFacilityOrderCount, diff --git a/src/store/modules/user/UserState.ts b/src/store/modules/user/UserState.ts index 57ec11db..27f41ca0 100644 --- a/src/store/modules/user/UserState.ts +++ b/src/store/modules/user/UserState.ts @@ -25,4 +25,5 @@ export default interface UserState { newRejectionApiConfig: any; partialOrderRejectionConfig: any; collateralRejectionConfig: any; + isShipNowDisabled: boolean; } \ No newline at end of file diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 1d7af3d0..3f47679f 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -108,6 +108,7 @@ const actions: ActionTree = { await dispatch('getNewRejectionApiConfig') await dispatch('getPartialOrderRejectionConfig') await dispatch('getCollateralRejectionConfig') + await dispatch('getDisableShipNowConfig') } 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. @@ -438,6 +439,33 @@ const actions: ActionTree = { } commit(types.USER_NEW_REJECTION_API_CONFIG_UPDATED, config); }, + + async getDisableShipNowConfig ({ commit }) { + let isShipNowDisabled = false; + const params = { + "inputFields": { + "productStoreId": this.state.user.currentEComStore.productStoreId, + "settingTypeEnumId": "DISABLE_SHIPNOW" + }, + "filterByDate": 'Y', + "entityName": "ProductStoreSetting", + "fieldList": ["settingTypeEnumId", "settingValue"], + "viewSize": 1 + } as any + + try { + const resp = await UserService.getDisableShipNowConfig(params) + + if (!hasError(resp)) { + isShipNowDisabled = resp.data?.docs[0]?.settingValue === "true"; + } else { + logger.error('Failed to fetch disable ship now config.'); + } + } catch (err) { + logger.error(err); + } + commit(types.USER_DISABLE_SHIP_NOW_CONFIG_UPDATED, isShipNowDisabled); + }, async updatePartialOrderRejectionConfig ({ dispatch }, payload) { let resp = {} as any; try { diff --git a/src/store/modules/user/getters.ts b/src/store/modules/user/getters.ts index 83f87ce2..1befc3a7 100644 --- a/src/store/modules/user/getters.ts +++ b/src/store/modules/user/getters.ts @@ -73,5 +73,8 @@ const getters: GetterTree = { getCollateralRejectionConfig(state) { return state.collateralRejectionConfig; }, + isShipNowDisabled(state) { + return state.isShipNowDisabled; + } } 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 0011503d..6de37eec 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -36,7 +36,8 @@ const userModule: Module = { allNotificationPrefs: [], newRejectionApiConfig: {}, partialOrderRejectionConfig: {}, - collateralRejectionConfig: {} + collateralRejectionConfig: {}, + isShipNowDisabled: false }, getters, actions, diff --git a/src/store/modules/user/mutation-types.ts b/src/store/modules/user/mutation-types.ts index 0616eebb..2be8f909 100644 --- a/src/store/modules/user/mutation-types.ts +++ b/src/store/modules/user/mutation-types.ts @@ -18,4 +18,5 @@ export const USER_UNREAD_NOTIFICATIONS_STATUS_UPDATED = SN_USER + '/UNREAD_NOTIF export const USER_ALL_NOTIFICATION_PREFS_UPDATED = SN_USER + '/ALL_NOTIFICATION_PREFS_UPDATED' export const USER_NEW_REJECTION_API_CONFIG_UPDATED = SN_USER + '/NEW_REJECTION_API_CONFIG_UPDATED' export const USER_PARTIAL_ORDER_REJECTION_CONFIG_UPDATED = SN_USER + '/PARTIAL_ORDER_REJECTION_CONFIG_UPDATED' -export const USER_COLLATERAL_REJECTION_CONFIG_UPDATED = SN_USER + '/COLLATERAL_REJECTION_CONFIG_UPDATED' \ No newline at end of file +export const USER_COLLATERAL_REJECTION_CONFIG_UPDATED = SN_USER + '/COLLATERAL_REJECTION_CONFIG_UPDATED' +export const USER_DISABLE_SHIP_NOW_CONFIG_UPDATED = SN_USER + '/DISABLE_SHIP_NOW_CONFIG_UPDATED' \ No newline at end of file diff --git a/src/store/modules/user/mutations.ts b/src/store/modules/user/mutations.ts index 2cce7671..00c0ec71 100644 --- a/src/store/modules/user/mutations.ts +++ b/src/store/modules/user/mutations.ts @@ -71,6 +71,9 @@ const mutations: MutationTree = { }, [types.USER_COLLATERAL_REJECTION_CONFIG_UPDATED] (state, payload) { state.collateralRejectionConfig = payload + }, + [types.USER_DISABLE_SHIP_NOW_CONFIG_UPDATED] (state, payload) { + state.isShipNowDisabled = payload } } export default mutations; \ No newline at end of file diff --git a/src/views/Completed.vue b/src/views/Completed.vue index e6c1fd71..a300abc5 100644 --- a/src/views/Completed.vue +++ b/src/views/Completed.vue @@ -43,7 +43,7 @@
- {{ translate("Ship") }} + {{ translate("Ship") }}
@@ -126,7 +126,7 @@
- {{ translate("Ship Now") }} + {{ translate("Ship Now") }} @@ -137,7 +137,7 @@
{{ translate("Shipped") }} - {{ translate("Ship Now") }} + {{ translate("Ship Now") }} {{ translate("Regenerate Shipping Label") }} @@ -268,7 +268,8 @@ export default defineComponent({ getPartyName: 'util/getPartyName', getShipmentMethodDesc: 'util/getShipmentMethodDesc', getProductStock: 'stock/getProductStock', - productStoreShipmentMethCount: 'util/getProductStoreShipmentMethCount' + productStoreShipmentMethCount: 'util/getProductStoreShipmentMethCount', + isShipNowDisabled: 'user/isShipNowDisabled' }) }, async mounted() { diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index f1cad963..9cba30d3 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -165,7 +165,7 @@
- {{ translate("Ship Now") }} + {{ translate("Ship Now") }} @@ -191,7 +191,7 @@ {{ translate("Shipped") }} - + {{ translate("Ship order") }} @@ -514,7 +514,8 @@ export default defineComponent({ isForceScanEnabled: 'util/isForceScanEnabled', productStoreShipmentMethods: 'carrier/getProductStoreShipmentMethods', facilityCarriers: 'carrier/getFacilityCarriers', - userProfile: 'user/getUserProfile' + userProfile: 'user/getUserProfile', + isShipNowDisabled: 'user/isShipNowDisabled' }) }, data() {