Skip to content

Commit

Permalink
Merge pull request #504 from amansinghbais/#494-recount-current
Browse files Browse the repository at this point in the history
Improved: UI for the recount to show previous count and updated validation to allow user save 0 as count (#494)
  • Loading branch information
ymaheshwari1 authored Nov 12, 2024
2 parents bfba8bf + 7c43782 commit f5fa523
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"Created": "Created",
"CSV data is missing or incorrect. Please check your file.": "CSV data is missing or incorrect. Please check your file.",
"CSV Mapping": "CSV Mapping",
"Current count": "Current count",
"Cycle Count": "Cycle Count",
"Cycle count": "Cycle count",
"Cycle count cancelled successfully.": "Cycle count cancelled successfully.",
Expand Down Expand Up @@ -152,6 +151,7 @@
"Make sure you've reviewed the products and their counts before uploading them for review": "Make sure you've reviewed the products and their counts before uploading them for review",
"Map all required fields": "Map all required fields",
"Mapping name": "Mapping name",
"New Count": "New Count",
"New mapping": "New mapping",
"No cycle counts found": "No cycle counts found",
"No items found": "No items found",
Expand Down Expand Up @@ -222,6 +222,7 @@
"Save new count": "Save new count",
"Saved mappings": "Saved mappings",
"Saving recount will replace the existing count for item.": "Saving recount will replace the existing count for item.",
"Scan a count before saving changes": "Scan a count before saving changes",
"Scan items": "Scan items",
"Scanned item does not match current product": "Scanned item does not match current product",
"Scan or search products": "Scan or search products",
Expand Down
21 changes: 15 additions & 6 deletions src/views/CountDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
<ion-list v-if="product.isRecounting">
<ion-item>
<ion-input :label="translate('Count')" :disabled="productStoreSettings['forceScan']" :placeholder="translate('submit physical count')" name="value" v-model="inputCount" id="value" type="number" min="0" required @ionInput="hasUnsavedChanges=true" @keydown="inputCountValidation"/>
<ion-button slot="end" fill="clear" size="default" class="ion-no-padding" @click="inputCount = 0">
<ion-icon :icon="closeOutline" stot="icon-only" />
</ion-button>
</ion-item>

<template v-if="productStoreSettings['showQoh']">
Expand Down Expand Up @@ -173,6 +176,9 @@
</ion-item>
<ion-item v-else>
<ion-input :label="translate('Count')" :placeholder="translate('submit physical count')" :disabled="productStoreSettings['forceScan']" name="value" v-model="inputCount" id="value" type="number" min="0" required @ionInput="hasUnsavedChanges=true" @keydown="inputCountValidation"/>
<ion-button slot="end" fill="clear" size="default" class="ion-no-padding" @click="inputCount = 0">
<ion-icon :icon="closeOutline" stot="icon-only" />
</ion-button>
</ion-item>

<template v-if="productStoreSettings['showQoh']">
Expand Down Expand Up @@ -232,7 +238,7 @@ import {
onIonViewDidLeave,
alertController
} from '@ionic/vue';
import { chevronDownCircleOutline, chevronUpCircleOutline } from "ionicons/icons";
import { chevronDownCircleOutline, chevronUpCircleOutline, closeOutline } from "ionicons/icons";
import { translate } from '@/i18n'
import { computed, defineProps, ref } from 'vue';
import { useStore } from "@/store";
Expand Down Expand Up @@ -299,6 +305,7 @@ onIonViewDidEnter(async() => {
onIonViewDidLeave(async() => {
await store.dispatch('count/updateCycleCountItems', []);
store.dispatch("product/currentProduct", {});
})
onBeforeRouteLeave(async (to) => {
Expand Down Expand Up @@ -400,6 +407,7 @@ async function scanProduct() {
if(!selectedItem) {
showToast(translate("Scanned item is not present in the count."))
queryString.value = ""
return;
}
Expand All @@ -420,6 +428,7 @@ async function scanProduct() {
inputCount.value++
}
}
queryString.value = ""
}
function updateFilteredItems() {
Expand Down Expand Up @@ -515,8 +524,8 @@ function getVariance(item , isRecounting) {
}
async function saveCount(currentProduct) {
if (!inputCount.value) {
showToast(translate("Enter a count before saving changes"))
if (!inputCount.value && inputCount.value !== 0) {
showToast(translate(productStoreSettings.value['forceScan'] ? "Scan a count before saving changes" : "Enter a count before saving changes"))
return;
}
try {
Expand Down Expand Up @@ -566,7 +575,7 @@ async function openRecountAlert() {
{
text: translate('Re-count'),
handler: () => {
inputCount.value = 0;
inputCount.value = product.value.quantity;
product.value.isRecounting = true;
}
}]
Expand All @@ -575,8 +584,8 @@ async function openRecountAlert() {
}
async function openRecountSaveAlert() {
if (!inputCount.value) {
showToast(translate("Enter a count before saving changes"));
if (!inputCount.value && inputCount.value !== 0) {
showToast(translate(productStoreSettings.value['forceScan'] ? "Scan a count before saving changes" : "Enter a count before saving changes"));
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/ProductItemList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const productStoreSettings = computed(() => store.getters["user/getProductStoreS
const currentProduct = computed(() => store.getters["product/getCurrentProduct"])
onMounted(() => {
if (currentProduct.value) {
if (Object.keys(currentProduct.value).length) {
navigateToDetail(currentProduct.value);
}
})
Expand Down

0 comments on commit f5fa523

Please sign in to comment.