feat(schedule): group reservations by real time slots and clean date-time formatting v3.4.2

This commit is contained in:
2026-10-07 22:26:52 -03:00
parent ec7a8ac7d4
commit e1c2c6e8c6
12 changed files with 334 additions and 93 deletions
+8 -4
View File
@@ -173,8 +173,12 @@
{% for reservation in reservations.items %}
<tr>
<td class="ps-3">
<div class="fw-bold">{{ reservation.start_time }}</div>
<small class="text-muted font-monospace">{{ reservation.start_time }} - {{ reservation.end_time }} hs</small>
<div class="fw-bold text-dark text-nowrap">
<i class="bi bi-calendar-event me-1 text-primary"></i>{{ reservation.date_display or reservation.date_short or format_date_human(reservation.start_time) }}
</div>
<span class="badge bg-light text-dark border font-monospace mt-1">
<i class="bi bi-clock me-1 text-primary"></i>{{ reservation.time_display or (reservation.start_time ~ ' - ' ~ reservation.end_time ~ ' hs') }}
</span>
</td>
<td>
<span class="badge bg-secondary-subtle text-secondary border font-monospace">
@@ -258,10 +262,10 @@
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<span class="badge bg-primary text-white font-monospace mb-1">
<i class="bi bi-calendar-event me-1"></i>{{ reservation.start_time }}
<i class="bi bi-calendar-event me-1"></i>{{ reservation.date_display or reservation.date_short or format_date_human(reservation.start_time) }}
</span>
<div class="small fw-bold text-muted font-monospace">
<i class="bi bi-clock me-1"></i>{{ reservation.start_time }} - {{ reservation.end_time }} hs
<i class="bi bi-clock me-1 text-primary"></i>{{ reservation.time_display or (reservation.start_time ~ ' - ' ~ reservation.end_time ~ ' hs') }}
</div>
</div>
{% if reservation.status == 'CONFIRMED' or reservation.status.value == 'CONFIRMED' %}
+73 -48
View File
@@ -179,25 +179,35 @@
</button>
</div>
</div>
</div>
<div class="card-body p-3">
<!-- Timeline View -->
<!-- Timeline View: Agrupado por franja horaria real sin repeticiones -->
<div id="timeline-view">
{% for hour in range(7, 22) %}
<div class="row border-bottom py-3 align-items-start {% if time_blocks[hour] %}bg-light-subtle{% endif %}">
<div class="col-md-2 col-3">
<div class="text-center p-2 rounded bg-body-tertiary border">
<strong class="h5 text-primary mb-0 font-monospace">{% if hour < 10 %}0{% endif %}{{ hour }}:00</strong>
<div class="small text-muted font-monospace">{{ hour+1 }}:00 hs</div>
{% for slot in grouped_slots %}
<div class="row border-bottom py-3 align-items-stretch bg-light-subtle mb-3 rounded border mx-0">
<div class="col-lg-2 col-md-3 col-12 mb-3 mb-md-0 d-flex flex-column justify-content-center">
<div class="text-center p-3 rounded bg-body-tertiary border shadow-sm h-100 d-flex flex-column justify-content-center">
<div class="badge bg-primary-subtle text-primary border border-primary-subtle mb-2 font-monospace">
<i class="bi bi-clock me-1"></i>{{ slot.shift }}
</div>
<strong class="h4 text-primary d-block mb-0 font-monospace">{{ slot.start_time }}</strong>
<div class="small fw-bold text-dark font-monospace">a {{ slot.end_time }} hs</div>
<div class="badge bg-secondary-subtle text-secondary border mt-2 align-self-center font-monospace" style="font-size: 0.75rem;">
<i class="bi bi-hourglass-split me-1"></i>{{ slot.duration_display }}
</div>
<div class="mt-2">
<span class="badge bg-light text-muted border" style="font-size: 0.72rem;">
{{ slot.items | length }} {% if slot.items | length == 1 %}asignatura{% else %}asignaturas{% endif %}
</span>
</div>
</div>
</div>
<div class="col-md-10 col-9">
{% if time_blocks[hour] %}
<div class="row g-2">
{% for item in time_blocks[hour] %}
<div class="col-md-6">
<div class="card border-0 shadow-sm h-100 border-start border-4 border-primary">
<div class="card-body p-3">
<div class="col-lg-10 col-md-9 col-12">
<div class="row g-2">
{% for item in slot.items %}
<div class="col-md-6 col-xl-6">
<div class="card border-0 shadow-sm h-100 border-start border-4 {% if item.reservation.is_virtual %}border-info{% else %}border-primary{% endif %}">
<div class="card-body p-3 d-flex flex-column justify-content-between">
<div>
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<h6 class="card-title fw-bold mb-1 text-primary">
@@ -207,62 +217,76 @@
{{ item.reservation.subject_code }}
</span>
<span class="badge bg-info-subtle text-info border">
{{ item.reservation.shift or 'Tarde' }}
{{ item.reservation.shift or slot.shift }}
</span>
{% if item.reservation.commission %}
<span class="badge bg-light text-dark border font-monospace">
{{ item.reservation.commission.code or item.reservation.commission.name }}
</span>
{% endif %}
</div>
<span class="badge bg-{% if item.reservation.status == 'CONFIRMED' or item.reservation.status.value == 'CONFIRMED' %}success-subtle text-success border border-success-subtle{% else %}warning-subtle text-warning border border-warning-subtle{% endif %}">
{% if item.reservation.status == 'CONFIRMED' or item.reservation.status.value == 'CONFIRMED' %}
Confirmada
<i class="bi bi-check-circle me-1"></i>Confirmada
{% else %}
Pendiente
<i class="bi bi-clock me-1"></i>Pendiente
{% endif %}
</span>
</div>
<div class="small text-muted mb-2">
<span class="fw-semibold text-dark me-2">
{% if item.reservation.is_virtual %}
<i class="bi bi-laptop me-1 text-info"></i>{{ item.classroom.code }}
{% else %}
<i class="bi bi-door-open me-1 text-success"></i>{{ item.classroom.code }}
{% endif %}
</span>
<span class="me-2">
<i class="bi bi-layers me-1"></i>{% if item.classroom.floor == 0 %}PB{% else %}Piso {{ item.classroom.floor }}{% endif %}
{% if item.classroom.building %} · {{ item.classroom.building }}{% endif %}
</span>
<span>
<i class="bi bi-clock me-1 text-warning"></i>{{ item.reservation.start_time }} - {{ item.reservation.end_time }} hs
<i class="bi bi-clock me-1 text-warning"></i>{{ item.reservation.time_display }}
</span>
</div>
<div class="d-flex justify-content-between align-items-center pt-2 border-top">
<span class="small text-muted">
<i class="bi bi-people me-1"></i>{{ item.reservation.expected_attendees }} estudiantes
</span>
<div class="d-flex gap-1">
{% if item.reservation.effective_virtual_link %}
<a href="{{ item.reservation.effective_virtual_link }}" target="_blank" class="btn btn-sm btn-outline-success py-0 px-2 d-inline-flex align-items-center" title="Unirse a Videollamada (Zoom / Meet)">
<i class="bi bi-camera-video me-1"></i>Zoom/Meet
</a>
{% endif %}
{% if user.can_edit_reservation(item.reservation) %}
<a href="/schedule/edit_reservation?id={{ item.reservation.id }}" class="btn btn-sm btn-outline-warning py-0 px-2" title="Modificar Reserva">
<i class="bi bi-pencil"></i>
</a>
{% endif %}
<a href="/schedule/view_reservation?id={{ item.reservation.id }}" class="btn btn-sm btn-outline-secondary py-0 px-2" title="Ver Ficha Detallada">
<i class="bi bi-eye me-1"></i>Detalles
</a>
</div>
</div>
<div class="d-flex justify-content-between align-items-center pt-2 border-top mt-2">
<span class="small text-muted">
<i class="bi bi-people me-1"></i>{{ item.reservation.expected_attendees }} estudiantes
{% if item.reservation.teacher_name or item.user.name %}
· <i class="bi bi-person me-1"></i>{{ item.reservation.teacher_name or item.user.name }}
{% endif %}
</span>
<div class="d-flex gap-1">
{% if item.reservation.effective_virtual_link %}
<a href="{{ item.reservation.effective_virtual_link }}" target="_blank" class="btn btn-sm btn-outline-success py-0 px-2 d-inline-flex align-items-center" title="Unirse a Videollamada (Zoom / Meet)">
<i class="bi bi-camera-video me-1"></i>Zoom/Meet
</a>
{% endif %}
{% if user.can_edit_reservation(item.reservation) %}
<a href="/schedule/edit_reservation?id={{ item.reservation.id }}" class="btn btn-sm btn-outline-warning py-0 px-2" title="Modificar Reserva">
<i class="bi bi-pencil"></i>
</a>
{% endif %}
<a href="/schedule/view_reservation?id={{ item.reservation.id }}" class="btn btn-sm btn-outline-secondary py-0 px-2" title="Ver Ficha Detallada">
<i class="bi bi-eye me-1"></i>Detalles
</a>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="text-muted py-2 small ps-2">
<i class="bi bi-dash-circle me-1"></i>Sin clases programadas en este horario
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% else %}
<div class="text-center py-4 text-muted">
<i class="bi bi-calendar-check fs-2 d-block mb-2"></i>
No hay clases programadas para esta fecha con los filtros aplicados.
</div>
{% endfor %}
</div>
@@ -284,15 +308,16 @@
<tbody>
{% for reservation in reservations %}
<tr>
<td class="ps-3 font-monospace fw-bold">
{{ reservation.start_time }} - {{ reservation.end_time }} hs
<td class="ps-3 font-monospace fw-bold text-nowrap">
<i class="bi bi-clock me-1 text-primary"></i>{{ reservation.time_display }}
</td>
<td>
<span class="badge bg-secondary-subtle text-secondary font-monospace border">
{{ reservation.classroom.code if reservation.classroom else 'Sin Aula' }}
</span>
<small class="text-muted d-block">
{% if reservation.classroom and reservation.classroom.floor == 0 %}Planta Baja{% elif reservation.classroom %}Piso {{ reservation.classroom.floor }}{% endif %}
{% if reservation.classroom and reservation.classroom.floor == 0 %}PB{% elif reservation.classroom %}Piso {{ reservation.classroom.floor }}{% endif %}
{% if reservation.classroom and reservation.classroom.building %} · {{ reservation.classroom.building }}{% endif %}
</small>
</td>
<td>
+4 -4
View File
@@ -56,11 +56,11 @@
</p>
</div>
<div class="col-md-6 mb-3">
<label class="text-muted small">Date & Time</label>
<label class="text-muted small">Fecha y Horario</label>
<p class="mb-0">
<i class="bi bi-clock"></i>
{{ format_date(reservation.start_time, format='long')|capitalize }}<br>
{{ reservation.start_time }} - {{ reservation.end_time }}
<i class="bi bi-clock me-1 text-primary"></i>
<span class="fw-bold">{{ reservation.date_display or format_date(reservation.start_time, 'human') }}</span><br>
<span class="font-monospace text-muted">{{ reservation.time_display or (reservation.start_time ~ ' - ' ~ reservation.end_time ~ ' hs') }}</span>
</p>
</div>
<div class="col-md-6 mb-3">