fix: remove redundant breadcrumbs and refine theme styles in buildings views

This commit is contained in:
2026-10-08 10:50:54 -03:00
parent 5161460440
commit 47c21dd25a
2 changed files with 66 additions and 82 deletions
+56 -70
View File
@@ -8,30 +8,23 @@
<div class="container-fluid pt-5 mt-4">
<div class="row">
<div class="col-xl-9 col-lg-11 mx-auto">
<!-- Breadcrumb y Encabezado Superior -->
<div class="d-flex flex-wrap justify-content-between align-items-center mb-4 gap-2">
<!-- Encabezado Principal Limpio (Sin breadcrumbs redundantes) -->
<div class="d-flex flex-wrap justify-content-between align-items-center mb-4 pb-2 border-bottom border-light-subtle gap-3">
<div>
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-1 small">
<li class="breadcrumb-item"><a href="/buildings/list_buildings" class="text-decoration-none">Edificios</a></li>
{% if building %}
<li class="breadcrumb-item"><a href="/buildings/view/{{ building.id }}" class="text-decoration-none">{{ building.name }}</a></li>
<li class="breadcrumb-item active" aria-current="page">Editar</li>
{% else %}
<li class="breadcrumb-item active" aria-current="page">Nuevo Edificio</li>
{% endif %}
</ol>
</nav>
<h1 class="h3 mb-0">
<h1 class="h3 mb-1">
<i class="bi bi-buildings text-primary me-2"></i>
{% if building %}Editar Edificio: <span class="text-primary">{{ building.name }}</span>{% else %}Nuevo Edificio{% endif %}
{% if building %}
Editar Edificio: <span class="text-primary">{{ building.name }}</span>
{% else %}
Nuevo Edificio / Sede
{% endif %}
</h1>
<p class="text-muted small mb-0 mt-1">Configura los datos de la sede, gestiona sus plantas físicas y administra sus aulas asociadas.</p>
<p class="text-muted small mb-0">Gestión de sede institucional, plantas físicas y distribución de aulas asociadas.</p>
</div>
<div class="d-flex gap-2">
{% if building %}
<a href="/buildings/view/{{ building.id }}" class="btn btn-outline-primary btn-sm">
<i class="bi bi-eye me-1"></i>Ver Ficha de la Sede
<i class="bi bi-eye me-1"></i>Ver Ficha
</a>
{% endif %}
<a href="/buildings/list_buildings" class="btn btn-outline-secondary btn-sm">
@@ -79,11 +72,11 @@
{% endif %}
</div>
<!-- Selector / Configurador de Pisos enriquecido -->
<!-- Selector de Plantas Físicas -->
<div class="col-md-5">
<label for="floorsInput" class="form-label fw-semibold d-flex justify-content-between align-items-center mb-1">
<span><i class="bi bi-layers me-1 text-primary"></i>Plantas Físicas (Floors)</span>
<span class="badge bg-secondary-subtle text-secondary" id="floorModeBadge">
<span><i class="bi bi-layers me-1 text-primary"></i>Plantas Físicas</span>
<span class="badge bg-secondary-subtle text-secondary-emphasis" id="floorModeBadge">
{% if building and building.is_virtual %}Campus Virtual{% else %}Presencial{% endif %}
</span>
</label>
@@ -95,31 +88,28 @@
{% if form.floors.errors %}
<div class="invalid-feedback d-block">{{ form.floors.errors[0] }}</div>
{% endif %}
<small class="text-muted d-block mt-1">Cantidad de niveles estructurales (0 para Campus Virtual)</small>
<small class="text-muted d-block mt-1">Niveles estructurales (0 para Campus Virtual)</small>
</div>
<!-- Panel de Configuración Rápida de Niveles (Presets & Acciones) -->
{% if not building %}
<!-- Presets Rápidos solo para Nuevo Edificio -->
<div class="col-12">
<div class="p-3 bg-body-tertiary rounded border border-light-subtle">
<div class="d-flex flex-wrap justify-content-between align-items-center mb-2 gap-2">
<div class="small fw-bold text-secondary">
<i class="bi bi-diagram-3 me-1"></i>Configurador Rápido de Plantas y Niveles
<div class="small fw-semibold text-secondary">
<i class="bi bi-lightning-charge me-1"></i>Presets Rápidos de Estructura:
</div>
<div class="d-flex flex-wrap gap-1">
<button type="button" class="btn btn-outline-primary btn-sm py-0 px-2" id="presetPB">Preset PB (1)</button>
<button type="button" class="btn btn-outline-primary btn-sm py-0 px-2" id="presetPB">Solo PB (1)</button>
<button type="button" class="btn btn-outline-primary btn-sm py-0 px-2" id="presetPBplus1">PB + 1 (2)</button>
<button type="button" class="btn btn-outline-primary btn-sm py-0 px-2" id="presetPBplus3">PB + 3 (4)</button>
<button type="button" class="btn btn-outline-secondary btn-sm py-0 px-2" id="presetVirtual">Virtual (0)</button>
<button type="button" class="btn btn-outline-secondary btn-sm py-0 px-2" id="presetVirtual">Campus Virtual (0)</button>
</div>
</div>
<div class="d-flex flex-wrap align-items-center gap-1" id="floorLevelChips">
<!-- Generado dinámicamente según floorsInput -->
</div>
<small class="text-muted mt-2 d-block" style="font-size: 0.78rem;">
<i class="bi bi-info-circle me-1"></i>Puedes usar los botones de acceso rápido para ajustar las plantas del edificio. Cada nivel admitirá creación y vinculación de aulas específicas.
</small>
<div class="d-flex flex-wrap align-items-center gap-1" id="floorLevelChips"></div>
</div>
</div>
{% endif %}
<div class="col-12">
{{ form.description.label(class="form-label fw-semibold") }}
@@ -148,7 +138,7 @@
</div>
</div>
<!-- Card 2: Panel Interactivo de Plantas y Aulas de la Sede -->
<!-- Card 2: Panel de Plantas Físicas y Distribución de Aulas (para Edificio Existente) -->
{% if building %}
<div class="card border-0 shadow-sm mb-4">
<div class="card-header bg-body-tertiary border-0 py-3 d-flex flex-wrap justify-content-between align-items-center gap-2">
@@ -156,7 +146,7 @@
<h5 class="mb-0 h6 fw-bold">
<i class="bi bi-layers-fill text-primary me-2"></i>Plantas Físicas y Distribución de Aulas
</h5>
<small class="text-muted">Gestiona los pisos del edificio, visualiza sus aulas asignadas o crea nuevos espacios por nivel</small>
<small class="text-muted">Espacios físicos asignados a cada planta del edificio</small>
</div>
<div class="d-flex flex-wrap align-items-center gap-2">
<span class="badge bg-primary-subtle text-primary border border-primary-subtle px-2 py-1">
@@ -166,7 +156,7 @@
<i class="bi bi-door-open me-1"></i>{{ classrooms|length }} Aulas
</span>
<span class="badge bg-success-subtle text-success border border-success-subtle px-2 py-1">
<i class="bi bi-people me-1"></i>{{ total_physical_capacity }} Plazas Físicas
<i class="bi bi-people me-1"></i>{{ total_physical_capacity }} Plazas
</span>
{% if not building.is_virtual %}
<a href="/classrooms/add_classroom?building_id={{ building.id }}" class="btn btn-sm btn-success">
@@ -178,7 +168,6 @@
<div class="card-body p-4">
{% if building.is_virtual %}
<!-- Caso Sede Virtual -->
<div class="alert alert-info border-0 shadow-sm d-flex align-items-center justify-content-between">
<div>
<i class="bi bi-cloud-check fs-4 me-2"></i>
@@ -210,15 +199,15 @@
{% endif %}
<div>
<span class="fw-bold fs-6">{{ f.floor_name }}</span>
<span class="badge bg-body-secondary text-secondary border ms-2">Código: {{ f.floor_code }}</span>
<span class="badge bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle ms-2">Nivel {{ f.floor_code }}</span>
</div>
</div>
<div class="d-flex align-items-center gap-2">
<span class="badge bg-light text-dark border">
<span class="badge bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle">
<i class="bi bi-door-open me-1"></i>{{ f.classrooms|length }} aulas
</span>
<span class="badge bg-light text-dark border">
<i class="bi bi-people me-1"></i>{{ f.total_capacity }} pers. cap.
<span class="badge bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle">
<i class="bi bi-people me-1"></i>{{ f.total_capacity }} plazas
</span>
<a href="/classrooms/add_classroom?building_id={{ building.id }}&floor={{ f.floor_code }}"
class="btn btn-sm btn-outline-success py-1 px-2"
@@ -233,31 +222,31 @@
{% if f.classrooms and f.classrooms|length > 0 %}
<div class="table-responsive">
<table class="table table-hover align-middle mb-0 table-sm">
<thead class="table-light">
<thead class="bg-body-tertiary">
<tr>
<th class="ps-3" style="width: 30%;">Aula / Espacio</th>
<th style="width: 20%;">Capacidad</th>
<th style="width: 25%;">Estado</th>
<th class="text-end pe-3" style="width: 25%;">Acciones</th>
<th class="ps-3 py-2 small fw-semibold text-secondary" style="width: 32%;">Aula / Espacio</th>
<th class="py-2 small fw-semibold text-secondary" style="width: 22%;">Capacidad</th>
<th class="py-2 small fw-semibold text-secondary" style="width: 22%;">Estado</th>
<th class="text-end pe-3 py-2 small fw-semibold text-secondary" style="width: 24%;">Acciones</th>
</tr>
</thead>
<tbody>
{% for c in f.classrooms %}
<tr>
<td class="ps-3">
<a href="/classrooms/view_classroom?id={{ c.id }}" class="fw-semibold text-decoration-none">
<i class="bi bi-door-open text-primary me-1"></i>{{ c.code_display or c.code or c.room_number }}
<td class="ps-3 py-2">
<a href="/classrooms/view_classroom?id={{ c.id }}" class="fw-semibold text-decoration-none text-primary">
<i class="bi bi-door-open me-1"></i>{{ c.code_display or c.code or c.room_number }}
</a>
{% if c.description %}
<small class="text-muted d-block" style="font-size: 0.75rem;">{{ c.description }}</small>
{% endif %}
</td>
<td>
<td class="py-2">
<span class="badge bg-primary-subtle text-primary border border-primary-subtle">
{{ c.capacity }} alumnos
</span>
</td>
<td>
<td class="py-2">
{% if c.is_active %}
<span class="badge bg-success-subtle text-success border border-success-subtle">
<i class="bi bi-check-circle me-1"></i>Activa
@@ -268,7 +257,7 @@
</span>
{% endif %}
</td>
<td class="text-end pe-3">
<td class="text-end pe-3 py-2">
<div class="btn-group btn-group-sm">
<a href="/classrooms/edit/{{ c.id }}" class="btn btn-outline-secondary py-0 px-2" title="Editar detalles del aula">
<i class="bi bi-pencil me-1"></i>Editar
@@ -317,8 +306,8 @@
</h5>
</div>
<div class="card-body p-4 text-center">
<div class="py-3">
<i class="bi bi-diagram-3 fs-1 text-primary mb-2 d-block"></i>
<div class="py-2">
<i class="bi bi-diagram-3 fs-2 text-primary mb-2 d-block"></i>
<h6 class="fw-bold mb-1">Previsualización de Niveles Físicos</h6>
<p class="text-muted small mb-3">
Ajusta el número de plantas arriba para previsualizar los niveles que compondrán este edificio. Al guardar la sede, podrás incorporar aulas directamente en cada una de sus plantas.
@@ -355,16 +344,13 @@ document.addEventListener('DOMContentLoaded', function() {
}
function renderLevelChips(val) {
if (!floorLevelChips) return;
floorLevelChips.innerHTML = '';
const count = parseInt(val, 10) || 0;
if (count === 0 || isVirtualTarget()) {
if (floorModeBadge) floorModeBadge.textContent = 'Campus Virtual';
const chip = document.createElement('span');
chip.className = 'badge bg-info-subtle text-info border border-info-subtle px-2 py-1';
chip.innerHTML = '<i class="bi bi-cloud-check me-1"></i>Campus Virtual (Nivel Digital)';
floorLevelChips.appendChild(chip);
if (floorLevelChips) {
floorLevelChips.innerHTML = '<span class="badge bg-info-subtle text-info border border-info-subtle px-2 py-1"><i class="bi bi-cloud-check me-1"></i>Campus Virtual (Nivel Digital)</span>';
}
if (newBuildingPreview) {
newBuildingPreview.innerHTML = '<span class="badge bg-info-subtle text-info border px-3 py-2"><i class="bi bi-cloud me-1"></i>Campus Virtual (100% Remoto)</span>';
}
@@ -374,26 +360,28 @@ document.addEventListener('DOMContentLoaded', function() {
if (floorModeBadge) floorModeBadge.textContent = 'Presencial (' + count + ' pisos)';
const levels = [];
// Standard levels
levels.push({ code: 'PB', name: 'Planta Baja (PB)' });
for (let i = 1; i < count; i++) {
levels.push({ code: String(i), name: 'Piso ' + i });
}
levels.forEach(function(lvl) {
const chip = document.createElement('span');
chip.className = 'badge bg-primary-subtle text-primary border border-primary-subtle px-2 py-1';
chip.innerHTML = '<i class="bi bi-layers me-1"></i>' + lvl.name;
floorLevelChips.appendChild(chip);
});
if (floorLevelChips) {
floorLevelChips.innerHTML = '';
levels.forEach(function(lvl) {
const chip = document.createElement('span');
chip.className = 'badge bg-primary-subtle text-primary border border-primary-subtle px-2 py-1';
chip.innerHTML = '<i class="bi bi-layers me-1"></i>' + lvl.name;
floorLevelChips.appendChild(chip);
});
}
if (newBuildingPreview) {
newBuildingPreview.innerHTML = '';
levels.forEach(function(lvl) {
const bChip = document.createElement('div');
bChip.className = 'p-2 rounded bg-body border text-center';
bChip.className = 'p-2 rounded bg-body border text-center shadow-sm';
bChip.style.minWidth = '110px';
bChip.innerHTML = '<i class="bi bi-layers text-primary d-block mb-1"></i><small class="fw-bold d-block">' + lvl.name + '</small><span class="badge bg-light text-muted border" style="font-size: 0.7rem;">Nivel ' + lvl.code + '</span>';
bChip.innerHTML = '<i class="bi bi-layers text-primary d-block mb-1"></i><small class="fw-bold d-block">' + lvl.name + '</small><span class="badge bg-secondary-subtle text-secondary border" style="font-size: 0.7rem;">Nivel ' + lvl.code + '</span>';
newBuildingPreview.appendChild(bChip);
});
}
@@ -422,7 +410,6 @@ document.addEventListener('DOMContentLoaded', function() {
});
}
// Presets
const pPB = document.getElementById('presetPB');
const pPB1 = document.getElementById('presetPBplus1');
const pPB3 = document.getElementById('presetPBplus3');
@@ -433,7 +420,6 @@ document.addEventListener('DOMContentLoaded', function() {
if (pPB3) pPB3.addEventListener('click', function() { floorsInput.value = 4; renderLevelChips(4); });
if (pVirt) pVirt.addEventListener('click', function() { floorsInput.value = 0; renderLevelChips(0); });
// Initial render
renderLevelChips(floorsInput.value);
}