diff --git a/aceptar.html b/aceptar.html
index 717351c..1c5ce5b 100644
--- a/aceptar.html
+++ b/aceptar.html
@@ -108,15 +108,27 @@
document.getElementById('ref').innerText = raw["Expediente"] || "Sin Ref";
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('timer').innerText = "Responde antes de que caduque el turno";
+
+ // Mostrar debug si existe, si no, mensaje normal
+ if (data.debug) {
+ document.getElementById('timer').innerHTML = `
+ Responde antes de que caduque el turno
+
+ LÍMITE BD: ${new Date(data.debug.hora_limite_bd).toLocaleTimeString()}
+ ACTUAL BD: ${new Date(data.debug.hora_actual_bd).toLocaleTimeString()}
+
+ `;
+ } else {
+ document.getElementById('timer').innerText = "Responde antes de que caduque el turno";
+ }
document.getElementById('loading').classList.add('hidden');
document.getElementById('content').classList.remove('hidden');
} else {
- showError(data.error);
+ showError(data.error, data.debug);
}
} 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('content').classList.add('hidden');
document.getElementById('error-screen').classList.remove('hidden');
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 = `
+ Modo Diagnóstico (Captura esto)
+ ESTADO BD: ${debugData.estado_en_bd}
+ HORA LÍMITE BD: ${new Date(debugData.hora_limite_bd).toLocaleString()}
+ HORA ACTUAL BD: ${new Date(debugData.hora_actual_bd).toLocaleString()}
+ * Si ESTADO BD es "expired", el reloj interno lo mató.
+ * Si HORA LÍMITE < HORA ACTUAL, es un desfase de zona horaria.
+ `;
+ document.getElementById('error-screen').appendChild(debugDiv);
+ }
}