feat(reception,udeci): v3.8.48 - forced scanner focus, spanish keyboard gun normalization, reception default dashboard, and udeci commission listings
This commit is contained in:
+16
-15
@@ -1544,6 +1544,20 @@
|
||||
</head>
|
||||
<body data-user-authenticated="{{ 'true' if (auth_user and auth_user.is_authenticated) else 'false' }}">
|
||||
{% if auth_user and auth_user.is_authenticated %}
|
||||
{% set active_nav_user = impersonated_user if (is_impersonating and impersonated_user) else (auth_user if (auth_user and auth_user.is_authenticated) else (current_user if (current_user and current_user.is_authenticated) else user)) %}
|
||||
{% set raw_user_role = ((active_nav_user.role if active_nav_user and active_nav_user.role else (role if role else 'alumno')) | string | lower) %}
|
||||
{% if 'admin' in raw_user_role %}
|
||||
{% set user_role = 'admin' %}
|
||||
{% elif 'bedel' in raw_user_role %}
|
||||
{% set user_role = 'bedelia' %}
|
||||
{% elif 'docent' in raw_user_role or 'prof' in raw_user_role %}
|
||||
{% set user_role = 'docente' %}
|
||||
{% elif 'recep' in raw_user_role %}
|
||||
{% set user_role = 'recepcion' %}
|
||||
{% else %}
|
||||
{% set user_role = 'alumno' %}
|
||||
{% endif %}
|
||||
{% set home_url = '/reception/scanner' if user_role == 'recepcion' else '/dashboard' %}
|
||||
|
||||
<div class="app-wrapper">
|
||||
<!-- Sidebar Backdrop (Móvil) -->
|
||||
@@ -1551,7 +1565,7 @@
|
||||
<!-- Sidebar -->
|
||||
<aside class="sidebar" id="sidebar">
|
||||
<div class="sidebar-header border-bottom border-secondary-subtle d-flex align-items-center justify-content-between px-3">
|
||||
<a href="/dashboard" class="text-decoration-none d-flex align-items-center brand-link">
|
||||
<a href="{{ home_url }}" class="text-decoration-none d-flex align-items-center brand-link">
|
||||
<img src="/img/logo_unicaba_mini.png" alt="Logo UniCABA" class="navbar-logo me-2" height="26">
|
||||
<span class="brand-text fs-5">Edu-Space</span>
|
||||
</a>
|
||||
@@ -1566,19 +1580,6 @@
|
||||
</div>
|
||||
|
||||
<div class="sidebar-body flex-grow-1 overflow-y-auto p-2">
|
||||
{% set active_nav_user = impersonated_user if (is_impersonating and impersonated_user) else (auth_user if (auth_user and auth_user.is_authenticated) else (current_user if (current_user and current_user.is_authenticated) else user)) %}
|
||||
{% set raw_user_role = ((active_nav_user.role if active_nav_user and active_nav_user.role else (role if role else 'alumno')) | string | lower) %}
|
||||
{% if 'admin' in raw_user_role %}
|
||||
{% set user_role = 'admin' %}
|
||||
{% elif 'bedel' in raw_user_role %}
|
||||
{% set user_role = 'bedelia' %}
|
||||
{% elif 'docent' in raw_user_role or 'prof' in raw_user_role %}
|
||||
{% set user_role = 'docente' %}
|
||||
{% elif 'recep' in raw_user_role %}
|
||||
{% set user_role = 'recepcion' %}
|
||||
{% else %}
|
||||
{% set user_role = 'alumno' %}
|
||||
{% endif %}
|
||||
<ul class="sidebar-nav mb-0" id="sidebarNav">
|
||||
{% if user_role == 'admin' %}
|
||||
<!-- ADMINISTRADOR -->
|
||||
@@ -1923,7 +1924,7 @@
|
||||
<div class="main-content">
|
||||
<!-- Mobile Header (Visible EXCLUSIVAMENTE en dispositivos móviles y tablets < 992px) -->
|
||||
<div class="mobile-header shadow-sm align-items-center justify-content-between px-3">
|
||||
<a href="/dashboard" class="text-decoration-none brand-link d-flex align-items-center">
|
||||
<a href="{{ home_url }}" class="text-decoration-none brand-link d-flex align-items-center">
|
||||
<img src="/img/logo_unicaba_mini.png" alt="Logo UniCABA" class="navbar-logo me-2" height="24">
|
||||
<span class="brand-text fw-bold fs-6">Edu-Space</span>
|
||||
</a>
|
||||
|
||||
@@ -208,7 +208,7 @@
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.warn('Fallback a token local para QR modal:', err);
|
||||
var fallback = "UNICABA:USR:{{ auth_user.id if auth_user else 0 }}:DNI:{{ auth_user.document_number if auth_user else 'N/A' }}";
|
||||
var fallback = "UNICABA:USR:{{ auth_user.id if auth_user else 0 }}:DNI:{{ auth_user.document_number or auth_user.dni or auth_user.id or 'N/A' }}";
|
||||
ensureQrLibrary(function() {
|
||||
renderModalQR(fallback);
|
||||
});
|
||||
|
||||
@@ -52,18 +52,23 @@
|
||||
|
||||
<!-- Entrada Manual o Pistola Óptica USB -->
|
||||
<div class="mt-4 pt-3 border-top">
|
||||
<label class="form-label small fw-bold text-uppercase text-muted">
|
||||
<i class="bi bi-upc-scan me-1 text-primary"></i> Pistola Óptica USB o Entrada Manual por DNI
|
||||
</label>
|
||||
<div class="d-flex align-items-center justify-content-between mb-1">
|
||||
<label class="form-label small fw-bold text-uppercase text-muted mb-0">
|
||||
<i class="bi bi-upc-scan me-1 text-primary"></i> Pistola Óptica USB o Entrada Manual
|
||||
</label>
|
||||
<span class="small text-success fw-semibold d-flex align-items-center gap-1" id="scannerFocusIndicator" title="El cursor está bloqueado en este campo para recibir el escaneo inmediato">
|
||||
<span class="scanner-active-dot"></span> Lector Listo
|
||||
</span>
|
||||
</div>
|
||||
<form id="manualScanForm" onsubmit="handleManualScan(event)">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control rounded-start-pill ps-3" id="scannerInput"
|
||||
<div class="input-group shadow-sm rounded-pill overflow-hidden border border-2 border-primary">
|
||||
<input type="text" class="form-control rounded-start-pill ps-3 border-0" id="scannerInput"
|
||||
placeholder="Escanea con la pistola o escribe el DNI..." autofocus autocomplete="off">
|
||||
<button class="btn btn-primary rounded-end-pill px-4 fw-semibold" type="submit">
|
||||
<button class="btn btn-primary rounded-end-pill px-4 fw-semibold border-0" type="submit">
|
||||
Validar
|
||||
</button>
|
||||
</div>
|
||||
<span class="small text-muted d-block mt-1">El lector óptico envía la lectura directamente a este campo con retorno de carro automático.</span>
|
||||
<span class="small text-muted d-block mt-1">El cursor se mantiene siempre activo aquí. La pistola óptica envía la lectura y valida automáticamente.</span>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -234,14 +239,46 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Mantener el cursor forzado permanentemente en el input de la pistola óptica
|
||||
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 !== input) {
|
||||
input.focus();
|
||||
}
|
||||
updateFocusIndicator(true);
|
||||
}
|
||||
|
||||
function updateFocusIndicator(isFocused) {
|
||||
const indicator = document.getElementById('scannerFocusIndicator');
|
||||
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';
|
||||
} 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';
|
||||
}
|
||||
}
|
||||
|
||||
// Entrada manual o con pistola de código de barras
|
||||
function handleManualScan(e) {
|
||||
e.preventDefault();
|
||||
if (e) e.preventDefault();
|
||||
const input = document.getElementById('scannerInput');
|
||||
const val = input.value.trim();
|
||||
if (!val) return;
|
||||
if (!input) return;
|
||||
let val = input.value.trim();
|
||||
if (!val) {
|
||||
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 = '';
|
||||
setTimeout(focusScannerInput, 50);
|
||||
}
|
||||
|
||||
// Petición AJAX de verificación al Backend BFF
|
||||
@@ -268,6 +305,8 @@
|
||||
message: 'Error de conexión con el validador.',
|
||||
todays_classes: []
|
||||
});
|
||||
} finally {
|
||||
setTimeout(focusScannerInput, 150);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,5 +425,51 @@
|
||||
setTimeout(() => { osc.stop(); }, 120);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// Eventos globales para forzar el foco permanente en scannerInput
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
focusScannerInput();
|
||||
setInterval(focusScannerInput, 2000);
|
||||
|
||||
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 {
|
||||
updateFocusIndicator(false);
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('focus', 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')) {
|
||||
focusScannerInput();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.scanner-active-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background-color: #22c55e;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
animation: pulse-dot 1.5s infinite ease-in-out;
|
||||
}
|
||||
@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); }
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user