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:
@@ -727,6 +727,28 @@ body {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.barcode-manual-entry {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.barcode-input-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.barcode-input-row .form-input {
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
font-size: 1.1rem;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.barcode-input-row .btn {
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.scan-hint {
|
||||
text-align: center;
|
||||
font-size: 0.85rem;
|
||||
|
||||
@@ -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