diff --git a/registro_entrada.php b/registro_entrada.php index 14d80b5..7e1f410 100644 --- a/registro_entrada.php +++ b/registro_entrada.php @@ -133,13 +133,6 @@ try { - @@ -304,15 +297,9 @@ document.addEventListener('DOMContentLoaded', (event) => { const barcodeInput = document.getElementById('barcode-input'); const sedeBarcodeSelect = document.getElementById('sede-barcode'); - const scannedProductInfo = document.getElementById('scanned-product-info'); - const scannedCodeSpan = document.getElementById('scanned-code'); - const acceptBtn = document.getElementById('accept-btn'); - const cancelBtn = document.getElementById('cancel-btn'); - const manualForm = document.getElementById('manual-entry-form'); let processing = false; - let lastScannedCode = null; // --- LÓGICA DE SONIDO (WEB AUDIO API) --- let audioCtx; @@ -415,42 +402,26 @@ document.addEventListener('DOMContentLoaded', (event) => { }); // ** Lógica del Escáner ** - function resetScanner() { - lastScannedCode = null; - barcodeInput.value = ''; - barcodeInput.disabled = false; - scannedProductInfo.style.display = 'none'; - processing = false; - barcodeInput.focus(); - } - barcodeInput.addEventListener('change', function() { const barcodeValue = this.value.trim(); - if (barcodeValue === '') return; - playBeep(); - lastScannedCode = barcodeValue; - scannedCodeSpan.textContent = barcodeValue; - scannedProductInfo.style.display = 'block'; - this.disabled = true; - acceptBtn.focus(); - }); + if (barcodeValue === '' || processing) return; - cancelBtn.addEventListener('click', resetScanner); - - acceptBtn.addEventListener('click', function() { - if (processing || !lastScannedCode) return; processing = true; + this.disabled = true; const sedeId = sedeBarcodeSelect.value; if (!sedeId) { showNotification("Por favor, seleccione una sede de destino.", false); playBeep(false); + this.value = ''; + this.disabled = false; processing = false; + this.focus(); return; } const formData = new FormData(); - formData.append('codigo_unico', lastScannedCode); + formData.append('codigo_unico', barcodeValue); formData.append('sede_id', sedeId); const borradorId = document.getElementById('borrador_id_barcode')?.value; if (borradorId) formData.append('borrador_id', borradorId); @@ -460,6 +431,7 @@ document.addEventListener('DOMContentLoaded', (event) => { .then(data => { if (data.success) { showNotification(data.message, true); + playBeep(true); refreshHistoryAndSummary(); } else { throw new Error(data.message || 'Error desconocido.'); @@ -470,7 +442,10 @@ document.addEventListener('DOMContentLoaded', (event) => { playBeep(false); }) .finally(() => { - resetScanner(); + this.value = ''; + this.disabled = false; + processing = false; + this.focus(); }); }); diff --git a/test_shalom_agencies.php b/test_shalom_agencies.php new file mode 100644 index 0000000..9d87049 --- /dev/null +++ b/test_shalom_agencies.php @@ -0,0 +1,19 @@ +