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
+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
});
+106 -36
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,45 +179,114 @@
</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">
<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>
</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>
<!-- 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="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 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="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 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>
<!-- 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:
</span>
<span class="small font-monospace text-muted">
{{ stats.assigned_classrooms_pct }}% asignadas · {{ stats.unassigned_classrooms_pct }}% libres
</span>
<!-- 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>
<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>
</a>
</div>
</div>
<!-- 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>
</div>
+233 -54
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,45 +168,114 @@
</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">
<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>
</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>
<!-- 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="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 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="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 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>
<!-- 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:
</span>
<span class="small font-monospace text-muted">
{{ stats.assigned_classrooms_pct }}% asignadas · {{ stats.unassigned_classrooms_pct }}% libres
</span>
<!-- 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>
<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>
</a>
</div>
</div>
<!-- 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>
</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)
+106 -36
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,45 +179,114 @@
</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">
<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>
</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>
<!-- 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="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 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="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 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>
<!-- 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:
</span>
<span class="small font-monospace text-muted">
{{ stats.assigned_classrooms_pct }}% asignadas · {{ stats.unassigned_classrooms_pct }}% libres
</span>
<!-- 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>
<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>
</a>
</div>
</div>
<!-- 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>
</div>
+223 -54
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,45 +168,114 @@
</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">
<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>
</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>
<!-- 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="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 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="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 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>
<!-- 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:
</span>
<span class="small font-monospace text-muted">
{{ stats.assigned_classrooms_pct }}% asignadas · {{ stats.unassigned_classrooms_pct }}% libres
</span>
<!-- 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>
<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>
</a>
</div>
</div>
<!-- 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>
</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) ========================= -->