Modificación del de vista de dopcumentos del alumno
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user