Aggiunto campo per inserire codice a barre manualmente

- Nuovo campo numerico nella pagina scansione per digitare il barcode
- Supporto tasto Invio per ricerca rapida
- Validazione: solo numeri, 4-14 cifre
- Riusa lo stesso flusso della scansione automatica (onBarcodeDetected)
This commit is contained in:
dadaloop82
2026-03-10 11:25:41 +00:00
parent 1bbecd7cc9
commit c735cacf37
3 changed files with 46 additions and 1 deletions
+17
View File
@@ -743,6 +743,23 @@ async function onBarcodeDetected(barcode) {
}
}
function submitManualBarcode() {
const input = document.getElementById('manual-barcode-input');
const barcode = (input.value || '').trim();
if (!barcode) {
showToast('Inserisci un codice a barre', 'error');
input.focus();
return;
}
if (!/^\d{4,14}$/.test(barcode)) {
showToast('Il codice a barre deve contenere solo numeri (4-14 cifre)', 'error');
input.focus();
return;
}
stopScanner();
onBarcodeDetected(barcode);
}
function startManualEntry(barcode = '') {
stopScanner();
// Reset form