Actualizar aceptar.html

This commit is contained in:
2026-02-16 08:16:36 +00:00
parent 14bc95d132
commit b2abddaffc

View File

@@ -108,15 +108,27 @@
document.getElementById('ref').innerText = raw["Expediente"] || "Sin Ref"; document.getElementById('ref').innerText = raw["Expediente"] || "Sin Ref";
document.getElementById('location').innerText = `${raw["Población"] || 'Zona'} (CP: ${raw["Código Postal"] || '---'})`; document.getElementById('location').innerText = `${raw["Población"] || 'Zona'} (CP: ${raw["Código Postal"] || '---'})`;
document.getElementById('desc').innerText = raw["Descripción"] || "Revisar en el lugar."; document.getElementById('desc').innerText = raw["Descripción"] || "Revisar en el lugar.";
// Mostrar debug si existe, si no, mensaje normal
if (data.debug) {
document.getElementById('timer').innerHTML = `
Responde antes de que caduque el turno<br>
<span class="text-[10px] text-gray-500 font-mono font-normal mt-2 block">
LÍMITE BD: ${new Date(data.debug.hora_limite_bd).toLocaleTimeString()}<br>
ACTUAL BD: ${new Date(data.debug.hora_actual_bd).toLocaleTimeString()}
</span>
`;
} else {
document.getElementById('timer').innerText = "Responde antes de que caduque el turno"; document.getElementById('timer').innerText = "Responde antes de que caduque el turno";
}
document.getElementById('loading').classList.add('hidden'); document.getElementById('loading').classList.add('hidden');
document.getElementById('content').classList.remove('hidden'); document.getElementById('content').classList.remove('hidden');
} else { } else {
showError(data.error); showError(data.error, data.debug);
} }
} catch (e) { } catch (e) {
showError("Error al conectar con el servidor"); showError("Error al conectar con el servidor", null);
} }
} }
@@ -154,11 +166,27 @@
} }
} }
function showError(msg) { function showError(msg, debugData = null) {
document.getElementById('loading').classList.add('hidden'); document.getElementById('loading').classList.add('hidden');
document.getElementById('content').classList.add('hidden'); document.getElementById('content').classList.add('hidden');
document.getElementById('error-screen').classList.remove('hidden'); document.getElementById('error-screen').classList.remove('hidden');
if(msg) document.getElementById('error-msg').innerText = msg; if(msg) document.getElementById('error-msg').innerText = msg;
// BLOQUE DE DIAGNÓSTICO EN LA PANTALLA DE ERROR
if(debugData && !document.getElementById('debug-box')) {
const debugDiv = document.createElement('div');
debugDiv.id = 'debug-box';
debugDiv.className = "mt-8 p-4 bg-slate-100 rounded-xl text-left text-[10px] font-mono text-slate-600 overflow-x-auto border border-slate-200";
debugDiv.innerHTML = `
<strong class="text-slate-800 uppercase tracking-widest block mb-2">Modo Diagnóstico (Captura esto)</strong>
ESTADO BD: <span class="text-blue-600 font-bold">${debugData.estado_en_bd}</span><br>
HORA LÍMITE BD: <span class="text-red-500 font-bold">${new Date(debugData.hora_limite_bd).toLocaleString()}</span><br>
HORA ACTUAL BD: <span class="text-emerald-600 font-bold">${new Date(debugData.hora_actual_bd).toLocaleString()}</span><br><br>
* Si ESTADO BD es "expired", el reloj interno lo mató.<br>
* Si HORA LÍMITE < HORA ACTUAL, es un desfase de zona horaria.
`;
document.getElementById('error-screen').appendChild(debugDiv);
}
} }
</script> </script>
</body> </body>