fix(academic): commission subjects and shared careers mapping, role-based scoping and gradebook milestones (v3.8.20)
This commit is contained in:
@@ -64,12 +64,20 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="fw-bold mb-1">{{ commission.subject.name }}</h5>
|
||||
<div class="d-flex align-items-center gap-2 mb-3 flex-wrap">
|
||||
<span class="badge bg-secondary-subtle text-secondary font-monospace border">{{ commission.subject.code }}</span>
|
||||
<span class="badge bg-primary-subtle text-primary border">
|
||||
<i class="bi bi-mortarboard me-1"></i>{{ commission.career_name or (commission.subject.career_obj.name if commission.subject.career_obj else 'Carrera General') }}
|
||||
</span>
|
||||
<h5 class="fw-bold mb-1">{{ commission.subject.name or commission.subject_name }}</h5>
|
||||
<div class="d-flex align-items-center gap-1 mb-3 flex-wrap">
|
||||
<span class="badge bg-secondary-subtle text-secondary font-monospace border">{{ commission.subject.code or commission.subject_code }}</span>
|
||||
{% if commission.careers and commission.careers|length > 0 %}
|
||||
{% for c_obj in commission.careers %}
|
||||
<span class="badge bg-primary-subtle text-primary border" title="Carrera Vinculada">
|
||||
<i class="bi bi-mortarboard me-1"></i>{{ c_obj.name }}
|
||||
</span>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<span class="badge bg-primary-subtle text-primary border" title="Carrera">
|
||||
<i class="bi bi-mortarboard me-1"></i>{{ commission.career_name or 'Carrera General' }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-wrap gap-2 mb-3">
|
||||
|
||||
@@ -198,15 +198,17 @@
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="fw-semibold text-primary">{{ comm.subject.name }}</div>
|
||||
<div class="fw-bold text-primary fs-6">{{ comm.subject.name or comm.subject_name }}</div>
|
||||
<div class="d-flex align-items-center gap-1 mt-1 flex-wrap">
|
||||
<span class="badge bg-secondary-subtle text-secondary border font-monospace">{{ comm.subject.code }}</span>
|
||||
{% if comm.subject.code or comm.subject_code %}
|
||||
<span class="badge bg-secondary-subtle text-secondary border font-monospace">{{ comm.subject.code or comm.subject_code }}</span>
|
||||
{% endif %}
|
||||
{% if comm.careers and (comm.careers | length > 0) %}
|
||||
{% for c_obj in comm.careers %}
|
||||
<span class="badge bg-primary-subtle text-primary border" title="Carrera"><i class="bi bi-mortarboard me-1"></i>{{ c_obj.name }}</span>
|
||||
<span class="badge bg-primary-subtle text-primary border" title="Carrera Vinculada"><i class="bi bi-mortarboard me-1"></i>{{ c_obj.name }}</span>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<span class="badge bg-primary-subtle text-primary border" title="Carrera"><i class="bi bi-mortarboard me-1"></i>{{ comm.career_name or comm.subject.career_name or 'Carrera General' }}</span>
|
||||
<span class="badge bg-primary-subtle text-primary border" title="Carrera Vinculada"><i class="bi bi-mortarboard me-1"></i>{{ comm.career_name or 'Carrera General' }}</span>
|
||||
{% endif %}
|
||||
<small class="text-muted ms-1">{{ comm.semester }} {{ comm.year }}</small>
|
||||
</div>
|
||||
@@ -403,21 +405,38 @@
|
||||
<label for="add_subject_id" class="form-label fw-semibold small">
|
||||
<i class="bi bi-book text-primary me-1"></i>Asignatura / Materia Asociada <span class="text-danger">*</span>
|
||||
</label>
|
||||
<select class="form-select" id="add_subject_id" name="subject_id" required>
|
||||
<select class="form-select form-select-sm" id="add_subject_id" name="subject_id" required>
|
||||
<option value="">-- Seleccione la materia a vincular... --</option>
|
||||
{% for s in subjects %}
|
||||
<option value="{{ s.id }}">
|
||||
{{ s.code }} · {{ s.name }} ({{ s.career_name or s.career or 'Carrera General' }})
|
||||
{% set car_names = [] %}
|
||||
{% if s.careers and s.careers|length > 0 %}
|
||||
{% for cr in s.careers %}{% set _ = car_names.push(cr.name) %}{% endfor %}
|
||||
{% elif s.career_name %}
|
||||
{% set _ = car_names.push(s.career_name) %}
|
||||
{% endif %}
|
||||
{% set car_label = car_names|join(', ') if car_names|length > 0 else 'Carrera General' %}
|
||||
<option value="{{ s.id }}" data-careers="{{ car_label }}">
|
||||
{{ s.code }} — {{ s.name }} [Carrera(s): {{ car_label }}]
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="form-text small">La comisión heredará el plan de estudios y carrera de la materia.</div>
|
||||
<div id="add_subject_careers_box" class="alert alert-info py-1 px-2 small mt-2 mb-0 d-flex align-items-center justify-content-between">
|
||||
<div>
|
||||
<i class="bi bi-mortarboard-fill me-1 text-primary"></i>
|
||||
<strong>Carrera(s) heredadas:</strong>
|
||||
<span id="add_subject_careers_text" class="fw-semibold ms-1">-</span>
|
||||
</div>
|
||||
<a href="/admin/subjects_list" target="_blank" class="small text-decoration-none fw-semibold">
|
||||
<i class="bi bi-box-arrow-up-right me-1"></i>Gestionar carreras en Materias
|
||||
</a>
|
||||
</div>
|
||||
<div class="form-text small mt-1">La comisión hereda automáticamente todas las carreras asociadas a esta asignatura.</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<label for="add_code" class="form-label fw-semibold small">
|
||||
<i class="bi bi-tag text-secondary me-1"></i>Código / Identificador <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input type="text" class="form-control" id="add_code" name="code" placeholder="Ej: Comisión A, B, N1, Única" required>
|
||||
<input type="text" class="form-control form-control-sm" id="add_code" name="code" placeholder="Ej: Comisión A, B, N1, Única" required>
|
||||
<div class="form-text small">Identificador visible para docentes y alumnos.</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -532,9 +551,29 @@
|
||||
</label>
|
||||
<select class="form-select form-select-sm" id="edit_subject_id" name="subject_id" required>
|
||||
{% for subj in subjects %}
|
||||
<option value="{{ subj.id }}">{{ subj.code }} — {{ subj.name }} ({{ subj.career_name or 'General' }})</option>
|
||||
{% set car_names = [] %}
|
||||
{% if subj.careers and subj.careers|length > 0 %}
|
||||
{% for cr in subj.careers %}{% set _ = car_names.push(cr.name) %}{% endfor %}
|
||||
{% elif subj.career_name %}
|
||||
{% set _ = car_names.push(subj.career_name) %}
|
||||
{% endif %}
|
||||
{% set car_label = car_names|join(', ') if car_names|length > 0 else 'Carrera General' %}
|
||||
<option value="{{ subj.id }}" data-careers="{{ car_label }}">
|
||||
{{ subj.code }} — {{ subj.name }} [Carrera(s): {{ car_label }}]
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div id="edit_subject_careers_box" class="alert alert-info py-1 px-2 small mt-2 mb-0 d-flex align-items-center justify-content-between">
|
||||
<div>
|
||||
<i class="bi bi-mortarboard-fill me-1 text-primary"></i>
|
||||
<strong>Carrera(s) heredadas:</strong>
|
||||
<span id="edit_subject_careers_text" class="fw-semibold ms-1">-</span>
|
||||
</div>
|
||||
<a href="/admin/subjects_list" target="_blank" class="small text-decoration-none fw-semibold">
|
||||
<i class="bi bi-box-arrow-up-right me-1"></i>Gestionar carreras en Materias
|
||||
</a>
|
||||
</div>
|
||||
<div class="form-text small mt-1">La comisión hereda automáticamente todas las carreras asociadas a esta asignatura.</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<label for="edit_code" class="form-label fw-semibold small">
|
||||
@@ -708,6 +747,31 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
editTermSelect.addEventListener('change', () => syncTerm(editTermSelect, editYearInput, editSemSelect));
|
||||
}
|
||||
|
||||
// Sincronización de Carreras Heredadas de la Materia
|
||||
function syncSubjectCareers(selectElem, textElem) {
|
||||
if (!selectElem || !textElem) return;
|
||||
const opt = selectElem.options[selectElem.selectedIndex];
|
||||
if (opt && opt.value) {
|
||||
const careers = opt.getAttribute('data-careers') || 'Carrera General';
|
||||
textElem.textContent = careers;
|
||||
} else {
|
||||
textElem.textContent = '-';
|
||||
}
|
||||
}
|
||||
|
||||
const addSubjectSelect = document.getElementById('add_subject_id');
|
||||
const addSubjectCareersText = document.getElementById('add_subject_careers_text');
|
||||
if (addSubjectSelect && addSubjectCareersText) {
|
||||
addSubjectSelect.addEventListener('change', () => syncSubjectCareers(addSubjectSelect, addSubjectCareersText));
|
||||
syncSubjectCareers(addSubjectSelect, addSubjectCareersText);
|
||||
}
|
||||
|
||||
const editSubjectSelect = document.getElementById('edit_subject_id');
|
||||
const editSubjectCareersText = document.getElementById('edit_subject_careers_text');
|
||||
if (editSubjectSelect && editSubjectCareersText) {
|
||||
editSubjectSelect.addEventListener('change', () => syncSubjectCareers(editSubjectSelect, editSubjectCareersText));
|
||||
}
|
||||
|
||||
// Poblar Modal Editar Comisión
|
||||
const modalEdit = document.getElementById('modalEditCommission');
|
||||
if (modalEdit) {
|
||||
@@ -716,7 +780,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
if (!btn) return;
|
||||
document.getElementById('edit_commission_id').value = btn.getAttribute('data-id') || '';
|
||||
document.getElementById('edit_code').value = btn.getAttribute('data-code') || '';
|
||||
document.getElementById('edit_subject_id').value = btn.getAttribute('data-subject-id') || '';
|
||||
const subjSelect = document.getElementById('edit_subject_id');
|
||||
subjSelect.value = btn.getAttribute('data-subject-id') || '';
|
||||
syncSubjectCareers(subjSelect, editSubjectCareersText);
|
||||
document.getElementById('edit_academic_term_id').value = btn.getAttribute('data-academic-term-id') || '';
|
||||
document.getElementById('edit_semester').value = btn.getAttribute('data-semester') || '1C';
|
||||
document.getElementById('edit_year').value = btn.getAttribute('data-year') || '2026';
|
||||
|
||||
Reference in New Issue
Block a user