Modificación del de vista de dopcumentos del alumno

This commit is contained in:
2026-05-06 18:33:18 -06:00
parent 91d0813a9c
commit 964ed4bbd2
27 changed files with 1921 additions and 339 deletions
+19
View File
@@ -59,6 +59,22 @@ class GrupoDocente extends Component
->get();
}
private function refreshMateriasSelect(): void
{
$grupo = $this->grupo;
$materiasAsignadas = DB::table('docente_grupo')
->where('grupo_id', $grupo->id)
->pluck('materia_id')
->toArray();
$this->materiasSelect = Material::whereHas('carreraMaterial', function ($query) use ($grupo) {
$query->where('carreras.id', $grupo->plan->carrera);
})
->where('ciclo', $grupo->ciclo)
->when(!empty($materiasAsignadas), fn($q) => $q->whereNotIn('id', $materiasAsignadas))
->get();
}
public function guardar()
{
$this->validate([
@@ -71,6 +87,7 @@ class GrupoDocente extends Component
]);
$this->reset(['docente_id', 'materia_id']);
$this->refreshMateriasSelect();
$this->dispatch('close-modal-docente');
$this->dispatch('swal',
icon: 'success', title: '¡Listo!',
@@ -96,6 +113,8 @@ class GrupoDocente extends Component
$this->grupo->docentes()->wherePivot('materia_id', $materiaId)->detach($docenteId);
$this->refreshMateriasSelect();
$this->dispatch('swal',
icon: 'success', title: 'Eliminado',
text: 'Docente y sus tareas removidos correctamente',