Skip to content

Commit

Permalink
Merge pull request #436 from amansinghbais/#433
Browse files Browse the repository at this point in the history
Implemented: migrated bopis settings from user preference to product store settings, and added permission over them (#433)
  • Loading branch information
ravilodhi authored Oct 14, 2024
2 parents 9f2315e + 92eee51 commit 1264b29
Show file tree
Hide file tree
Showing 18 changed files with 246 additions and 74 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 0 additions & 4 deletions src/adapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import {
getNotificationUserPrefTypeIds,
getProductIdentificationPref,
getUserFacilities,
getUserPreference,
hasError,
initialise,
logout,
removeClientRegistrationToken,
resetConfig,
setProductIdentificationPref,
setUserLocale,
setUserPreference,
storeClientRegistrationToken,
subscribeTopic,
unsubscribeTopic,
Expand All @@ -32,15 +30,13 @@ export {
getNotificationUserPrefTypeIds,
getProductIdentificationPref,
getUserFacilities,
getUserPreference,
hasError,
initialise,
logout,
removeClientRegistrationToken,
resetConfig,
setProductIdentificationPref,
setUserLocale,
setUserPreference,
storeClientRegistrationToken,
subscribeTopic,
unsubscribeTopic,
Expand Down
6 changes: 6 additions & 0 deletions src/authorization/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
6 changes: 6 additions & 0 deletions src/authorization/Rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "出荷書類を生成する",
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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),
Expand All @@ -70,6 +71,7 @@ const app = createApp(App)
setUserLocale,
storeClientRegistrationToken,
getAvailableTimeZones,
hasPermission,
setUserTimeZone
});

Expand Down
63 changes: 63 additions & 0 deletions src/services/UtilService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { api } from '@/adapter';
import { hasError } from '@/adapter';

const fetchRejectReasons = async (query: any): Promise<any> => {
return api({
Expand Down Expand Up @@ -57,12 +58,74 @@ const fetchReservedQuantity = async (query: any): Promise <any> => {
});
}

const getProductStoreSettings = async (payload: any): Promise<any> => {
return api({
url: "performFind",
method: "post",
data: payload
});
}

const createProductStoreSetting = async (payload: any): Promise<any> => {
return api({
url: "service/createProductStoreSetting",
method: "post",
data: payload
});
}

const updateProductStoreSetting = async (payload: any): Promise<any> => {
return api({
url: "service/updateProductStoreSetting",
method: "post",
data: payload
});
}

const createEnumeration = async (payload: any): Promise<any> => {
return api({
url: "/service/createEnumeration",
method: "post",
data: payload
})
}

const isEnumExists = async (enumId: string): Promise<any> => {
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
}
2 changes: 1 addition & 1 deletion src/store/modules/user/UserState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export default interface UserState {
current: any;
currentFacility: object;
instanceUrl: string;
preference: any;
permissions: any;
currentEComStore: any;
partialOrderRejectionConfig: any
Expand All @@ -12,4 +11,5 @@ export default interface UserState {
firebaseDeviceId: string;
hasUnreadNotifications: boolean;
allNotificationPrefs: any;
bopisProductStoreSettings: any;
}
Loading

0 comments on commit 1264b29

Please sign in to comment.