feat(dashboard): add commissions pagination, career filter, unassigned KPI card, and occupancy pie charts v3.8.19

This commit is contained in:
2026-10-26 17:08:39 -03:00
parent e4aa832b6e
commit a692c9ce67
13 changed files with 999 additions and 237 deletions
+14
View File
@@ -11,6 +11,20 @@ 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.19] - 2026-10-26
### Added & Improved
- **Dashboard: Paginación y Filtro por Carrera en Panel de Comisiones**:
- Implementado selector interactivo de carrera (`<select id="commCareerFilter">`) para filtrar instantáneamente en el cliente las cursadas por su carrera de pertenencia.
- Implementado paginador reactivo universal (`#commPaginationContainer`) con bloques de 10 elementos por página, resumen dinámico (`Mostrando X a Y de Z comisiones`), controles Anterior/Siguiente y botones de página numéricos.
- Enriquecidas las comisiones en `DashboardService` (`build_comm_item`) con `career_name`, `career_names` y `career_id`, exponiendo badges de carrera en la columna de Asignatura de cada bloque de período (`Hoy`, `Mañana`, `Semana`, `Mes`).
- Incorporada alerta amigable cuando no existan comisiones para la carrera seleccionada.
- **Dashboard: Tarjeta de Comisiones Sin Asignar y Gráficos de Torta para Ocupación en Día (Hoy)**:
- Agregada al lado de "Aulas Sin Asignar" la nueva tarjeta métrica de **"Comisiones Sin Asignar"** (con conteo, porcentaje respecto al total del ciclo y enlace de acceso directo al catálogo de comisiones) y la tarjeta de **"Comisiones Asignadas"** para un balance de 4 cuadrantes armónico.
- Incorporados 2 gráficos de torta interactivos (Chart.js Doughnut):
1. **Ocupación de Aulas Físicas (Hoy)**: Aulas Asignadas (Verde) vs Aulas Libres (Amarillo).
2. **Asignación de Comisiones (Hoy)**: Comisiones Con Aula (Azul) vs Comisiones Sin Asignar (Rojo).
- Ambos gráficos de torta y tarjetas métricas se actualizan reactivamente al cambiar el switcher de período (`Día (Hoy)`, `Mañana`, `Semana`, `Mes`) en Bedelía y Administración.
## [3.8.18] - 2026-10-26
### Changed & Fixed
- **Armonización de Tablas en Modo Oscuro (`.table-light`)**:
+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: Armonización de Tablas en Dark Mode, Perfil en Español y Cabeceras — v3.8.18**:
- **Armonización de Tablas en Modo Oscuro**: Regla global en `base.html` neutralizando el contraste cegador de `.table-light` en tema oscuro, adaptando fondos a `#1e293b` con texto blanco `#f1f5f9` y bordes sutiles; migración a `bg-body-tertiary` en `academic_terms`, `subjects`, `careers`, `commissions`, `classrooms` y `schedule`.
- **Mi Perfil 100% en Español (`/auth/profile`)**: Traducida la vista completa, formularios de preferencias de idioma y tema, datos de cuenta institucional y rediseñada la cabecera con tarjeta institucional y breadcrumbs ergonómicos.
- **Modernización de Cabecera en Tipificaciones (`/admin/milestone_types_list`)**: Eliminado el breadcrumb tosco reemplazándolo por una tarjeta con badge de icono dorado y estilo cohesivo.
- **QA & Seguridad**: 0 vulnerabilidades en SAST/SCA (Bandit, pip-audit, njsscan, npm audit) y 100% plantillas verificadas.
- **Versión Consolidada**: `v3.8.18`.
- **Sprint Activo: Paginación y Filtro por Carrera en Comisiones, Tarjeta KPI y Gráficos de Ocupación — v3.8.19**:
- **Paginación y Filtro Interactivo por Carrera en Comisiones**: Implementada paginación de 10 elementos por página en `dashbede.html` para los 8 bloques temporales (`today`, `tomorrow`, `week`, `month` / asignadas y sin asignar) con selector de carrera dinámico `<select id="commCareerFilter">`, badges de titulación en filas y alerta de estado vacío.
- **Tarjeta KPI de Comisiones Sin Asignar**: Agregada al lado de "Aulas Sin Asignar" en la sección de Percentiles de Asignación tanto en Bedelía (`dashbede.html`) como en Administración (`dashadm.html`), con conteo dinámico y porcentaje respecto al total de comisiones del ciclo.
- **Gráficos de Torta de Ocupación en Día (Hoy)**: Implementados dos gráficos Chart.js Doughnut interactivos (`#bedeliaClassroomsPieChart` / `#bedeliaCommissionsPieChart` y análogos de administración) para Aulas (Asignadas vs Libres) y Comisiones (Con Aula vs Sin Asignar), con leyendas reactivas y tooltip con porcentajes.
- **Enriquecimiento de Backend (`dashboard_service.py`)**: `build_comm_item` provee `career_name`, `career_names` y `career_id`, y el endpoint de dashboard expone el listado global de carreras (`careers`).
- **QA & Seguridad**: 79 tests aprobados en `pytest` (100%), 0 vulnerabilidades en auditoría de seguridad (Bandit, pip-audit, njsscan, npm audit) y balance de etiquetas verificado (`diff=0`).
- **Versión Consolidada**: `v3.8.19`.
## 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.18"
__version__ = "3.8.19"
class DummyContext:
def __enter__(self):
+10
View File
@@ -10,6 +10,7 @@ from sqlalchemy import func
from app import db
from app.models.classroom import Classroom
from app.models.subject import Subject, Commission
from app.models.career import Career
from app.models.user import User
from app.models.reservation import Reservation
from app.models.audit_log import AuditLog
@@ -366,12 +367,20 @@ class DashboardService:
if r_first:
assigned_room = r_first.classroom.code if r_first.classroom else 'Aula Virtual'
assigned_time = f"{r_first.start_time.strftime('%H:%M')} - {r_first.end_time.strftime('%H:%M')} hs"
career_name = comm.career_name if hasattr(comm, 'career_name') else (comm.subject.career.name if (comm.subject and comm.subject.career) else 'UniCABA')
career_names = comm.career_names if hasattr(comm, 'career_names') else career_name
career_id = comm.career_id if hasattr(comm, 'career_id') else None
return {
'id': comm.id,
'code': comm.code,
'full_code': comm.get_full_code(),
'subject_name': comm.subject.name if comm.subject else 'Sin materia',
'subject_code': comm.subject.code if comm.subject else '',
'career_name': career_name,
'career_names': career_names,
'career_id': career_id,
'teacher_name': comm.teacher_name or 'Sin docente',
'schedule': comm.schedule or 'Sin horario',
'shift': comm.shift or 'Sin turno',
@@ -639,6 +648,7 @@ class DashboardService:
'milestones': milestones,
'filter_stats': filter_stats,
'date_labels': date_labels,
'careers': [c.to_dict() for c in Career.query.order_by(Career.name.asc()).all()],
'ui': {
'show_role_banner': SystemSetting.get_value('dashboard_role_banner_enabled', 'true') in ['true', 'True', '1', True]
},
+1 -1
View File
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="edu-space-admin",
version="3.8.18",
version="3.8.19",
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.18",
"version": "3.8.19",
"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.18';
const FRONTEND_VERSION = '3.8.18';
const BACKEND_VERSION = '3.8.18';
const APP_VERSION = '3.8.19';
const FRONTEND_VERSION = '3.8.19';
const BACKEND_VERSION = '3.8.19';
env.addGlobal('app_version', APP_VERSION);
env.addGlobal('frontend_version', FRONTEND_VERSION);
+1
View File
@@ -244,6 +244,7 @@ router.get('/', async (req, res) => {
upcoming_reservations,
filter_stats,
date_labels,
careers: apiData.careers || [],
floor_availability,
all_physical_rooms_today: allPhysicalToday
});
+104 -34
View File
@@ -137,9 +137,10 @@
</div>
</div>
<div class="card-body p-3">
<div class="row g-3 align-items-center">
<!-- Tarjeta 1: Asignadas -->
<div class="col-md-3">
<!-- Fila 1: 4 Tarjetas KPI (Aulas Asignadas, Aulas Sin Asignar, Comisiones Sin Asignar, Comisiones Asignadas) -->
<div class="row g-3">
<!-- Tarjeta 1: Aulas Asignadas -->
<div class="col-md-3 col-sm-6">
<a href="/classrooms/list_classrooms?view_mode=physical" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-success bg-opacity-10 border border-success-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
@@ -158,8 +159,8 @@
</a>
</div>
<!-- Tarjeta 2: Sin Asignar -->
<div class="col-md-3">
<!-- Tarjeta 2: Aulas Sin Asignar (Libres) -->
<div class="col-md-3 col-sm-6">
<a href="/classrooms/list_classrooms?view_mode=physical" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-warning bg-opacity-10 border border-warning-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
@@ -178,46 +179,115 @@
</a>
</div>
<!-- Tarjeta 3: Barras Comparativas de Percentil -->
<div class="col-md-6">
<div class="p-3 rounded bg-body-tertiary border h-100 d-flex flex-column justify-content-center">
<!-- Tarjeta 3: Comisiones Sin Asignar (Pendientes) -->
<div class="col-md-3 col-sm-6">
<a href="/admin/commissions_list" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-danger bg-opacity-10 border border-danger-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="small fw-semibold text-body">
<i class="bi bi-pie-chart me-1 text-primary"></i>Ocupación en <span id="adminPctPeriodTitle">Día (Hoy)</span>:
</span>
<span class="small font-monospace text-muted" id="adminPctLegendText">
<strong class="text-success" id="adminPctLegendAssigned">{{ filter_stats.today.classrooms.assigned_count }} asignadas ({{ filter_stats.today.classrooms.assigned_pct }}%)</strong> · <strong class="text-warning-emphasis" id="adminPctLegendUnassigned">{{ filter_stats.today.classrooms.unassigned_count }} libres ({{ filter_stats.today.classrooms.unassigned_pct }}%)</strong>
</span>
<span class="text-danger small fw-bold text-uppercase">Comisiones Sin Asignar</span>
<span class="badge bg-danger text-white font-monospace" id="adminPctCommUnassignedPct">{{ filter_stats.today.commissions.unassigned_pct }}%</span>
</div>
<div class="progress mb-3" style="height: 14px;">
<div id="adminPctProgressBarAssigned" class="progress-bar bg-success progress-bar-striped" role="progressbar"
{{ ('style="width: ' ~ (filter_stats.today.classrooms.assigned_pct or 0) ~ '%;"') | safe }}
aria-valuenow="{{ filter_stats.today.classrooms.assigned_pct }}" aria-valuemin="0" aria-valuemax="100">
<span id="adminPctBarTextAssigned">{{ filter_stats.today.classrooms.assigned_pct }}%</span>
<div class="d-flex align-items-baseline justify-content-center gap-2 my-2">
<h2 class="mb-0 fw-bold text-danger" id="adminPctCommUnassignedCount">{{ filter_stats.today.commissions.unassigned_count }}</h2>
<span class="text-muted small">/ {{ filter_stats.today.commissions.total }} comisiones</span>
</div>
<div id="adminPctProgressBarUnassigned" class="progress-bar bg-warning" role="progressbar"
{{ ('style="width: ' ~ (filter_stats.today.classrooms.unassigned_pct or 0) ~ '%;"') | safe }}
aria-valuenow="{{ filter_stats.today.classrooms.unassigned_pct }}" aria-valuemin="0" aria-valuemax="100">
<span id="adminPctBarTextUnassigned">{{ filter_stats.today.classrooms.unassigned_pct }}%</span>
<div class="text-danger small pt-2 border-top border-danger-subtle d-flex align-items-center justify-content-between">
<span>Pendientes de asignación</span>
<i class="bi bi-arrow-right"></i>
</div>
</div>
</a>
</div>
<!-- Tarjeta 4: Comisiones Asignadas (Con Aula) -->
<div class="col-md-3 col-sm-6">
<a href="/admin/commissions_list" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-primary bg-opacity-10 border border-primary-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="text-primary small fw-bold text-uppercase">Comisiones Asignadas</span>
<span class="badge bg-primary text-white font-monospace" id="adminPctCommAssignedPct">{{ filter_stats.today.commissions.assigned_pct }}%</span>
</div>
<div class="d-flex align-items-baseline justify-content-center gap-2 my-2">
<h2 class="mb-0 fw-bold text-primary" id="adminPctCommAssignedCount">{{ filter_stats.today.commissions.assigned_count }}</h2>
<span class="text-muted small">/ {{ filter_stats.today.commissions.total }} comisiones</span>
</div>
<div class="text-primary small pt-2 border-top border-primary-subtle d-flex align-items-center justify-content-between">
<span>Con aula asignada</span>
<i class="bi bi-arrow-right"></i>
</div>
</div>
</a>
</div>
</div>
<!-- Comparador de referencia cuatrimestral -->
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="small fw-semibold text-secondary">
<i class="bi bi-calendar-range me-1"></i>Referencia Cuatrimestral Global:
<!-- Fila 2: Gráficos de Torta para Ocupación en Día (Hoy) -->
<div class="row g-3 mt-2">
<!-- Gráfico de Torta: Aulas Físicas -->
<div class="col-md-6">
<div class="p-3 rounded bg-body-tertiary border h-100 d-flex flex-column justify-content-between">
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="small fw-bold text-body">
<i class="bi bi-pie-chart-fill text-success me-1"></i>Ocupación de Aulas: <span id="adminClassPiePeriodTitle">Día (Hoy)</span>
</span>
<span class="badge bg-body text-secondary border font-monospace small" id="adminClassPieTotalBadge">Total: {{ filter_stats.today.classrooms.total }} aulas</span>
</div>
<div class="position-relative d-flex justify-content-center align-items-center my-2" style="height: 180px;">
<canvas id="adminClassroomsPieChart"></canvas>
</div>
<div class="d-flex justify-content-around text-center small pt-2 border-top mt-2">
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #198754;"></span>
<span class="text-success fw-semibold" id="adminClassPieLegendAssigned">Asignadas: {{ filter_stats.today.classrooms.assigned_count }} ({{ filter_stats.today.classrooms.assigned_pct }}%)</span>
</div>
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #ffc107;"></span>
<span class="text-warning-emphasis fw-semibold" id="adminClassPieLegendUnassigned">Libres: {{ filter_stats.today.classrooms.unassigned_count }} ({{ filter_stats.today.classrooms.unassigned_pct }}%)</span>
</div>
</div>
</div>
</div>
<!-- Gráfico de Torta: Comisiones -->
<div class="col-md-6">
<div class="p-3 rounded bg-body-tertiary border h-100 d-flex flex-column justify-content-between">
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="small fw-bold text-body">
<i class="bi bi-pie-chart-fill text-primary me-1"></i>Asignación de Comisiones: <span id="adminCommPiePeriodTitle">Día (Hoy)</span>
</span>
<span class="badge bg-body text-secondary border font-monospace small" id="adminCommPieTotalBadge">Total: {{ filter_stats.today.commissions.total }} comisiones</span>
</div>
<div class="position-relative d-flex justify-content-center align-items-center my-2" style="height: 180px;">
<canvas id="adminCommissionsPieChart"></canvas>
</div>
<div class="d-flex justify-content-around text-center small pt-2 border-top mt-2">
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #0d6efd;"></span>
<span class="text-primary fw-semibold" id="adminCommPieLegendAssigned">Con Aula: {{ filter_stats.today.commissions.assigned_count }} ({{ filter_stats.today.commissions.assigned_pct }}%)</span>
</div>
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #dc3545;"></span>
<span class="text-danger fw-semibold" id="adminCommPieLegendUnassigned">Sin Asignar: {{ filter_stats.today.commissions.unassigned_count }} ({{ filter_stats.today.commissions.unassigned_pct }}%)</span>
</div>
</div>
</div>
</div>
</div>
<!-- Referencia Cuatrimestral Global al pie -->
<div class="mt-3 p-2 rounded bg-body-tertiary border d-flex justify-content-between align-items-center flex-wrap gap-2">
<span class="small fw-semibold text-secondary">
<i class="bi bi-calendar-range me-1"></i>Referencia Cuatrimestral Global de Aulas:
</span>
<div class="flex-grow-1 mx-2" style="max-width: 320px; min-width: 180px;">
<div class="progress" style="height: 8px;">
<div class="progress-bar bg-success" role="progressbar" {{ ('style="width: ' ~ (stats.assigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
<div class="progress-bar bg-warning" role="progressbar" {{ ('style="width: ' ~ (stats.unassigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
</div>
</div>
<span class="small font-monospace text-muted">
{{ stats.assigned_classrooms_pct }}% asignadas · {{ stats.unassigned_classrooms_pct }}% libres
</span>
</div>
<div class="progress" style="height: 8px;">
<div class="progress-bar bg-secondary" role="progressbar" {{ ('style="width: ' ~ (stats.assigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
<div class="progress-bar bg-secondary-subtle" role="progressbar" {{ ('style="width: ' ~ (stats.unassigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
</div>
</div>
</div>
</div>
</div>
</div>
+231 -52
View File
@@ -126,9 +126,10 @@
</div>
</div>
<div class="card-body p-3">
<div class="row g-3 align-items-center">
<!-- Fila 1: 4 Tarjetas KPI (Aulas Asignadas, Aulas Sin Asignar, Comisiones Sin Asignar, Comisiones Asignadas) -->
<div class="row g-3">
<!-- Tarjeta 1: Aulas Asignadas -->
<div class="col-md-3">
<div class="col-md-3 col-sm-6">
<a href="/classrooms/list_classrooms?view_mode=physical" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-success bg-opacity-10 border border-success-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
@@ -148,7 +149,7 @@
</div>
<!-- Tarjeta 2: Aulas Sin Asignar (Libres) -->
<div class="col-md-3">
<div class="col-md-3 col-sm-6">
<a href="/schedule/add_reservation" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-warning bg-opacity-10 border border-warning-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
@@ -167,46 +168,115 @@
</a>
</div>
<!-- Tarjeta 3: Barras Comparativas de Percentil -->
<div class="col-md-6">
<div class="p-3 rounded bg-body-tertiary border h-100 d-flex flex-column justify-content-center">
<!-- Tarjeta 3: Comisiones Sin Asignar (Pendientes) -->
<div class="col-md-3 col-sm-6">
<a href="#bedelia-commissions-panel" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-danger bg-opacity-10 border border-danger-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="small fw-semibold text-body">
<i class="bi bi-pie-chart me-1 text-primary"></i>Ocupación en <span id="bedeliaPctPeriodTitle">Día (Hoy)</span>:
</span>
<span class="small font-monospace text-muted" id="bedeliaPctLegendText">
<strong class="text-success" id="bedeliaPctLegendAssigned">{{ filter_stats.today.classrooms.assigned_count }} asignadas ({{ filter_stats.today.classrooms.assigned_pct }}%)</strong> · <strong class="text-warning-emphasis" id="bedeliaPctLegendUnassigned">{{ filter_stats.today.classrooms.unassigned_count }} libres ({{ filter_stats.today.classrooms.unassigned_pct }}%)</strong>
</span>
<span class="text-danger small fw-bold text-uppercase">Comisiones Sin Asignar</span>
<span class="badge bg-danger text-white font-monospace" id="bedeliaPctCommUnassignedPct">{{ filter_stats.today.commissions.unassigned_pct }}%</span>
</div>
<div class="progress mb-3" style="height: 14px;">
<div id="bedeliaPctProgressBarAssigned" class="progress-bar bg-success progress-bar-striped" role="progressbar"
{{ ('style="width: ' ~ (filter_stats.today.classrooms.assigned_pct or 0) ~ '%;"') | safe }}
aria-valuenow="{{ filter_stats.today.classrooms.assigned_pct }}" aria-valuemin="0" aria-valuemax="100">
<span id="bedeliaPctBarTextAssigned">{{ filter_stats.today.classrooms.assigned_pct }}%</span>
<div class="d-flex align-items-baseline justify-content-center gap-2 my-2">
<h2 class="mb-0 fw-bold text-danger" id="bedeliaPctCommUnassignedCount">{{ filter_stats.today.commissions.unassigned_count }}</h2>
<span class="text-muted small">/ <span class="pctTotalCommissions">{{ filter_stats.today.commissions.total }}</span> comisiones</span>
</div>
<div id="bedeliaPctProgressBarUnassigned" class="progress-bar bg-warning" role="progressbar"
{{ ('style="width: ' ~ (filter_stats.today.classrooms.unassigned_pct or 0) ~ '%;"') | safe }}
aria-valuenow="{{ filter_stats.today.classrooms.unassigned_pct }}" aria-valuemin="0" aria-valuemax="100">
<span id="bedeliaPctBarTextUnassigned">{{ filter_stats.today.classrooms.unassigned_pct }}%</span>
<div class="text-danger small pt-2 border-top border-danger-subtle d-flex align-items-center justify-content-between">
<span>Pendientes de asignar</span>
<i class="bi bi-arrow-down-circle"></i>
</div>
</div>
</a>
</div>
<!-- Tarjeta 4: Comisiones Asignadas (Con Aula) -->
<div class="col-md-3 col-sm-6">
<a href="#bedelia-commissions-panel" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-primary bg-opacity-10 border border-primary-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="text-primary small fw-bold text-uppercase">Comisiones Asignadas</span>
<span class="badge bg-primary text-white font-monospace" id="bedeliaPctCommAssignedPct">{{ filter_stats.today.commissions.assigned_pct }}%</span>
</div>
<div class="d-flex align-items-baseline justify-content-center gap-2 my-2">
<h2 class="mb-0 fw-bold text-primary" id="bedeliaPctCommAssignedCount">{{ filter_stats.today.commissions.assigned_count }}</h2>
<span class="text-muted small">/ <span class="pctTotalCommissions">{{ filter_stats.today.commissions.total }}</span> comisiones</span>
</div>
<div class="text-primary small pt-2 border-top border-primary-subtle d-flex align-items-center justify-content-between">
<span>Con aula asignada</span>
<i class="bi bi-check2-circle"></i>
</div>
</div>
</a>
</div>
</div>
<!-- Comparador de referencia cuatrimestral -->
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="small fw-semibold text-secondary">
<i class="bi bi-calendar-range me-1"></i>Referencia Cuatrimestral Global:
<!-- Fila 2: Gráficos de Torta para Ocupación en Día (Hoy) -->
<div class="row g-3 mt-2">
<!-- Gráfico de Torta: Aulas Físicas -->
<div class="col-md-6">
<div class="p-3 rounded bg-body-tertiary border h-100 d-flex flex-column justify-content-between">
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="small fw-bold text-body">
<i class="bi bi-pie-chart-fill text-success me-1"></i>Ocupación de Aulas: <span id="bedeliaClassPiePeriodTitle">Día (Hoy)</span>
</span>
<span class="badge bg-body text-secondary border font-monospace small" id="bedeliaClassPieTotalBadge">Total: {{ filter_stats.today.classrooms.total }} aulas</span>
</div>
<div class="position-relative d-flex justify-content-center align-items-center my-2" style="height: 180px;">
<canvas id="bedeliaClassroomsPieChart"></canvas>
</div>
<div class="d-flex justify-content-around text-center small pt-2 border-top mt-2">
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #198754;"></span>
<span class="text-success fw-semibold" id="bedeliaClassPieLegendAssigned">Asignadas: {{ filter_stats.today.classrooms.assigned_count }} ({{ filter_stats.today.classrooms.assigned_pct }}%)</span>
</div>
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #ffc107;"></span>
<span class="text-warning-emphasis fw-semibold" id="bedeliaClassPieLegendUnassigned">Libres: {{ filter_stats.today.classrooms.unassigned_count }} ({{ filter_stats.today.classrooms.unassigned_pct }}%)</span>
</div>
</div>
</div>
</div>
<!-- Gráfico de Torta: Comisiones -->
<div class="col-md-6">
<div class="p-3 rounded bg-body-tertiary border h-100 d-flex flex-column justify-content-between">
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="small fw-bold text-body">
<i class="bi bi-pie-chart-fill text-primary me-1"></i>Asignación de Comisiones: <span id="bedeliaCommPiePeriodTitle">Día (Hoy)</span>
</span>
<span class="badge bg-body text-secondary border font-monospace small" id="bedeliaCommPieTotalBadge">Total: {{ filter_stats.today.commissions.total }} comisiones</span>
</div>
<div class="position-relative d-flex justify-content-center align-items-center my-2" style="height: 180px;">
<canvas id="bedeliaCommissionsPieChart"></canvas>
</div>
<div class="d-flex justify-content-around text-center small pt-2 border-top mt-2">
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #0d6efd;"></span>
<span class="text-primary fw-semibold" id="bedeliaCommPieLegendAssigned">Con Aula: {{ filter_stats.today.commissions.assigned_count }} ({{ filter_stats.today.commissions.assigned_pct }}%)</span>
</div>
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #dc3545;"></span>
<span class="text-danger fw-semibold" id="bedeliaCommPieLegendUnassigned">Sin Asignar: {{ filter_stats.today.commissions.unassigned_count }} ({{ filter_stats.today.commissions.unassigned_pct }}%)</span>
</div>
</div>
</div>
</div>
</div>
<!-- Referencia Cuatrimestral Global al pie -->
<div class="mt-3 p-2 rounded bg-body-tertiary border d-flex justify-content-between align-items-center flex-wrap gap-2">
<span class="small fw-semibold text-secondary">
<i class="bi bi-calendar-range me-1"></i>Referencia Cuatrimestral Global de Aulas:
</span>
<div class="flex-grow-1 mx-2" style="max-width: 320px; min-width: 180px;">
<div class="progress" style="height: 8px;">
<div class="progress-bar bg-success" role="progressbar" {{ ('style="width: ' ~ (stats.assigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
<div class="progress-bar bg-warning" role="progressbar" {{ ('style="width: ' ~ (stats.unassigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
</div>
</div>
<span class="small font-monospace text-muted">
{{ stats.assigned_classrooms_pct }}% asignadas · {{ stats.unassigned_classrooms_pct }}% libres
</span>
</div>
<div class="progress" style="height: 8px;">
<div class="progress-bar bg-secondary" role="progressbar" {{ ('style="width: ' ~ (stats.assigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
<div class="progress-bar bg-secondary-subtle" role="progressbar" {{ ('style="width: ' ~ (stats.unassigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -484,7 +554,7 @@
</div>
</div>
<!-- Sub-navegación: Asignadas vs Sin Asignar -->
<!-- Sub-navegación: Asignadas vs Sin Asignar + Filtro de Carrera -->
<div class="card-body border-bottom bg-body-tertiary py-2 px-3">
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2">
<div class="nav nav-pills nav-fill gap-2" role="tablist" id="commStatusPills">
@@ -497,6 +567,20 @@
<span class="badge bg-success ms-1" id="commStatusBadgeAssigned">{{ filter_stats.today.commissions.assigned_count }}</span>
</button>
</div>
<!-- Filtro por Carrera -->
<div class="d-flex align-items-center gap-2">
<label for="commCareerFilter" class="small fw-semibold text-muted text-nowrap mb-0">
<i class="bi bi-mortarboard me-1"></i>Carrera:
</label>
<select id="commCareerFilter" class="form-select form-select-sm" style="min-width: 220px; max-width: 320px;" onchange="onCommCareerFilterChange(this.value)">
<option value="">Todas las carreras</option>
{% for career in careers %}
<option value="{{ career.name }}">{{ career.name }}</option>
{% endfor %}
</select>
</div>
<div class="small text-muted font-monospace" id="commStatusSummaryText">
Período activo: <strong>{{ filter_stats.today.label }}</strong>
</div>
@@ -522,13 +606,18 @@
</thead>
<tbody>
{% for comm in filter_stats.today.commissions.unassigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-danger-subtle text-danger border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td class="small">{{ comm.teacher_name }}</td>
<td><span class="badge bg-body-tertiary text-body border"><i class="bi bi-clock me-1"></i>{{ comm.schedule }}</span></td>
@@ -544,6 +633,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-check-circle-fill text-success fs-1 d-block mb-2"></i>
@@ -571,13 +664,18 @@
</thead>
<tbody>
{% for comm in filter_stats.today.commissions.assigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-success-subtle text-success border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td>
<span class="badge bg-primary-subtle text-primary border font-monospace">
@@ -597,6 +695,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-info-circle text-muted fs-1 d-block mb-2"></i>
@@ -624,13 +726,18 @@
</thead>
<tbody>
{% for comm in filter_stats.tomorrow.commissions.unassigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-danger-subtle text-danger border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td class="small">{{ comm.teacher_name }}</td>
<td><span class="badge bg-body-tertiary text-body border"><i class="bi bi-clock me-1"></i>{{ comm.schedule }}</span></td>
@@ -646,6 +753,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-check-circle-fill text-success fs-1 d-block mb-2"></i>
@@ -673,13 +784,18 @@
</thead>
<tbody>
{% for comm in filter_stats.tomorrow.commissions.assigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-success-subtle text-success border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td>
<span class="badge bg-primary-subtle text-primary border font-monospace">
@@ -699,6 +815,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-info-circle text-muted fs-1 d-block mb-2"></i>
@@ -726,13 +846,18 @@
</thead>
<tbody>
{% for comm in filter_stats.week.commissions.unassigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-danger-subtle text-danger border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td class="small">{{ comm.teacher_name }}</td>
<td><span class="badge bg-body-tertiary text-body border"><i class="bi bi-clock me-1"></i>{{ comm.schedule }}</span></td>
@@ -748,6 +873,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-check-circle-fill text-success fs-1 d-block mb-2"></i>
@@ -756,7 +885,7 @@
{% endif %}
</div>
<!-- 2. SEMANA: Asignadas -->
<!-- 3. SEMANA: Asignadas -->
<div id="commBlock-week-assigned" class="comm-block" style="display: none;">
{% if filter_stats.week.commissions.assigned and filter_stats.week.commissions.assigned | length > 0 %}
<div class="table-responsive">
@@ -774,13 +903,18 @@
</thead>
<tbody>
{% for comm in filter_stats.week.commissions.assigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-success-subtle text-success border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td>
<span class="badge bg-primary-subtle text-primary border font-monospace">
@@ -800,6 +934,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-info-circle text-muted fs-1 d-block mb-2"></i>
@@ -808,7 +946,7 @@
{% endif %}
</div>
<!-- 3. MES: Sin Asignar -->
<!-- 4. MES: Sin Asignar -->
<div id="commBlock-month-unassigned" class="comm-block" style="display: none;">
{% if filter_stats.month.commissions.unassigned and filter_stats.month.commissions.unassigned | length > 0 %}
<div class="table-responsive">
@@ -826,13 +964,18 @@
</thead>
<tbody>
{% for comm in filter_stats.month.commissions.unassigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-danger-subtle text-danger border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td class="small">{{ comm.teacher_name }}</td>
<td><span class="badge bg-body-tertiary text-body border"><i class="bi bi-clock me-1"></i>{{ comm.schedule }}</span></td>
@@ -848,6 +991,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-check-circle-fill text-success fs-1 d-block mb-2"></i>
@@ -856,7 +1003,7 @@
{% endif %}
</div>
<!-- 3. MES: Asignadas -->
<!-- 4. MES: Asignadas -->
<div id="commBlock-month-assigned" class="comm-block" style="display: none;">
{% if filter_stats.month.commissions.assigned and filter_stats.month.commissions.assigned | length > 0 %}
<div class="table-responsive">
@@ -874,13 +1021,18 @@
</thead>
<tbody>
{% for comm in filter_stats.month.commissions.assigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-success-subtle text-success border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td>
<span class="badge bg-primary-subtle text-primary border font-monospace">
@@ -900,6 +1052,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-info-circle text-muted fs-1 d-block mb-2"></i>
@@ -908,6 +1064,19 @@
{% endif %}
</div>
</div>
<!-- Barra de Paginación para Comisiones -->
<div class="card-footer bg-body-tertiary py-2 px-3 border-top" id="commPaginationContainer" style="display: none;">
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2">
<div class="small text-muted font-monospace" id="commPaginationSummary">
Mostrando <strong id="commPageStart">1</strong>-<strong id="commPageEnd">10</strong> de <strong id="commPageTotal">0</strong> comisiones
</div>
<div class="d-flex align-items-center gap-2">
<ul class="pagination pagination-sm mb-0" id="commPaginationNav">
</ul>
</div>
</div>
</div>
</div>
<!-- ========================= Panel: Aulas (Asignadas vs Libres / Sin Asignar) ========================= -->
@@ -1347,6 +1516,16 @@
</div>
</a>
</div>
<div class="col-md-12 col-lg-12 mt-2">
<div class="d-flex justify-content-end gap-2">
<a href="/schedule/export_csv" class="btn btn-sm btn-outline-success">
<i class="bi bi-file-earmark-excel me-1"></i>Descargar Planilla del Día (Excel / CSV)
</a>
<a href="/schedule/today_schedule" class="btn btn-sm btn-outline-primary">
<i class="bi bi-printer me-1"></i>Abrir Cartelera Imprimible
</a>
</div>
</div>
</div>
</div>
</div>
+293 -45
View File
@@ -179,8 +179,131 @@ $(document).ready(function() {
}
});
}
// Inicialización de Gráficos de Torta (Doughnut) para Aulas y Comisiones
initDoughnutCharts();
// Poblar dinámicamente opciones de carrera si faltaran en el selector
const careerSelect = document.getElementById('commCareerFilter');
if (careerSelect) {
const existingValues = new Set(Array.from(careerSelect.options).map(o => o.value));
document.querySelectorAll('tr[data-career]').forEach(function(tr) {
const cName = tr.getAttribute('data-career');
if (cName && !existingValues.has(cName)) {
existingValues.add(cName);
const opt = document.createElement('option');
opt.value = cName;
opt.textContent = cName;
careerSelect.appendChild(opt);
}
});
}
// Inicializar la paginación y filtrado de comisiones
applyCommPaginationAndFilter();
});
// Referencias globales a los gráficos Doughnut
let classroomsPieChart = null;
let commissionsPieChart = null;
function initDoughnutCharts() {
const classCanvas = document.getElementById('bedeliaClassroomsPieChart') || document.getElementById('adminClassroomsPieChart');
const commCanvas = document.getElementById('bedeliaCommissionsPieChart') || document.getElementById('adminCommissionsPieChart');
if (classCanvas && FILTER_STATS_DATA && FILTER_STATS_DATA.today) {
const todayClass = FILTER_STATS_DATA.today.classrooms || {};
const assigned = todayClass.assigned_count || 0;
const unassigned = todayClass.unassigned_count || 0;
classroomsPieChart = new Chart(classCanvas.getContext('2d'), {
type: 'doughnut',
data: {
labels: ['Aulas Asignadas', 'Aulas Libres'],
datasets: [{
data: [assigned, unassigned],
backgroundColor: ['#198754', '#ffc107'],
borderColor: 'transparent',
borderWidth: 2,
hoverOffset: 4
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
cutout: '68%',
plugins: {
legend: { display: false },
tooltip: {
callbacks: {
label: function(ctx) {
const val = ctx.raw || 0;
const total = ctx.dataset.data.reduce((a, b) => a + b, 0);
const pct = total > 0 ? Math.round((val / total) * 100) : 0;
return ` ${ctx.label}: ${val} (${pct}%)`;
}
}
}
}
}
});
}
if (commCanvas && FILTER_STATS_DATA && FILTER_STATS_DATA.today) {
const todayComm = FILTER_STATS_DATA.today.commissions || {};
const assigned = todayComm.assigned_count || 0;
const unassigned = todayComm.unassigned_count || 0;
commissionsPieChart = new Chart(commCanvas.getContext('2d'), {
type: 'doughnut',
data: {
labels: ['Con Aula Asignada', 'Sin Asignar (Pendientes)'],
datasets: [{
data: [assigned, unassigned],
backgroundColor: ['#0d6efd', '#dc3545'],
borderColor: 'transparent',
borderWidth: 2,
hoverOffset: 4
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
cutout: '68%',
plugins: {
legend: { display: false },
tooltip: {
callbacks: {
label: function(ctx) {
const val = ctx.raw || 0;
const total = ctx.dataset.data.reduce((a, b) => a + b, 0);
const pct = total > 0 ? Math.round((val / total) * 100) : 0;
return ` ${ctx.label}: ${val} (${pct}%)`;
}
}
}
}
}
});
}
}
function updateDoughnutCharts(period) {
if (!FILTER_STATS_DATA || !FILTER_STATS_DATA[period]) return;
const periodData = FILTER_STATS_DATA[period];
const classData = periodData.classrooms || {};
const commData = periodData.commissions || {};
if (classroomsPieChart) {
classroomsPieChart.data.datasets[0].data = [classData.assigned_count || 0, classData.unassigned_count || 0];
classroomsPieChart.update();
}
if (commissionsPieChart) {
commissionsPieChart.data.datasets[0].data = [commData.assigned_count || 0, commData.unassigned_count || 0];
commissionsPieChart.update();
}
}
// Apply dynamic colors from data-color attributes (milestone type badges)
document.querySelectorAll('[data-color]').forEach(function(el) {
const color = el.getAttribute('data-color');
@@ -222,15 +345,19 @@ function switchBedeliaPercentiles(period) {
if (!FILTER_STATS_DATA || !FILTER_STATS_DATA[period]) return;
const periodData = FILTER_STATS_DATA[period];
const classData = periodData.classrooms || {};
const commData = periodData.commissions || {};
const dateText = document.getElementById('bedeliaPctDateText');
if (dateText) dateText.innerText = periodData.label || '';
const periodTitle = document.getElementById('bedeliaPctPeriodTitle');
if (periodTitle) {
periodTitle.innerText = period === 'today' ? 'Día (Hoy)' : (period === 'tomorrow' ? 'Mañana' : (period === 'week' ? 'Semana' : 'Mes'));
}
const periodName = period === 'today' ? 'Día (Hoy)' : (period === 'tomorrow' ? 'Mañana' : (period === 'week' ? 'Semana' : 'Mes'));
const classPieTitle = document.getElementById('bedeliaClassPiePeriodTitle');
const commPieTitle = document.getElementById('bedeliaCommPiePeriodTitle');
if (classPieTitle) classPieTitle.innerText = periodName;
if (commPieTitle) commPieTitle.innerText = periodName;
// Tarjetas KPI Aulas
const assignedCount = document.getElementById('bedeliaPctAssignedCount');
const assignedPct = document.getElementById('bedeliaPctAssignedPct');
const unassignedCount = document.getElementById('bedeliaPctUnassignedCount');
@@ -245,28 +372,30 @@ function switchBedeliaPercentiles(period) {
assignedLabel.innerText = period === 'today' ? 'Con cursada activa hoy' : (period === 'tomorrow' ? 'Con cursada activa mañana' : (period === 'week' ? 'Con cursada activa esta semana' : 'Con cursada activa este mes'));
}
// Actualizar leyendas y barras
const legendAssigned = document.getElementById('bedeliaPctLegendAssigned');
const legendUnassigned = document.getElementById('bedeliaPctLegendUnassigned');
if (legendAssigned) legendAssigned.innerText = (classData.assigned_count ?? 0) + ' asignadas (' + (classData.assigned_pct ?? 0) + '%)';
if (legendUnassigned) legendUnassigned.innerText = (classData.unassigned_count ?? 0) + ' libres (' + (classData.unassigned_pct ?? 0) + '%)';
// Tarjetas KPI Comisiones
const commUnassignedCount = document.getElementById('bedeliaPctCommUnassignedCount');
const commUnassignedPct = document.getElementById('bedeliaPctCommUnassignedPct');
const commAssignedCount = document.getElementById('bedeliaPctCommAssignedCount');
const commAssignedPct = document.getElementById('bedeliaPctCommAssignedPct');
const barAssigned = document.getElementById('bedeliaPctProgressBarAssigned');
const barUnassigned = document.getElementById('bedeliaPctProgressBarUnassigned');
const barTextAssigned = document.getElementById('bedeliaPctBarTextAssigned');
const barTextUnassigned = document.getElementById('bedeliaPctBarTextUnassigned');
if (commUnassignedCount) commUnassignedCount.innerText = commData.unassigned_count ?? 0;
if (commUnassignedPct) commUnassignedPct.innerText = (commData.unassigned_pct ?? 0) + '%';
if (commAssignedCount) commAssignedCount.innerText = commData.assigned_count ?? 0;
if (commAssignedPct) commAssignedPct.innerText = (commData.assigned_pct ?? 0) + '%';
if (barAssigned) {
barAssigned.style.width = (classData.assigned_pct ?? 0) + '%';
barAssigned.setAttribute('aria-valuenow', classData.assigned_pct ?? 0);
}
if (barTextAssigned) barTextAssigned.innerText = (classData.assigned_pct ?? 0) + '%';
// Leyendas de los gráficos de torta
const classLegendAssigned = document.getElementById('bedeliaClassPieLegendAssigned');
const classLegendUnassigned = document.getElementById('bedeliaClassPieLegendUnassigned');
const commLegendAssigned = document.getElementById('bedeliaCommPieLegendAssigned');
const commLegendUnassigned = document.getElementById('bedeliaCommPieLegendUnassigned');
if (barUnassigned) {
barUnassigned.style.width = (classData.unassigned_pct ?? 0) + '%';
barUnassigned.setAttribute('aria-valuenow', classData.unassigned_pct ?? 0);
}
if (barTextUnassigned) barTextUnassigned.innerText = (classData.unassigned_pct ?? 0) + '%';
if (classLegendAssigned) classLegendAssigned.innerText = 'Asignadas: ' + (classData.assigned_count ?? 0) + ' (' + (classData.assigned_pct ?? 0) + '%)';
if (classLegendUnassigned) classLegendUnassigned.innerText = 'Libres: ' + (classData.unassigned_count ?? 0) + ' (' + (classData.unassigned_pct ?? 0) + '%)';
if (commLegendAssigned) commLegendAssigned.innerText = 'Con Aula: ' + (commData.assigned_count ?? 0) + ' (' + (commData.assigned_pct ?? 0) + '%)';
if (commLegendUnassigned) commLegendUnassigned.innerText = 'Sin Asignar: ' + (commData.unassigned_count ?? 0) + ' (' + (commData.unassigned_pct ?? 0) + '%)';
// Actualizar gráficos Doughnut
updateDoughnutCharts(period);
// Botones activos
document.querySelectorAll('#bedeliaPctPeriodSwitcher button').forEach(function(btn) {
@@ -279,15 +408,19 @@ function switchAdminPercentiles(period) {
if (!FILTER_STATS_DATA || !FILTER_STATS_DATA[period]) return;
const periodData = FILTER_STATS_DATA[period];
const classData = periodData.classrooms || {};
const commData = periodData.commissions || {};
const dateText = document.getElementById('adminPctDateText');
if (dateText) dateText.innerText = periodData.label || '';
const periodTitle = document.getElementById('adminPctPeriodTitle');
if (periodTitle) {
periodTitle.innerText = period === 'today' ? 'Día (Hoy)' : (period === 'tomorrow' ? 'Mañana' : (period === 'week' ? 'Semana' : 'Mes'));
}
const periodName = period === 'today' ? 'Día (Hoy)' : (period === 'tomorrow' ? 'Mañana' : (period === 'week' ? 'Semana' : 'Mes'));
const classPieTitle = document.getElementById('adminClassPiePeriodTitle');
const commPieTitle = document.getElementById('adminCommPiePeriodTitle');
if (classPieTitle) classPieTitle.innerText = periodName;
if (commPieTitle) commPieTitle.innerText = periodName;
// Tarjetas KPI Aulas
const assignedCount = document.getElementById('adminPctAssignedCount');
const assignedPct = document.getElementById('adminPctAssignedPct');
const unassignedCount = document.getElementById('adminPctUnassignedCount');
@@ -298,33 +431,145 @@ function switchAdminPercentiles(period) {
if (unassignedCount) unassignedCount.innerText = classData.unassigned_count ?? 0;
if (unassignedPct) unassignedPct.innerText = (classData.unassigned_pct ?? 0) + '%';
const legendAssigned = document.getElementById('adminPctLegendAssigned');
const legendUnassigned = document.getElementById('adminPctLegendUnassigned');
if (legendAssigned) legendAssigned.innerText = (classData.assigned_count ?? 0) + ' asignadas (' + (classData.assigned_pct ?? 0) + '%)';
if (legendUnassigned) legendUnassigned.innerText = (classData.unassigned_count ?? 0) + ' libres (' + (classData.unassigned_pct ?? 0) + '%)';
// Tarjetas KPI Comisiones
const commUnassignedCount = document.getElementById('adminPctCommUnassignedCount');
const commUnassignedPct = document.getElementById('adminPctCommUnassignedPct');
const commAssignedCount = document.getElementById('adminPctCommAssignedCount');
const commAssignedPct = document.getElementById('adminPctCommAssignedPct');
const barAssigned = document.getElementById('adminPctProgressBarAssigned');
const barUnassigned = document.getElementById('adminPctProgressBarUnassigned');
const barTextAssigned = document.getElementById('adminPctBarTextAssigned');
const barTextUnassigned = document.getElementById('adminPctBarTextUnassigned');
if (commUnassignedCount) commUnassignedCount.innerText = commData.unassigned_count ?? 0;
if (commUnassignedPct) commUnassignedPct.innerText = (commData.unassigned_pct ?? 0) + '%';
if (commAssignedCount) commAssignedCount.innerText = commData.assigned_count ?? 0;
if (commAssignedPct) commAssignedPct.innerText = (commData.assigned_pct ?? 0) + '%';
if (barAssigned) {
barAssigned.style.width = (classData.assigned_pct ?? 0) + '%';
barAssigned.setAttribute('aria-valuenow', classData.assigned_pct ?? 0);
}
if (barTextAssigned) barTextAssigned.innerText = (classData.assigned_pct ?? 0) + '%';
// Leyendas de los gráficos de torta
const classLegendAssigned = document.getElementById('adminClassPieLegendAssigned');
const classLegendUnassigned = document.getElementById('adminClassPieLegendUnassigned');
const commLegendAssigned = document.getElementById('adminCommPieLegendAssigned');
const commLegendUnassigned = document.getElementById('adminCommPieLegendUnassigned');
if (barUnassigned) {
barUnassigned.style.width = (classData.unassigned_pct ?? 0) + '%';
barUnassigned.setAttribute('aria-valuenow', classData.unassigned_pct ?? 0);
}
if (barTextUnassigned) barTextUnassigned.innerText = (classData.unassigned_pct ?? 0) + '%';
if (classLegendAssigned) classLegendAssigned.innerText = 'Asignadas: ' + (classData.assigned_count ?? 0) + ' (' + (classData.assigned_pct ?? 0) + '%)';
if (classLegendUnassigned) classLegendUnassigned.innerText = 'Libres: ' + (classData.unassigned_count ?? 0) + ' (' + (classData.unassigned_pct ?? 0) + '%)';
if (commLegendAssigned) commLegendAssigned.innerText = 'Con Aula: ' + (commData.assigned_count ?? 0) + ' (' + (commData.assigned_pct ?? 0) + '%)';
if (commLegendUnassigned) commLegendUnassigned.innerText = 'Sin Asignar: ' + (commData.unassigned_count ?? 0) + ' (' + (commData.unassigned_pct ?? 0) + '%)';
// Actualizar gráficos Doughnut
updateDoughnutCharts(period);
document.querySelectorAll('#adminPctPeriodSwitcher button').forEach(function(btn) {
btn.classList.toggle('active', btn.getAttribute('data-period') === period);
});
}
// ======================== Paginación y Filtro de Carrera para Comisiones ========================
let commCurrentPage = 1;
const commPageSize = 10;
let commSelectedCareer = '';
function onCommCareerFilterChange(career) {
commSelectedCareer = (career || '').trim();
commCurrentPage = 1;
applyCommPaginationAndFilter();
}
function goToCommPage(page) {
commCurrentPage = page;
applyCommPaginationAndFilter();
}
function applyCommPaginationAndFilter() {
const activeBlock = document.getElementById('commBlock-' + currentCommPeriod + '-' + currentCommStatus);
const paginationContainer = document.getElementById('commPaginationContainer');
if (!activeBlock) {
if (paginationContainer) paginationContainer.style.display = 'none';
return;
}
const table = activeBlock.querySelector('table');
const tableContainer = activeBlock.querySelector('.table-responsive');
const noMatchAlert = activeBlock.querySelector('.comm-no-match-alert');
if (!table) {
if (paginationContainer) paginationContainer.style.display = 'none';
if (noMatchAlert) noMatchAlert.style.display = 'none';
return;
}
const rows = Array.from(table.querySelectorAll('tbody tr'));
if (rows.length === 0) {
if (paginationContainer) paginationContainer.style.display = 'none';
if (noMatchAlert) noMatchAlert.style.display = 'none';
return;
}
// Filtrar por carrera seleccionada
const filterLower = commSelectedCareer.toLowerCase();
const filteredRows = rows.filter(function(row) {
if (!filterLower) return true;
const career = (row.getAttribute('data-career') || '').toLowerCase();
const careerNames = (row.getAttribute('data-career-names') || '').toLowerCase();
return career.includes(filterLower) || careerNames.includes(filterLower);
});
if (filteredRows.length === 0) {
rows.forEach(function(r) { r.style.display = 'none'; });
if (tableContainer) tableContainer.style.display = 'none';
if (noMatchAlert) noMatchAlert.style.display = 'block';
if (paginationContainer) paginationContainer.style.display = 'none';
return;
}
if (noMatchAlert) noMatchAlert.style.display = 'none';
if (tableContainer) tableContainer.style.display = 'block';
// Calcular páginas
const totalItems = filteredRows.length;
const totalPages = Math.ceil(totalItems / commPageSize);
if (commCurrentPage > totalPages) commCurrentPage = totalPages;
if (commCurrentPage < 1) commCurrentPage = 1;
const startIndex = (commCurrentPage - 1) * commPageSize;
const endIndex = Math.min(startIndex + commPageSize, totalItems);
// Ocultar todas las filas
rows.forEach(function(r) { r.style.display = 'none'; });
// Mostrar únicamente las filas de la página actual
for (let i = startIndex; i < endIndex; i++) {
filteredRows[i].style.display = '';
}
// Actualizar resumen
const startEl = document.getElementById('commPageStart');
const endEl = document.getElementById('commPageEnd');
const totalEl = document.getElementById('commPageTotal');
if (startEl) startEl.innerText = startIndex + 1;
if (endEl) endEl.innerText = endIndex;
if (totalEl) totalEl.innerText = totalItems;
// Renderizar botones de paginación
const navEl = document.getElementById('commPaginationNav');
if (navEl) {
let navHtml = '';
const prevDisabled = commCurrentPage === 1 ? 'disabled' : '';
navHtml += `<li class="page-item ${prevDisabled}"><a class="page-link" href="javascript:void(0)" onclick="goToCommPage(${commCurrentPage - 1})"><i class="bi bi-chevron-left"></i></a></li>`;
for (let p = 1; p <= totalPages; p++) {
const activeClass = p === commCurrentPage ? 'active' : '';
navHtml += `<li class="page-item ${activeClass}"><a class="page-link" href="javascript:void(0)" onclick="goToCommPage(${p})">${p}</a></li>`;
}
const nextDisabled = commCurrentPage === totalPages ? 'disabled' : '';
navHtml += `<li class="page-item ${nextDisabled}"><a class="page-link" href="javascript:void(0)" onclick="goToCommPage(${commCurrentPage + 1})"><i class="bi bi-chevron-right"></i></a></li>`;
navEl.innerHTML = navHtml;
}
if (paginationContainer) {
paginationContainer.style.display = totalItems > 0 ? 'block' : 'none';
}
}
// Bedelía: Switcher de Período para Comisiones (Día / Semana / Mes)
function switchCommFilterPeriod(period) {
currentCommPeriod = period;
@@ -364,6 +609,9 @@ function renderActiveCommBlock() {
});
const target = document.getElementById('commBlock-' + currentCommPeriod + '-' + currentCommStatus);
if (target) target.style.display = 'block';
commCurrentPage = 1;
applyCommPaginationAndFilter();
}
// Bedelía: Switcher de Período para Aulas (Día / Semana / Mes)
+104 -34
View File
@@ -137,9 +137,10 @@
</div>
</div>
<div class="card-body p-3">
<div class="row g-3 align-items-center">
<!-- Tarjeta 1: Asignadas -->
<div class="col-md-3">
<!-- Fila 1: 4 Tarjetas KPI (Aulas Asignadas, Aulas Sin Asignar, Comisiones Sin Asignar, Comisiones Asignadas) -->
<div class="row g-3">
<!-- Tarjeta 1: Aulas Asignadas -->
<div class="col-md-3 col-sm-6">
<a href="/classrooms/list_classrooms?view_mode=physical" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-success bg-opacity-10 border border-success-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
@@ -158,8 +159,8 @@
</a>
</div>
<!-- Tarjeta 2: Sin Asignar -->
<div class="col-md-3">
<!-- Tarjeta 2: Aulas Sin Asignar (Libres) -->
<div class="col-md-3 col-sm-6">
<a href="/classrooms/list_classrooms?view_mode=physical" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-warning bg-opacity-10 border border-warning-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
@@ -178,46 +179,115 @@
</a>
</div>
<!-- Tarjeta 3: Barras Comparativas de Percentil -->
<div class="col-md-6">
<div class="p-3 rounded bg-body-tertiary border h-100 d-flex flex-column justify-content-center">
<!-- Tarjeta 3: Comisiones Sin Asignar (Pendientes) -->
<div class="col-md-3 col-sm-6">
<a href="/admin/commissions_list" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-danger bg-opacity-10 border border-danger-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="small fw-semibold text-body">
<i class="bi bi-pie-chart me-1 text-primary"></i>Ocupación en <span id="adminPctPeriodTitle">Día (Hoy)</span>:
</span>
<span class="small font-monospace text-muted" id="adminPctLegendText">
<strong class="text-success" id="adminPctLegendAssigned">{{ filter_stats.today.classrooms.assigned_count }} asignadas ({{ filter_stats.today.classrooms.assigned_pct }}%)</strong> · <strong class="text-warning-emphasis" id="adminPctLegendUnassigned">{{ filter_stats.today.classrooms.unassigned_count }} libres ({{ filter_stats.today.classrooms.unassigned_pct }}%)</strong>
</span>
<span class="text-danger small fw-bold text-uppercase">Comisiones Sin Asignar</span>
<span class="badge bg-danger text-white font-monospace" id="adminPctCommUnassignedPct">{{ filter_stats.today.commissions.unassigned_pct }}%</span>
</div>
<div class="progress mb-3" style="height: 14px;">
<div id="adminPctProgressBarAssigned" class="progress-bar bg-success progress-bar-striped" role="progressbar"
{{ ('style="width: ' ~ (filter_stats.today.classrooms.assigned_pct or 0) ~ '%;"') | safe }}
aria-valuenow="{{ filter_stats.today.classrooms.assigned_pct }}" aria-valuemin="0" aria-valuemax="100">
<span id="adminPctBarTextAssigned">{{ filter_stats.today.classrooms.assigned_pct }}%</span>
<div class="d-flex align-items-baseline justify-content-center gap-2 my-2">
<h2 class="mb-0 fw-bold text-danger" id="adminPctCommUnassignedCount">{{ filter_stats.today.commissions.unassigned_count }}</h2>
<span class="text-muted small">/ {{ filter_stats.today.commissions.total }} comisiones</span>
</div>
<div id="adminPctProgressBarUnassigned" class="progress-bar bg-warning" role="progressbar"
{{ ('style="width: ' ~ (filter_stats.today.classrooms.unassigned_pct or 0) ~ '%;"') | safe }}
aria-valuenow="{{ filter_stats.today.classrooms.unassigned_pct }}" aria-valuemin="0" aria-valuemax="100">
<span id="adminPctBarTextUnassigned">{{ filter_stats.today.classrooms.unassigned_pct }}%</span>
<div class="text-danger small pt-2 border-top border-danger-subtle d-flex align-items-center justify-content-between">
<span>Pendientes de asignación</span>
<i class="bi bi-arrow-right"></i>
</div>
</div>
</a>
</div>
<!-- Tarjeta 4: Comisiones Asignadas (Con Aula) -->
<div class="col-md-3 col-sm-6">
<a href="/admin/commissions_list" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-primary bg-opacity-10 border border-primary-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="text-primary small fw-bold text-uppercase">Comisiones Asignadas</span>
<span class="badge bg-primary text-white font-monospace" id="adminPctCommAssignedPct">{{ filter_stats.today.commissions.assigned_pct }}%</span>
</div>
<div class="d-flex align-items-baseline justify-content-center gap-2 my-2">
<h2 class="mb-0 fw-bold text-primary" id="adminPctCommAssignedCount">{{ filter_stats.today.commissions.assigned_count }}</h2>
<span class="text-muted small">/ {{ filter_stats.today.commissions.total }} comisiones</span>
</div>
<div class="text-primary small pt-2 border-top border-primary-subtle d-flex align-items-center justify-content-between">
<span>Con aula asignada</span>
<i class="bi bi-arrow-right"></i>
</div>
</div>
</a>
</div>
</div>
<!-- Comparador de referencia cuatrimestral -->
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="small fw-semibold text-secondary">
<i class="bi bi-calendar-range me-1"></i>Referencia Cuatrimestral Global:
<!-- Fila 2: Gráficos de Torta para Ocupación en Día (Hoy) -->
<div class="row g-3 mt-2">
<!-- Gráfico de Torta: Aulas Físicas -->
<div class="col-md-6">
<div class="p-3 rounded bg-body-tertiary border h-100 d-flex flex-column justify-content-between">
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="small fw-bold text-body">
<i class="bi bi-pie-chart-fill text-success me-1"></i>Ocupación de Aulas: <span id="adminClassPiePeriodTitle">Día (Hoy)</span>
</span>
<span class="badge bg-body text-secondary border font-monospace small" id="adminClassPieTotalBadge">Total: {{ filter_stats.today.classrooms.total }} aulas</span>
</div>
<div class="position-relative d-flex justify-content-center align-items-center my-2" style="height: 180px;">
<canvas id="adminClassroomsPieChart"></canvas>
</div>
<div class="d-flex justify-content-around text-center small pt-2 border-top mt-2">
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #198754;"></span>
<span class="text-success fw-semibold" id="adminClassPieLegendAssigned">Asignadas: {{ filter_stats.today.classrooms.assigned_count }} ({{ filter_stats.today.classrooms.assigned_pct }}%)</span>
</div>
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #ffc107;"></span>
<span class="text-warning-emphasis fw-semibold" id="adminClassPieLegendUnassigned">Libres: {{ filter_stats.today.classrooms.unassigned_count }} ({{ filter_stats.today.classrooms.unassigned_pct }}%)</span>
</div>
</div>
</div>
</div>
<!-- Gráfico de Torta: Comisiones -->
<div class="col-md-6">
<div class="p-3 rounded bg-body-tertiary border h-100 d-flex flex-column justify-content-between">
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="small fw-bold text-body">
<i class="bi bi-pie-chart-fill text-primary me-1"></i>Asignación de Comisiones: <span id="adminCommPiePeriodTitle">Día (Hoy)</span>
</span>
<span class="badge bg-body text-secondary border font-monospace small" id="adminCommPieTotalBadge">Total: {{ filter_stats.today.commissions.total }} comisiones</span>
</div>
<div class="position-relative d-flex justify-content-center align-items-center my-2" style="height: 180px;">
<canvas id="adminCommissionsPieChart"></canvas>
</div>
<div class="d-flex justify-content-around text-center small pt-2 border-top mt-2">
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #0d6efd;"></span>
<span class="text-primary fw-semibold" id="adminCommPieLegendAssigned">Con Aula: {{ filter_stats.today.commissions.assigned_count }} ({{ filter_stats.today.commissions.assigned_pct }}%)</span>
</div>
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #dc3545;"></span>
<span class="text-danger fw-semibold" id="adminCommPieLegendUnassigned">Sin Asignar: {{ filter_stats.today.commissions.unassigned_count }} ({{ filter_stats.today.commissions.unassigned_pct }}%)</span>
</div>
</div>
</div>
</div>
</div>
<!-- Referencia Cuatrimestral Global al pie -->
<div class="mt-3 p-2 rounded bg-body-tertiary border d-flex justify-content-between align-items-center flex-wrap gap-2">
<span class="small fw-semibold text-secondary">
<i class="bi bi-calendar-range me-1"></i>Referencia Cuatrimestral Global de Aulas:
</span>
<div class="flex-grow-1 mx-2" style="max-width: 320px; min-width: 180px;">
<div class="progress" style="height: 8px;">
<div class="progress-bar bg-success" role="progressbar" {{ ('style="width: ' ~ (stats.assigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
<div class="progress-bar bg-warning" role="progressbar" {{ ('style="width: ' ~ (stats.unassigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
</div>
</div>
<span class="small font-monospace text-muted">
{{ stats.assigned_classrooms_pct }}% asignadas · {{ stats.unassigned_classrooms_pct }}% libres
</span>
</div>
<div class="progress" style="height: 8px;">
<div class="progress-bar bg-secondary" role="progressbar" {{ ('style="width: ' ~ (stats.assigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
<div class="progress-bar bg-secondary-subtle" role="progressbar" {{ ('style="width: ' ~ (stats.unassigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
</div>
</div>
</div>
</div>
</div>
</div>
+221 -52
View File
@@ -126,9 +126,10 @@
</div>
</div>
<div class="card-body p-3">
<div class="row g-3 align-items-center">
<!-- Fila 1: 4 Tarjetas KPI (Aulas Asignadas, Aulas Sin Asignar, Comisiones Sin Asignar, Comisiones Asignadas) -->
<div class="row g-3">
<!-- Tarjeta 1: Aulas Asignadas -->
<div class="col-md-3">
<div class="col-md-3 col-sm-6">
<a href="/classrooms/list_classrooms?view_mode=physical" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-success bg-opacity-10 border border-success-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
@@ -148,7 +149,7 @@
</div>
<!-- Tarjeta 2: Aulas Sin Asignar (Libres) -->
<div class="col-md-3">
<div class="col-md-3 col-sm-6">
<a href="/schedule/add_reservation" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-warning bg-opacity-10 border border-warning-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
@@ -167,46 +168,115 @@
</a>
</div>
<!-- Tarjeta 3: Barras Comparativas de Percentil -->
<div class="col-md-6">
<div class="p-3 rounded bg-body-tertiary border h-100 d-flex flex-column justify-content-center">
<!-- Tarjeta 3: Comisiones Sin Asignar (Pendientes) -->
<div class="col-md-3 col-sm-6">
<a href="#bedelia-commissions-panel" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-danger bg-opacity-10 border border-danger-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="small fw-semibold text-body">
<i class="bi bi-pie-chart me-1 text-primary"></i>Ocupación en <span id="bedeliaPctPeriodTitle">Día (Hoy)</span>:
</span>
<span class="small font-monospace text-muted" id="bedeliaPctLegendText">
<strong class="text-success" id="bedeliaPctLegendAssigned">{{ filter_stats.today.classrooms.assigned_count }} asignadas ({{ filter_stats.today.classrooms.assigned_pct }}%)</strong> · <strong class="text-warning-emphasis" id="bedeliaPctLegendUnassigned">{{ filter_stats.today.classrooms.unassigned_count }} libres ({{ filter_stats.today.classrooms.unassigned_pct }}%)</strong>
</span>
<span class="text-danger small fw-bold text-uppercase">Comisiones Sin Asignar</span>
<span class="badge bg-danger text-white font-monospace" id="bedeliaPctCommUnassignedPct">{{ filter_stats.today.commissions.unassigned_pct }}%</span>
</div>
<div class="progress mb-3" style="height: 14px;">
<div id="bedeliaPctProgressBarAssigned" class="progress-bar bg-success progress-bar-striped" role="progressbar"
{{ ('style="width: ' ~ (filter_stats.today.classrooms.assigned_pct or 0) ~ '%;"') | safe }}
aria-valuenow="{{ filter_stats.today.classrooms.assigned_pct }}" aria-valuemin="0" aria-valuemax="100">
<span id="bedeliaPctBarTextAssigned">{{ filter_stats.today.classrooms.assigned_pct }}%</span>
<div class="d-flex align-items-baseline justify-content-center gap-2 my-2">
<h2 class="mb-0 fw-bold text-danger" id="bedeliaPctCommUnassignedCount">{{ filter_stats.today.commissions.unassigned_count }}</h2>
<span class="text-muted small">/ <span class="pctTotalCommissions">{{ filter_stats.today.commissions.total }}</span> comisiones</span>
</div>
<div id="bedeliaPctProgressBarUnassigned" class="progress-bar bg-warning" role="progressbar"
{{ ('style="width: ' ~ (filter_stats.today.classrooms.unassigned_pct or 0) ~ '%;"') | safe }}
aria-valuenow="{{ filter_stats.today.classrooms.unassigned_pct }}" aria-valuemin="0" aria-valuemax="100">
<span id="bedeliaPctBarTextUnassigned">{{ filter_stats.today.classrooms.unassigned_pct }}%</span>
<div class="text-danger small pt-2 border-top border-danger-subtle d-flex align-items-center justify-content-between">
<span>Pendientes de asignar</span>
<i class="bi bi-arrow-down-circle"></i>
</div>
</div>
</a>
</div>
<!-- Tarjeta 4: Comisiones Asignadas (Con Aula) -->
<div class="col-md-3 col-sm-6">
<a href="#bedelia-commissions-panel" class="text-decoration-none text-reset d-block h-100">
<div class="p-3 rounded bg-primary bg-opacity-10 border border-primary-subtle h-100 text-center transition-all">
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="text-primary small fw-bold text-uppercase">Comisiones Asignadas</span>
<span class="badge bg-primary text-white font-monospace" id="bedeliaPctCommAssignedPct">{{ filter_stats.today.commissions.assigned_pct }}%</span>
</div>
<div class="d-flex align-items-baseline justify-content-center gap-2 my-2">
<h2 class="mb-0 fw-bold text-primary" id="bedeliaPctCommAssignedCount">{{ filter_stats.today.commissions.assigned_count }}</h2>
<span class="text-muted small">/ <span class="pctTotalCommissions">{{ filter_stats.today.commissions.total }}</span> comisiones</span>
</div>
<div class="text-primary small pt-2 border-top border-primary-subtle d-flex align-items-center justify-content-between">
<span>Con aula asignada</span>
<i class="bi bi-check2-circle"></i>
</div>
</div>
</a>
</div>
</div>
<!-- Comparador de referencia cuatrimestral -->
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="small fw-semibold text-secondary">
<i class="bi bi-calendar-range me-1"></i>Referencia Cuatrimestral Global:
<!-- Fila 2: Gráficos de Torta para Ocupación en Día (Hoy) -->
<div class="row g-3 mt-2">
<!-- Gráfico de Torta: Aulas Físicas -->
<div class="col-md-6">
<div class="p-3 rounded bg-body-tertiary border h-100 d-flex flex-column justify-content-between">
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="small fw-bold text-body">
<i class="bi bi-pie-chart-fill text-success me-1"></i>Ocupación de Aulas: <span id="bedeliaClassPiePeriodTitle">Día (Hoy)</span>
</span>
<span class="badge bg-body text-secondary border font-monospace small" id="bedeliaClassPieTotalBadge">Total: {{ filter_stats.today.classrooms.total }} aulas</span>
</div>
<div class="position-relative d-flex justify-content-center align-items-center my-2" style="height: 180px;">
<canvas id="bedeliaClassroomsPieChart"></canvas>
</div>
<div class="d-flex justify-content-around text-center small pt-2 border-top mt-2">
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #198754;"></span>
<span class="text-success fw-semibold" id="bedeliaClassPieLegendAssigned">Asignadas: {{ filter_stats.today.classrooms.assigned_count }} ({{ filter_stats.today.classrooms.assigned_pct }}%)</span>
</div>
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #ffc107;"></span>
<span class="text-warning-emphasis fw-semibold" id="bedeliaClassPieLegendUnassigned">Libres: {{ filter_stats.today.classrooms.unassigned_count }} ({{ filter_stats.today.classrooms.unassigned_pct }}%)</span>
</div>
</div>
</div>
</div>
<!-- Gráfico de Torta: Comisiones -->
<div class="col-md-6">
<div class="p-3 rounded bg-body-tertiary border h-100 d-flex flex-column justify-content-between">
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="small fw-bold text-body">
<i class="bi bi-pie-chart-fill text-primary me-1"></i>Asignación de Comisiones: <span id="bedeliaCommPiePeriodTitle">Día (Hoy)</span>
</span>
<span class="badge bg-body text-secondary border font-monospace small" id="bedeliaCommPieTotalBadge">Total: {{ filter_stats.today.commissions.total }} comisiones</span>
</div>
<div class="position-relative d-flex justify-content-center align-items-center my-2" style="height: 180px;">
<canvas id="bedeliaCommissionsPieChart"></canvas>
</div>
<div class="d-flex justify-content-around text-center small pt-2 border-top mt-2">
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #0d6efd;"></span>
<span class="text-primary fw-semibold" id="bedeliaCommPieLegendAssigned">Con Aula: {{ filter_stats.today.commissions.assigned_count }} ({{ filter_stats.today.commissions.assigned_pct }}%)</span>
</div>
<div>
<span class="d-inline-block rounded-circle me-1" style="width: 10px; height: 10px; background-color: #dc3545;"></span>
<span class="text-danger fw-semibold" id="bedeliaCommPieLegendUnassigned">Sin Asignar: {{ filter_stats.today.commissions.unassigned_count }} ({{ filter_stats.today.commissions.unassigned_pct }}%)</span>
</div>
</div>
</div>
</div>
</div>
<!-- Referencia Cuatrimestral Global al pie -->
<div class="mt-3 p-2 rounded bg-body-tertiary border d-flex justify-content-between align-items-center flex-wrap gap-2">
<span class="small fw-semibold text-secondary">
<i class="bi bi-calendar-range me-1"></i>Referencia Cuatrimestral Global de Aulas:
</span>
<div class="flex-grow-1 mx-2" style="max-width: 320px; min-width: 180px;">
<div class="progress" style="height: 8px;">
<div class="progress-bar bg-success" role="progressbar" {{ ('style="width: ' ~ (stats.assigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
<div class="progress-bar bg-warning" role="progressbar" {{ ('style="width: ' ~ (stats.unassigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
</div>
</div>
<span class="small font-monospace text-muted">
{{ stats.assigned_classrooms_pct }}% asignadas · {{ stats.unassigned_classrooms_pct }}% libres
</span>
</div>
<div class="progress" style="height: 8px;">
<div class="progress-bar bg-secondary" role="progressbar" {{ ('style="width: ' ~ (stats.assigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
<div class="progress-bar bg-secondary-subtle" role="progressbar" {{ ('style="width: ' ~ (stats.unassigned_classrooms_pct or 0) ~ '%;"') | safe }}></div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -484,7 +554,7 @@
</div>
</div>
<!-- Sub-navegación: Asignadas vs Sin Asignar -->
<!-- Sub-navegación: Asignadas vs Sin Asignar + Filtro de Carrera -->
<div class="card-body border-bottom bg-body-tertiary py-2 px-3">
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2">
<div class="nav nav-pills nav-fill gap-2" role="tablist" id="commStatusPills">
@@ -497,6 +567,20 @@
<span class="badge bg-success ms-1" id="commStatusBadgeAssigned">{{ filter_stats.today.commissions.assigned_count }}</span>
</button>
</div>
<!-- Filtro por Carrera -->
<div class="d-flex align-items-center gap-2">
<label for="commCareerFilter" class="small fw-semibold text-muted text-nowrap mb-0">
<i class="bi bi-mortarboard me-1"></i>Carrera:
</label>
<select id="commCareerFilter" class="form-select form-select-sm" style="min-width: 220px; max-width: 320px;" onchange="onCommCareerFilterChange(this.value)">
<option value="">Todas las carreras</option>
{% for career in careers %}
<option value="{{ career.name }}">{{ career.name }}</option>
{% endfor %}
</select>
</div>
<div class="small text-muted font-monospace" id="commStatusSummaryText">
Período activo: <strong>{{ filter_stats.today.label }}</strong>
</div>
@@ -522,13 +606,18 @@
</thead>
<tbody>
{% for comm in filter_stats.today.commissions.unassigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-danger-subtle text-danger border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td class="small">{{ comm.teacher_name }}</td>
<td><span class="badge bg-body-tertiary text-body border"><i class="bi bi-clock me-1"></i>{{ comm.schedule }}</span></td>
@@ -544,6 +633,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-check-circle-fill text-success fs-1 d-block mb-2"></i>
@@ -571,13 +664,18 @@
</thead>
<tbody>
{% for comm in filter_stats.today.commissions.assigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-success-subtle text-success border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td>
<span class="badge bg-primary-subtle text-primary border font-monospace">
@@ -597,6 +695,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-info-circle text-muted fs-1 d-block mb-2"></i>
@@ -624,13 +726,18 @@
</thead>
<tbody>
{% for comm in filter_stats.tomorrow.commissions.unassigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-danger-subtle text-danger border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td class="small">{{ comm.teacher_name }}</td>
<td><span class="badge bg-body-tertiary text-body border"><i class="bi bi-clock me-1"></i>{{ comm.schedule }}</span></td>
@@ -646,6 +753,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-check-circle-fill text-success fs-1 d-block mb-2"></i>
@@ -673,13 +784,18 @@
</thead>
<tbody>
{% for comm in filter_stats.tomorrow.commissions.assigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-success-subtle text-success border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td>
<span class="badge bg-primary-subtle text-primary border font-monospace">
@@ -699,6 +815,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-info-circle text-muted fs-1 d-block mb-2"></i>
@@ -726,13 +846,18 @@
</thead>
<tbody>
{% for comm in filter_stats.week.commissions.unassigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-danger-subtle text-danger border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td class="small">{{ comm.teacher_name }}</td>
<td><span class="badge bg-body-tertiary text-body border"><i class="bi bi-clock me-1"></i>{{ comm.schedule }}</span></td>
@@ -748,6 +873,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-check-circle-fill text-success fs-1 d-block mb-2"></i>
@@ -756,7 +885,7 @@
{% endif %}
</div>
<!-- 2. SEMANA: Asignadas -->
<!-- 3. SEMANA: Asignadas -->
<div id="commBlock-week-assigned" class="comm-block" style="display: none;">
{% if filter_stats.week.commissions.assigned and filter_stats.week.commissions.assigned | length > 0 %}
<div class="table-responsive">
@@ -774,13 +903,18 @@
</thead>
<tbody>
{% for comm in filter_stats.week.commissions.assigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-success-subtle text-success border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td>
<span class="badge bg-primary-subtle text-primary border font-monospace">
@@ -800,6 +934,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-info-circle text-muted fs-1 d-block mb-2"></i>
@@ -808,7 +946,7 @@
{% endif %}
</div>
<!-- 3. MES: Sin Asignar -->
<!-- 4. MES: Sin Asignar -->
<div id="commBlock-month-unassigned" class="comm-block" style="display: none;">
{% if filter_stats.month.commissions.unassigned and filter_stats.month.commissions.unassigned | length > 0 %}
<div class="table-responsive">
@@ -826,13 +964,18 @@
</thead>
<tbody>
{% for comm in filter_stats.month.commissions.unassigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-danger-subtle text-danger border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td class="small">{{ comm.teacher_name }}</td>
<td><span class="badge bg-body-tertiary text-body border"><i class="bi bi-clock me-1"></i>{{ comm.schedule }}</span></td>
@@ -848,6 +991,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-check-circle-fill text-success fs-1 d-block mb-2"></i>
@@ -856,7 +1003,7 @@
{% endif %}
</div>
<!-- 3. MES: Asignadas -->
<!-- 4. MES: Asignadas -->
<div id="commBlock-month-assigned" class="comm-block" style="display: none;">
{% if filter_stats.month.commissions.assigned and filter_stats.month.commissions.assigned | length > 0 %}
<div class="table-responsive">
@@ -874,13 +1021,18 @@
</thead>
<tbody>
{% for comm in filter_stats.month.commissions.assigned %}
<tr>
<tr data-career="{{ comm.career_name }}" data-career-names="{{ comm.career_names }}">
<td class="ps-3 font-monospace">
<span class="badge bg-success-subtle text-success border font-monospace">{{ comm.full_code }}</span>
</td>
<td>
<div class="fw-semibold text-body">{{ comm.subject_name }}</div>
{% if comm.subject_code %}<small class="text-muted font-monospace">{{ comm.subject_code }}</small>{% endif %}
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
{% if comm.subject_code %}<span class="badge bg-secondary-subtle text-body-secondary font-monospace" style="font-size: 0.72rem;">{{ comm.subject_code }}</span>{% endif %}
<span class="badge bg-primary-subtle text-primary border" style="font-size: 0.72rem;">
<i class="bi bi-mortarboard me-1"></i>{{ comm.career_name }}
</span>
</div>
</td>
<td>
<span class="badge bg-primary-subtle text-primary border font-monospace">
@@ -900,6 +1052,10 @@
</tbody>
</table>
</div>
<div class="comm-no-match-alert text-center py-4" style="display: none;">
<i class="bi bi-funnel text-muted fs-2 d-block mb-2"></i>
<span class="text-muted small">No hay comisiones para la carrera seleccionada.</span>
</div>
{% else %}
<div class="text-center py-4">
<i class="bi bi-info-circle text-muted fs-1 d-block mb-2"></i>
@@ -908,6 +1064,19 @@
{% endif %}
</div>
</div>
<!-- Barra de Paginación para Comisiones -->
<div class="card-footer bg-body-tertiary py-2 px-3 border-top" id="commPaginationContainer" style="display: none;">
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2">
<div class="small text-muted font-monospace" id="commPaginationSummary">
Mostrando <strong id="commPageStart">1</strong>-<strong id="commPageEnd">10</strong> de <strong id="commPageTotal">0</strong> comisiones
</div>
<div class="d-flex align-items-center gap-2">
<ul class="pagination pagination-sm mb-0" id="commPaginationNav">
</ul>
</div>
</div>
</div>
</div>
<!-- ========================= Panel: Aulas (Asignadas vs Libres / Sin Asignar) ========================= -->