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:
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user