Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved: allowing user to select specific identifier instead of primaryId/secondaryId in barcodeIdentififier (#412) #413

Merged
merged 5 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 Expand Up @@ -120,7 +120,7 @@
}
return resp;
},
async createPurchaseShipment({ commit }, payload) {

Check warning on line 123 in src/store/modules/order/actions.ts

View workflow job for this annotation

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

'commit' is defined but never used

Check warning on line 123 in src/store/modules/order/actions.ts

View workflow job for this annotation

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

'commit' is defined but never used
let resp;
try {
const params = {
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 @@
},

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 Expand Up @@ -102,7 +102,7 @@
return Promise.reject(new Error(err))
}
},
async receiveShipmentItem ({ commit }, payload) {

Check warning on line 105 in src/store/modules/shipment/actions.ts

View workflow job for this annotation

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

'commit' is defined but never used

Check warning on line 105 in src/store/modules/shipment/actions.ts

View workflow job for this annotation

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

'commit' is defined but never used
let areAllSuccess = true;

for (const item of payload.items) {
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 @@ -159,7 +159,7 @@
/**
* update current eComStore information
*/
async setEComStore({ commit, dispatch }, payload) {

Check warning on line 162 in src/store/modules/user/actions.ts

View workflow job for this annotation

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

'dispatch' is defined but never used

Check warning on line 162 in src/store/modules/user/actions.ts

View workflow job for this annotation

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

'dispatch' is defined but never used
commit(types.USER_CURRENT_ECOM_STORE_UPDATED, payload.eComStore);
await UserService.setUserPreference({
'userPrefTypeId': 'SELECTED_BRAND',
Expand All @@ -180,6 +180,8 @@
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 / reusable_workflow_job (20.x)

'DxpProductIdentifier' is defined but never used

export default defineComponent({
name: 'Settings',
Expand Down Expand Up @@ -208,9 +207,12 @@
setup(){
const store = useStore();
const router = useRouter();
const productIdentificationStore = useProductIdentificationStore();
let barcodeIdentificationOptions = computed(() => productIdentificationStore.getProductIdentificationOptions)

return {
Actions,
barcodeIdentificationOptions,
codeWorkingOutline,
ellipsisVertical,
globeOutline,
Expand Down
Loading