feat: agregar contadores de usuarios por rol y paginacion reforzada (v3.8.13)

This commit is contained in:
2026-10-26 12:41:50 -03:00
parent 71a0ac5d11
commit 85f320d96e
13 changed files with 240 additions and 22 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "3.8.12",
"version": "3.8.13",
"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.12';
const FRONTEND_VERSION = '3.8.12';
const BACKEND_VERSION = '3.8.12';
const APP_VERSION = '3.8.13';
const FRONTEND_VERSION = '3.8.13';
const BACKEND_VERSION = '3.8.13';
env.addGlobal('app_version', APP_VERSION);
env.addGlobal('frontend_version', FRONTEND_VERSION);
+13
View File
@@ -436,6 +436,15 @@ const handleUsersList = async (req, res) => {
let roles = [...MOCK_ROLES];
let document_types = [];
let total = 0;
let role_counts = {
total: 0,
active: 0,
inactive: 0,
admin: 0,
bedelia: 0,
docente: 0,
alumno: 0
};
try {
const resp = await req.apiClient.get('/admin/users', {
@@ -452,6 +461,9 @@ const handleUsersList = async (req, res) => {
roles = resp.data.roles || roles;
document_types = resp.data.document_types || [];
total = resp.data.total !== undefined ? resp.data.total : users.length;
if (resp.data.role_counts) {
role_counts = resp.data.role_counts;
}
}
} catch (apiErr) {
console.warn('Users list API notice:', apiErr.message);
@@ -468,6 +480,7 @@ const handleUsersList = async (req, res) => {
role_filter,
status_filter,
pagination,
role_counts,
msg,
error
});
+150 -2
View File
@@ -39,6 +39,121 @@
</div>
{% endif %}
<!-- User Metrics & Role Distribution Counters -->
<div class="row g-3 mb-4">
<!-- Total Usuarios -->
<div class="col-6 col-md-4 col-xl">
<a href="/admin/users_list" class="text-decoration-none text-reset d-block h-100">
<div class="card border-0 shadow-sm h-100 p-3 transition-all {% if not role_filter %}border-start border-primary border-4 bg-primary-subtle bg-opacity-25{% endif %}">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="text-muted small fw-semibold text-uppercase">Total Usuarios</span>
<div class="bg-primary bg-opacity-10 text-primary rounded-circle p-2">
<i class="bi bi-people-fill fs-5"></i>
</div>
</div>
<div class="d-flex align-items-baseline justify-content-between">
<h3 class="fw-bold mb-0 text-primary">{{ role_counts.total or 0 }}</h3>
<span class="badge bg-success-subtle text-success border border-success-subtle font-monospace small">
{{ role_counts.active or 0 }} activos
</span>
</div>
<div class="small text-muted mt-2 pt-2 border-top d-flex justify-content-between align-items-center">
<span>Padrón global</span>
<i class="bi bi-arrow-right"></i>
</div>
</div>
</a>
</div>
<!-- Administradores -->
<div class="col-6 col-md-4 col-xl">
<a href="/admin/users_list?role=1" class="text-decoration-none text-reset d-block h-100">
<div class="card border-0 shadow-sm h-100 p-3 transition-all {% if role_filter == '1' %}border-start border-dark border-4 bg-dark-subtle bg-opacity-25{% endif %}">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="text-muted small fw-semibold text-uppercase">Administradores</span>
<div class="bg-dark bg-opacity-10 text-dark rounded-circle p-2">
<i class="bi bi-shield-check fs-5"></i>
</div>
</div>
<div class="d-flex align-items-baseline justify-content-between">
<h3 class="fw-bold mb-0 text-dark">{{ role_counts.admin or 0 }}</h3>
<span class="badge bg-dark-subtle text-dark border small">Admin</span>
</div>
<div class="small text-muted mt-2 pt-2 border-top d-flex justify-content-between align-items-center">
<span>Gestión y TI</span>
<i class="bi bi-arrow-right"></i>
</div>
</div>
</a>
</div>
<!-- Bedelía -->
<div class="col-6 col-md-4 col-xl">
<a href="/admin/users_list?role=7" class="text-decoration-none text-reset d-block h-100">
<div class="card border-0 shadow-sm h-100 p-3 transition-all {% if role_filter == '7' %}border-start border-warning border-4 bg-warning-subtle bg-opacity-25{% endif %}">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="text-muted small fw-semibold text-uppercase">Bedelía</span>
<div class="bg-warning bg-opacity-10 text-warning rounded-circle p-2">
<i class="bi bi-building-gear fs-5"></i>
</div>
</div>
<div class="d-flex align-items-baseline justify-content-between">
<h3 class="fw-bold mb-0 text-warning-emphasis">{{ role_counts.bedelia or 0 }}</h3>
<span class="badge bg-warning-subtle text-warning-emphasis border border-warning-subtle small">Operadores</span>
</div>
<div class="small text-muted mt-2 pt-2 border-top d-flex justify-content-between align-items-center">
<span>Control de Aulas</span>
<i class="bi bi-arrow-right"></i>
</div>
</div>
</a>
</div>
<!-- Docentes -->
<div class="col-6 col-md-4 col-xl">
<a href="/admin/users_list?role=2" class="text-decoration-none text-reset d-block h-100">
<div class="card border-0 shadow-sm h-100 p-3 transition-all {% if role_filter == '2' %}border-start border-info border-4 bg-info-subtle bg-opacity-25{% endif %}">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="text-muted small fw-semibold text-uppercase">Docentes</span>
<div class="bg-info bg-opacity-10 text-info rounded-circle p-2">
<i class="bi bi-person-video3 fs-5"></i>
</div>
</div>
<div class="d-flex align-items-baseline justify-content-between">
<h3 class="fw-bold mb-0 text-info">{{ role_counts.docente or 0 }}</h3>
<span class="badge bg-info-subtle text-info border border-info-subtle small">Profesores</span>
</div>
<div class="small text-muted mt-2 pt-2 border-top d-flex justify-content-between align-items-center">
<span>Equipo docente</span>
<i class="bi bi-arrow-right"></i>
</div>
</div>
</a>
</div>
<!-- Alumnos -->
<div class="col-6 col-md-4 col-xl">
<a href="/admin/users_list?role=6" class="text-decoration-none text-reset d-block h-100">
<div class="card border-0 shadow-sm h-100 p-3 transition-all {% if role_filter == '6' %}border-start border-success border-4 bg-success-subtle bg-opacity-25{% endif %}">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="text-muted small fw-semibold text-uppercase">Alumnos</span>
<div class="bg-success bg-opacity-10 text-success rounded-circle p-2">
<i class="bi bi-mortarboard fs-5"></i>
</div>
</div>
<div class="d-flex align-items-baseline justify-content-between">
<h3 class="fw-bold mb-0 text-success">{{ role_counts.alumno or 0 }}</h3>
<span class="badge bg-success-subtle text-success border border-success-subtle small">Estudiantes</span>
</div>
<div class="small text-muted mt-2 pt-2 border-top d-flex justify-content-between align-items-center">
<span>Matrícula regular</span>
<i class="bi bi-arrow-right"></i>
</div>
</div>
</a>
</div>
</div>
<!-- Filters & Search -->
<div class="card border-0 shadow-sm mb-4">
<div class="card-body p-3">
@@ -49,8 +164,8 @@
<i class="bi bi-search text-muted"></i>
</span>
<input type="text" name="search" class="form-control border-start-0"
placeholder="Buscar por nombre, apellido, email o nro de documento..."
value="{{ search }}">
placeholder="Buscar por nombre, apellido, email o nro de documento..."
value="{{ search }}">
</div>
</div>
<div class="col-md-3">
@@ -84,6 +199,39 @@
<!-- Users Table -->
<div class="card border-0 shadow-sm">
<div class="card-header bg-body-tertiary border-0 py-3 d-flex flex-column flex-md-row justify-content-between align-items-center gap-2">
<div>
<span class="fw-bold text-body">
<i class="bi bi-list-ul me-1 text-primary"></i>Padrón de Usuarios
</span>
<span class="text-muted small ms-2">
(Página <strong>{{ pagination.page }}</strong> de <strong>{{ pagination.pages }}</strong> · Mostrando <strong>{{ users | length }}</strong> de <strong>{{ pagination.total }}</strong> usuarios)
</span>
</div>
{% if pagination and pagination.pages > 1 %}
<nav aria-label="Navegación rápida de usuarios">
<ul class="pagination pagination-sm mb-0">
<li class="page-item {% if not pagination.has_prev %}disabled{% endif %}">
<a class="page-link" href="/admin/users_list?page={{ pagination.page - 1 }}{% if search %}&search={{ search }}{% endif %}{% if role_filter %}&role={{ role_filter }}{% endif %}{% if status_filter %}&status={{ status_filter }}{% endif %}">
&laquo; Ant
</a>
</li>
{% for p in pagination.pages_list %}
<li class="page-item {% if p == pagination.page %}active{% endif %}">
<a class="page-link" href="/admin/users_list?page={{ p }}{% if search %}&search={{ search }}{% endif %}{% if role_filter %}&role={{ role_filter }}{% endif %}{% if status_filter %}&status={{ status_filter }}{% endif %}">
{{ p }}
</a>
</li>
{% endfor %}
<li class="page-item {% if not pagination.has_next %}disabled{% endif %}">
<a class="page-link" href="/admin/users_list?page={{ pagination.page + 1 }}{% if search %}&search={{ search }}{% endif %}{% if role_filter %}&role={{ role_filter }}{% endif %}{% if status_filter %}&status={{ status_filter }}{% endif %}">
Sig &raquo;
</a>
</li>
</ul>
</nav>
{% endif %}
</div>
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead class="bg-body-tertiary">