fix(ui): improve subjects modals and table layout preventing element clipping (v3.8.22)
This commit is contained in:
@@ -3,6 +3,33 @@
|
||||
{% block title %}Gestión de Asignaturas - Edu-Space Admin{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<style>
|
||||
.hover-item {
|
||||
transition: all 0.15s ease-in-out;
|
||||
}
|
||||
.hover-item:hover {
|
||||
background-color: var(--bs-primary-bg-subtle, rgba(13, 110, 253, 0.08)) !important;
|
||||
border-color: var(--bs-primary-border-subtle, #3b82f6) !important;
|
||||
}
|
||||
.hover-item:has(.career-checkbox:checked) {
|
||||
background-color: rgba(13, 110, 253, 0.12) !important;
|
||||
border-color: var(--bs-primary) !important;
|
||||
}
|
||||
.cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
.fs-xs {
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.border-end-md {
|
||||
border-right: 1px solid var(--bs-border-color) !important;
|
||||
}
|
||||
}
|
||||
.modal-dialog-scrollable .modal-body {
|
||||
max-height: calc(100vh - 210px);
|
||||
}
|
||||
</style>
|
||||
<div class="container-fluid pt-5 mt-4">
|
||||
<!-- Header -->
|
||||
<div class="d-flex flex-column flex-md-row justify-content-between align-items-md-center gap-3 mb-4">
|
||||
@@ -123,15 +150,15 @@
|
||||
<table class="table table-hover align-middle mb-0">
|
||||
<thead class="bg-body-tertiary">
|
||||
<tr>
|
||||
<th>Código</th>
|
||||
<th>Nombre de la Asignatura</th>
|
||||
<th>Carrera</th>
|
||||
<th>Departamento</th>
|
||||
<th>Créditos</th>
|
||||
<th>Comisiones</th>
|
||||
<th>Estado</th>
|
||||
<th style="min-width: 105px;">Código</th>
|
||||
<th style="min-width: 250px;">Nombre de la Asignatura</th>
|
||||
<th style="min-width: 220px;">Carrera(s) Vinculada(s)</th>
|
||||
<th style="min-width: 180px;">Departamento</th>
|
||||
<th style="min-width: 85px;" class="text-center">Créditos</th>
|
||||
<th style="min-width: 100px;" class="text-center">Comisiones</th>
|
||||
<th style="min-width: 90px;" class="text-center">Estado</th>
|
||||
{% if can_edit %}
|
||||
<th class="text-end">Acciones</th>
|
||||
<th class="text-end" style="min-width: 110px;">Acciones</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -142,9 +169,9 @@
|
||||
<span class="badge font-monospace bg-primary-subtle text-primary border">{{ s.code }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="fw-bold text-body">{{ s.name }}</span>
|
||||
<span class="fw-bold text-body d-block">{{ s.name }}</span>
|
||||
{% if s.description %}
|
||||
<small class="text-muted d-block text-truncate" style="max-width: 300px;">{{ s.description }}</small>
|
||||
<small class="text-muted d-block text-wrap" style="max-width: 380px;">{{ s.description }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
@@ -167,15 +194,15 @@
|
||||
<td>
|
||||
<span class="small text-muted">{{ s.department or '-' }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<td class="text-center">
|
||||
<span class="badge bg-light text-dark border">{{ s.credits }} cr.</span>
|
||||
</td>
|
||||
<td>
|
||||
<td class="text-center">
|
||||
<span class="badge bg-info-subtle text-info border">
|
||||
<i class="bi bi-diagram-3 me-1"></i>{{ s.commissions|length if s.commissions else 0 }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<td class="text-center">
|
||||
<span class="badge rounded-pill {% if s.is_active %}bg-success-subtle text-success border border-success-subtle{% else %}bg-secondary-subtle text-secondary border{% endif %}">
|
||||
{% if s.is_active %}Activa{% else %}Inactiva{% endif %}
|
||||
</span>
|
||||
@@ -267,71 +294,86 @@
|
||||
<!-- Modal Nueva Asignatura -->
|
||||
{% if can_edit %}
|
||||
<div class="modal fade" id="modalAddSubject" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
|
||||
<div class="modal-content shadow border-0">
|
||||
<form method="POST" action="/admin/subject_add">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title h6 fw-bold">
|
||||
<div class="modal-header border-bottom py-3">
|
||||
<h5 class="modal-title h6 fw-bold mb-0">
|
||||
<i class="bi bi-book text-primary me-2"></i>Nueva Asignatura
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row g-2 mb-3">
|
||||
<div class="col-md-5">
|
||||
<label class="form-label small fw-semibold">Código *</label>
|
||||
<input type="text" name="code" class="form-control form-control-sm font-monospace" placeholder="ej. ASIG0015" required>
|
||||
<div class="modal-body p-4">
|
||||
<div class="row g-4">
|
||||
<!-- Columna Izquierda: Datos de la Asignatura -->
|
||||
<div class="col-md-6 border-end-md">
|
||||
<h6 class="fw-bold mb-3 text-primary d-flex align-items-center">
|
||||
<i class="bi bi-info-circle me-2"></i>Información Académica
|
||||
</h6>
|
||||
<div class="row g-2 mb-3">
|
||||
<div class="col-7">
|
||||
<label class="form-label small fw-semibold">Código *</label>
|
||||
<input type="text" name="code" class="form-control form-control-sm font-monospace" placeholder="ej. ASIG0015" required>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<label class="form-label small fw-semibold">Créditos *</label>
|
||||
<input type="number" name="credits" class="form-control form-control-sm" value="4" min="1" max="20" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-semibold">Nombre de la Asignatura *</label>
|
||||
<input type="text" name="name" class="form-control form-control-sm" placeholder="ej. Álgebra Lineal" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-semibold">Departamento / Área</label>
|
||||
<input type="text" name="department" class="form-control form-control-sm" placeholder="ej. Ciencias Exactas, Informática">
|
||||
</div>
|
||||
<div class="mb-0">
|
||||
<label class="form-label small fw-semibold">Descripción / Objetivos</label>
|
||||
<textarea name="description" class="form-control form-control-sm" rows="3" placeholder="Programa de la materia, contenidos mínimos..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<label class="form-label small fw-semibold">Créditos</label>
|
||||
<input type="number" name="credits" class="form-control form-control-sm" value="4" min="1" max="20">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-semibold">Nombre de la Asignatura *</label>
|
||||
<input type="text" name="name" class="form-control form-control-sm" placeholder="ej. Álgebra Lineal" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-1">
|
||||
<label class="form-label small fw-semibold mb-0">
|
||||
<i class="bi bi-mortarboard text-primary me-1"></i>Carreras Vinculadas
|
||||
</label>
|
||||
<span class="badge bg-secondary-subtle text-secondary border rounded-pill" id="addSubjectCareerCount">0 seleccionadas</span>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-center mb-2 gap-2">
|
||||
<input type="text" class="form-control form-control-sm career-filter-input" placeholder="Filtrar carreras..." data-target="addSubjectCareerList">
|
||||
<div class="btn-group btn-group-sm flex-shrink-0">
|
||||
|
||||
<!-- Columna Derecha: Carreras Vinculadas -->
|
||||
<div class="col-md-6">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h6 class="fw-bold mb-0 text-primary d-flex align-items-center">
|
||||
<i class="bi bi-mortarboard me-2"></i>Planes y Carreras
|
||||
</h6>
|
||||
<span class="badge bg-secondary-subtle text-secondary border rounded-pill px-2 py-1 fs-xs" id="addSubjectCareerCount">0 seleccionadas</span>
|
||||
</div>
|
||||
<div class="input-group input-group-sm mb-2">
|
||||
<span class="input-group-text bg-body-tertiary"><i class="bi bi-search text-muted"></i></span>
|
||||
<input type="text" class="form-control career-filter-input" placeholder="Filtrar carreras..." data-target="addSubjectCareerList">
|
||||
<button type="button" class="btn btn-outline-secondary select-all-careers" data-target="addSubjectCareerList" title="Seleccionar todas las visibles">Todas</button>
|
||||
<button type="button" class="btn btn-outline-secondary deselect-all-careers" data-target="addSubjectCareerList" title="Deseleccionar todas">Ninguna</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="border rounded p-2 bg-body-tertiary" style="max-height: 170px; overflow-y: auto;" id="addSubjectCareerList">
|
||||
{% for c in careers %}
|
||||
<div class="form-check career-item py-1 px-2 mb-1 rounded">
|
||||
<input class="form-check-input career-checkbox" type="checkbox" name="career_ids" value="{{ c.id }}" id="add_career_{{ c.id }}">
|
||||
<label class="form-check-label small d-flex justify-content-between align-items-center w-100 cursor-pointer" for="add_career_{{ c.id }}">
|
||||
<span class="career-label-text fw-medium">{{ c.name }}</span>
|
||||
<span class="badge bg-secondary-subtle text-secondary font-monospace ms-2">{{ c.code or ('ID ' + c.id) }}</span>
|
||||
<div class="border rounded p-2 bg-body-tertiary" style="max-height: 250px; min-height: 180px; overflow-y: auto;" id="addSubjectCareerList">
|
||||
{% for c in careers %}
|
||||
<label class="career-item d-flex align-items-center justify-content-between p-2 mb-1 rounded border border-secondary-subtle bg-body hover-item cursor-pointer" for="add_career_{{ c.id }}">
|
||||
<div class="form-check mb-0 d-flex align-items-center">
|
||||
<input class="form-check-input career-checkbox me-2" type="checkbox" name="career_ids" value="{{ c.id }}" id="add_career_{{ c.id }}">
|
||||
<span class="career-label-text small fw-medium">{{ c.name }}</span>
|
||||
</div>
|
||||
<span class="badge bg-secondary-subtle text-secondary font-monospace ms-2 flex-shrink-0">{{ c.code or ('ID ' + c.id) }}</span>
|
||||
</label>
|
||||
{% else %}
|
||||
<p class="text-muted small mb-0 p-3 text-center">No hay carreras registradas.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="text-muted small mb-0 p-2 text-center">No hay carreras registradas.</p>
|
||||
{% endfor %}
|
||||
<small class="text-muted d-block mt-2 lh-sm fs-xs">
|
||||
<i class="bi bi-info-circle me-1"></i>Podés asociar la asignatura a una o varias carreras para compartirla en sus planes de estudio.
|
||||
</small>
|
||||
</div>
|
||||
<small class="text-muted d-block mt-1">Podés seleccionar una o más carreras para asociar esta asignatura a múltiples planes de estudio.</small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-semibold">Departamento / Área</label>
|
||||
<input type="text" name="department" class="form-control form-control-sm" placeholder="ej. Ciencias Exactas, Informática">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-semibold">Descripción</label>
|
||||
<textarea name="description" class="form-control form-control-sm" rows="2" placeholder="Programa de la materia..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal">Cancelar</button>
|
||||
<button type="submit" class="btn btn-sm btn-primary">Crear Asignatura</button>
|
||||
<div class="modal-footer bg-body-tertiary border-top py-2 px-3">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary px-3" data-bs-dismiss="modal">
|
||||
<i class="bi bi-x-lg me-1"></i>Cancelar
|
||||
</button>
|
||||
<button type="submit" class="btn btn-sm btn-primary px-4 shadow-sm">
|
||||
<i class="bi bi-plus-lg me-1"></i>Crear Asignatura
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -340,76 +382,91 @@
|
||||
|
||||
<!-- Modal Editar Asignatura (Global fuera de la tabla para evitar problemas de visualización) -->
|
||||
<div class="modal fade" id="modalEditSubject" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
|
||||
<div class="modal-content shadow border-0">
|
||||
<form method="POST" action="/admin/subject_edit" id="formEditSubject">
|
||||
<input type="hidden" name="id" id="editSubjectId">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title h6 fw-bold">
|
||||
<div class="modal-header border-bottom py-3">
|
||||
<h5 class="modal-title h6 fw-bold mb-0">
|
||||
<i class="bi bi-pencil-square text-primary me-2"></i>Editar Asignatura
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row g-2 mb-3">
|
||||
<div class="col-md-5">
|
||||
<label class="form-label small fw-semibold">Código *</label>
|
||||
<input type="text" name="code" id="editSubjectCode" class="form-control form-control-sm font-monospace" required>
|
||||
<div class="modal-body p-4">
|
||||
<div class="row g-4">
|
||||
<!-- Columna Izquierda: Datos de la Asignatura -->
|
||||
<div class="col-md-6 border-end-md">
|
||||
<h6 class="fw-bold mb-3 text-primary d-flex align-items-center">
|
||||
<i class="bi bi-info-circle me-2"></i>Información Académica
|
||||
</h6>
|
||||
<div class="row g-2 mb-3">
|
||||
<div class="col-7">
|
||||
<label class="form-label small fw-semibold">Código *</label>
|
||||
<input type="text" name="code" id="editSubjectCode" class="form-control form-control-sm font-monospace" required>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<label class="form-label small fw-semibold">Créditos *</label>
|
||||
<input type="number" name="credits" id="editSubjectCredits" class="form-control form-control-sm" min="1" max="20" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-semibold">Nombre de la Asignatura *</label>
|
||||
<input type="text" name="name" id="editSubjectName" class="form-control form-control-sm" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-semibold">Departamento / Área</label>
|
||||
<input type="text" name="department" id="editSubjectDept" class="form-control form-control-sm" placeholder="ej. Ciencias Exactas, Informática">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-semibold">Descripción / Objetivos</label>
|
||||
<textarea name="description" id="editSubjectDesc" class="form-control form-control-sm" rows="3" placeholder="Programa de la materia..."></textarea>
|
||||
</div>
|
||||
<div class="form-check form-switch mt-2">
|
||||
<input class="form-check-input" type="checkbox" name="is_active" id="editSubjectActive" role="switch">
|
||||
<label class="form-check-label small fw-semibold" for="editSubjectActive">Asignatura Activa</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<label class="form-label small fw-semibold">Créditos</label>
|
||||
<input type="number" name="credits" id="editSubjectCredits" class="form-control form-control-sm" min="1" max="20">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-semibold">Nombre de la Asignatura *</label>
|
||||
<input type="text" name="name" id="editSubjectName" class="form-control form-control-sm" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-1">
|
||||
<label class="form-label small fw-semibold mb-0">
|
||||
<i class="bi bi-mortarboard text-primary me-1"></i>Carreras Vinculadas
|
||||
</label>
|
||||
<span class="badge bg-secondary-subtle text-secondary border rounded-pill" id="editSubjectCareerCount">0 seleccionadas</span>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-center mb-2 gap-2">
|
||||
<input type="text" class="form-control form-control-sm career-filter-input" placeholder="Filtrar carreras..." data-target="editSubjectCareerList">
|
||||
<div class="btn-group btn-group-sm flex-shrink-0">
|
||||
|
||||
<!-- Columna Derecha: Carreras Vinculadas -->
|
||||
<div class="col-md-6">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h6 class="fw-bold mb-0 text-primary d-flex align-items-center">
|
||||
<i class="bi bi-mortarboard me-2"></i>Planes y Carreras
|
||||
</h6>
|
||||
<span class="badge bg-secondary-subtle text-secondary border rounded-pill px-2 py-1 fs-xs" id="editSubjectCareerCount">0 seleccionadas</span>
|
||||
</div>
|
||||
<div class="input-group input-group-sm mb-2">
|
||||
<span class="input-group-text bg-body-tertiary"><i class="bi bi-search text-muted"></i></span>
|
||||
<input type="text" class="form-control career-filter-input" placeholder="Filtrar carreras..." data-target="editSubjectCareerList">
|
||||
<button type="button" class="btn btn-outline-secondary select-all-careers" data-target="editSubjectCareerList" title="Seleccionar todas las visibles">Todas</button>
|
||||
<button type="button" class="btn btn-outline-secondary deselect-all-careers" data-target="editSubjectCareerList" title="Deseleccionar todas">Ninguna</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="border rounded p-2 bg-body-tertiary" style="max-height: 170px; overflow-y: auto;" id="editSubjectCareerList">
|
||||
{% for c in careers %}
|
||||
<div class="form-check career-item py-1 px-2 mb-1 rounded">
|
||||
<input class="form-check-input career-checkbox" type="checkbox" name="career_ids" value="{{ c.id }}" id="edit_career_{{ c.id }}">
|
||||
<label class="form-check-label small d-flex justify-content-between align-items-center w-100 cursor-pointer" for="edit_career_{{ c.id }}">
|
||||
<span class="career-label-text fw-medium">{{ c.name }}</span>
|
||||
<span class="badge bg-secondary-subtle text-secondary font-monospace ms-2">{{ c.code or ('ID ' + c.id) }}</span>
|
||||
<div class="border rounded p-2 bg-body-tertiary" style="max-height: 250px; min-height: 180px; overflow-y: auto;" id="editSubjectCareerList">
|
||||
{% for c in careers %}
|
||||
<label class="career-item d-flex align-items-center justify-content-between p-2 mb-1 rounded border border-secondary-subtle bg-body hover-item cursor-pointer" for="edit_career_{{ c.id }}">
|
||||
<div class="form-check mb-0 d-flex align-items-center">
|
||||
<input class="form-check-input career-checkbox me-2" type="checkbox" name="career_ids" value="{{ c.id }}" id="edit_career_{{ c.id }}">
|
||||
<span class="career-label-text small fw-medium">{{ c.name }}</span>
|
||||
</div>
|
||||
<span class="badge bg-secondary-subtle text-secondary font-monospace ms-2 flex-shrink-0">{{ c.code or ('ID ' + c.id) }}</span>
|
||||
</label>
|
||||
{% else %}
|
||||
<p class="text-muted small mb-0 p-3 text-center">No hay carreras registradas.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="text-muted small mb-0 p-2 text-center">No hay carreras registradas.</p>
|
||||
{% endfor %}
|
||||
<small class="text-muted d-block mt-2 lh-sm fs-xs">
|
||||
<i class="bi bi-info-circle me-1"></i>Podés asociar la asignatura a una o varias carreras para compartirla en sus planes de estudio.
|
||||
</small>
|
||||
</div>
|
||||
<small class="text-muted d-block mt-1">Podés seleccionar una o más carreras para asociar esta asignatura a múltiples planes de estudio.</small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-semibold">Departamento / Área</label>
|
||||
<input type="text" name="department" id="editSubjectDept" class="form-control form-control-sm">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-semibold">Descripción / Objetivos</label>
|
||||
<textarea name="description" id="editSubjectDesc" class="form-control form-control-sm" rows="2"></textarea>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="is_active" id="editSubjectActive">
|
||||
<label class="form-check-label small" for="editSubjectActive">Asignatura Activa</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal">Cancelar</button>
|
||||
<button type="submit" class="btn btn-sm btn-primary">Guardar Cambios</button>
|
||||
<div class="modal-footer bg-body-tertiary border-top py-2 px-3">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary px-3" data-bs-dismiss="modal">
|
||||
<i class="bi bi-x-lg me-1"></i>Cancelar
|
||||
</button>
|
||||
<button type="submit" class="btn btn-sm btn-primary px-4 shadow-sm">
|
||||
<i class="bi bi-check-lg me-1"></i>Guardar Cambios
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -453,9 +510,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
var checked = container.querySelectorAll('.career-checkbox:checked').length;
|
||||
badge.textContent = checked + (checked === 1 ? ' seleccionada' : ' seleccionadas');
|
||||
if (checked > 0) {
|
||||
badge.className = 'badge bg-primary text-white rounded-pill';
|
||||
badge.className = 'badge bg-primary text-white rounded-pill px-2 py-1 fs-xs';
|
||||
} else {
|
||||
badge.className = 'badge bg-secondary-subtle text-secondary border rounded-pill';
|
||||
badge.className = 'badge bg-secondary-subtle text-secondary border rounded-pill px-2 py-1 fs-xs';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user