diff --git a/modules/turnero/api/rellamar.php b/modules/turnero/api/rellamar.php index 6535487..fa52d27 100644 --- a/modules/turnero/api/rellamar.php +++ b/modules/turnero/api/rellamar.php @@ -31,6 +31,10 @@ if ($stmt->rowCount() === 0) { jsonError('El turno no está en estado en_recepcion o no existe.', 404); } +// Notificar SSE para que las pantallas se actualicen inmediatamente +$stmtS = $pdo->prepare('UPDATE turnero_sesiones SET sse_ping_at = NOW() WHERE id = (SELECT sesion_id FROM turnero_turnos WHERE id = ?)'); +$stmtS->execute([$turnoId]); + // Devolver el turno actualizado para que recepcion.php abra la ficha $stmtT = $pdo->prepare( "SELECT t.*, diff --git a/modules/turnero/views/display.php b/modules/turnero/views/display.php index 54a4145..6ecc390 100644 --- a/modules/turnero/views/display.php +++ b/modules/turnero/views/display.php @@ -537,7 +537,7 @@ async function cargarSnapshot() { // Arrancar polling cada 4 s (funciona aunque SSE falle por proxy) function iniciarPolling() { cargarSnapshot(); - pollTimer = setInterval(cargarSnapshot, 4000); + pollTimer = setInterval(cargarSnapshot, 2000); } // ── SSE ─────────────────────────────────────────────────────── diff --git a/modules/turnero/views/display_global.php b/modules/turnero/views/display_global.php index 0ac8d6e..f8923a7 100644 --- a/modules/turnero/views/display_global.php +++ b/modules/turnero/views/display_global.php @@ -684,7 +684,7 @@ async function cargarSnapshot() { } cargarSnapshot(); -setInterval(cargarSnapshot, 4000); +setInterval(cargarSnapshot, 2000); diff --git a/modules/turnero/views/display_recepcion.php b/modules/turnero/views/display_recepcion.php index 2b1f5ab..a98e4bd 100644 --- a/modules/turnero/views/display_recepcion.php +++ b/modules/turnero/views/display_recepcion.php @@ -372,7 +372,7 @@ async function cargar() { } cargar(); -setInterval(cargar, 4000); +setInterval(cargar, 2000); diff --git a/modules/turnero/views/recepcion.php b/modules/turnero/views/recepcion.php index 51962c0..6cdf4be 100644 --- a/modules/turnero/views/recepcion.php +++ b/modules/turnero/views/recepcion.php @@ -197,6 +197,31 @@ $adminNombre = $_SESSION['admin_user']['full_name'] ?? $_SESSION['admin_user'][' border: 1px solid #bfdbfe; border-radius: 8px; padding: .25rem .75rem; font-size: .82rem; font-weight: 700; } + + /* ── Toast ── */ + .rec-toast { + position: fixed; bottom: 2rem; right: 2rem; z-index: 9999; + display: flex; align-items: center; gap: .7rem; + padding: .8rem 1.2rem; border-radius: 12px; + background: #fff; border: 1px solid #e2e8f0; + box-shadow: 0 8px 30px rgba(0,0,0,.12); + font-size: .9rem; font-weight: 500; + transform: translateY(120%); opacity: 0; + transition: transform .3s ease, opacity .3s ease; + pointer-events: none; + } + .rec-toast.show { + transform: translateY(0); opacity: 1; + } + .rec-toast.success { border-left: 4px solid #22c55e; } + .rec-toast.info { border-left: 4px solid #3b82f6; } + .rec-toast.warn { border-left: 4px solid #f59e0b; } + .rec-toast.error { border-left: 4px solid #ef4444; } + .rec-toast .ico { font-size: 1.2rem; } + .rec-toast.success .ico { color: #22c55e; } + .rec-toast.info .ico { color: #3b82f6; } + .rec-toast.warn .ico { color: #f59e0b; } + .rec-toast.error .ico { color: #ef4444; } @@ -404,6 +429,11 @@ require_once __DIR__ . '/../../../shared/components/sidebar.php'; +
+ + +
+