From 60d20c7eaf34ab24cc12d5be13317bd20717bf16 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Mon, 30 Dec 2024 19:14:02 +0530 Subject: [PATCH 1/3] Improved: added support for removing the unmatched hard count items from the cycle count (#557) --- src/views/HardCountDetail.vue | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/views/HardCountDetail.vue b/src/views/HardCountDetail.vue index fabe6b80..22f9e640 100644 --- a/src/views/HardCountDetail.vue +++ b/src/views/HardCountDetail.vue @@ -4,6 +4,11 @@ {{ cycleCount.countImportName }} + + + + + @@ -178,6 +183,7 @@ import { IonContent, IonBadge, IonButton, + IonButtons, IonIcon, IonItem, IonList, @@ -200,7 +206,7 @@ import { alertController, modalController } from "@ionic/vue"; -import { chevronDownOutline, chevronUpOutline, cloudOfflineOutline, paperPlaneOutline } from "ionicons/icons"; +import { chevronDownOutline, chevronUpOutline, cloudOfflineOutline, paperPlaneOutline, trashOutline } from "ionicons/icons"; import { translate } from "@/i18n"; import { computed, defineProps, ref } from "vue"; import { useStore } from "@/store"; @@ -339,6 +345,17 @@ async function changeProduct(direction: string) { isScrolling.value = false; } +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 updatedItems = items.filter((item: any) => item.scannedId !== current.scannedId); + + store.dispatch("count/updateCycleCountItems", updatedItems); + store.dispatch("product/currentProduct", newCurrent ? newCurrent : {}) +} + async function scanProduct() { let isNewlyAdded = false; if(!queryString.value) { From 4fbc0860127ac197d311fede515f725d5794d16f Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Fri, 3 Jan 2025 10:54:48 +0530 Subject: [PATCH 2/3] Improved: check to showing delete icon to only show if item is unmatched not in matching (#557) --- src/views/HardCountDetail.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/HardCountDetail.vue b/src/views/HardCountDetail.vue index 22f9e640..dfd4b2b8 100644 --- a/src/views/HardCountDetail.vue +++ b/src/views/HardCountDetail.vue @@ -4,7 +4,7 @@ {{ cycleCount.countImportName }} - + From 7430f064a483087e97ce101cb2124e82932bacb9 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Fri, 3 Jan 2025 11:58:53 +0530 Subject: [PATCH 3/3] Improved: selecting the first item in case of no item after the removed item and updated variable name (#557) --- src/views/HardCountDetail.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/HardCountDetail.vue b/src/views/HardCountDetail.vue index dfd4b2b8..87dd1dd3 100644 --- a/src/views/HardCountDetail.vue +++ b/src/views/HardCountDetail.vue @@ -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() {