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
+50 -64
View File
@@ -8,30 +8,23 @@
<div class="container-fluid pt-5 mt-4"> <div class="container-fluid pt-5 mt-4">
<div class="row"> <div class="row">
<div class="col-xl-9 col-lg-11 mx-auto"> <div class="col-xl-9 col-lg-11 mx-auto">
<!-- Breadcrumb y Encabezado Superior --> <!-- Encabezado Principal Limpio (Sin breadcrumbs redundantes) -->
<div class="d-flex flex-wrap justify-content-between align-items-center mb-4 gap-2"> <div class="d-flex flex-wrap justify-content-between align-items-center mb-4 pb-2 border-bottom border-light-subtle gap-3">
<div> <div>
<nav aria-label="breadcrumb"> <h1 class="h3 mb-1">
<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">
<i class="bi bi-buildings text-primary me-2"></i> <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> </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>
<div class="d-flex gap-2"> <div class="d-flex gap-2">
{% if building %} {% if building %}
<a href="/buildings/view/{{ building.id }}" class="btn btn-outline-primary btn-sm"> <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> </a>
{% endif %} {% endif %}
<a href="/buildings/list_buildings" class="btn btn-outline-secondary btn-sm"> <a href="/buildings/list_buildings" class="btn btn-outline-secondary btn-sm">
@@ -79,11 +72,11 @@
{% endif %} {% endif %}
</div> </div>
<!-- Selector / Configurador de Pisos enriquecido --> <!-- Selector de Plantas Físicas -->
<div class="col-md-5"> <div class="col-md-5">
<label for="floorsInput" class="form-label fw-semibold d-flex justify-content-between align-items-center mb-1"> <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><i class="bi bi-layers me-1 text-primary"></i>Plantas Físicas</span>
<span class="badge bg-secondary-subtle text-secondary" id="floorModeBadge"> <span class="badge bg-secondary-subtle text-secondary-emphasis" id="floorModeBadge">
{% if building and building.is_virtual %}Campus Virtual{% else %}Presencial{% endif %} {% if building and building.is_virtual %}Campus Virtual{% else %}Presencial{% endif %}
</span> </span>
</label> </label>
@@ -95,31 +88,28 @@
{% if form.floors.errors %} {% if form.floors.errors %}
<div class="invalid-feedback d-block">{{ form.floors.errors[0] }}</div> <div class="invalid-feedback d-block">{{ form.floors.errors[0] }}</div>
{% endif %} {% 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> </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="col-12">
<div class="p-3 bg-body-tertiary rounded border border-light-subtle"> <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="d-flex flex-wrap justify-content-between align-items-center mb-2 gap-2">
<div class="small fw-bold text-secondary"> <div class="small fw-semibold text-secondary">
<i class="bi bi-diagram-3 me-1"></i>Configurador Rápido de Plantas y Niveles <i class="bi bi-lightning-charge me-1"></i>Presets Rápidos de Estructura:
</div> </div>
<div class="d-flex flex-wrap gap-1"> <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="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-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> </div>
<div class="d-flex flex-wrap align-items-center gap-1" id="floorLevelChips"> <div class="d-flex flex-wrap align-items-center gap-1" id="floorLevelChips"></div>
<!-- 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> </div>
</div> </div>
{% endif %}
<div class="col-12"> <div class="col-12">
{{ form.description.label(class="form-label fw-semibold") }} {{ form.description.label(class="form-label fw-semibold") }}
@@ -148,7 +138,7 @@
</div> </div>
</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 %} {% if building %}
<div class="card border-0 shadow-sm mb-4"> <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"> <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"> <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 <i class="bi bi-layers-fill text-primary me-2"></i>Plantas Físicas y Distribución de Aulas
</h5> </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>
<div class="d-flex flex-wrap align-items-center gap-2"> <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"> <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 <i class="bi bi-door-open me-1"></i>{{ classrooms|length }} Aulas
</span> </span>
<span class="badge bg-success-subtle text-success border border-success-subtle px-2 py-1"> <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> </span>
{% if not building.is_virtual %} {% if not building.is_virtual %}
<a href="/classrooms/add_classroom?building_id={{ building.id }}" class="btn btn-sm btn-success"> <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"> <div class="card-body p-4">
{% if building.is_virtual %} {% 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 class="alert alert-info border-0 shadow-sm d-flex align-items-center justify-content-between">
<div> <div>
<i class="bi bi-cloud-check fs-4 me-2"></i> <i class="bi bi-cloud-check fs-4 me-2"></i>
@@ -210,15 +199,15 @@
{% endif %} {% endif %}
<div> <div>
<span class="fw-bold fs-6">{{ f.floor_name }}</span> <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> </div>
<div class="d-flex align-items-center gap-2"> <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 <i class="bi bi-door-open me-1"></i>{{ f.classrooms|length }} aulas
</span> </span>
<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-people me-1"></i>{{ f.total_capacity }} pers. cap. <i class="bi bi-people me-1"></i>{{ f.total_capacity }} plazas
</span> </span>
<a href="/classrooms/add_classroom?building_id={{ building.id }}&floor={{ f.floor_code }}" <a href="/classrooms/add_classroom?building_id={{ building.id }}&floor={{ f.floor_code }}"
class="btn btn-sm btn-outline-success py-1 px-2" class="btn btn-sm btn-outline-success py-1 px-2"
@@ -233,31 +222,31 @@
{% if f.classrooms and f.classrooms|length > 0 %} {% if f.classrooms and f.classrooms|length > 0 %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-hover align-middle mb-0 table-sm"> <table class="table table-hover align-middle mb-0 table-sm">
<thead class="table-light"> <thead class="bg-body-tertiary">
<tr> <tr>
<th class="ps-3" style="width: 30%;">Aula / Espacio</th> <th class="ps-3 py-2 small fw-semibold text-secondary" style="width: 32%;">Aula / Espacio</th>
<th style="width: 20%;">Capacidad</th> <th class="py-2 small fw-semibold text-secondary" style="width: 22%;">Capacidad</th>
<th style="width: 25%;">Estado</th> <th class="py-2 small fw-semibold text-secondary" style="width: 22%;">Estado</th>
<th class="text-end pe-3" style="width: 25%;">Acciones</th> <th class="text-end pe-3 py-2 small fw-semibold text-secondary" style="width: 24%;">Acciones</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for c in f.classrooms %} {% for c in f.classrooms %}
<tr> <tr>
<td class="ps-3"> <td class="ps-3 py-2">
<a href="/classrooms/view_classroom?id={{ c.id }}" class="fw-semibold text-decoration-none"> <a href="/classrooms/view_classroom?id={{ c.id }}" class="fw-semibold text-decoration-none text-primary">
<i class="bi bi-door-open text-primary me-1"></i>{{ c.code_display or c.code or c.room_number }} <i class="bi bi-door-open me-1"></i>{{ c.code_display or c.code or c.room_number }}
</a> </a>
{% if c.description %} {% if c.description %}
<small class="text-muted d-block" style="font-size: 0.75rem;">{{ c.description }}</small> <small class="text-muted d-block" style="font-size: 0.75rem;">{{ c.description }}</small>
{% endif %} {% endif %}
</td> </td>
<td> <td class="py-2">
<span class="badge bg-primary-subtle text-primary border border-primary-subtle"> <span class="badge bg-primary-subtle text-primary border border-primary-subtle">
{{ c.capacity }} alumnos {{ c.capacity }} alumnos
</span> </span>
</td> </td>
<td> <td class="py-2">
{% if c.is_active %} {% if c.is_active %}
<span class="badge bg-success-subtle text-success border border-success-subtle"> <span class="badge bg-success-subtle text-success border border-success-subtle">
<i class="bi bi-check-circle me-1"></i>Activa <i class="bi bi-check-circle me-1"></i>Activa
@@ -268,7 +257,7 @@
</span> </span>
{% endif %} {% endif %}
</td> </td>
<td class="text-end pe-3"> <td class="text-end pe-3 py-2">
<div class="btn-group btn-group-sm"> <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"> <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 <i class="bi bi-pencil me-1"></i>Editar
@@ -317,8 +306,8 @@
</h5> </h5>
</div> </div>
<div class="card-body p-4 text-center"> <div class="card-body p-4 text-center">
<div class="py-3"> <div class="py-2">
<i class="bi bi-diagram-3 fs-1 text-primary mb-2 d-block"></i> <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> <h6 class="fw-bold mb-1">Previsualización de Niveles Físicos</h6>
<p class="text-muted small mb-3"> <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. 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) { function renderLevelChips(val) {
if (!floorLevelChips) return;
floorLevelChips.innerHTML = '';
const count = parseInt(val, 10) || 0; const count = parseInt(val, 10) || 0;
if (count === 0 || isVirtualTarget()) { if (count === 0 || isVirtualTarget()) {
if (floorModeBadge) floorModeBadge.textContent = 'Campus Virtual'; if (floorModeBadge) floorModeBadge.textContent = 'Campus Virtual';
const chip = document.createElement('span'); if (floorLevelChips) {
chip.className = 'badge bg-info-subtle text-info border border-info-subtle px-2 py-1'; 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>';
chip.innerHTML = '<i class="bi bi-cloud-check me-1"></i>Campus Virtual (Nivel Digital)'; }
floorLevelChips.appendChild(chip);
if (newBuildingPreview) { 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>'; 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)'; if (floorModeBadge) floorModeBadge.textContent = 'Presencial (' + count + ' pisos)';
const levels = []; const levels = [];
// Standard levels
levels.push({ code: 'PB', name: 'Planta Baja (PB)' }); levels.push({ code: 'PB', name: 'Planta Baja (PB)' });
for (let i = 1; i < count; i++) { for (let i = 1; i < count; i++) {
levels.push({ code: String(i), name: 'Piso ' + i }); levels.push({ code: String(i), name: 'Piso ' + i });
} }
if (floorLevelChips) {
floorLevelChips.innerHTML = '';
levels.forEach(function(lvl) { levels.forEach(function(lvl) {
const chip = document.createElement('span'); const chip = document.createElement('span');
chip.className = 'badge bg-primary-subtle text-primary border border-primary-subtle px-2 py-1'; 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; chip.innerHTML = '<i class="bi bi-layers me-1"></i>' + lvl.name;
floorLevelChips.appendChild(chip); floorLevelChips.appendChild(chip);
}); });
}
if (newBuildingPreview) { if (newBuildingPreview) {
newBuildingPreview.innerHTML = ''; newBuildingPreview.innerHTML = '';
levels.forEach(function(lvl) { levels.forEach(function(lvl) {
const bChip = document.createElement('div'); 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.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); newBuildingPreview.appendChild(bChip);
}); });
} }
@@ -422,7 +410,6 @@ document.addEventListener('DOMContentLoaded', function() {
}); });
} }
// Presets
const pPB = document.getElementById('presetPB'); const pPB = document.getElementById('presetPB');
const pPB1 = document.getElementById('presetPBplus1'); const pPB1 = document.getElementById('presetPBplus1');
const pPB3 = document.getElementById('presetPBplus3'); 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 (pPB3) pPB3.addEventListener('click', function() { floorsInput.value = 4; renderLevelChips(4); });
if (pVirt) pVirt.addEventListener('click', function() { floorsInput.value = 0; renderLevelChips(0); }); if (pVirt) pVirt.addEventListener('click', function() { floorsInput.value = 0; renderLevelChips(0); });
// Initial render
renderLevelChips(floorsInput.value); renderLevelChips(floorsInput.value);
} }
+10 -12
View File
@@ -4,17 +4,11 @@
{% block content %} {% block content %}
<div class="container-fluid pt-5 mt-4"> <div class="container-fluid pt-5 mt-4">
<!-- Breadcrumb & Header --> <!-- Header Limpio sin breadcrumbs redundantes -->
<div class="row mb-4 align-items-center"> <div class="row mb-4 align-items-center pb-2 border-bottom border-light-subtle">
<div class="col-md-7"> <div class="col-md-7">
<nav aria-label="breadcrumb"> <h1 class="h3 mb-1 d-flex align-items-center flex-wrap gap-2">
<ol class="breadcrumb mb-1 small"> <i class="bi bi-buildings text-primary me-1"></i> {{ building.name }}
<li class="breadcrumb-item"><a href="/buildings/list_buildings">Edificios</a></li>
<li class="breadcrumb-item active">{{ building.name }}</li>
</ol>
</nav>
<h1 class="h3 mb-0 d-flex align-items-center flex-wrap gap-2">
<i class="bi bi-building text-primary"></i> {{ building.name }}
<span class="badge bg-secondary-subtle text-secondary font-monospace border fs-6">{{ building.code or 'EDIF' }}</span> <span class="badge bg-secondary-subtle text-secondary font-monospace border fs-6">{{ building.code or 'EDIF' }}</span>
{% if building.is_active %} {% if building.is_active %}
<span class="badge bg-success-subtle text-success border border-success-subtle fs-6"> <span class="badge bg-success-subtle text-success border border-success-subtle fs-6">
@@ -26,13 +20,17 @@
</span> </span>
{% endif %} {% endif %}
</h1> </h1>
<p class="text-muted small mb-0">{{ building.address or 'Sede institucional UniCABA' }}</p>
</div> </div>
<div class="col-md-5 text-md-end mt-3 mt-md-0"> <div class="col-md-5 text-md-end mt-3 mt-md-0">
<a href="/buildings/list_buildings" class="btn btn-outline-secondary btn-sm me-2">
<i class="bi bi-arrow-left me-1"></i>Volver a Edificios
</a>
{% if user.has_permission('classrooms', 'read_write') or user.is_admin() or user.is_bedelia() %} {% if user.has_permission('classrooms', 'read_write') or user.is_admin() or user.is_bedelia() %}
<a href="/buildings/edit/{{ building.id }}" class="btn btn-outline-secondary me-2"> <a href="/buildings/edit/{{ building.id }}" class="btn btn-outline-primary btn-sm me-2">
<i class="bi bi-pencil me-1"></i>Editar Edificio <i class="bi bi-pencil me-1"></i>Editar Edificio
</a> </a>
<a href="/classrooms/add_classroom?building_id={{ building.id }}" class="btn btn-primary"> <a href="/classrooms/add_classroom?building_id={{ building.id }}" class="btn btn-success btn-sm">
<i class="bi bi-plus-circle me-1"></i>Nueva Aula <i class="bi bi-plus-circle me-1"></i>Nueva Aula
</a> </a>
{% endif %} {% endif %}