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: added support for removing the unmatched hard count items from the cycle count (#557) #575

Merged
merged 3 commits into from
Jan 3, 2025
Merged
Changes from 1 commit
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
Next Next commit
Improved: added support for removing the unmatched hard count items f…
…rom the cycle count (#557)
  • Loading branch information
amansinghbais committed Dec 30, 2024
commit 60d20c7eaf34ab24cc12d5be13317bd20717bf16
19 changes: 18 additions & 1 deletion src/views/HardCountDetail.vue
Original file line number Diff line number Diff line change
@@ -4,6 +4,11 @@
<ion-toolbar>
<ion-back-button default-href="/tabs/count" slot="start"></ion-back-button>
<ion-title>{{ cycleCount.countImportName }}</ion-title>
<ion-buttons slot="end" v-if="currentProduct && !isItemAlreadyAdded(currentProduct)">
<ion-button fill="clear" @click="removeCountItem(currentProduct)">
<ion-icon :icon="trashOutline" slot="icon-only" />
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>

@@ -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) {
Loading