Autosave: 20260428-033211
This commit is contained in:
parent
870bef9157
commit
c214262958
@ -133,13 +133,6 @@ try {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -304,15 +297,9 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
|||||||
|
|
||||||
const barcodeInput = document.getElementById('barcode-input');
|
const barcodeInput = document.getElementById('barcode-input');
|
||||||
const sedeBarcodeSelect = document.getElementById('sede-barcode');
|
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');
|
const manualForm = document.getElementById('manual-entry-form');
|
||||||
|
|
||||||
let processing = false;
|
let processing = false;
|
||||||
let lastScannedCode = null;
|
|
||||||
|
|
||||||
// --- LÓGICA DE SONIDO (WEB AUDIO API) ---
|
// --- LÓGICA DE SONIDO (WEB AUDIO API) ---
|
||||||
let audioCtx;
|
let audioCtx;
|
||||||
@ -415,42 +402,26 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ** Lógica del Escáner **
|
// ** 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() {
|
barcodeInput.addEventListener('change', function() {
|
||||||
const barcodeValue = this.value.trim();
|
const barcodeValue = this.value.trim();
|
||||||
if (barcodeValue === '') return;
|
if (barcodeValue === '' || processing) return;
|
||||||
playBeep();
|
|
||||||
lastScannedCode = barcodeValue;
|
|
||||||
scannedCodeSpan.textContent = barcodeValue;
|
|
||||||
scannedProductInfo.style.display = 'block';
|
|
||||||
this.disabled = true;
|
|
||||||
acceptBtn.focus();
|
|
||||||
});
|
|
||||||
|
|
||||||
cancelBtn.addEventListener('click', resetScanner);
|
|
||||||
|
|
||||||
acceptBtn.addEventListener('click', function() {
|
|
||||||
if (processing || !lastScannedCode) return;
|
|
||||||
processing = true;
|
processing = true;
|
||||||
|
this.disabled = true;
|
||||||
|
|
||||||
const sedeId = sedeBarcodeSelect.value;
|
const sedeId = sedeBarcodeSelect.value;
|
||||||
if (!sedeId) {
|
if (!sedeId) {
|
||||||
showNotification("Por favor, seleccione una sede de destino.", false);
|
showNotification("Por favor, seleccione una sede de destino.", false);
|
||||||
playBeep(false);
|
playBeep(false);
|
||||||
|
this.value = '';
|
||||||
|
this.disabled = false;
|
||||||
processing = false;
|
processing = false;
|
||||||
|
this.focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('codigo_unico', lastScannedCode);
|
formData.append('codigo_unico', barcodeValue);
|
||||||
formData.append('sede_id', sedeId);
|
formData.append('sede_id', sedeId);
|
||||||
const borradorId = document.getElementById('borrador_id_barcode')?.value;
|
const borradorId = document.getElementById('borrador_id_barcode')?.value;
|
||||||
if (borradorId) formData.append('borrador_id', borradorId);
|
if (borradorId) formData.append('borrador_id', borradorId);
|
||||||
@ -460,6 +431,7 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
|||||||
.then(data => {
|
.then(data => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
showNotification(data.message, true);
|
showNotification(data.message, true);
|
||||||
|
playBeep(true);
|
||||||
refreshHistoryAndSummary();
|
refreshHistoryAndSummary();
|
||||||
} else {
|
} else {
|
||||||
throw new Error(data.message || 'Error desconocido.');
|
throw new Error(data.message || 'Error desconocido.');
|
||||||
@ -470,7 +442,10 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
|||||||
playBeep(false);
|
playBeep(false);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.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