Skip to content

Commit

Permalink
Removed: removed productIdentifiers getter , mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ridwan6947 committed Jul 23, 2024
1 parent 71c48f1 commit d378b59
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 35 deletions.
19 changes: 0 additions & 19 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default defineComponent({
computed: {
...mapGetters({
currentEComStore: 'user/getCurrentEComStore',
productIdentifications: 'util/getProductIdentifications',
userProfile: 'user/getUserProfile',
userToken: 'user/getUserToken',
instanceUrl: 'user/getInstanceUrl'
Expand Down Expand Up @@ -100,24 +99,6 @@ export default defineComponent({
emitter.on('presentLoader', this.presentLoader);
emitter.on('dismissLoader', this.dismissLoader);
},
async mounted() {
if(this.productIdentifications.length <= 0) {
// TODO: fetch product identifications from enumeration instead of storing it in env
this.store.dispatch('util/setProductIdentifications', process.env.VUE_APP_PRDT_IDENT ? JSON.parse(process.env.VUE_APP_PRDT_IDENT) : [])
}
if(this.userProfile) {
this.store.dispatch('user/getProductIdentificationPref', this.currentEComStore.productStoreId);
}
// Handles case when user resumes or reloads the app
// Luxon timezzone should be set with the user's selected timezone
if (this.userProfile && this.userProfile.userTimeZone) {
Settings.defaultZone = this.userProfile.userTimeZone;
}
await useProductIdentificationStore().getIdentificationPref(this.currentEComStore?.productStoreId)
.catch((error) => console.log(error))
},
unmounted() {
emitter.off('presentLoader', this.presentLoader);
emitter.off('dismissLoader', this.dismissLoader);
Expand Down
4 changes: 2 additions & 2 deletions src/components/ClosePurchaseOrderModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<DxpShopifyImg size="small" :src="getProduct(item.productId).mainImageUrl" />
</ion-thumbnail>
<ion-label>
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) || getProduct(item.productId).productName }}</h2>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId))}}</p>
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}</h2>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
</ion-label>
<ion-buttons>
<ion-checkbox aria-label="itemStatus" slot="end" :modelValue="isPOItemStatusPending(item) ? item.isChecked : true" :disabled="isPOItemStatusPending(item) ? false : true" />
Expand Down
1 change: 0 additions & 1 deletion src/store/modules/util/UtilState.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export default interface UtilState {
status: any;
productIdentifications: Array<string>;
isForceScanEnabled: boolean;
barcodeIdentificationPref: any;
}
3 changes: 0 additions & 3 deletions src/store/modules/util/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ const actions: ActionTree<UtilState, RootState> = {
}
return cachedStatus;
},
async setProductIdentifications({ commit }, payload) {
commit(types.UTIL_PRODUCT_IDENT_UPDATED, payload)
},

async getForceScanSetting({ commit, dispatch }, eComStoreId) {
const payload = {
Expand Down
3 changes: 0 additions & 3 deletions src/store/modules/util/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ const getters: GetterTree <UtilState, RootState> = {
getStatusDesc: (state) => (statusId: string) => {
return state.status[statusId]
},
getProductIdentifications: (state) => {
return state.productIdentifications
},
isForceScanEnabled(state) {
return state.isForceScanEnabled
},
Expand Down
1 change: 0 additions & 1 deletion src/store/modules/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const utilModule: Module<UtilState, RootState> = {
namespaced: true,
state: {
status: {},
productIdentifications: [],
isForceScanEnabled: false,
barcodeIdentificationPref: ""
},
Expand Down
3 changes: 0 additions & 3 deletions src/store/modules/util/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ const mutations: MutationTree <UtilState> = {
[types.UTIL_STATUS_UPDATED](state, payload) {
state.status = payload
},
[types.UTIL_PRODUCT_IDENT_UPDATED](state, payload) {
state.productIdentifications = payload
},
[types.UTIL_FORCE_SCAN_STATUS_UPDATED](state, payload) {
state.isForceScanEnabled = payload
},
Expand Down
2 changes: 1 addition & 1 deletion src/views/AddProductToPOModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<ion-label>
<!-- Honouring the identifications set by the user on the settings page -->
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) : getProduct(product.productId).productName }}</h2>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(product.productId)) }}</p>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(product.productId)) }}</p>
</ion-label>
<ion-icon v-if="isProductAvailableInOrder(product.productId)" color="success" :icon="checkmarkCircle" />
<ion-button v-else fill="outline" @click="addtoOrder(product)">{{ translate("Add to Purchase Order") }}</ion-button>
Expand Down
1 change: 0 additions & 1 deletion src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ export default defineComponent({
userProfile: 'user/getUserProfile',
currentFacility: 'user/getCurrentFacility',
currentEComStore: 'user/getCurrentEComStore',
productIdentifications: 'util/getProductIdentifications',
productIdentificationPref: 'user/getProductIdentificationPref',
isForceScanEnabled: 'util/isForceScanEnabled',
barcodeIdentificationPref: 'util/getBarcodeIdentificationPref'
Expand Down
2 changes: 1 addition & 1 deletion src/views/ShipmentDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</ion-thumbnail>
<ion-label class="ion-text-wrap">
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}</h2>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
</ion-label>
</ion-item>
</div>
Expand Down

0 comments on commit d378b59

Please sign in to comment.