mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-24 06:28:34 +01:00
ProductBarcode: fix barcode value not updated + fix search button not reset properly
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
<FormTextField
|
<FormTextField
|
||||||
:disabled="searching"
|
:disabled="searching"
|
||||||
class="w-[30%]"
|
class="w-[30%]"
|
||||||
:model-value="barcode"
|
v-model="barcode"
|
||||||
:label="$t('components.item.product_import.barcode')"
|
:label="$t('components.item.product_import.barcode')"
|
||||||
@keyup.enter="retrieveProductInfo(barcode)"
|
@keyup.enter="retrieveProductInfo(barcode)"
|
||||||
/>
|
/>
|
||||||
@@ -138,6 +138,7 @@
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
registerOpenDialogCallback(DialogID.ProductImport, params => {
|
registerOpenDialogCallback(DialogID.ProductImport, params => {
|
||||||
selectedRow.value = -1;
|
selectedRow.value = -1;
|
||||||
|
searching.value = false;
|
||||||
|
|
||||||
if (params?.barcode) {
|
if (params?.barcode) {
|
||||||
// Reset if the barcode is different
|
// Reset if the barcode is different
|
||||||
@@ -165,14 +166,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function retrieveProductInfo(barcode: string) {
|
async function retrieveProductInfo(barcode: string) {
|
||||||
products.value = null;
|
|
||||||
searching.value = true;
|
|
||||||
|
|
||||||
if (!barcode || barcode.trim().length === 0) {
|
if (!barcode || barcode.trim().length === 0) {
|
||||||
console.error("Invalid barcode provided");
|
console.error("Invalid barcode provided");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
products.value = null;
|
||||||
|
searching.value = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await api.products.searchFromBarcode(barcode.trim());
|
const result = await api.products.searchFromBarcode(barcode.trim());
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user