Autosave: 20260428-033211
This commit is contained in:
parent
870bef9157
commit
c214262958
@ -133,13 +133,6 @@ try {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="scanned-product-info" class="mt-3" style="display: none;">
|
||||
<p><strong>Producto escaneado:</strong> <span id="scanned-code"></span></p>
|
||||
<div class="d-grid gap-2">
|
||||
<button type="button" id="accept-btn" class="btn btn-success"> <i class="fa fa-check-circle"></i> Aceptar y Registrar</button>
|
||||
<button type="button" id="cancel-btn" class="btn btn-danger"> <i class="fa fa-times-circle"></i> Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
19
test_shalom_agencies.php
Normal file
19
test_shalom_agencies.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
$apiKey = 'sk_mlq1j3na_4a676ewvaop';
|
||||
$url = "https://shalom-api.lat/api/v1/agencies";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Accept: application/json',
|
||||
"Authorization: Bearer {$apiKey}"
|
||||
]);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
echo "HTTP Code: $httpCode\n";
|
||||
echo "Response: $response\n";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user