Skip to content

Commit

Permalink
Merge pull request #413 from amansinghbais/#412
Browse files Browse the repository at this point in the history
Improved: allowing user to select specific identifier instead of primaryId/secondaryId in barcodeIdentififier (#412)
  • Loading branch information
ravilodhi authored Nov 5, 2024
2 parents cbe1b10 + dea1c42 commit d3d68a6
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 25 deletions.
6 changes: 2 additions & 4 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"Pending: items": "Pending: {itemsCount} items",
"Please provide a valid valid barcode identifier.": "Please provide a valid valid barcode identifier.",
"primary identifier": "primary identifier",
"Primary identifier": "Primary identifier",
"Primary Product Identifier": "Primary Product Identifier",
"Primary": "Primary",
"Proceed": "Proceed",
Expand Down Expand Up @@ -104,7 +103,6 @@
"Scanned item is not present within the shipment:": "Scanned item is not present within the shipment: {itemName}",
"Scanned successfully.": "Scanned {itemName} successfully.",
"secondary identifier": "secondary identifier",
"Secondary identifier": "Secondary identifier",
"Search": "Search",
"Search purchase orders": "Search purchase orders",
"Search returns": "Search returns",
Expand Down Expand Up @@ -140,8 +138,8 @@
"Timezone": "Timezone",
"Time zone updated successfully": "Time zone updated successfully",
"To close the purchase order, select all.": "To close the purchase order, select all.",
"Unable to update barcode identification preference.": "Unable to update barcode identification preference.",
"Unable to update force scan preference.": "Unable to update force scan preference.",
"Unable to update barcode identification preference since no product store config found.": "Unable to update barcode identification preference since no product store config found.",
"Unable to update force scan preference since no product store config found.": "Unable to update force scan preference since no product store config found.",
"Unable to update product identifier preference": "Unable to update product identifier preference",
"Username": "Username",
"Version: ": "Version: {appVersion}",
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const actions: ActionTree<OrderState, RootState> = {
return resp;
},
async updateProductCount({ commit, state }, payload ) {
const barcodeIdentifier = store.getters['util/getBarcodeIdentificationValue'];
const barcodeIdentifier = store.getters['util/getBarcodeIdentificationPref'];
const getProduct = store.getters['product/getProduct'];

const item = state.current.items.find((item: any) => {
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/return/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const actions: ActionTree<ReturnState, RootState> = {
return resp;
},
async updateReturnProductCount ({ commit, state }, payload) {
const barcodeIdentifier = store.getters['util/getBarcodeIdentificationValue'];
const barcodeIdentifier = store.getters['util/getBarcodeIdentificationPref'];
const getProduct = store.getters['product/getProduct'];

const item = state.current.items.find((item: any) => {
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/shipment/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const actions: ActionTree<ShipmentState, RootState> = {
},

async updateShipmentProductCount ({ commit, state }, payload) {
const barcodeIdentifier = store.getters['util/getBarcodeIdentificationValue'];
const barcodeIdentifier = store.getters['util/getBarcodeIdentificationPref'];
const getProduct = store.getters['product/getProduct'];

const item = state.current.items.find((item: any) => {
Expand Down
2 changes: 2 additions & 0 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ const actions: ActionTree<UserState, RootState> = {
commit(types.USER_CURRENT_ECOM_STORE_UPDATED, eComStore);
commit(types.USER_CURRENT_FACILITY_UPDATED, payload.facility);
await dispatch('getFacilityLocations', payload.facility.facilityId)
eComStore?.productStoreId ? this.dispatch('util/getForceScanSetting', eComStore.productStoreId) : this.dispatch('util/updateForceScanStatus', false)
eComStore?.productStoreId ? this.dispatch('util/getBarcodeIdentificationPref', eComStore.productStoreId) : this.dispatch('util/updateBarcodeIdentificationPref', "internalName")
},

/**
Expand Down
10 changes: 5 additions & 5 deletions src/store/modules/util/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const actions: ActionTree<UtilState, RootState> = {

// 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 force scan preference."))
showToast(translate("Unable to update force scan preference since no product store config found."))
commit(types.UTIL_FORCE_SCAN_STATUS_UPDATED, prefValue)
return;
}
Expand Down Expand Up @@ -191,7 +191,7 @@ const actions: ActionTree<UtilState, RootState> = {
}
} catch(err) {
console.error(err)
commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, "primaryId")
commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, "internalName")
}
},

Expand All @@ -218,7 +218,7 @@ const actions: ActionTree<UtilState, RootState> = {
fromDate,
"productStoreId": ecomStore.productStoreId,
"settingTypeEnumId": "BARCODE_IDEN_PREF",
"settingValue": "primaryId"
"settingValue": "internalName"
}

await UtilService.createBarcodeIdentificationPref(params) as any
Expand All @@ -228,7 +228,7 @@ const actions: ActionTree<UtilState, RootState> = {

// not checking for resp success and fail case as every time we need to update the state with the
// default value when creating a scan setting
commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, "primaryId")
commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, "internalName")
return fromDate;
},

Expand All @@ -238,7 +238,7 @@ const actions: ActionTree<UtilState, RootState> = {

// 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 barcode identification preference."))
showToast(translate("Unable to update barcode identification preference since no product store config found."))
commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, prefValue)
return;
}
Expand Down
9 changes: 0 additions & 9 deletions src/store/modules/util/getters.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { GetterTree } from 'vuex'
import RootState from '@/store/RootState'
import UtilState from './UtilState';
import { computed } from 'vue';
import { useProductIdentificationStore } from '@hotwax/dxp-components';




const getters: GetterTree <UtilState, RootState> = {
Expand All @@ -16,11 +12,6 @@ const getters: GetterTree <UtilState, RootState> = {
},
getBarcodeIdentificationPref(state) {
return state.barcodeIdentificationPref
},
getBarcodeIdentificationValue(state, getters, rootState, rootGetters) {
const productIdentificationStore = useProductIdentificationStore();
const productIdentificationPref = computed(() => productIdentificationStore.getProductIdentificationPref) as any;
return productIdentificationPref.value[state.barcodeIdentificationPref]
}
}
export default getters;
10 changes: 6 additions & 4 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@
</ion-item>
<ion-item lines="none">
<ion-select :label="translate('Barcode Identifier')" interface="popover" :placeholder="translate('Select')" :value="barcodeIdentificationPref" @ionChange="setBarcodeIdentificationPref($event.detail.value)">
<ion-select-option value="primaryId">{{ translate("Primary identifier") }}</ion-select-option>
<ion-select-option value="secondaryId">{{ translate("Secondary identifier") }}</ion-select-option>
<ion-select-option v-for="identification in barcodeIdentificationOptions" :key="identification" :value="identification" >{{ identification }}</ion-select-option>
</ion-select>
</ion-item>
</ion-card>
Expand All @@ -86,14 +85,14 @@

<script lang="ts">
import { alertController, IonAvatar, IonButton, IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle, IonContent, IonHeader,IonIcon, IonItem, IonMenuButton, IonPage, IonSelect, IonSelectOption, IonTitle, IonToggle, IonToolbar } from '@ionic/vue';
import { defineComponent } from 'vue';
import { computed, defineComponent } from 'vue';
import { codeWorkingOutline, ellipsisVertical, openOutline, saveOutline, globeOutline, personCircleOutline, storefrontOutline} from 'ionicons/icons'
import { mapGetters, useStore } from 'vuex';
import { useRouter } from 'vue-router';
import Image from '@/components/Image.vue'
import { DateTime } from 'luxon';
import { Actions, hasPermission } from '@/authorization';
import { DxpProductIdentifier, translate } from "@hotwax/dxp-components"
import { DxpProductIdentifier, translate, useProductIdentificationStore } from "@hotwax/dxp-components"

Check warning on line 95 in src/views/Settings.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'DxpProductIdentifier' is defined but never used

Check warning on line 95 in src/views/Settings.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / build_and_deploy

'DxpProductIdentifier' is defined but never used

Check warning on line 95 in src/views/Settings.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'DxpProductIdentifier' is defined but never used
export default defineComponent({
name: 'Settings',
Expand Down Expand Up @@ -208,9 +207,12 @@ export default defineComponent({
setup(){
const store = useStore();
const router = useRouter();
const productIdentificationStore = useProductIdentificationStore();
let barcodeIdentificationOptions = computed(() => productIdentificationStore.getProductIdentificationOptions)
return {
Actions,
barcodeIdentificationOptions,
codeWorkingOutline,
ellipsisVertical,
globeOutline,
Expand Down

0 comments on commit d3d68a6

Please sign in to comment.