feat(reception): add distinct warning color for students without classes and scan alert interactions (v3.8.51)

This commit is contained in:
2026-10-28 14:33:07 -03:00
parent 9f21442bed
commit 1477780df0
7 changed files with 163 additions and 33 deletions
+139 -24
View File
@@ -102,11 +102,16 @@
<div class="col-12 col-lg-7">
<!-- Tarjeta de Resultado en Pantalla Completa -->
<div class="card border-0 shadow-sm rounded-4 overflow-hidden mb-4" id="resultCard" style="min-height: 380px;">
<div class="card-header py-3 px-4 bg-light border-0 d-flex align-items-center justify-content-between" id="resultHeader">
<div class="card-header py-3 px-4 bg-light border-0 d-flex align-items-center justify-content-between transition-all" id="resultHeader">
<h5 class="fw-bold mb-0" id="resultStatusText">
<i class="bi bi-person-badge me-2 text-muted"></i> Esperando lectura...
</h5>
<span class="badge bg-secondary rounded-pill px-3 py-1" id="resultTimeBadge">--:--</span>
<div class="d-flex align-items-center gap-2">
<span class="badge bg-white text-dark border shadow-xs px-2 py-1 small rounded-pill d-none animate-pulse-badge" id="scanAlertBadge">
<i class="bi bi-lightning-charge-fill text-warning me-1"></i> ¡Nuevo Escaneo!
</span>
<span class="badge bg-secondary rounded-pill px-3 py-1 font-monospace" id="resultTimeBadge">--:--</span>
</div>
</div>
<div class="card-body p-4 d-flex flex-column justify-content-center text-center" id="resultBody">
<div class="py-5 text-muted" id="waitingState">
@@ -369,9 +374,12 @@
function displayVerificationResult(data) {
const waitingState = document.getElementById('waitingState');
const activeState = document.getElementById('activeResultState');
const resultCard = document.getElementById('resultCard');
const cardHeader = document.getElementById('resultHeader');
const statusText = document.getElementById('resultStatusText');
const timeBadge = document.getElementById('resultTimeBadge');
const matriculaBadge = document.getElementById('matriculaBadge');
const alertBadge = document.getElementById('scanAlertBadge');
waitingState.classList.add('d-none');
activeState.classList.remove('d-none');
@@ -379,21 +387,58 @@
const now = new Date();
timeBadge.innerText = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' });
// Disparar interacción visual: Flash del card para alertar a la operadora
resultCard.classList.remove('animate-scan-success', 'animate-scan-warning', 'animate-scan-danger');
void resultCard.offsetWidth; // Forzar reflow para reiniciar animación
if (alertBadge) {
alertBadge.classList.remove('d-none');
setTimeout(() => { alertBadge.classList.add('d-none'); }, 2500);
}
const hasClasses = Boolean(data.todays_classes && data.todays_classes.length > 0);
if (data.status === 'AUTORIZADO') {
cardHeader.className = 'card-header py-3 px-4 bg-success text-white border-0 d-flex align-items-center justify-content-between';
statusText.innerHTML = '<i class="bi bi-check-circle-fill me-2"></i> ACCESO AUTORIZADO';
document.getElementById('matriculaBadge').className = 'badge bg-success rounded-pill px-3 py-1 mb-1';
document.getElementById('matriculaBadge').innerText = data.matricula_status || 'ACTIVO';
if (hasClasses) {
// CASO 1: AUTORIZADO CON CLASES HOY -> VERDE INSTITUCIONAL
resultCard.className = 'card border-2 border-success shadow-lg rounded-4 overflow-hidden mb-4 animate-scan-success';
resultCard.style.backgroundColor = '';
cardHeader.className = 'card-header py-3 px-4 bg-success text-white border-0 d-flex align-items-center justify-content-between';
statusText.innerHTML = '<i class="bi bi-check-circle-fill me-2"></i> ACCESO AUTORIZADO — TIENE CLASE HOY';
timeBadge.className = 'badge bg-white text-success rounded-pill px-3 py-1 font-monospace fw-bold';
matriculaBadge.className = 'badge bg-success rounded-pill px-3 py-1 mb-1 me-1';
matriculaBadge.innerHTML = (data.matricula_status || 'REGULAR / ACTIVO') + ' <span class="badge bg-primary text-white rounded-pill px-2 py-0 ms-1"><i class="bi bi-mortarboard-fill me-1"></i>Tiene Cursada</span>';
playAudioFeedback('SUCCESS_WITH_CLASSES');
} else {
// CASO 2: AUTORIZADO PERO SIN CLASES HOY -> ÁMBAR / AMARILLO DESTACADO
resultCard.className = 'card border-2 border-warning shadow-lg rounded-4 overflow-hidden mb-4 animate-scan-warning';
resultCard.style.backgroundColor = '#FFFDF5';
cardHeader.className = 'card-header py-3 px-4 bg-warning text-dark border-0 d-flex align-items-center justify-content-between fw-bold';
statusText.innerHTML = '<i class="bi bi-calendar-x-fill text-dark me-2"></i> ACCESO AUTORIZADO — SIN CLASES PROGRAMADAS HOY';
timeBadge.className = 'badge bg-dark text-white rounded-pill px-3 py-1 font-monospace';
matriculaBadge.className = 'badge bg-success rounded-pill px-3 py-1 mb-1 me-1';
matriculaBadge.innerHTML = (data.matricula_status || 'REGULAR / ACTIVO') + ' <span class="badge bg-warning text-dark border border-dark-subtle rounded-pill px-2 py-0 ms-1 fw-bold"><i class="bi bi-calendar-x me-1"></i>Sin Cursada Hoy</span>';
playAudioFeedback('SUCCESS_NO_CLASSES');
}
} else if (data.status === 'RESTRINGIDO') {
cardHeader.className = 'card-header py-3 px-4 bg-warning text-dark border-0 d-flex align-items-center justify-content-between';
resultCard.className = 'card border-2 border-warning shadow-lg rounded-4 overflow-hidden mb-4 animate-scan-warning';
resultCard.style.backgroundColor = '#FFFDF5';
cardHeader.className = 'card-header py-3 px-4 bg-warning text-dark border-0 d-flex align-items-center justify-content-between fw-bold';
statusText.innerHTML = '<i class="bi bi-exclamation-triangle-fill me-2"></i> ACCESO OBSERVADO / RESTRINGIDO';
document.getElementById('matriculaBadge').className = 'badge bg-warning text-dark rounded-pill px-3 py-1 mb-1';
document.getElementById('matriculaBadge').innerText = data.matricula_status || 'OBSERVADO';
timeBadge.className = 'badge bg-dark text-white rounded-pill px-3 py-1 font-monospace';
matriculaBadge.className = 'badge bg-warning text-dark rounded-pill px-3 py-1 mb-1';
matriculaBadge.innerText = data.matricula_status || 'OBSERVADO';
playAudioFeedback('WARNING');
} else {
// CASO 3: DENEGADO -> ROJO
resultCard.className = 'card border-2 border-danger shadow-lg rounded-4 overflow-hidden mb-4 animate-scan-danger';
resultCard.style.backgroundColor = '';
cardHeader.className = 'card-header py-3 px-4 bg-danger text-white border-0 d-flex align-items-center justify-content-between';
statusText.innerHTML = '<i class="bi bi-x-circle-fill me-2"></i> ACCESO DENEGADO';
document.getElementById('matriculaBadge').className = 'badge bg-danger rounded-pill px-3 py-1 mb-1';
document.getElementById('matriculaBadge').innerText = data.matricula_status || 'NO REGISTRADO';
timeBadge.className = 'badge bg-white text-danger rounded-pill px-3 py-1 font-monospace fw-bold';
matriculaBadge.className = 'badge bg-danger rounded-pill px-3 py-1 mb-1';
matriculaBadge.innerText = data.matricula_status || 'NO REGISTRADO';
playAudioFeedback('DENIED');
}
document.getElementById('userNameText').innerText = data.user_name || 'Desconocido';
@@ -404,7 +449,7 @@
// Renderizado del cronograma de aulas de hoy
const classesContainer = document.getElementById('classesContainer');
if (data.todays_classes && data.todays_classes.length > 0) {
if (hasClasses) {
classesContainer.innerHTML = data.todays_classes.map(c => `
<div class="card border border-primary-subtle rounded-3 p-3 mb-2 bg-white shadow-sm">
<div class="d-flex align-items-start justify-content-between">
@@ -431,8 +476,16 @@
`).join('');
} else {
classesContainer.innerHTML = `
<div class="alert alert-secondary py-2 px-3 rounded-3 small mb-0">
<i class="bi bi-info-circle me-1"></i> No tiene clases presenciales programadas para el día de hoy.
<div class="alert alert-warning border border-warning-subtle text-dark p-3 rounded-4 mb-0 shadow-xs">
<div class="d-flex align-items-center gap-3">
<div class="rounded-circle bg-warning text-dark p-2 d-flex align-items-center justify-content-center shadow-xs" style="width: 42px; height: 42px;">
<i class="bi bi-calendar-x-fill fs-5"></i>
</div>
<div>
<div class="fw-bold fs-6 text-dark">No registra clases presenciales programadas para hoy</div>
<div class="small text-muted">El alumno/docente ingresa a la sede pero no tiene aula asignada para la fecha actual.</div>
</div>
</div>
</div>
`;
}
@@ -483,18 +536,51 @@
}
}
// Feedback sonoro opcional vía Web Audio API
function playBeep(success) {
// Feedback sonoro avanzado vía Web Audio API diferenciado por resultado
function playAudioFeedback(type) {
try {
const ctx = new (window.AudioContext || window.webkitAudioContext)();
const osc = ctx.createOscillator();
const gain = ctx.createGain();
osc.connect(gain);
gain.connect(ctx.destination);
osc.frequency.value = success ? 880 : 330;
gain.gain.value = 0.1;
osc.start();
setTimeout(() => { osc.stop(); }, 120);
const now = ctx.currentTime;
if (type === 'SUCCESS_WITH_CLASSES') {
// Tono doble ascendente armónico (D5 -> A5): Éxito con aula asignada
const osc1 = ctx.createOscillator();
const gain1 = ctx.createGain();
osc1.type = 'sine';
osc1.frequency.setValueAtTime(587.33, now); // D5
osc1.frequency.setValueAtTime(880.00, now + 0.08); // A5
gain1.gain.setValueAtTime(0.12, now);
gain1.gain.exponentialRampToValueAtTime(0.001, now + 0.25);
osc1.connect(gain1);
gain1.connect(ctx.destination);
osc1.start(now);
osc1.stop(now + 0.25);
} else if (type === 'SUCCESS_NO_CLASSES') {
// Tono doble suave (A4 -> C#5): Alumno regular pero sin cursada hoy
const osc2 = ctx.createOscillator();
const gain2 = ctx.createGain();
osc2.type = 'triangle';
osc2.frequency.setValueAtTime(440.00, now); // A4
osc2.frequency.setValueAtTime(554.37, now + 0.09); // C#5
gain2.gain.setValueAtTime(0.10, now);
gain2.gain.exponentialRampToValueAtTime(0.001, now + 0.24);
osc2.connect(gain2);
gain2.connect(ctx.destination);
osc2.start(now);
osc2.stop(now + 0.24);
} else {
// Tono grave de alerta (A3): Acceso denegado o restringido
const osc3 = ctx.createOscillator();
const gain3 = ctx.createGain();
osc3.type = 'sawtooth';
osc3.frequency.setValueAtTime(220.00, now);
gain3.gain.setValueAtTime(0.15, now);
gain3.gain.exponentialRampToValueAtTime(0.001, now + 0.3);
osc3.connect(gain3);
gain3.connect(ctx.destination);
osc3.start(now);
osc3.stop(now + 0.3);
}
} catch (e) {}
}
@@ -544,5 +630,34 @@
70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
/* Animaciones de detección de nuevo escaneo para la operadora */
@keyframes scan-flash-success {
0% { transform: scale(0.98); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.8); }
50% { transform: scale(1.02); box-shadow: 0 0 35px 8px rgba(34, 197, 94, 0.5); }
100% { transform: scale(1); box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.12); }
}
@keyframes scan-flash-warning {
0% { transform: scale(0.98); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.8); }
50% { transform: scale(1.02); box-shadow: 0 0 35px 8px rgba(245, 158, 11, 0.5); }
100% { transform: scale(1); box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.12); }
}
@keyframes scan-flash-danger {
0% { transform: scale(0.98); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8); }
50% { transform: scale(1.02); box-shadow: 0 0 35px 8px rgba(239, 68, 68, 0.5); }
100% { transform: scale(1); box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.12); }
}
.animate-scan-success { animation: scan-flash-success 0.55s ease-out; }
.animate-scan-warning { animation: scan-flash-warning 0.55s ease-out; }
.animate-scan-danger { animation: scan-flash-danger 0.55s ease-out; }
@keyframes pulse-badge {
0% { transform: scale(1); }
50% { transform: scale(1.12); }
100% { transform: scale(1); }
}
.animate-pulse-badge { animation: pulse-badge 0.8s infinite ease-in-out; }
.transition-all { transition: all 0.3s ease; }
</style>
{% endblock %}