fix(v3.4.6): fix reservation cascade, remove calendar mocks, strip auto meet links, friendly dates, dynamic building floors and career filter

This commit is contained in:
2026-10-08 08:26:15 -03:00
parent 25039efdeb
commit 368dc71b14
23 changed files with 291 additions and 149 deletions
+1 -1
View File
@@ -1127,7 +1127,7 @@
<div class="sidebar-footer-text mt-3 pt-2 border-top border-secondary-subtle text-center">
<span class="badge bg-secondary-subtle text-secondary-emphasis font-monospace px-2 py-1" style="font-size:0.68rem;" title="Versión Institucional de Edu-Space">
<i class="bi bi-tag-fill me-1"></i>v{{ app_version or '3.4.1' }} <span class="opacity-75">(FE: {{ frontend_version or '3.4.1' }} · BE: {{ backend_version or '3.4.1' }})</span>
<i class="bi bi-tag-fill me-1"></i>v{{ app_version or '3.4.6' }} <span class="opacity-75">(FE: {{ frontend_version or '3.4.6' }} · BE: {{ backend_version or '3.4.6' }})</span>
</span>
</div>
</div>
+1 -1
View File
@@ -97,7 +97,7 @@
</div>
<div>
<div class="text-muted small fw-semibold">Pisos Presenciales</div>
<h3 class="fw-bold mb-0 text-warning">{{ buildings|sum(attribute='floors') }}</h3>
<h3 class="fw-bold mb-0 text-warning">{{ total_floors or 4 }}</h3>
<small class="text-muted" style="font-size: 0.72rem;">Plantas físicas activas</small>
</div>
</div>
+13 -10
View File
@@ -97,27 +97,27 @@
<span class="badge badge-brand">{{ classrooms|length }} aulas configuradas</span>
</div>
<div class="card-body p-4">
{% if classrooms_by_floor %}
{% for floor_num in classrooms_by_floor|sort %}
{% if floors_list and (classrooms|length > 0) %}
{% for fl in floors_list %}
<div class="mb-4">
<div class="d-flex align-items-center mb-3">
<span class="badge bg-dark bg-opacity-75 fs-6 px-3 py-2 me-2">
<i class="bi bi-layer-forward me-1"></i>
{% if floor_num == 0 %}Planta Baja{% else %}Piso {{ floor_num }}{% endif %}
{{ fl.floor_name }}
</span>
<div class="border-bottom flex-grow-1"></div>
<small class="text-muted ms-2">{{ classrooms_by_floor[floor_num]|length }} aulas</small>
<small class="text-muted ms-2">{{ fl.classrooms|length }} aula(s)</small>
</div>
<div class="row g-3">
{% for c in classrooms_by_floor[floor_num] %}
{% for c in fl.classrooms %}
<div class="col-md-6 col-xl-4">
<div class="card border border-light-subtle shadow-sm h-100">
<div class="card-body p-3">
<div class="d-flex justify-content-between align-items-start mb-2">
<h6 class="fw-bold mb-0">
<a href="/classrooms/view_classroom" class="text-decoration-none text-primary">
<i class="bi bi-door-open me-1"></i>{{ c.code }}
<a href="/classrooms/view_classroom?id={{ c.id }}" class="text-decoration-none text-primary">
<i class="bi bi-door-open me-1"></i>{{ c.code or c.room_number or ('Aula ' + c.id) }}
</a>
</h6>
{% if c.is_active %}
@@ -128,7 +128,7 @@
</div>
<div class="small text-muted mb-2">
<i class="bi bi-people me-1"></i>Capacidad: <strong>{{ c.capacity }}</strong> estudiantes
<i class="bi bi-people me-1"></i>Capacidad: <strong>{{ c.capacity or 35 }}</strong> estudiantes
</div>
{% if c.description %}
@@ -136,11 +136,14 @@
{% endif %}
<div class="d-flex justify-content-between align-items-center pt-2 border-top">
<a href="/classrooms/view_classroom" class="btn btn-outline-primary btn-sm py-0 px-2">
<a href="/classrooms/view_classroom?id={{ c.id }}" class="btn btn-outline-primary btn-sm py-0 px-2">
<small>Ver Ficha</small>
</a>
<a href="/schedule/add_reservation?classroom_id={{ c.id }}" class="btn btn-outline-success btn-sm py-0 px-2">
<small><i class="bi bi-calendar-plus me-1"></i>Reservar</small>
</a>
{% if user.has_permission('classrooms', 'read_write') %}
<a href="/classrooms/edit_classroom" class="btn btn-outline-secondary btn-sm py-0 px-2">
<a href="/classrooms/edit_classroom?id={{ c.id }}" class="btn btn-outline-secondary btn-sm py-0 px-2">
<small>Editar</small>
</a>
{% endif %}
+4 -2
View File
@@ -195,10 +195,12 @@ document.addEventListener('DOMContentLoaded', function() {
if (!floorDatalist) return;
floorDatalist.innerHTML = '';
var floors = buildingFloors[bId] || [];
floors.forEach(function(f) {
var dynamicDefaults = ['Planta Baja (PB)', 'Entrepiso (EP)', 'Subsuelo', 'Piso 1', 'Piso 2', 'Piso 3', 'Piso 4'];
var allOptions = Array.from(new Set([...dynamicDefaults, ...floors]));
allOptions.forEach(function(f) {
var opt = document.createElement('option');
opt.value = f;
opt.textContent = (f === '0' || f === 'PB') ? 'Planta Baja' : 'Piso ' + f;
opt.textContent = f;
floorDatalist.appendChild(opt);
});
}
+4 -2
View File
@@ -188,10 +188,12 @@ document.addEventListener('DOMContentLoaded', function() {
if (!floorDatalist) return;
floorDatalist.innerHTML = '';
var floors = buildingFloors[bId] || [];
floors.forEach(function(f) {
var dynamicDefaults = ['Planta Baja (PB)', 'Entrepiso (EP)', 'Subsuelo', 'Piso 1', 'Piso 2', 'Piso 3', 'Piso 4'];
var allOptions = Array.from(new Set([...dynamicDefaults, ...floors]));
allOptions.forEach(function(f) {
var opt = document.createElement('option');
opt.value = f;
opt.textContent = (f === '0' || f === 'PB') ? 'Planta Baja' : 'Piso ' + f;
opt.textContent = f;
floorDatalist.appendChild(opt);
});
}
+4 -4
View File
@@ -122,11 +122,11 @@
{% for res in upcoming_reservations %}
<tr>
<td class="ps-3">
<div class="fw-bold font-monospace text-primary fs-6 mb-1">
<i class="bi bi-calendar-event text-primary me-1"></i>{{ res.start_time }}
<div class="fw-bold text-primary fs-6 mb-1">
<i class="bi bi-calendar-event text-primary me-1"></i>{{ res.date_display_friendly or res.date_display or res.start_time }}
</div>
<div class="small font-monospace text-body-secondary">
<i class="bi bi-clock text-warning me-1"></i>{{ res.start_time }} - {{ res.end_time }} hs
<div class="small text-body-secondary font-monospace">
<i class="bi bi-clock text-warning me-1"></i>{{ res.time_range_friendly or (res.start_time_display + ' a ' + res.end_time_display + ' hs') }}
</div>
</td>
<td>
+28 -38
View File
@@ -248,36 +248,11 @@
{% block extra_js %}
<script type="application/json" id="classroom-data">
{
{% for c in classroom_list %}
"{{ c.id }}": {
"id": {{ c.id }},
"building_id": {{ (c.building_id or 0)|tojson }},
"building_name": {{ c.building_name|tojson }},
"floor": {{ c.floor|tojson }},
"floor_display": {{ c.floor_display|tojson }},
"code": {{ c.code|tojson }},
"code_display": {{ c.code_display|tojson }},
"location_display": {{ c.location_display|tojson }},
"capacity": {{ c.capacity_display|tojson }},
"capacity_num": {{ c.capacity }},
"is_virtual": {{ c.is_virtual|tojson }}
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{{ classroom_data_json | safe }}
</script>
<script type="application/json" id="commission-data">
{
{% for c in commission_list %}
"{{ c.id }}": {
"id": {{ c.id }},
"code": {{ c.code|tojson }},
"virtual_link": {{ (c.virtual_link or '')|tojson }},
"max_students": {{ c.max_students }}
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{{ commission_data_json | safe }}
</script>
<script type="application/json" id="i18n-strings">
@@ -386,21 +361,30 @@ $(document).ready(function() {
// Extraer pisos únicos de este edificio
const buildingFloors = [];
Object.values(classroomData).forEach(c => {
if (c.building_id == selectedBuildingId && c.floor) {
if (!buildingFloors.some(f => f.floor === c.floor)) {
const matchesBuilding = (String(c.building_id) === String(selectedBuildingId)) ||
(!c.is_virtual && String(selectedBuildingId) === '1') ||
(c.building_name && c.building_name.toLowerCase().includes('central') && String(selectedBuildingId) === '1');
if (matchesBuilding && c.floor) {
if (!buildingFloors.some(f => String(f.floor).toLowerCase() === String(c.floor).toLowerCase())) {
buildingFloors.push({
floor: c.floor,
floor_display: c.floor_display
floor_display: c.floor_display || `Piso ${c.floor}`
});
}
}
});
// Ordenar pisos: PB primero, luego numérico
// Ordenar pisos: Subsuelos, PB, Entrepisos, luego numéricos
buildingFloors.sort((a, b) => {
if (a.floor === '0' || a.floor.toUpperCase() === 'PB') return -1;
if (b.floor === '0' || b.floor.toUpperCase() === 'PB') return 1;
return a.floor.localeCompare(b.floor, undefined, { numeric: true });
const fA = String(a.floor || '').toUpperCase();
const fB = String(b.floor || '').toUpperCase();
if (fA.includes('SUB') || fA === 'SS') return -1;
if (fB.includes('SUB') || fB === 'SS') return 1;
if (fA === '0' || fA.includes('PB') || fA.includes('PLANTA BAJA')) return -1;
if (fB === '0' || fB.includes('PB') || fB.includes('PLANTA BAJA')) return 1;
if (fA.includes('EP') || fA.includes('ENTRE')) return -1;
if (fB.includes('EP') || fB.includes('ENTRE')) return 1;
return fA.localeCompare(fB, undefined, { numeric: true });
});
buildingFloors.forEach(f => {
@@ -412,7 +396,10 @@ $(document).ready(function() {
// Poblar aulas de este edificio inicialmente
Object.values(classroomData).forEach(c => {
if (c.building_id == selectedBuildingId) {
const matchesBuilding = (String(c.building_id) === String(selectedBuildingId)) ||
(!c.is_virtual && String(selectedBuildingId) === '1') ||
(c.building_name && c.building_name.toLowerCase().includes('central') && String(selectedBuildingId) === '1');
if (matchesBuilding) {
$classroom.append($('<option>', {
value: c.id,
text: `${c.code} · ${c.floor_display} (Cap: ${c.capacity})`
@@ -434,13 +421,16 @@ $(document).ready(function() {
let lastId = null;
Object.values(classroomData).forEach(c => {
const matchesBuilding = !selectedBuildingId || c.building_id == selectedBuildingId;
const matchesFloor = !selectedFloor || c.floor == selectedFloor;
const matchesBuilding = !selectedBuildingId ||
(String(c.building_id) === String(selectedBuildingId)) ||
(!c.is_virtual && String(selectedBuildingId) === '1') ||
(c.building_name && c.building_name.toLowerCase().includes('central') && String(selectedBuildingId) === '1');
const matchesFloor = !selectedFloor || String(c.floor).toLowerCase() === String(selectedFloor).toLowerCase();
if (matchesBuilding && matchesFloor) {
$classroom.append($('<option>', {
value: c.id,
text: `${c.code} (Cap: ${c.capacity})`
text: `${c.code} · ${c.floor_display} (Cap: ${c.capacity})`
}));
lastId = c.id;
count++;
+21 -32
View File
@@ -260,36 +260,11 @@
{% block extra_js %}
<script type="application/json" id="classroom-data">
{
{% for c in classroom_list %}
"{{ c.id }}": {
"id": {{ c.id }},
"building_id": {{ (c.building_id or 0)|tojson }},
"building_name": {{ c.building_name|tojson }},
"floor": {{ c.floor|tojson }},
"floor_display": {{ c.floor_display|tojson }},
"code": {{ c.code|tojson }},
"code_display": {{ c.code_display|tojson }},
"location_display": {{ c.location_display|tojson }},
"capacity": {{ c.capacity_display|tojson }},
"capacity_num": {{ c.capacity }},
"is_virtual": {{ c.is_virtual|tojson }}
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{{ classroom_data_json | safe }}
</script>
<script type="application/json" id="commission-data">
{
{% for c in commission_list %}
"{{ c.id }}": {
"id": {{ c.id }},
"code": {{ c.code|tojson }},
"virtual_link": {{ (c.virtual_link or '')|tojson }},
"max_students": {{ c.max_students }}
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{{ commission_data_json | safe }}
</script>
<script>
@@ -334,15 +309,24 @@ $(document).ready(function() {
const floors = new Set();
Object.values(classroomData).forEach(function(room) {
if (String(room.building_id) === String(selectedBldg)) {
const matchesBuilding = (String(room.building_id) === String(selectedBldg)) ||
(!room.is_virtual && String(selectedBldg) === '1') ||
(room.building_name && room.building_name.toLowerCase().includes('central') && String(selectedBldg) === '1');
if (matchesBuilding && room.floor) {
floors.add(room.floor);
}
});
const sortedFloors = Array.from(floors).sort(function(a, b) {
if (a === '0' || a === 'PB') return -1;
if (b === '0' || b === 'PB') return 1;
return String(a).localeCompare(String(b), undefined, {numeric: true});
const fA = String(a || '').toUpperCase();
const fB = String(b || '').toUpperCase();
if (fA.includes('SUB') || fA === 'SS') return -1;
if (fB.includes('SUB') || fB === 'SS') return 1;
if (fA === '0' || fA.includes('PB') || fA.includes('PLANTA BAJA')) return -1;
if (fB === '0' || fB.includes('PB') || fB.includes('PLANTA BAJA')) return 1;
if (fA.includes('EP') || fA.includes('ENTRE')) return -1;
if (fB.includes('EP') || fB.includes('ENTRE')) return 1;
return fA.localeCompare(fB, undefined, {numeric: true});
});
sortedFloors.forEach(function(fl) {
@@ -368,7 +352,12 @@ $(document).ready(function() {
}
const matchingRooms = Object.values(classroomData).filter(function(room) {
return String(room.building_id) === String(selectedBldg) && String(room.floor) === String(selectedFloor);
const matchesBuilding = !selectedBldg ||
(String(room.building_id) === String(selectedBldg)) ||
(!room.is_virtual && String(selectedBldg) === '1') ||
(room.building_name && room.building_name.toLowerCase().includes('central') && String(selectedBldg) === '1');
const matchesFloor = String(room.floor).toLowerCase() === String(selectedFloor).toLowerCase();
return matchesBuilding && matchesFloor;
});
matchingRooms.sort(function(a, b) { return a.code.localeCompare(b.code); });