Skip to content

Commit

Permalink
Fixed: used product store settings inplace of userpreference everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Oct 18, 2024
1 parent 733c60b commit 6b31d36
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +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"}}
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": "PRINT_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"}}
10 changes: 5 additions & 5 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const actions: ActionTree<OrderState , RootState> ={

const orderQueryPayload = prepareOrderQuery({
...payload,
shipmentMethodTypeId: !store.state.user.preference.showShippingOrders ? 'STOREPICKUP' : '',
shipmentMethodTypeId: !store.state.user.bopisProductStoreSettings['SHOW_SHIPPING_ORDERS'] ? 'STOREPICKUP' : '',
'-shipmentStatusId': '(SHIPMENT_PACKED OR SHIPMENT_SHIPPED)',
'-fulfillmentStatus': '(Cancelled OR Rejected)',
orderStatusId: 'ORDER_APPROVED',
Expand Down Expand Up @@ -234,7 +234,7 @@ const actions: ActionTree<OrderState , RootState> ={

const orderQueryPayload = prepareOrderQuery({
...payload,
shipmentMethodTypeId: !store.state.user.preference.showShippingOrders ? 'STOREPICKUP' : '',
shipmentMethodTypeId: !store.state.user.bopisProductStoreSettings['SHOW_SHIPPING_ORDERS'] ? 'STOREPICKUP' : '',
orderTypeId: 'SALES_ORDER'
})

Expand Down Expand Up @@ -335,7 +335,7 @@ const actions: ActionTree<OrderState , RootState> ={
let resp;
const orderQueryPayload = prepareOrderQuery({
...payload,
shipmentMethodTypeId: !store.state.user.preference.showShippingOrders ? 'STOREPICKUP' : '',
shipmentMethodTypeId: !store.state.user.bopisProductStoreSettings['SHOW_SHIPPING_ORDERS'] ? 'STOREPICKUP' : '',
shipmentStatusId: "SHIPMENT_PACKED",
orderTypeId: 'SALES_ORDER',
'-fulfillmentStatus': '(Cancelled OR Rejected)',
Expand Down Expand Up @@ -421,7 +421,7 @@ const actions: ActionTree<OrderState , RootState> ={
let resp;
const orderQueryPayload = prepareOrderQuery({
...payload,
shipmentMethodTypeId: !store.state.user.preference.showShippingOrders ? 'STOREPICKUP' : '',
shipmentMethodTypeId: !store.state.user.bopisProductStoreSettings['SHOW_SHIPPING_ORDERS'] ? 'STOREPICKUP' : '',
orderItemStatusId: "ITEM_COMPLETED",
orderTypeId: 'SALES_ORDER',
docType: 'ORDER'
Expand Down Expand Up @@ -541,7 +541,7 @@ const actions: ActionTree<OrderState , RootState> ={
async packShipGroupItems ({ state, dispatch, commit }, payload) {
emitter.emit("presentLoader")

if (store.state.user.preference.configurePicker && payload.order.isPicked !== 'Y') {
if (store.state.user.bopisProductStoreSettings['ENABLE_TRACKING'] && payload.order.isPicked !== 'Y') {
let resp;

const items = payload.order.parts[0].items;
Expand Down
9 changes: 4 additions & 5 deletions src/views/OrderDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ion-button v-if="orderType === 'open'" class="ion-hide-md-up" :disabled="!order?.orderId || !hasPermission(Actions.APP_ORDER_UPDATE) || order.readyToHandover || order.readyToShip || order.rejected" @click="rejectOrder()">
<ion-icon slot="icon-only" color="danger" :icon="bagRemoveOutline" />
</ion-button>
<ion-button v-else-if="orderType === 'packed' && showPackingSlip" :class="order.part?.shipmentMethodEnum?.shipmentMethodEnumId !== 'STOREPICKUP' ? 'ion-hide-md-up' : ''" :disabled="!order?.orderId || !hasPermission(Actions.APP_ORDER_UPDATE) || order.handovered || order.shipped" @click="order.part?.shipmentMethodEnum?.shipmentMethodEnumId === 'STOREPICKUP' ? printPackingSlip(order) : printShippingLabelAndPackingSlip(order)">
<ion-button v-else-if="orderType === 'packed' && getBopisProductStoreSettings('PRINT_PACKING_SLIPS')" :class="order.part?.shipmentMethodEnum?.shipmentMethodEnumId !== 'STOREPICKUP' ? 'ion-hide-md-up' : ''" :disabled="!order?.orderId || !hasPermission(Actions.APP_ORDER_UPDATE) || order.handovered || order.shipped" @click="order.part?.shipmentMethodEnum?.shipmentMethodEnumId === 'STOREPICKUP' ? printPackingSlip(order) : printShippingLabelAndPackingSlip(order)">
<ion-icon slot="icon-only" :icon="printOutline" />
</ion-button>
</ion-buttons>
Expand Down Expand Up @@ -79,7 +79,7 @@
<p>{{ order.shippingInstructions }}</p>
</ion-label>
</ion-item>
<ion-item v-if="orderType === 'packed' && configurePicker && order.pickers" lines="none">
<ion-item v-if="orderType === 'packed' && getBopisProductStoreSettings('ENABLE_TRACKING') && order.pickers" lines="none">
<ion-label>
{{ order.pickers ? translate("Picked by", { pickers: order.pickers }) : translate("No picker assigned.") }}
</ion-label>
Expand Down Expand Up @@ -313,15 +313,14 @@ export default defineComponent({
...mapGetters({
order: "order/getCurrent",
currentFacility: 'user/getCurrentFacility',
configurePicker: "user/configurePicker",
partialOrderRejectionConfig: 'user/getPartialOrderRejectionConfig',
getPaymentMethodDesc: 'util/getPaymentMethodDesc',
getStatusDesc: 'util/getStatusDesc',
showPackingSlip: 'user/showPackingSlip',
getProduct: 'product/getProduct',
getProductStock: 'stock/getProductStock',
getfacilityTypeDesc: 'util/getFacilityTypeDesc',
getPartyName: 'util/getPartyName',
getBopisProductStoreSettings: 'user/getBopisProductStoreSettings'
})
},
props: ['orderType', 'orderId', 'orderPartSeqId'],
Expand Down Expand Up @@ -395,7 +394,7 @@ export default defineComponent({
return rejectOrderModal.present();
},
async readyForPickup(order: any, part: any) {
if(this.configurePicker && order.isPicked !== 'Y') return this.assignPicker(order, part, this.currentFacility.facilityId);
if(this.getBopisProductStoreSettings('ENABLE_TRACKING') && order.isPicked !== 'Y') return this.assignPicker(order, part, this.currentFacility.facilityId);
const pickup = part?.shipmentMethodEnum?.shipmentMethodEnumId === 'STOREPICKUP';
const header = pickup ? translate('Ready for pickup') : translate('Ready to ship');
const message = pickup ? translate('An email notification will be sent to that their order is ready for pickup. This order will also be moved to the packed orders tab.', { customerName: order.customer.name, space: '<br/><br/>' }) : '';
Expand Down
14 changes: 6 additions & 8 deletions src/views/Orders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
{{ order.part.shipmentMethodEnum?.shipmentMethodEnumId === 'STOREPICKUP' ? translate("Ready for pickup") : translate("Ready to ship") }}
</ion-button>
<div></div>
<ion-button v-if="printPicklistPref" slot="end" fill="clear" @click.stop="printPicklist(order, order.part)">
<ion-button v-if="getBopisProductStoreSettings('PRINT_PICKLISTS')" slot="end" fill="clear" @click.stop="printPicklist(order, order.part)">
<ion-icon :icon="printOutline" slot="icon-only" />
</ion-button>
</div>
Expand All @@ -86,7 +86,7 @@
<ion-label class="ion-text-wrap">
<h1>{{ order.customer.name }}</h1>
<p>{{ order.orderName ? order.orderName : order.orderId }}</p>
<p v-if="configurePicker">{{ order.pickers ? translate("Picked by", { pickers: order.pickers }) : translate("No picker assigned.") }}</p>
<p v-if="getBopisProductStoreSettings('ENABLE_TRACKING')">{{ order.pickers ? translate("Picked by", { pickers: order.pickers }) : translate("No picker assigned.") }}</p>
</ion-label>
<ion-badge v-if="order.placedDate" color="dark" slot="end">{{ timeFromNow(order.placedDate) }}</ion-badge>
</ion-item>
Expand Down Expand Up @@ -118,7 +118,7 @@
<ion-button :disabled="!hasPermission(Actions.APP_ORDER_UPDATE)" fill="clear" @click.stop="deliverShipment(order)">
{{ order.part.shipmentMethodEnum.shipmentMethodEnumId === 'STOREPICKUP' ? translate("Handover") : translate("Ship") }}
</ion-button>
<ion-button v-if="showPackingSlip" fill="clear" slot="end" @click.stop="printPackingSlip(order)">
<ion-button v-if="getBopisProductStoreSettings('PRINT_PACKING_SLIPS')" fill="clear" slot="end" @click.stop="printPackingSlip(order)">
<ion-icon slot="icon-only" :icon="printOutline" />
</ion-button>
<ion-button v-if="order.part.shipmentMethodEnum.shipmentMethodEnumId === 'STOREPICKUP'" fill="clear" slot="end" @click.stop="sendReadyForPickupEmail(order)">
Expand Down Expand Up @@ -252,15 +252,13 @@ export default defineComponent({
orders: 'order/getOpenOrders',
packedOrders: 'order/getPackedOrders',
completedOrders: 'order/getCompletedOrders',
configurePicker: "user/configurePicker",
currentFacility: 'user/getCurrentFacility',
isPackedOrdersScrollable: 'order/isPackedOrdersScrollable',
isOpenOrdersScrollable: 'order/isOpenOrdersScrollable',
isCompletedOrdersScrollable: 'order/isCompletedOrdersScrollable',
showPackingSlip: 'user/showPackingSlip',
notifications: 'user/getNotifications',
unreadNotificationsStatus: 'user/getUnreadNotificationsStatus',
printPicklistPref: 'user/printPicklistPref'
getBopisProductStoreSettings: 'user/getBopisProductStoreSettings'
})
},
data() {
Expand Down Expand Up @@ -393,7 +391,7 @@ export default defineComponent({
}
},
async readyForPickup (order: any, part: any) {
if(this.configurePicker && order.isPicked !== 'Y') return this.assignPicker(order, part, this.currentFacility.facilityId);
if(this.getBopisProductStoreSettings('ENABLE_TRACKING') && order.isPicked !== 'Y') return this.assignPicker(order, part, this.currentFacility.facilityId);
const pickup = part.shipmentMethodEnum?.shipmentMethodEnumId === 'STOREPICKUP';
const header = pickup ? translate('Ready for pickup') : translate('Ready to ship');
const message = pickup ? translate('An email notification will be sent to that their order is ready for pickup. This order will also be moved to the packed orders tab.', { customerName: order.customer.name, space: '<br/><br/>'}) : '';
Expand Down Expand Up @@ -516,7 +514,7 @@ export default defineComponent({
return;
}
if(!this.configurePicker) {
if(!this.getBopisProductStoreSettings('ENABLE_TRACKING')) {
try {
const resp = await UserService.ensurePartyRole({
partyId: "_NA_",
Expand Down
3 changes: 0 additions & 3 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,11 @@ export default defineComponent({
userProfile: 'user/getUserProfile',
currentFacility: 'user/getCurrentFacility',
currentEComStore: 'user/getCurrentEComStore',
configurePicker: "user/configurePicker",
showShippingOrders: 'user/showShippingOrders',
showPackingSlip: 'user/showPackingSlip',
partialOrderRejectionConfig: 'user/getPartialOrderRejectionConfig',
firebaseDeviceId: 'user/getFirebaseDeviceId',
notificationPrefs: 'user/getNotificationPrefs',
allNotificationPrefs: 'user/getAllNotificationPrefs',
printPicklistPref: "user/printPicklistPref",
getBopisProductStoreSettings: "user/getBopisProductStoreSettings"
})
},
Expand Down

0 comments on commit 6b31d36

Please sign in to comment.