Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/hotwax/inventory-count into h…
Browse files Browse the repository at this point in the history
…otwax#559-persist
  • Loading branch information
amansinghbais committed Jan 3, 2025
2 parents daee11e + c338b8f commit b996758
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/views/HardCountDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 && currentProduct.isMatchNotFound">
<ion-button fill="clear" @click="removeCountItem(currentProduct)">
<ion-icon :icon="trashOutline" slot="icon-only" />
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>

Expand Down Expand Up @@ -178,6 +183,7 @@ import {
IonContent,
IonBadge,
IonButton,
IonButtons,
IonIcon,
IonItem,
IonList,
Expand All @@ -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";
Expand Down Expand Up @@ -331,6 +337,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 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", updatedProduct ? updatedProduct : {})
}
async function scanProduct() {
let isNewlyAdded = false;
if(!queryString.value) {
Expand Down

0 comments on commit b996758

Please sign in to comment.