fix: update bedelia views for today and weekly reservations, available rooms and unassigned commissions
This commit is contained in:
@@ -833,6 +833,7 @@ const handleCommissionsList = async (req, res) => {
|
||||
const career_id = req.query.career_id || '';
|
||||
const shift = req.query.shift || '';
|
||||
const active = req.query.active || '';
|
||||
const unassigned_room = req.query.unassigned_room || '';
|
||||
const created = req.query.created === '1';
|
||||
|
||||
let commissions = [];
|
||||
@@ -843,7 +844,7 @@ const handleCommissionsList = async (req, res) => {
|
||||
|
||||
try {
|
||||
const [cRes, uRes] = await Promise.allSettled([
|
||||
req.apiClient.get('/commissions', { params: { search, subject_id, career_id, shift, active } }),
|
||||
req.apiClient.get('/commissions', { params: { search, subject_id, career_id, shift, active, unassigned_room } }),
|
||||
req.apiClient.get('/users')
|
||||
]);
|
||||
|
||||
@@ -853,6 +854,11 @@ const handleCommissionsList = async (req, res) => {
|
||||
get_full_code: () => c.full_code || c.code,
|
||||
career_id: c.career_id,
|
||||
career_name: c.career_name || 'Carrera General',
|
||||
classroom_name: c.classroom_name || 'Sin Aula Asignada',
|
||||
has_classroom: Boolean(c.has_classroom),
|
||||
is_virtual: Boolean(c.is_virtual),
|
||||
virtual_link: c.virtual_link || '',
|
||||
schedule: c.schedule || 'Sin horario',
|
||||
subject: {
|
||||
id: c.subject_id,
|
||||
name: c.subject_name,
|
||||
@@ -907,6 +913,7 @@ const handleCommissionsList = async (req, res) => {
|
||||
career_filter: career_id ? parseInt(career_id, 10) : '',
|
||||
shift_filter: shift,
|
||||
active_filter: active,
|
||||
unassigned_room_filter: unassigned_room,
|
||||
created,
|
||||
msg: req.query.msg || (created ? 'created' : ''),
|
||||
error: req.query.error || '',
|
||||
|
||||
@@ -107,11 +107,15 @@ router.get('/', async (req, res) => {
|
||||
]
|
||||
};
|
||||
} else if (role === 'bedelia') {
|
||||
const apiWeekSchedule = Array.isArray(apiData.week_schedule_list) ? apiData.week_schedule_list : [];
|
||||
role_data = {
|
||||
pending_reservations: apiPending || [],
|
||||
today_schedule_list: apiTodaySchedule || [],
|
||||
week_schedule_list: apiWeekSchedule,
|
||||
unassigned_commissions_week: bedeliaData.unassigned_commissions_week || [],
|
||||
unassigned_commissions_month: bedeliaData.unassigned_commissions_month || [],
|
||||
unassigned_commissions_general: bedeliaData.unassigned_commissions_general || [],
|
||||
available_classrooms_today: bedeliaData.available_classrooms_today || [],
|
||||
available_classrooms_week: bedeliaData.available_classrooms_week || [],
|
||||
available_classrooms_month: bedeliaData.available_classrooms_month || []
|
||||
};
|
||||
|
||||
@@ -164,11 +164,21 @@ router.get('/list_reservations', handleReservationsList);
|
||||
// 4. Vista de Hoy (Cartelera del Día)
|
||||
const handleTodaySchedule = async (req, res) => {
|
||||
try {
|
||||
const todayStr = req.query.date || '2026-09-18';
|
||||
const defaultTodayStr = new Date().toISOString().split('T')[0];
|
||||
const todayStr = req.query.date || defaultTodayStr;
|
||||
const hide_virtual = req.query.hide_virtual === '1' || req.query.hide_virtual === 'true';
|
||||
const floor_filter = req.query.floor || '';
|
||||
const shift_filter = req.query.shift || '';
|
||||
|
||||
// Fechas anterior y siguiente para navegación
|
||||
const currentDateObj = new Date(todayStr + 'T00:00:00');
|
||||
const prevDateObj = new Date(currentDateObj);
|
||||
prevDateObj.setDate(prevDateObj.getDate() - 1);
|
||||
const nextDateObj = new Date(currentDateObj);
|
||||
nextDateObj.setDate(nextDateObj.getDate() + 1);
|
||||
const prevDateStr = prevDateObj.toISOString().split('T')[0];
|
||||
const nextDateStr = nextDateObj.toISOString().split('T')[0];
|
||||
|
||||
const params = {
|
||||
start_date: todayStr,
|
||||
end_date: todayStr
|
||||
@@ -238,6 +248,9 @@ const handleTodaySchedule = async (req, res) => {
|
||||
time_blocks,
|
||||
stats,
|
||||
today: todayStr,
|
||||
prev_date: prevDateStr,
|
||||
next_date: nextDateStr,
|
||||
default_today: defaultTodayStr,
|
||||
hide_virtual,
|
||||
floor_filter,
|
||||
shift_filter,
|
||||
@@ -246,12 +259,16 @@ const handleTodaySchedule = async (req, res) => {
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error fetching today reservations:', error.message);
|
||||
const fallbackToday = new Date().toISOString().split('T')[0];
|
||||
res.render('schedule/today', {
|
||||
title: 'Cartelera del Día (Offline)',
|
||||
reservations: [],
|
||||
time_blocks: {},
|
||||
stats: { total_reservations: 0, confirmed: 0, pending: 0, occupied_classrooms: 0, total_classrooms: 59 },
|
||||
today: '2026-09-18',
|
||||
today: fallbackToday,
|
||||
prev_date: fallbackToday,
|
||||
next_date: fallbackToday,
|
||||
default_today: fallbackToday,
|
||||
hide_virtual: false,
|
||||
floor_filter: '',
|
||||
shift_filter: '',
|
||||
|
||||
@@ -134,6 +134,16 @@
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-6 col-md-2">
|
||||
<label class="form-label small fw-semibold mb-1">
|
||||
<i class="bi bi-door-open text-primary me-1"></i>Aula / Espacio
|
||||
</label>
|
||||
<select name="unassigned_room" class="form-select form-select-sm" id="unassigned-room-filter">
|
||||
<option value="" {% if not unassigned_room_filter %}selected{% endif %}>Todas las comisiones</option>
|
||||
<option value="true" {% if unassigned_room_filter == 'true' %}selected{% endif %}>⚠️ Sin Aula Asignada</option>
|
||||
<option value="false" {% if unassigned_room_filter == 'false' %}selected{% endif %}>✅ Con Aula Asignada</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-6 col-md-1">
|
||||
<label class="form-label small fw-semibold mb-1">Estado</label>
|
||||
<select name="active" class="form-select form-select-sm" id="active-filter">
|
||||
@@ -142,9 +152,9 @@
|
||||
<option value="" {% if not active_filter %}selected{% endif %}>Todas</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-12 col-md-2 d-flex gap-2">
|
||||
<button type="submit" class="btn btn-primary btn-sm flex-fill" id="filter-btn">
|
||||
<i class="bi bi-funnel me-1"></i>Filtrar
|
||||
<div class="col-12 col-md-1 d-flex gap-1">
|
||||
<button type="submit" class="btn btn-primary btn-sm flex-fill" id="filter-btn" title="Aplicar filtros">
|
||||
<i class="bi bi-funnel"></i>
|
||||
</button>
|
||||
<a href="/admin/commissions_list" class="btn btn-outline-secondary btn-sm" title="Limpiar filtros">
|
||||
<i class="bi bi-x"></i>
|
||||
@@ -171,6 +181,7 @@
|
||||
<tr>
|
||||
<th class="ps-3">Comisión</th>
|
||||
<th>Asignatura</th>
|
||||
<th>Espacio / Aula</th>
|
||||
<th>Docente</th>
|
||||
<th class="text-center">Turno</th>
|
||||
<th class="text-center">Alumnos</th>
|
||||
@@ -200,6 +211,26 @@
|
||||
<small class="text-muted ms-1">{{ comm.semester }} {{ comm.year }}</small>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{% if comm.has_classroom %}
|
||||
{% if comm.is_virtual %}
|
||||
<span class="badge bg-info-subtle text-info border">
|
||||
<i class="bi bi-camera-video me-1"></i>{{ comm.classroom_name }}
|
||||
</span>
|
||||
{% if comm.virtual_link %}
|
||||
<a href="{{ comm.virtual_link }}" target="_blank" class="text-info ms-1 small" title="Enlace Videoconferencia"><i class="bi bi-box-arrow-up-right"></i></a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<span class="badge bg-success-subtle text-success border font-monospace">
|
||||
<i class="bi bi-door-open me-1"></i>{{ comm.classroom_name }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<span class="badge bg-danger-subtle text-danger border">
|
||||
<i class="bi bi-exclamation-triangle-fill me-1"></i>Sin Aula
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if comm.teachers and comm.teachers | length > 0 %}
|
||||
<div class="d-flex flex-column gap-1">
|
||||
|
||||
@@ -637,6 +637,171 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ========================= Panel: Cartelera Operativa & Agenda de Clases (Hoy y Semana) ========================= -->
|
||||
<div class="card border-0 shadow-sm mb-4" id="bedelia-reservations-schedule">
|
||||
<div class="card-header bg-body-tertiary border-0 py-3 d-flex justify-content-between align-items-center flex-wrap gap-2">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<i class="bi bi-calendar-check-fill text-primary fs-5"></i>
|
||||
<div>
|
||||
<h5 class="mb-0 h6 fw-bold">Cartelera Operativa & Agenda de Clases</h5>
|
||||
<small class="text-muted">Control de reservas áulicas presenciales y virtuales activas</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex gap-2 align-items-center flex-wrap">
|
||||
<div class="btn-group btn-group-sm" role="group" id="bedeliaScheduleSwitcher">
|
||||
<button type="button" class="btn btn-outline-primary active" data-view="today" onclick="switchBedeliaScheduleView('today')">
|
||||
<i class="bi bi-calendar-day me-1"></i>Clases de Hoy
|
||||
<span class="badge bg-primary ms-1" id="bedeliaTodayBadge">{{ role_data.today_schedule_list | length }}</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-primary" data-view="week" onclick="switchBedeliaScheduleView('week')">
|
||||
<i class="bi bi-calendar-week me-1"></i>Esta Semana
|
||||
<span class="badge bg-primary ms-1" id="bedeliaWeekBadge">{{ role_data.week_schedule_list | length }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<a href="/schedule/today_schedule" class="btn btn-sm btn-outline-info">
|
||||
<i class="bi bi-clock-history me-1"></i>Cartelera en Vivo
|
||||
</a>
|
||||
<a href="/schedule/calendar_view" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-calendar3 me-1"></i>Calendario Semanal
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<!-- Tabla Clases de Hoy -->
|
||||
<div id="bedeliaScheduleToday">
|
||||
{% if role_data.today_schedule_list and role_data.today_schedule_list | length > 0 %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0 small">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="ps-3">Horario</th>
|
||||
<th>Aula / Espacio</th>
|
||||
<th>Asignatura</th>
|
||||
<th>Comisión / Turno</th>
|
||||
<th>Docente</th>
|
||||
<th class="text-center">Estado</th>
|
||||
<th class="text-end pe-3">Acción</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for r in role_data.today_schedule_list %}
|
||||
<tr>
|
||||
<td class="ps-3 font-monospace">
|
||||
<strong>{{ r.start_time }}</strong> - {{ r.end_time }} hs
|
||||
</td>
|
||||
<td>
|
||||
{% if r.classroom.is_virtual %}
|
||||
<span class="badge bg-info-subtle text-info border">
|
||||
<i class="bi bi-camera-video me-1"></i>{{ r.classroom.code }}
|
||||
</span>
|
||||
{% if r.virtual_link %}
|
||||
<a href="{{ r.virtual_link }}" target="_blank" class="btn btn-xs btn-outline-info ms-1 py-0 px-1" title="Unirse a videoconferencia">
|
||||
<i class="bi bi-box-arrow-up-right"></i> Link
|
||||
</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<span class="badge bg-primary-subtle text-primary border font-monospace">
|
||||
<i class="bi bi-door-open me-1"></i>{{ r.classroom.code }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<div class="fw-semibold text-body">{{ r.subject_name }}</div>
|
||||
{% if r.subject_code %}<small class="text-muted font-monospace">{{ r.subject_code }}</small>{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge bg-secondary-subtle text-secondary border me-1">{{ r.commission.code }}</span>
|
||||
<span class="badge bg-light text-dark border">{{ r.shift }}</span>
|
||||
</td>
|
||||
<td class="small">{{ r.user.name }}</td>
|
||||
<td class="text-center">
|
||||
<span class="badge bg-success-subtle text-success border">Confirmada</span>
|
||||
</td>
|
||||
<td class="text-end pe-3">
|
||||
<a href="/schedule/today_schedule" class="btn btn-sm btn-outline-primary py-0 px-2" title="Ver en cartelera del día">
|
||||
<i class="bi bi-eye me-1"></i>Ver
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-center py-4">
|
||||
<i class="bi bi-calendar-x text-muted fs-1 d-block mb-2"></i>
|
||||
<h6 class="text-secondary fw-bold">No hay clases programadas para el día de hoy</h6>
|
||||
<p class="text-muted small mb-0">Consulte el cronograma semanal o cargue una nueva reserva si corresponde.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Tabla Agenda Semanal -->
|
||||
<div id="bedeliaScheduleWeek" style="display: none;">
|
||||
{% if role_data.week_schedule_list and role_data.week_schedule_list | length > 0 %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0 small">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="ps-3">Fecha</th>
|
||||
<th>Horario</th>
|
||||
<th>Aula / Espacio</th>
|
||||
<th>Asignatura</th>
|
||||
<th>Comisión / Turno</th>
|
||||
<th>Docente</th>
|
||||
<th class="text-end pe-3">Acción</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for r in role_data.week_schedule_list %}
|
||||
<tr>
|
||||
<td class="ps-3 font-monospace fw-bold text-primary">
|
||||
{{ r.date_display }}
|
||||
</td>
|
||||
<td class="font-monospace">
|
||||
{{ r.start_time }} - {{ r.end_time }} hs
|
||||
</td>
|
||||
<td>
|
||||
{% if r.classroom.is_virtual %}
|
||||
<span class="badge bg-info-subtle text-info border">
|
||||
<i class="bi bi-camera-video me-1"></i>{{ r.classroom.code }}
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="badge bg-primary-subtle text-primary border font-monospace">
|
||||
<i class="bi bi-door-open me-1"></i>{{ r.classroom.code }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<div class="fw-semibold text-body">{{ r.subject_name }}</div>
|
||||
{% if r.subject_code %}<small class="text-muted font-monospace">{{ r.subject_code }}</small>{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge bg-secondary-subtle text-secondary border me-1">{{ r.commission.code }}</span>
|
||||
<span class="badge bg-light text-dark border">{{ r.shift }}</span>
|
||||
</td>
|
||||
<td class="small">{{ r.user.name }}</td>
|
||||
<td class="text-end pe-3">
|
||||
<a href="/schedule/calendar_view" class="btn btn-sm btn-outline-secondary py-0 px-2" title="Ver en calendario">
|
||||
<i class="bi bi-calendar3 me-1"></i>Calendario
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-center py-4">
|
||||
<i class="bi bi-calendar-x text-muted fs-1 d-block mb-2"></i>
|
||||
<h6 class="text-secondary fw-bold">No hay clases programadas para esta semana</h6>
|
||||
<p class="text-muted small mb-0">Puede importar cursadas desde Google Sheets o cargar reservas manualmente.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ========================= Panel: Comisiones Sin Reserva (Semana/Mes) ========================= -->
|
||||
<div class="card border-0 shadow-sm mb-4" id="bedelia-unassigned-commissions">
|
||||
<div class="card-header bg-body-tertiary border-0 py-3 d-flex justify-content-between align-items-center flex-wrap gap-2">
|
||||
@@ -653,6 +818,10 @@
|
||||
<i class="bi bi-calendar-week me-1"></i>Esta Semana
|
||||
<span class="badge bg-danger ms-1" id="commWeekBadge">{{ role_data.unassigned_commissions_week | length }}</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-danger" data-period="general" onclick="switchCommPeriod('general')">
|
||||
<i class="bi bi-exclamation-triangle-fill me-1"></i>Sin Aula Física ni Virtual
|
||||
<span class="badge bg-danger ms-1" id="commGeneralBadge">{{ role_data.unassigned_commissions_general | length }}</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-danger" data-period="month" onclick="switchCommPeriod('month')">
|
||||
<i class="bi bi-calendar-month me-1"></i>Este Mes
|
||||
<span class="badge bg-danger ms-1" id="commMonthBadge">{{ role_data.unassigned_commissions_month | length }}</span>
|
||||
@@ -769,12 +938,63 @@
|
||||
<h6 class="text-success fw-bold">¡Todas las comisiones tienen reserva este mes!</h6>
|
||||
<p class="text-muted small mb-0">No hay comisiones activas sin aula reservada en el mes actual.</p>
|
||||
</div>
|
||||
<!-- Tabla General (Sin Aula Presencial ni Virtual) -->
|
||||
<div id="commTableGeneral" style="display: none;">
|
||||
{% if role_data.unassigned_commissions_general and role_data.unassigned_commissions_general | length > 0 %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0 small">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="ps-3">Código</th>
|
||||
<th>Materia</th>
|
||||
<th>Docente</th>
|
||||
<th>Horario Programado</th>
|
||||
<th>Turno</th>
|
||||
<th>Cupo</th>
|
||||
<th class="text-end pe-3">Acción</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for comm in role_data.unassigned_commissions_general %}
|
||||
<tr>
|
||||
<td class="ps-3">
|
||||
<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>
|
||||
<small class="text-muted font-monospace">{{ comm.subject_code }}</small>
|
||||
</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>
|
||||
<td><span class="badge bg-info-subtle text-info-emphasis border">{{ comm.shift }}</span></td>
|
||||
<td class="font-monospace">{{ comm.current_students }}/{{ comm.max_students }}</td>
|
||||
<td class="text-end pe-3">
|
||||
<a href="/schedule/add_reservation?commission_id={{ comm.id }}" class="btn btn-sm btn-outline-success py-0 px-2" title="Asignar aula a esta comisión">
|
||||
<i class="bi bi-plus-circle me-1"></i>Asignar
|
||||
</a>
|
||||
<a href="/admin/commission_detail?id={{ comm.id }}" class="btn btn-sm btn-outline-primary py-0 px-2 ms-1" title="Ver detalle">
|
||||
<i class="bi bi-eye me-1"></i>Detalle
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-center py-4">
|
||||
<i class="bi bi-check-circle-fill text-success fs-1 d-block mb-2"></i>
|
||||
<h6 class="text-success fw-bold">¡Excelente! Todas las comisiones tienen aula física o virtual asignada</h6>
|
||||
<p class="text-muted small mb-0">No se detectaron comisiones huérfanas sin espacio asignado.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ========================= Panel: Aulas Disponibles (Semana/Mes) ========================= -->
|
||||
<!-- ========================= Panel: Aulas Disponibles (Hoy / Semana / Mes) ========================= -->
|
||||
<div class="card border-0 shadow-sm mb-4" id="bedelia-available-classrooms">
|
||||
<div class="card-header bg-body-tertiary border-0 py-3 d-flex justify-content-between align-items-center flex-wrap gap-2">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
@@ -786,7 +1006,11 @@
|
||||
</div>
|
||||
<div class="d-flex gap-2 align-items-center flex-wrap">
|
||||
<div class="btn-group btn-group-sm" role="group" id="classroomPeriodSwitcher">
|
||||
<button type="button" class="btn btn-outline-success active" data-period="week" onclick="switchClassroomPeriod('week')">
|
||||
<button type="button" class="btn btn-outline-success active" data-period="today" onclick="switchClassroomPeriod('today')">
|
||||
<i class="bi bi-calendar-day me-1"></i>Hoy
|
||||
<span class="badge bg-success ms-1" id="classTodayBadge">{{ role_data.available_classrooms_today | length }}</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-success" data-period="week" onclick="switchClassroomPeriod('week')">
|
||||
<i class="bi bi-calendar-week me-1"></i>Esta Semana
|
||||
<span class="badge bg-success ms-1" id="classWeekBadge">{{ role_data.available_classrooms_week | length }}</span>
|
||||
</button>
|
||||
@@ -801,8 +1025,49 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-3">
|
||||
<!-- Vista Hoy -->
|
||||
<div id="classroomGridToday">
|
||||
{% if role_data.available_classrooms_today and role_data.available_classrooms_today | length > 0 %}
|
||||
<div class="row g-2">
|
||||
{% for aula in role_data.available_classrooms_today %}
|
||||
<div class="col-sm-6 col-md-4 col-lg-3">
|
||||
<a href="/schedule/add_reservation?classroom_id={{ aula.id }}" class="text-decoration-none text-reset d-block h-100">
|
||||
<div class="p-3 rounded border h-100 transition-all {% if aula.is_virtual %}bg-info bg-opacity-10 border-info-subtle{% else %}bg-success bg-opacity-10 border-success-subtle{% endif %}">
|
||||
<div class="d-flex justify-content-between align-items-start mb-2">
|
||||
<span class="badge {% if aula.is_virtual %}bg-info-subtle text-info{% else %}bg-success-subtle text-success{% endif %} border font-monospace fw-bold">
|
||||
{{ aula.code }}
|
||||
</span>
|
||||
{% if aula.is_virtual %}
|
||||
<i class="bi bi-camera-video text-info"></i>
|
||||
{% else %}
|
||||
<i class="bi bi-door-open text-success"></i>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="small text-muted mb-1">
|
||||
<i class="bi bi-building me-1"></i>{{ aula.building }}{% if aula.floor %} · {{ aula.floor }}{% endif %}
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span class="small fw-semibold text-body">
|
||||
<i class="bi bi-people-fill me-1"></i>Cap: {{ aula.capacity }}
|
||||
</span>
|
||||
<span class="badge bg-success text-white small"><i class="bi bi-plus-circle me-1"></i>Asignar</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-center py-4">
|
||||
<i class="bi bi-calendar-check-fill text-primary fs-1 d-block mb-2"></i>
|
||||
<h6 class="text-primary fw-bold">¡Todas las aulas están ocupadas en el día de hoy!</h6>
|
||||
<p class="text-muted small mb-0">Consulte el cronograma por piso o la cartelera del día.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Vista Semana -->
|
||||
<div id="classroomGridWeek">
|
||||
<div id="classroomGridWeek" style="display: none;">
|
||||
{% if role_data.available_classrooms_week and role_data.available_classrooms_week | length > 0 %}
|
||||
<div class="row g-2">
|
||||
{% for aula in role_data.available_classrooms_week %}
|
||||
@@ -1577,18 +1842,38 @@ document.querySelectorAll('[data-color]').forEach(function(el) {
|
||||
if (color) el.style.setProperty('background-color', color, 'important');
|
||||
});
|
||||
|
||||
// Bedelía: Switchers de período para paneles de Comisiones y Aulas
|
||||
// Bedelía: Switcher para Cartelera y Agenda de Clases
|
||||
function switchBedeliaScheduleView(view) {
|
||||
const todayEl = document.getElementById('bedeliaScheduleToday');
|
||||
const weekEl = document.getElementById('bedeliaScheduleWeek');
|
||||
if (todayEl) todayEl.style.display = view === 'today' ? 'block' : 'none';
|
||||
if (weekEl) weekEl.style.display = view === 'week' ? 'block' : 'none';
|
||||
document.querySelectorAll('#bedeliaScheduleSwitcher button').forEach(function(btn) {
|
||||
btn.classList.toggle('active', btn.getAttribute('data-view') === view);
|
||||
});
|
||||
}
|
||||
|
||||
// Bedelía: Switchers de período para paneles de Comisiones
|
||||
function switchCommPeriod(period) {
|
||||
document.getElementById('commTableWeek').style.display = period === 'week' ? 'block' : 'none';
|
||||
document.getElementById('commTableMonth').style.display = period === 'month' ? 'block' : 'none';
|
||||
const weekEl = document.getElementById('commTableWeek');
|
||||
const genEl = document.getElementById('commTableGeneral');
|
||||
const monthEl = document.getElementById('commTableMonth');
|
||||
if (weekEl) weekEl.style.display = period === 'week' ? 'block' : 'none';
|
||||
if (genEl) genEl.style.display = period === 'general' ? 'block' : 'none';
|
||||
if (monthEl) monthEl.style.display = period === 'month' ? 'block' : 'none';
|
||||
document.querySelectorAll('#commPeriodSwitcher button').forEach(function(btn) {
|
||||
btn.classList.toggle('active', btn.getAttribute('data-period') === period);
|
||||
});
|
||||
}
|
||||
|
||||
// Bedelía: Switchers de período para paneles de Aulas
|
||||
function switchClassroomPeriod(period) {
|
||||
document.getElementById('classroomGridWeek').style.display = period === 'week' ? 'block' : 'none';
|
||||
document.getElementById('classroomGridMonth').style.display = period === 'month' ? 'block' : 'none';
|
||||
const todayEl = document.getElementById('classroomGridToday');
|
||||
const weekEl = document.getElementById('classroomGridWeek');
|
||||
const monthEl = document.getElementById('classroomGridMonth');
|
||||
if (todayEl) todayEl.style.display = period === 'today' ? 'block' : 'none';
|
||||
if (weekEl) weekEl.style.display = period === 'week' ? 'block' : 'none';
|
||||
if (monthEl) monthEl.style.display = period === 'month' ? 'block' : 'none';
|
||||
document.querySelectorAll('#classroomPeriodSwitcher button').forEach(function(btn) {
|
||||
btn.classList.toggle('active', btn.getAttribute('data-period') === period);
|
||||
});
|
||||
|
||||
@@ -88,8 +88,29 @@
|
||||
<div class="card border-0 shadow-sm mb-4">
|
||||
<div class="card-body p-3">
|
||||
<form method="GET" action="/schedule/today_schedule" class="row g-2 align-items-center">
|
||||
<!-- Selector de Fecha y Navegación de Días -->
|
||||
<div class="col-lg-3 col-md-6">
|
||||
<label for="dateSelect" class="form-label small fw-bold text-muted mb-1">
|
||||
<i class="bi bi-calendar-event text-primary me-1"></i>Fecha de la Cartelera
|
||||
</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<a href="/schedule/today_schedule?date={{ prev_date }}&floor={{ floor_filter }}&shift={{ shift_filter }}{% if hide_virtual %}&hide_virtual=1{% endif %}" class="btn btn-outline-secondary" title="Día Anterior">
|
||||
<i class="bi bi-chevron-left"></i>
|
||||
</a>
|
||||
<input type="date" name="date" id="dateSelect" class="form-control form-control-sm font-monospace text-center fw-bold" value="{{ today }}" onchange="this.form.submit()">
|
||||
<a href="/schedule/today_schedule?date={{ next_date }}&floor={{ floor_filter }}&shift={{ shift_filter }}{% if hide_virtual %}&hide_virtual=1{% endif %}" class="btn btn-outline-secondary" title="Día Siguiente">
|
||||
<i class="bi bi-chevron-right"></i>
|
||||
</a>
|
||||
{% if today != default_today %}
|
||||
<a href="/schedule/today_schedule" class="btn btn-primary btn-sm" title="Volver al Día de Hoy">
|
||||
Hoy
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Filter by Floor -->
|
||||
<div class="col-lg-3 col-md-4">
|
||||
<div class="col-lg-2 col-md-3">
|
||||
<label for="floorSelect" class="form-label small fw-bold text-muted mb-1">
|
||||
<i class="bi bi-layers text-secondary me-1"></i>Piso / Planta
|
||||
</label>
|
||||
@@ -104,7 +125,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Filter by Turno -->
|
||||
<div class="col-lg-3 col-md-4">
|
||||
<div class="col-lg-2 col-md-3">
|
||||
<label for="shiftSelect" class="form-label small fw-bold text-muted mb-1">
|
||||
<i class="bi bi-brightness-high text-warning me-1"></i>Turno
|
||||
</label>
|
||||
@@ -116,7 +137,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Hide Virtual Classrooms Toggle -->
|
||||
<div class="col-lg-4 col-md-4 pt-md-3">
|
||||
<div class="col-lg-3 col-md-6 pt-md-3">
|
||||
<div class="form-check form-switch pt-1">
|
||||
<input class="form-check-input" type="checkbox" role="switch" name="hide_virtual" value="1" id="hideVirtualToday" {% if hide_virtual %}checked{% endif %} onchange="this.form.submit()">
|
||||
<label class="form-check-label fw-semibold small text-dark" for="hideVirtualToday">
|
||||
@@ -127,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="col-lg-2 col-md-12 pt-md-3 text-lg-end d-flex gap-2">
|
||||
<div class="col-lg-2 col-md-6 pt-md-3 text-lg-end d-flex gap-2">
|
||||
<button type="submit" class="btn btn-primary btn-sm flex-fill">
|
||||
<i class="bi bi-funnel me-1"></i>Filtrar
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user