From a85bdfef88aee5f62efe7504f6a81bba5660cae6 Mon Sep 17 00:00:00 2001 From: Crumb Owl Date: Tue, 1 Jul 2025 11:41:33 +0200 Subject: [PATCH] ProductBarcode: display barcode type in frontend/Scanner.vue --- frontend/components/App/ScannerModal.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/components/App/ScannerModal.vue b/frontend/components/App/ScannerModal.vue index 1f4e049c..91076976 100644 --- a/frontend/components/App/ScannerModal.vue +++ b/frontend/components/App/ScannerModal.vue @@ -19,7 +19,7 @@ role="alert" > - Product barcode detected: {{ detectedBarcode }} + {{ detectedBarcodeType }} product barcode detected: {{ detectedBarcode }} @@ -66,6 +66,7 @@ const codeReader = new BrowserMultiFormatReader(); const errorMessage = ref(null); const detectedBarcode = ref(""); + const detectedBarcodeType = ref(""); const api = useUserApi(); const handleError = (error: unknown) => { @@ -193,13 +194,16 @@ navigateTo(sanitizedPath); } catch (err) { // Check if it's a barcode for a new element - switch (result.getBarcodeFormat()) { + const bcfmt = result.getBarcodeFormat(); + + switch (bcfmt) { case BarcodeFormat.EAN_13: case BarcodeFormat.UPC_A: case BarcodeFormat.UPC_E: case BarcodeFormat.UPC_EAN_EXTENSION: console.info("Barcode detected"); detectedBarcode.value = result.getText(); + detectedBarcodeType.value = BarcodeFormat[bcfmt].replaceAll("_","-"); break; default: