Skip to content

Commit

Permalink
Improved: selecting the first item in case of no item after the remov…
Browse files Browse the repository at this point in the history
…ed item and updated variable name (#557)
  • Loading branch information
amansinghbais committed Jan 3, 2025
1 parent 4fbc086 commit 7430f06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/views/HardCountDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@ function removeCountItem(current: any) {
const items = JSON.parse(JSON.stringify(cycleCountItems.value.itemList))
const currentItemIndex = items.findIndex((item: any) => item.scannedId === current.scannedId);
const newCurrent = items[(currentItemIndex < items.length - 1) ? (currentItemIndex + 1) : (currentItemIndex - 1)];
const updatedProduct = items[(currentItemIndex < items.length - 1) ? (currentItemIndex + 1) : 0];
const updatedItems = items.filter((item: any) => item.scannedId !== current.scannedId);
store.dispatch("count/updateCycleCountItems", updatedItems);
store.dispatch("product/currentProduct", newCurrent ? newCurrent : {})
store.dispatch("product/currentProduct", updatedProduct ? updatedProduct : {})
}
async function scanProduct() {
Expand Down

0 comments on commit 7430f06

Please sign in to comment.