feat(scanner): reorganizacion de layout, auto-foco opcional, com colapsable, recursos graficos y contrastes dark mode v3.8.55

This commit is contained in:
2026-10-28 15:34:11 -03:00
parent 1ce6ca0ea5
commit aa61c19910
7 changed files with 495 additions and 296 deletions
+18
View File
@@ -11,6 +11,24 @@ El formato está basado en [Keep a Changelog](https://keepachangelog.com/es-ES/1
- **Sincronización Continua Moodle (Fase 6):** Automatización de workers persistentes en background para el procesamiento continuo de la cola de Web Services Moodle 4.1.
- **Pruebas de Carga y Hardening (Fase 6):** Pruebas de estrés de concurrencia y validación final de producción.
## [3.8.55] - 2026-10-28
### Added & Enhanced (Ergonomía de Recepción, Auto-foco Opcional, COM Contraíble, Recursos Gráficos y Contrastes Dark Mode)
- **Reorganización Ergonómica de la Consola de Recepción (`/reception/scanner`)**:
- **Columna Izquierda (`col-lg-5`)**: Lector óptico USB HID / pistola de código de barras junto con la tabla histórica de Últimos Ingresos Registrados en Sede, consolidando la zona de captura e inspección inmediata.
- **Columna Derecha (`col-lg-7`)**: Ficha de resultado y validación en pantalla completa y panel de configuración de puertos serie COM.
- **Panel de Puertos Serie COM Minimizable / Contraíble**: El bloque de gestión de hasta 4 lectores seriales ahora se encuentra contraído (`collapse`) por defecto con indicador de rotación de chevron y badge resumen `0 / 4 Activos`, expandible con un solo clic.
- **Control Interactivo de Auto-foco del Cursor**:
- Desactivación predeterminada del bucle de captura forzada que secuestraba el foco del cursor cada 2 segundos.
- Botón selector en cabecera (`#btnToggleAutoFocus`) que permite al operador activar o desactivar la retención automática del cursor en el campo de escaneo según su flujo de trabajo.
- **Integración Sutil de Recursos Gráficos Institucionales**:
- `mini_logo_icon.png`: Isotipo oficial integrado en el encabezado del lector óptico.
- `square_course_name.png`: Banner degradado institucional aplicado como fondo suave en la cabecera del resultado de validación.
- `bg_course-card.png`: Marca de agua botánica oficial aplicada sutilmente en el cuerpo de la ficha de validación.
- **Optimización Integral de Contrastes en Modo Oscuro (WCAG AA)**:
- Eliminación de estilos en línea que forzaban fondos claros sobre el modo oscuro.
- Ajuste de paletas de fondo (`#17162E`, `#1F1D3C`, `#0E0D1D`), bordes violetas `#8B5CF6`, tipografía `#F8FAFC` y placeholders legibles `#94A3B8`.
- Estilización adaptativa de tablas `#recentLogsTable` y del contenedor de cronograma áulico `classes-section-container`.
## [3.8.54] - 2026-10-28
### Fixed & Enhanced (Desacople Total de Modal QR vs Carnet Completo, Normalización de DNI y Visibilidad de Usuario/Acceso)
- **Desacople y Eliminación de Bloqueo/Solapamiento entre `/credential/my-card` y Modal Global**:
+7 -6
View File
@@ -9,12 +9,13 @@ Memoria del proyecto entre sesiones para la rama `dev`.
- Libro de Calificaciones (*Gradebook*) con actas de regularidad inmutables.
- Autenticación híbrida (Google OAuth 2.0, Moodle SSO, Local) y Modo Impersonación.
- Reinicialización segura del sistema con contraseña de Administrador.
- **Sprint Activo: Desacople QR Modal vs Carnet, DNI en Credencial/Perfil y Resolución Robusta (v3.8.54)**:
- **Desacople Total de Modal QR y Carnet Completo**: Se eliminó el solapamiento y bloqueo en `/credential/my-card` interceptando los disparadores de barra lateral para realizar scroll y resaltado sin abrir modales redundantes.
- **QR Local y Desbloqueo Seguro**: Empaquetado de `qrcode.min.js` local en `frontend/public/js/qrcode.min.js`, uso de `shown.bs.modal`, renderizado eficiente con `makeCode()` y limpieza rigurosa de clases/backdrops al cerrar.
- **DNI y Nombre de Usuario / Login**: Corrección en carnet (`card.html`) para mostrar fehacientemente el DNI institucional en vez del correo. Inclusión de `document_number`, `document_type` y `username` en tokens JWT, sesión de Express y ficha de `/auth/profile`. Adición de `@property def username` y `@property def auth_provider_label` en el modelo `User`.
- **Adaptación de DNI Parser y Búsqueda en BD**: Erradicación de warnings de linter en `argentine_dni_parser.py`, ampliación de separadores para pistolas en teclado español y eliminación del error `User.username == doc` en `QRSecurityService` sustituido por búsqueda multi-criterio con `func.replace(User.document_number, '.', '')`.
- **Versión Consolidada**: `v3.8.54`.
- **Sprint Activo: Ergonomía de Recepción, Auto-foco Opcional, COM Contraíble, Recursos Gráficos y Contrastes Dark Mode (v3.8.55)**:
- **Reorganización del Puesto de Control en `/reception/scanner`**: Columna izquierda consolidada con lector óptico USB e historial cronológico de últimos accesos en sede; columna derecha con tarjeta ampliada de validación y panel de configuración de puertos COM.
- **Control de Foco no Invasivo**: Auto-foco desactivado por defecto (evita secuestrar el cursor cada 2 segundos); botón interactivo toggle (`#btnToggleAutoFocus`) para activarlo/desactivarlo a demanda del operador.
- **Puertos COM Minimizables**: Configuración de hardware serie contraída por defecto con indicador chevron animado y resumen de estado `0 / 4 Activos`.
- **Recursos Gráficos Sutiles**: Incorporación de `mini_logo_icon.png` en el lector, `square_course_name.png` en el header de validación y `bg_course-card.png` como marca de agua botánica.
- **Optimización de Contrastes en Modo Oscuro (WCAG AA)**: Adaptación completa de colores para evitar textos ilegibles o fondos blancos sobre tema oscuro.
- **Versión Consolidada**: `v3.8.55`.
## Decisiones (y por qué)
- **Flujo Secuencial de Bedelía (9 Pasos)**: Estandarizar la carga operativa en: 1) Sede -> 2) Aula -> 3) Ciclo Lectivo -> 4) Carrera -> 5) Materia (vinculada a Carrera) -> 6) Comisión (asociada a Materia, Carrera y Ciclo) -> 7) Profesores -> 8) Alumnos -> 9) Reserva de Espacio. Esto asegura consistencia e integridad relacional.
+1 -1
View File
@@ -7,7 +7,7 @@ from typing import Any
from database import db, get_db, engine, SessionLocal, session
from config.config import Config
__version__ = "3.8.54"
__version__ = "3.8.55"
class DummyContext:
def __enter__(self):
+1 -1
View File
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="edu-space-admin",
version="3.8.54",
version="3.8.55",
description="Administrative interface for Edu-Space Classroom Management System (FastAPI ASGI Core)",
author="Edu-Space Development Team",
author_email="admin@edu-space.com",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "3.8.54",
"version": "3.8.55",
"description": "",
"main": "index.js",
"scripts": {
+3 -3
View File
@@ -86,9 +86,9 @@ const env = nunjucks.configure(path.join(__dirname, '../views'), {
});
// Versiones institucionales del sistema
const APP_VERSION = '3.8.54';
const FRONTEND_VERSION = '3.8.54';
const BACKEND_VERSION = '3.8.54';
const APP_VERSION = '3.8.55';
const FRONTEND_VERSION = '3.8.55';
const BACKEND_VERSION = '3.8.55';
env.addGlobal('app_version', APP_VERSION);
env.addGlobal('frontend_version', FRONTEND_VERSION);
+401 -221
View File
@@ -7,13 +7,14 @@
<!-- Header de Control de Acceso -->
<div class="d-flex flex-wrap align-items-center justify-content-between gap-3 mb-4">
<div>
<div class="d-flex align-items-center gap-2">
<div class="d-flex align-items-center gap-2 mb-1">
<img src="/img/mini_logo_icon.png" alt="UniCABA" height="24" class="rounded shadow-xs">
<span class="badge bg-secondary text-white rounded-pill px-3 py-1 fw-semibold">
<i class="bi bi-qr-code-scan me-1"></i> Control de Acceso
</span>
<span class="badge bg-success-subtle text-success border border-success-subtle rounded-pill px-2 py-0">En Línea</span>
</div>
<h1 class="h3 fw-bold mt-1 mb-0">Consola de Recepción &amp; Escáner QR</h1>
<h1 class="h3 fw-bold mb-0">Consola de Recepción &amp; Escáner QR</h1>
<p class="text-muted small mb-0">Identifica a los estudiantes y docentes al ingresar, valida su estado de matrícula e infórmales su aula y piso del día.</p>
</div>
@@ -32,36 +33,49 @@
</div>
<div class="row g-4">
<!-- Columna Izquierda: Escáner Óptico / Pistola USB y Puerto Serial -->
<div class="col-12 col-lg-5">
<div class="card border-0 shadow-sm rounded-4 p-4 mb-4">
<!-- ========================================================================= -->
<!-- COLUMNA IZQUIERDA: LECTURA ÓPTICA (ESCANEO) Y REGISTROS RECIENTES -->
<!-- ========================================================================= -->
<div class="col-12 col-lg-5 col-xl-5">
<!-- 1. Tarjeta de Entrada de Lectura Óptica (Pistola USB / DNI) -->
<div class="card border-0 shadow-sm rounded-4 p-4 mb-4 scanner-card">
<div class="d-flex align-items-center justify-content-between mb-3">
<h5 class="fw-bold mb-0 text-dark d-flex align-items-center">
<div class="d-flex align-items-center gap-2">
<img src="/img/mini_logo_icon.png" alt="Icono" height="20" class="rounded shadow-xs">
<h5 class="fw-bold mb-0 text-body d-flex align-items-center">
<i class="bi bi-upc-scan me-2 text-primary"></i>Lector Óptico de Acceso
</h5>
<span class="small text-success fw-semibold d-flex align-items-center gap-1" id="scannerFocusIndicator" title="El cursor está atrapado permanentemente en este campo para lectura USB directa">
<span class="scanner-active-dot"></span> Lector Listo
</div>
<span class="small fw-semibold d-flex align-items-center gap-1" id="scannerFocusIndicator" title="Estado de foco del lector">
<span class="scanner-idle-dot"></span> Manual
</span>
</div>
<!-- Banner Informativo de Operación -->
<div class="p-3 bg-light rounded-4 border mb-3 text-start">
<div class="d-flex align-items-start gap-2">
<i class="bi bi-shield-check text-primary fs-5 mt-1"></i>
<!-- Banner Informativo con Control de Foco -->
<div class="p-3 bg-body-tertiary rounded-4 border mb-3 text-start">
<div class="d-flex align-items-center justify-content-between gap-2 flex-wrap">
<div class="d-flex align-items-center gap-2">
<i class="bi bi-shield-check text-primary fs-5"></i>
<div>
<div class="fw-bold small text-dark">Modo Alta Velocidad USB HID / COM</div>
<div class="text-muted small" style="font-size: 0.76rem;">
El cursor se mantiene retenido permanentemente en el campo de escaneo. Dispara la pistola óptica sobre la credencial QR o DNI físico para registrar el acceso en tiempo real.
<div class="fw-bold small text-body">Modo USB HID / Pistola Óptica</div>
<div class="text-muted small" style="font-size: 0.74rem;">Dispara la pistola o escribe el DNI para registrar el acceso</div>
</div>
</div>
<!-- Botón Toggle de Auto-foco (Predeterminado Apagado a petición del usuario) -->
<button type="button" class="btn btn-sm btn-outline-secondary rounded-pill px-3 shadow-none"
id="btnToggleAutoFocus" onclick="toggleAutoFocus()"
title="Activa o desactiva la captura permanente del cursor en el campo de escaneo">
<i class="bi bi-cursor me-1" id="autoFocusIcon"></i>
<span id="autoFocusStatusText">Auto-foco: Inactivo</span>
</button>
</div>
</div>
<!-- Entrada de Lectura Óptica USB -->
<!-- Formulario de Entrada de Lectura Óptica USB -->
<form id="manualScanForm" onsubmit="handleManualScan(event)">
<div class="input-group shadow-sm rounded-pill overflow-hidden border border-2 border-primary mb-2">
<input type="text" class="form-control rounded-start-pill ps-3 border-0 py-2 fs-6" id="scannerInput"
placeholder="Escanea con la pistola o escribe el DNI..." autofocus autocomplete="off">
<div class="input-group shadow-sm rounded-pill overflow-hidden border border-2 border-primary mb-2 scanner-input-group">
<input type="text" class="form-control rounded-start-pill ps-3 border-0 py-2 fs-6 text-body" id="scannerInput"
placeholder="Escanea con la pistola o escribe el DNI..." autocomplete="off">
<button class="btn btn-primary rounded-end-pill px-4 fw-semibold border-0" type="submit">
<i class="bi bi-arrow-right-circle me-1"></i> Validar
</button>
@@ -75,19 +89,159 @@
</button>
</div>
</form>
</div>
<!-- Panel de Conexión Multi-Lector Serial / Puertos COM (Hasta 4 lectores) -->
<div class="mt-4 pt-3 border-top">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="small fw-bold text-uppercase text-muted">
<i class="bi bi-usb-symbol me-1 text-primary"></i> Lectores Serie COM (Hasta 4)
<!-- 2. Tarjeta de Últimos Ingresos Registrados en Sede (Registros en la Columna Izquierda) -->
<div class="card border-0 shadow-sm rounded-4 overflow-hidden mb-4 logs-card">
<div class="card-header bg-body border-0 py-3 px-4 d-flex align-items-center justify-content-between">
<h6 class="fw-bold mb-0 text-body d-flex align-items-center">
<i class="bi bi-clock-history me-2 text-primary"></i> Últimos Ingresos en Sede
</h6>
<button type="button" class="btn btn-sm btn-link text-decoration-none p-0 text-primary" onclick="refreshRecentLogs()">
<i class="bi bi-arrow-clockwise me-1"></i> Actualizar
</button>
</div>
<div class="table-responsive" style="max-height: 420px;">
<table class="table table-hover table-sm align-middle mb-0" id="recentLogsTable">
<thead class="table-light small">
<tr>
<th class="ps-3">Usuario</th>
<th>Rol</th>
<th>DNI</th>
<th>Sede</th>
<th>Hora</th>
<th class="text-center">Estado</th>
</tr>
</thead>
<tbody class="small" id="recentLogsBody">
{% if recentLogs and recentLogs | length > 0 %}
{% for log in recentLogs %}
<tr>
<td class="ps-3 fw-semibold text-body">{{ log.user_name }}</td>
<td><span class="badge bg-body-tertiary text-body border">{{ log.user_role or 'ALUMNO' }}</span></td>
<td class="font-monospace text-body-secondary">{{ log.user_dni or '--' }}</td>
<td class="text-body-secondary">{{ log.building_name }}</td>
<td class="font-monospace text-body-secondary">{{ log.scanned_time if log.scanned_time else (log.scanned_at | replace('T', ' ') | truncate(16, true, '')) }}</td>
<td class="text-center">
{% if log.status == 'AUTORIZADO' %}
<span class="badge bg-success-subtle text-success">OK</span>
{% else %}
<span class="badge bg-danger-subtle text-danger">{{ log.status }}</span>
{% endif %}
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="6" class="text-center py-4 text-muted">Aún no se han registrado ingresos hoy.</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
</div>
<!-- ========================================================================= -->
<!-- COLUMNA DERECHA: RESULTADO DE VALIDACIÓN Y CONFIGURACIÓN COM CONTRAÍBLE -->
<!-- ========================================================================= -->
<div class="col-12 col-lg-7 col-xl-7">
<!-- 1. Tarjeta de Resultado en Pantalla de Validación Instantánea -->
<div class="card border-0 shadow-sm rounded-4 overflow-hidden mb-4 result-validation-card" id="resultCard" style="min-height: 380px;">
<!-- Header con Banner Gráfico Oficial (square_course_name.png) -->
<div class="card-header py-3 px-4 border-0 d-flex align-items-center justify-content-between transition-all header-course-banner" id="resultHeader">
<h5 class="fw-bold mb-0 text-white d-flex align-items-center" id="resultStatusText">
<i class="bi bi-person-badge me-2 opacity-75"></i> Esperando lectura...
</h5>
<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-black bg-opacity-40 text-white border border-white border-opacity-25 rounded-pill px-3 py-1 font-monospace" id="resultTimeBadge">--:--</span>
</div>
</div>
<!-- Cuerpo con Marca de Agua Botánica Sutil (bg_course-card.png) -->
<div class="card-body p-4 d-flex flex-column justify-content-center text-center result-body-watermark" id="resultBody">
<div class="py-5 text-muted" id="waitingState">
<div class="mb-3 d-inline-block p-3 rounded-circle bg-primary bg-opacity-10 text-primary">
<i class="bi bi-qr-code-scan display-4 d-block"></i>
</div>
<h4 class="fw-bold text-body">Apunta el lector óptico a la credencial</h4>
<p class="small text-muted max-w-md mx-auto mb-0">
Al detectar la credencial dinámica o física del alumno o docente, el sistema mostrará instantáneamente sus datos de ingreso y las aulas donde cursa hoy.
</p>
</div>
<!-- Contenedor de Resultado Activo (Oculto inicialmente) -->
<div id="activeResultState" class="d-none text-start">
<div class="row align-items-center mb-4">
<div class="col-auto">
<div class="rounded-circle bg-primary text-white display-6 fw-bold d-flex align-items-center justify-content-center shadow-sm"
style="width: 76px; height: 76px;" id="userInitial">
A
</div>
</div>
<div class="col">
<div class="badge bg-success rounded-pill px-3 py-1 mb-1" id="matriculaBadge">REGULAR / ACTIVO</div>
<h3 class="fw-bold mb-0 text-body" id="userNameText">Nombre del Alumno</h3>
<div class="text-muted small">
<span id="userRoleText">ESTUDIANTE</span> • DNI: <strong id="userDniText" class="font-monospace text-body">12345678</strong>
</div>
</div>
</div>
<!-- Sección de Aulas y Clases de Hoy -->
<div class="p-3 bg-body-tertiary rounded-4 border mb-3 classes-section-container">
<h6 class="fw-bold text-uppercase text-primary small mb-3 d-flex align-items-center">
<i class="bi bi-compass-fill me-2"></i> Cronograma Áulico del Día de Hoy
</h6>
<div id="classesContainer">
<!-- Inyección dinámica de clases -->
</div>
</div>
<div class="d-flex align-items-center justify-content-between text-muted small">
<span id="scanTimestampText"><i class="bi bi-clock me-1"></i> Escaneado a las: --:--</span>
<span class="badge bg-primary-subtle text-primary border border-primary-subtle rounded-pill px-3 py-1">
Check-in Registrado
</span>
</div>
</div>
</div>
</div>
<!-- 2. Panel Colapsable y Minimizable de Puertos Serie COM (Hasta 4 lectores) -->
<div class="card border-0 shadow-sm rounded-4 overflow-hidden mb-4 com-config-card">
<div class="card-header bg-body border-0 py-3 px-4 d-flex align-items-center justify-content-between cursor-pointer"
data-bs-toggle="collapse" data-bs-target="#comPortsCollapse" aria-expanded="false" aria-controls="comPortsCollapse"
style="cursor: pointer;" title="Haz clic para expandir o contraer la configuración de lectores COM">
<div class="d-flex align-items-center gap-2">
<span class="p-1 px-2 rounded-2 bg-primary bg-opacity-10 text-primary d-inline-flex align-items-center">
<i class="bi bi-usb-symbol me-1"></i> <strong class="small">COM</strong>
</span>
<div>
<span class="small fw-bold text-uppercase text-body d-block" style="letter-spacing: 0.04em;">
Lectores Serie COM (Hasta 4)
</span>
<span class="text-muted small" style="font-size: 0.72rem;">Click para minimizar o configurar puertos seriales</span>
</div>
</div>
<div class="d-flex align-items-center gap-2">
<span class="badge bg-secondary-subtle text-secondary rounded-pill px-2 py-1 small" id="comGlobalBadge">
<i class="bi bi-circle-fill text-muted me-1" style="font-size: 0.5rem;"></i> 0 / 4 Activos
</span>
<button type="button" class="btn btn-sm btn-link text-decoration-none text-muted p-0" aria-label="Expandir/Contraer">
<i class="bi bi-chevron-down fs-6 transition-all" id="comCollapseIcon"></i>
</button>
</div>
</div>
<!-- Botones de Acción Rápida Global -->
<!-- Cuerpo Colapsado por Defecto -->
<div class="collapse" id="comPortsCollapse">
<div class="card-body p-3 pt-1 border-top">
<!-- Barra de Acciones Rápidas Globales -->
<div class="d-flex align-items-center gap-2 mb-3">
<button type="button" class="btn btn-sm btn-primary rounded-pill px-3 py-1 flex-grow-1 shadow-xs" id="btnQuickConnectCOM" onclick="handleQuickConnectCOM()">
<i class="bi bi-usb-plug-fill me-1"></i> Conectar Lector COM
@@ -103,13 +257,13 @@
<!-- Grilla de los 4 Slots de Lectores Seriales -->
<div class="row g-2" id="serialSlotsContainer">
<!-- Slot 1 -->
<div class="col-12">
<div class="p-2 rounded-3 bg-body-tertiary border transition-all" id="slotCard1">
<div class="col-12 col-md-6">
<div class="p-2 rounded-3 bg-body-tertiary border transition-all h-100" id="slotCard1">
<div class="d-flex align-items-center justify-content-between">
<div class="d-flex align-items-center gap-2">
<span class="badge bg-secondary rounded-circle p-1" id="slotLed1" style="width: 10px; height: 10px;"></span>
<div>
<div class="fw-semibold small text-dark" style="font-size: 0.78rem;">Lector 1 (Paso Principal)</div>
<div class="fw-semibold small text-body" style="font-size: 0.78rem;">Lector 1 (Paso Principal)</div>
<div class="text-muted" style="font-size: 0.70rem;" id="slotStatusText1">Sin conectar</div>
</div>
</div>
@@ -127,13 +281,13 @@
</div>
<!-- Slot 2 -->
<div class="col-12">
<div class="p-2 rounded-3 bg-body-tertiary border transition-all" id="slotCard2">
<div class="col-12 col-md-6">
<div class="p-2 rounded-3 bg-body-tertiary border transition-all h-100" id="slotCard2">
<div class="d-flex align-items-center justify-content-between">
<div class="d-flex align-items-center gap-2">
<span class="badge bg-secondary rounded-circle p-1" id="slotLed2" style="width: 10px; height: 10px;"></span>
<div>
<div class="fw-semibold small text-dark" style="font-size: 0.78rem;">Lector 2 (Molinete / Acceso)</div>
<div class="fw-semibold small text-body" style="font-size: 0.78rem;">Lector 2 (Molinete)</div>
<div class="text-muted" style="font-size: 0.70rem;" id="slotStatusText2">Sin conectar</div>
</div>
</div>
@@ -151,13 +305,13 @@
</div>
<!-- Slot 3 -->
<div class="col-12">
<div class="p-2 rounded-3 bg-body-tertiary border transition-all" id="slotCard3">
<div class="col-12 col-md-6">
<div class="p-2 rounded-3 bg-body-tertiary border transition-all h-100" id="slotCard3">
<div class="d-flex align-items-center justify-content-between">
<div class="d-flex align-items-center gap-2">
<span class="badge bg-secondary rounded-circle p-1" id="slotLed3" style="width: 10px; height: 10px;"></span>
<div>
<div class="fw-semibold small text-dark" style="font-size: 0.78rem;">Lector 3 (Mesa Bedelía)</div>
<div class="fw-semibold small text-body" style="font-size: 0.78rem;">Lector 3 (Bedelía)</div>
<div class="text-muted" style="font-size: 0.70rem;" id="slotStatusText3">Sin conectar</div>
</div>
</div>
@@ -175,13 +329,13 @@
</div>
<!-- Slot 4 -->
<div class="col-12">
<div class="p-2 rounded-3 bg-body-tertiary border transition-all" id="slotCard4">
<div class="col-12 col-md-6">
<div class="p-2 rounded-3 bg-body-tertiary border transition-all h-100" id="slotCard4">
<div class="d-flex align-items-center justify-content-between">
<div class="d-flex align-items-center gap-2">
<span class="badge bg-secondary rounded-circle p-1" id="slotLed4" style="width: 10px; height: 10px;"></span>
<div>
<div class="fw-semibold small text-dark" style="font-size: 0.78rem;">Lector 4 (Auxiliar / Puesto 2)</div>
<div class="fw-semibold small text-body" style="font-size: 0.78rem;">Lector 4 (Auxiliar)</div>
<div class="text-muted" style="font-size: 0.70rem;" id="slotStatusText4">Sin conectar</div>
</div>
</div>
@@ -201,118 +355,6 @@
</div>
</div>
</div>
<!-- Columna Derecha: Tarjeta de Validación Instantánea y Aulas del Día -->
<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 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>
<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">
<i class="bi bi-qr-code-scan display-1 opacity-25 text-primary mb-3 d-block"></i>
<h4 class="fw-bold text-secondary">Apunta el lector óptico a la credencial</h4>
<p class="small text-muted max-w-md mx-auto">
Al detectar la credencial dinámica o física del alumno o docente, el sistema mostrará instantáneamente sus datos de ingreso y las aulas donde cursa hoy.
</p>
</div>
<!-- Contenedor de Resultado Activo (Oculto inicialmente) -->
<div id="activeResultState" class="d-none text-start">
<div class="row align-items-center mb-4">
<div class="col-auto">
<div class="rounded-circle bg-primary text-white display-6 fw-bold d-flex align-items-center justify-content-center shadow-sm"
style="width: 80px; height: 80px;" id="userInitial">
A
</div>
</div>
<div class="col">
<div class="badge bg-success rounded-pill px-3 py-1 mb-1" id="matriculaBadge">REGULAR / ACTIVO</div>
<h3 class="fw-bold mb-0 text-dark" id="userNameText">Nombre del Alumno</h3>
<div class="text-muted small">
<span id="userRoleText">ESTUDIANTE</span> • DNI: <strong id="userDniText">12345678</strong>
</div>
</div>
</div>
<!-- Sección de Aulas y Clases de Hoy -->
<div class="p-3 bg-light rounded-4 border mb-3">
<h6 class="fw-bold text-uppercase text-primary small mb-3">
<i class="bi bi-compass-fill me-1"></i> Cronograma Áulico del Día de Hoy
</h6>
<div id="classesContainer">
<!-- Inyección dinámica de clases -->
</div>
</div>
<div class="d-flex align-items-center justify-content-between text-muted small">
<span id="scanTimestampText"><i class="bi bi-clock me-1"></i> Escaneado a las: --:--</span>
<span class="badge bg-primary-subtle text-primary border border-primary-subtle rounded-pill px-3 py-1">
Check-in Registrado
</span>
</div>
</div>
</div>
</div>
<!-- Tabla de Ingresos Recientes -->
<div class="card border-0 shadow-sm rounded-4 overflow-hidden">
<div class="card-header bg-body border-0 py-3 px-4 d-flex align-items-center justify-content-between">
<h6 class="fw-bold mb-0 text-dark">
<i class="bi bi-clock-history me-2 text-primary"></i> Últimos Ingresos Registrados en Sede
</h6>
<button type="button" class="btn btn-sm btn-link text-decoration-none p-0" onclick="refreshRecentLogs()">
<i class="bi bi-arrow-clockwise me-1"></i> Actualizar
</button>
</div>
<div class="table-responsive" style="max-height: 250px;">
<table class="table table-hover table-sm align-middle mb-0" id="recentLogsTable">
<thead class="table-light small">
<tr>
<th class="ps-4">Usuario</th>
<th>Rol</th>
<th>DNI</th>
<th>Sede</th>
<th>Hora</th>
<th class="text-center">Estado</th>
</tr>
</thead>
<tbody class="small" id="recentLogsBody">
{% if recentLogs and recentLogs | length > 0 %}
{% for log in recentLogs %}
<tr>
<td class="ps-4 fw-semibold">{{ log.user_name }}</td>
<td><span class="badge bg-light text-dark border">{{ log.user_role or 'ALUMNO' }}</span></td>
<td>{{ log.user_dni or '--' }}</td>
<td>{{ log.building_name }}</td>
<td>{{ log.scanned_time if log.scanned_time else (log.scanned_at | replace('T', ' ') | truncate(16, true, '')) }}</td>
<td class="text-center">
{% if log.status == 'AUTORIZADO' %}
<span class="badge bg-success-subtle text-success">OK</span>
{% else %}
<span class="badge bg-danger-subtle text-danger">{{ log.status }}</span>
{% endif %}
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="6" class="text-center py-3 text-muted">Aún no se han registrado ingresos hoy.</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@@ -323,6 +365,48 @@
<script>
let isScanningLocked = false;
let multiScanner = null;
let isAutoFocusActive = false; // Predeterminado: apagado según requerimiento del usuario
let autoFocusInterval = null;
// Toggle interactivo del foco del cursor
function toggleAutoFocus() {
isAutoFocusActive = !isAutoFocusActive;
updateAutoFocusUI();
if (isAutoFocusActive) {
focusScannerInput();
if (!autoFocusInterval) {
autoFocusInterval = setInterval(() => {
if (isAutoFocusActive) {
focusScannerInput();
}
}, 2500);
}
} else {
if (autoFocusInterval) {
clearInterval(autoFocusInterval);
autoFocusInterval = null;
}
updateFocusIndicator(false);
}
}
function updateAutoFocusUI() {
const btn = document.getElementById('btnToggleAutoFocus');
const text = document.getElementById('autoFocusStatusText');
const icon = document.getElementById('autoFocusIcon');
if (!btn || !text) return;
if (isAutoFocusActive) {
btn.className = 'btn btn-sm btn-success text-white rounded-pill px-3 shadow-xs';
text.innerText = 'Auto-foco: Activo';
if (icon) icon.className = 'bi bi-cursor-fill me-1';
} else {
btn.className = 'btn btn-sm btn-outline-secondary rounded-pill px-3';
text.innerText = 'Auto-foco: Inactivo';
if (icon) icon.className = 'bi bi-cursor me-1 text-muted';
}
}
// Inicializar MultiSerialBarcodeScanner (hasta 4 lectores COM)
function initSerialScanner() {
@@ -333,7 +417,6 @@
onCodeScanned: function(code, slotInfo) {
if (!isScanningLocked) {
isScanningLocked = true;
// Destello visual en la tarjeta del lector específico emisor
flashSlotCard(slotInfo ? slotInfo.slotId : 1);
verifyToken(code, slotInfo);
setTimeout(() => { isScanningLocked = false; }, 1500);
@@ -347,19 +430,17 @@
}
});
// Comprobar compatibilidad con Web Serial API
if (!multiScanner.isSupported()) {
const badge = document.getElementById('comGlobalBadge');
if (badge) {
badge.className = 'badge bg-body-tertiary text-muted rounded-pill px-2 py-1 small border';
badge.innerHTML = '<i class="bi bi-info-circle me-1"></i> Modo USB-HID (Chromium requerido para COM)';
badge.innerHTML = '<i class="bi bi-info-circle me-1"></i> Modo USB-HID';
}
for (let i = 1; i <= 4; i++) {
const btn = document.getElementById(`btnConnectSlot${i}`);
if (btn) btn.disabled = true;
}
} else {
// Reabrir automáticamente puertos autorizados
reconnectAuthorizedComPorts();
}
}
@@ -417,7 +498,7 @@
async function handleConnectSlot(slotId) {
if (!multiScanner) initSerialScanner();
if (!multiScanner.isSupported()) {
alert('La Web Serial API no está disponible en este navegador. Utiliza Google Chrome o Microsoft Edge en entornos Windows.');
alert('La Web Serial API no está disponible en este navegador. Utiliza Google Chrome o Microsoft Edge.');
return;
}
@@ -441,10 +522,9 @@
async function handleQuickConnectCOM() {
if (!multiScanner) initSerialScanner();
if (!multiScanner.isSupported()) {
alert('La Web Serial API no está disponible en este navegador. Utiliza Google Chrome o Microsoft Edge en entornos Windows.');
alert('La Web Serial API no está disponible en este navegador. Utiliza Google Chrome o Microsoft Edge.');
return;
}
// Buscar el primer slot disponible
const freeSlot = multiScanner.slots.find(s => !s.isConnected());
const targetSlotId = freeSlot ? freeSlot.id : 1;
await handleConnectSlot(targetSlotId);
@@ -465,13 +545,12 @@
}
}
// Mantener el cursor forzado permanentemente en el input de la pistola óptica
// Foco manual o condicional
function focusScannerInput() {
const input = document.getElementById('scannerInput');
if (!input) return;
const active = document.activeElement;
// Evitar robar el foco solo si el usuario está activamente en el selector de sedes
if (active && active.id === 'buildingSelect') return;
if (active && (active.tagName === 'SELECT' || active.tagName === 'BUTTON' || active.id === 'buildingSelect')) return;
if (active !== input) {
input.focus();
}
@@ -483,14 +562,13 @@
if (!indicator) return;
if (isFocused) {
indicator.className = 'small text-success fw-semibold d-flex align-items-center gap-1';
indicator.innerHTML = '<span class="scanner-active-dot"></span> Lector Listo';
indicator.innerHTML = '<span class="scanner-active-dot"></span> Foco Listo';
} else {
indicator.className = 'small text-warning fw-semibold d-flex align-items-center gap-1';
indicator.innerHTML = '<i class="bi bi-exclamation-circle"></i> Haz clic para activar';
indicator.className = 'small text-muted fw-semibold d-flex align-items-center gap-1';
indicator.innerHTML = '<span class="scanner-idle-dot"></span> Inactivo';
}
}
// Entrada manual o con pistola de código de barras
function handleManualScan(e) {
if (e) e.preventDefault();
const input = document.getElementById('scannerInput');
@@ -500,14 +578,14 @@
focusScannerInput();
return;
}
// Normalización para teclados en español / latinoamericano donde la pistola traduce : a Ñ
val = val.replace(/Ñ/g, ':').replace(/ñ/g, ':');
verifyToken(val);
input.value = '';
if (isAutoFocusActive) {
setTimeout(focusScannerInput, 50);
}
}
// Petición AJAX de verificación al Backend BFF
async function verifyToken(token, slotInfo = null) {
const buildingId = document.getElementById('buildingSelect').value;
@@ -532,11 +610,12 @@
todays_classes: []
}, slotInfo);
} finally {
if (isAutoFocusActive) {
setTimeout(focusScannerInput, 150);
}
}
}
// Despliegue visual de resultados en pantalla
function displayVerificationResult(data, slotInfo = null) {
const waitingState = document.getElementById('waitingState');
const activeState = document.getElementById('activeResultState');
@@ -553,9 +632,8 @@
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
void resultCard.offsetWidth;
if (alertBadge) {
const sourceLabel = slotInfo ? (slotInfo.slotName || `Lector ${slotInfo.slotId}`) : 'Pistola Óptica';
@@ -568,20 +646,20 @@
if (data.status === 'AUTORIZADO') {
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';
// AUTORIZADO CON CLASES HOY -> VERDE INSTITUCIONAL
resultCard.className = 'card border-2 border-success shadow-lg rounded-4 overflow-hidden mb-4 animate-scan-success result-validation-card';
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';
cardHeader.className = 'card-header py-3 px-4 bg-success text-white border-0 d-flex align-items-center justify-content-between header-course-banner';
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';
// AUTORIZADO PERO SIN CLASES HOY -> ÁMBAR
resultCard.className = 'card border-2 border-warning shadow-lg rounded-4 overflow-hidden mb-4 animate-scan-warning result-validation-card';
resultCard.style.backgroundColor = '';
cardHeader.className = 'card-header py-3 px-4 bg-warning text-dark border-0 d-flex align-items-center justify-content-between fw-bold header-course-banner';
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';
@@ -589,19 +667,19 @@
playAudioFeedback('SUCCESS_NO_CLASSES');
}
} else if (data.status === 'RESTRINGIDO') {
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';
resultCard.className = 'card border-2 border-warning shadow-lg rounded-4 overflow-hidden mb-4 animate-scan-warning result-validation-card';
resultCard.style.backgroundColor = '';
cardHeader.className = 'card-header py-3 px-4 bg-warning text-dark border-0 d-flex align-items-center justify-content-between fw-bold header-course-banner';
statusText.innerHTML = '<i class="bi bi-exclamation-triangle-fill me-2"></i> ACCESO OBSERVADO / RESTRINGIDO';
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';
// DENEGADO -> ROJO
resultCard.className = 'card border-2 border-danger shadow-lg rounded-4 overflow-hidden mb-4 animate-scan-danger result-validation-card';
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';
cardHeader.className = 'card-header py-3 px-4 bg-danger text-white border-0 d-flex align-items-center justify-content-between header-course-banner';
statusText.innerHTML = '<i class="bi bi-x-circle-fill me-2"></i> ACCESO DENEGADO';
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';
@@ -615,24 +693,23 @@
document.getElementById('userInitial').innerText = (data.user_name || '?')[0].toUpperCase();
document.getElementById('scanTimestampText').innerHTML = `<i class="bi bi-clock me-1"></i> Escaneado: ${now.toLocaleTimeString()}`;
// Renderizado del cronograma de aulas de hoy
const classesContainer = document.getElementById('classesContainer');
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="card border border-primary-subtle rounded-3 p-3 mb-2 bg-body shadow-xs text-body">
<div class="d-flex align-items-start justify-content-between">
<div>
<span class="badge bg-primary text-white rounded-pill px-2 py-0 small mb-1">${c.commission_name}</span>
<h5 class="fw-bold mb-1 text-primary">${c.subject_name}</h5>
<div class="text-muted small">
<i class="bi bi-person me-1"></i> Docente: <strong>${c.teacher_name || 'A designar'}</strong>
<i class="bi bi-person me-1"></i> Docente: <strong class="text-body">${c.teacher_name || 'A designar'}</strong>
</div>
</div>
<div class="text-end">
<span class="badge bg-warning text-dark fs-6 px-3 py-1 rounded-pill fw-bold shadow-sm">
<i class="bi bi-door-open me-1"></i> ${c.classroom_name}
</span>
<div class="fw-semibold text-dark mt-1" style="font-size: 0.85rem;">
<div class="fw-semibold text-body mt-1" style="font-size: 0.85rem;">
Piso: <strong>${c.floor || 1}</strong> (${c.building_name})
</div>
<div class="small text-muted mt-1">
@@ -658,13 +735,13 @@
`;
} else {
classesContainer.innerHTML = `
<div class="alert alert-warning border border-warning-subtle text-dark p-3 rounded-4 mb-0 shadow-xs">
<div class="alert alert-warning border border-warning-subtle text-body 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="fw-bold fs-6 text-body">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>
@@ -673,7 +750,6 @@
}
}
// Actualización de la tabla de ingresos recientes
async function refreshRecentLogs() {
const buildingId = document.getElementById('buildingSelect').value;
try {
@@ -683,11 +759,11 @@
if (data.items && data.items.length > 0) {
tbody.innerHTML = data.items.map(l => `
<tr>
<td class="ps-4 fw-semibold">${l.user_name}</td>
<td><span class="badge bg-light text-dark border">${l.user_role || 'ALUMNO'}</span></td>
<td>${l.user_dni || '--'}</td>
<td>${l.building_name}</td>
<td>${formatLogTime(l)}</td>
<td class="ps-3 fw-semibold text-body">${l.user_name}</td>
<td><span class="badge bg-body-tertiary text-body border">${l.user_role || 'ALUMNO'}</span></td>
<td class="font-monospace text-body-secondary">${l.user_dni || '--'}</td>
<td class="text-body-secondary">${l.building_name}</td>
<td class="font-monospace text-body-secondary">${formatLogTime(l)}</td>
<td class="text-center">
<span class="badge ${l.status === 'AUTORIZADO' ? 'bg-success-subtle text-success' : 'bg-danger-subtle text-danger'}">
${l.status === 'AUTORIZADO' ? 'OK' : l.status}
@@ -718,19 +794,17 @@
}
}
// Feedback sonoro avanzado vía Web Audio API diferenciado por resultado
function playAudioFeedback(type) {
try {
const ctx = new (window.AudioContext || window.webkitAudioContext)();
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
osc1.frequency.setValueAtTime(587.33, now);
osc1.frequency.setValueAtTime(880.00, now + 0.08);
gain1.gain.setValueAtTime(0.12, now);
gain1.gain.exponentialRampToValueAtTime(0.001, now + 0.25);
osc1.connect(gain1);
@@ -738,12 +812,11 @@
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
osc2.frequency.setValueAtTime(440.00, now);
osc2.frequency.setValueAtTime(554.37, now + 0.09);
gain2.gain.setValueAtTime(0.10, now);
gain2.gain.exponentialRampToValueAtTime(0.001, now + 0.24);
osc2.connect(gain2);
@@ -751,7 +824,6 @@
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';
@@ -766,39 +838,46 @@
} catch (e) {}
}
// Eventos globales para forzar el foco permanente en scannerInput
document.addEventListener('DOMContentLoaded', () => {
initSerialScanner();
focusScannerInput();
setInterval(focusScannerInput, 2000);
updateAutoFocusUI();
// Control de rotación del chevron del collapse de puertos COM
const comCollapse = document.getElementById('comPortsCollapse');
const comIcon = document.getElementById('comCollapseIcon');
if (comCollapse && comIcon) {
comCollapse.addEventListener('show.bs.collapse', () => {
comIcon.style.transform = 'rotate(180deg)';
});
comCollapse.addEventListener('hide.bs.collapse', () => {
comIcon.style.transform = 'rotate(0deg)';
});
}
const input = document.getElementById('scannerInput');
if (input) {
input.addEventListener('focus', () => updateFocusIndicator(true));
input.addEventListener('blur', () => {
setTimeout(() => {
const active = document.activeElement;
if (active && active.id !== 'buildingSelect') {
focusScannerInput();
} else {
if (!isAutoFocusActive) {
updateFocusIndicator(false);
}
}, 100);
});
}
});
window.addEventListener('focus', focusScannerInput);
window.addEventListener('focus', () => {
if (isAutoFocusActive) focusScannerInput();
});
document.addEventListener('click', (e) => {
// Si el usuario no hace clic sobre el selector de sedes o botones interactivos, regresar el cursor al input
if (!e.target.closest('select, button, a, #reader')) {
if (isAutoFocusActive && !e.target.closest('select, button, a, input, textarea, .card-header')) {
focusScannerInput();
}
});
</script>
<style>
/* Estilos de Punto Indicador de Foco */
.scanner-active-dot {
width: 8px;
height: 8px;
@@ -807,26 +886,50 @@
display: inline-block;
animation: pulse-dot 1.5s infinite ease-in-out;
}
.scanner-idle-dot {
width: 8px;
height: 8px;
background-color: #94a3b8;
border-radius: 50%;
display: inline-block;
}
@keyframes pulse-dot {
0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
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 */
/* Recursos Gráficos Sutiles: Banner de Cabecera y Marca de Agua Botánica */
.header-course-banner {
background-image: linear-gradient(135deg, rgba(30, 27, 75, 0.92) 0%, rgba(67, 56, 202, 0.85) 60%, rgba(180, 62, 142, 0.90) 100%),
url('/img/square_course_name.png');
background-size: cover;
background-position: center right;
}
.result-body-watermark {
position: relative;
background-image: url('/img/bg_course-card.png');
background-repeat: no-repeat;
background-position: bottom right;
background-size: 260px auto;
background-blend-mode: overlay;
}
/* Animaciones de Flash de Escaneo */
@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); }
0% { transform: scale(0.99); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.8); }
50% { transform: scale(1.015); box-shadow: 0 0 35px 8px rgba(34, 197, 94, 0.4); }
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); }
0% { transform: scale(0.99); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.8); }
50% { transform: scale(1.015); box-shadow: 0 0 35px 8px rgba(245, 158, 11, 0.4); }
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); }
0% { transform: scale(0.99); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8); }
50% { transform: scale(1.015); box-shadow: 0 0 35px 8px rgba(239, 68, 68, 0.4); }
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; }
@@ -840,6 +943,83 @@
}
.animate-pulse-badge { animation: pulse-badge 0.8s infinite ease-in-out; }
.transition-all { transition: all 0.3s ease; }
.transition-all { transition: all 0.25s ease; }
/* ========================================================================= */
/* MEJORAS DE CONTRASTE ESTRICTAS PARA MODO OSCURO (WCAG AA) */
/* ========================================================================= */
[data-bs-theme="dark"] .scanner-card,
[data-bs-theme="dark"] .logs-card,
[data-bs-theme="dark"] .result-validation-card,
[data-bs-theme="dark"] .com-config-card {
background-color: #17162E !important;
border: 1px solid rgba(255, 255, 255, 0.08) !important;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45) !important;
}
[data-bs-theme="dark"] .card-header.bg-body {
background-color: #1F1D3C !important;
border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
}
[data-bs-theme="dark"] #scannerInput {
background-color: #0E0D1D !important;
color: #F8FAFC !important;
border-color: #8B5CF6 !important;
}
[data-bs-theme="dark"] #scannerInput::placeholder {
color: #94A3B8 !important;
opacity: 0.8;
}
[data-bs-theme="dark"] .scanner-input-group {
border-color: #A855F7 !important;
box-shadow: 0 0 12px rgba(168, 85, 247, 0.2) !important;
}
[data-bs-theme="dark"] .bg-body-tertiary {
background-color: #1E1C38 !important;
border-color: rgba(255, 255, 255, 0.08) !important;
}
[data-bs-theme="dark"] .result-body-watermark {
background-blend-mode: screen;
opacity: 0.98;
}
[data-bs-theme="dark"] #recentLogsTable thead,
[data-bs-theme="dark"] #recentLogsTable thead th {
background-color: #1F1D3C !important;
color: #F1F5F9 !important;
border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}
[data-bs-theme="dark"] #recentLogsTable td {
color: #E2E8F0 !important;
border-color: rgba(255, 255, 255, 0.05) !important;
}
[data-bs-theme="dark"] #recentLogsTable tbody tr:hover td {
background-color: rgba(180, 62, 142, 0.12) !important;
}
[data-bs-theme="dark"] .classes-section-container {
background-color: #1A1832 !important;
border-color: rgba(255, 255, 255, 0.08) !important;
}
[data-bs-theme="dark"] .classes-section-container .card {
background-color: #211E40 !important;
border-color: rgba(139, 92, 246, 0.25) !important;
}
[data-bs-theme="dark"] #waitingState h4 {
color: #F8FAFC !important;
}
[data-bs-theme="dark"] #waitingState p {
color: #94A3B8 !important;
}
</style>
{% endblock %}