Skip to content

Commit

Permalink
Improved: added support for default recount updation behaviour and re…
Browse files Browse the repository at this point in the history
…seting to it (#528)
  • Loading branch information
amansinghbais committed Dec 27, 2024
1 parent e32acea commit 19c13bd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/store/modules/count/CountState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export default interface CountState {
stats: any;
cycleCounts: any;
cycleCountItems: any;
cycleCountImportSystemMessages: Array<any>
cycleCountImportSystemMessages: Array<any>;
defaultRecountUpdateBehaviour: String;
}
3 changes: 3 additions & 0 deletions src/store/modules/count/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const getters: GetterTree<CountState, RootState> = {
},
getCycleCountImportSystemMessages(state) {
return state.cycleCountImportSystemMessages
},
getDefaultRecountUpdateBehaviour(state) {
return state.defaultRecountUpdateBehaviour
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/store/modules/count/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const countModule: Module<CountState, RootState> = {
list: [],
isScrollable: true
},
cycleCountItems: {}
cycleCountItems: {},
defaultRecountUpdateBehaviour: "add"
},
getters,
actions,
Expand Down
4 changes: 4 additions & 0 deletions src/views/HardCountDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ const getProduct = computed(() => (id: any) => store.getters["product/getProduct
const cycleCountItems = computed(() => store.getters["count/getCycleCountItems"]);
const userProfile = computed(() => store.getters["user/getUserProfile"])
const productStoreSettings = computed(() => store.getters["user/getProductStoreSettings"])
const defaultRecountUpdateBehaviour = computed(() => store.getters["count/getDefaultRecountUpdateBehaviour"])
const currentItemIndex = computed(() => !currentProduct.value ? 0 : currentProduct.value.scannedId ? itemsList.value?.findIndex((item: any) => item.scannedId === currentProduct.value.scannedId) : itemsList?.value.findIndex((item: any) => item.productId === currentProduct.value?.productId && item.importItemSeqId === currentProduct.value?.importItemSeqId));
const itemsList = computed(() => {
Expand Down Expand Up @@ -251,6 +252,7 @@ onIonViewDidEnter(async() => {
previousItem = itemsList.value[0];
await store.dispatch("product/currentProduct", itemsList.value?.length ? itemsList.value[0] : {})
barcodeInputRef.value?.$el?.setFocus();
selectedCountUpdateType.value = defaultRecountUpdateBehaviour.value
})
onIonViewDidLeave(async() => {
Expand Down Expand Up @@ -319,6 +321,7 @@ function handleSegmentChange() {
store.dispatch("product/currentProduct", {});
}
inputCount.value = ""
selectedCountUpdateType.value = defaultRecountUpdateBehaviour.value
}
async function changeProduct(direction: string) {
Expand Down Expand Up @@ -548,6 +551,7 @@ const onScroll = (event: any) => {
products.forEach((product: any) => {
observer.observe(product);
});
selectedCountUpdateType.value = defaultRecountUpdateBehaviour.value
};
async function saveCount(currentProduct: any, isScrollEvent = false) {
Expand Down

0 comments on commit 19c13bd

Please sign in to comment.