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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user