Alta de modificaciones de grupo con alumbnos y docentes

This commit is contained in:
2026-04-18 16:00:39 -06:00
parent c502d047e9
commit 2d73e8a2b0
34 changed files with 1256 additions and 247 deletions
+93
View File
@@ -0,0 +1,93 @@
@extends('layouts.landing')
@section('title',"Crear")
@section('content')
<div class="container-fluid">
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Crear Docente</h6>
<a href="{{route('docente.index')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Regresar</a>
</div>
</div>
<div class="card-body">
@if (session('warn'))
<div class="alert alert-danger">
<strong>{{session('warn')}}</strong>
</div>
@endif
<form action="{{route('docente.store')}}" method="POST">
@csrf
<div class="mb-3">
<label class="small mb-1">Nombre</label>
<input class="form-control" name="name" value="{{ old('name') }}">
</div>
<div class="mb-3">
<label class="small mb-1">Apellido Paterno</label>
<input class="form-control" name="apellidoPaterno" value="{{ old('apellidoPaterno') }}">
</div>
<div class="mb-3">
<label class="small mb-1">Apellido Materno</label>
<input class="form-control" name="apellidoMaterno" value="{{ old('apellidoMaterno') }}">
</div>
<div class="mb-3">
<label class="small mb-1">Correo</label>
<input class="form-control" name="email" value="{{ old('email') }}">
</div>
<div class="mb-3">
<label class="small mb-1">Telefono</label>
<input class="form-control" name="telefono" type="number" value="{{ old('telefono') }}">
</div>
<div class="mb-3">
<label class="small mb-1">Dirección</label>
<input class="form-control" name="direccion" value="{{ old('direccion') }}">
</div>
<div class="mb-3">
<label for="plantel">Seleccionar campus</label>
<select class="form-control" name="plantel" value="{{ old('plantel') }}">
<option value="0">Seleccionar..</option>
@foreach ($plantels as $plantel)
<option value="{{ $plantel->id }}">{{$plantel->name}}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="rol">Seleccionar rol</label>
<select class="form-control" name="rol" value="{{ old('rol') }}">
<option value="0">Seleccionar..</option>
@foreach ($roles as $role)
<option value="{{ $role->id }}">{{$role->name}}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="status">Seleccionar status</label>
<select class="form-control" name="status" value="{{ old('status') }}">
<option value="1">Activo</option>
<option value="0">Inactivo</option>
</select>
</div>
<input class="btn btn-primary" type="submit" value="Crear">
</form>
</div>
</div>
</div>
@endsection
+93
View File
@@ -0,0 +1,93 @@
@extends('layouts.landing')
@section('title',"Edit")
@section('content')
<div class="container-fluid">
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Editar Docente</h6>
<a href="{{route('docente.index')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Regresar</a>
</div>
</div>
<div class="card-body">
@if (session('info'))
<div class="alert alert-success">
<strong>{{session('info')}}</strong>
</div>
@endif
<form action="{{route('docente.update',$docente->id)}}" method="POST">
@method('PUT')
@csrf
<div class="mb-3">
<label class="small mb-1">Nombre</label>
<input class="form-control" name="name" value="{{$usr->name}}">
</div>
<div class="mb-3">
<label class="small mb-1">Apellido Paterno</label>
<input class="form-control" name="apellidoPaterno" value="{{$usr->apellidoPaterno}}">
</div>
<div class="mb-3">
<label class="small mb-1">Apellido Materno</label>
<input class="form-control" name="apellidoMaterno" value="{{$usr->apellidoMaterno}}">
</div>
<div class="mb-3">
<label class="small mb-1">Correo</label>
<input class="form-control" name="email" value="{{$usr->email}}">
</div>
<div class="mb-3">
<label class="small mb-1">Telefono</label>
<input class="form-control" name="telefono" type="number" value="{{$usr->telefono}}">
</div>
<div class="mb-3">
<label class="small mb-1">Dirección</label>
<input class="form-control" name="direccion" value="{{$usr->direccion}}">
</div>
<div class="mb-3">
<label for="plantel">Seleccionar campus</label>
<select class="form-control" name="plantel">
<option value="0">Seleccionar..</option>
@foreach ($plantels as $plantel)
<option value="{{ $plantel->id }}" {{ $usr->existe($plantel->id) ? 'selected' : '' }} >{{$plantel->name}}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="rol">Seleccionar rol</label>
<select class="form-control" name="rol">
<option value="0">Seleccionar..</option>
@foreach ($roles as $role)
<option value="{{ $role->id }}" {{ $usr->roles->contains('id', $role->id) ? 'selected' : '' }}>{{$role->name}}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="status">Seleccionar status</label>
<select class="form-control" name="status" id="status" >
<option value="1" {{ $usr->status=='1' ? 'selected' : '' }}>Activo</option>
<option value="0" {{ $usr->status=='0' ? 'selected' : '' }}>Inactivo</option>
</select>
</div>
<input class="btn btn-primary" type="submit" value="Update">
</form>
</div>
</div>
</div>
@endsection
+88
View File
@@ -0,0 +1,88 @@
@extends('layouts.landing')
@section('head')
@include('layouts._partials.tablaStyle')
@endsection
@section('title',"Inicio")
@section('content')
<div class="container-fluid">
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">docente</h6>
@can('docente.create')
<a href="{{route('docente.create')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Crear docente</a>
@endcan
</div>
</div>
<div class="card-body">
<div class="container-fluid">
<table id="tcont" class="table table-striped table-bordered nowrap table-hover" style="width:100%;">
<thead>
<tr>
<th>Id</th>
<th>Nombre</th>
<th>Campus</th>
<th>Rol</th>
<th>Correo</th>
<th>Opciones</th>
</tr>
</thead>
<tbody>
@forelse ($docentes as $docente)
@php $usr = $docente->docentes->first() @endphp
<tr>
<td>{{ $docente->id }}</td>
<td>{{ $usr?->name }} {{ $usr?->apellidoPaterno }}</td>
<td>
@foreach($usr?->plantelUsuarios ?? [] as $plantel)
<span class="badge bg-primary text-white">{{ $plantel->name }}</span>
@endforeach
</td>
<td>
@foreach($usr?->roles ?? [] as $rol)
<span class="badge bg-primary text-white">{{ $rol->name }}</span>
@endforeach
</td>
<td>{{ $usr?->email }}</td>
<td class="row mx-auto">
@can('docente.destroy')
<div class="col-sm-6 col-md-6">
<a href="{{ route('docente.edit', $docente->id) }}" class="btn btn-primary">Edit</a>
</div>
@endcan
@can('docente.destroy')
<div class="col-sm-6 col-md-6">
<form class="delete-form" action="{{route('docente.destroy',$docente->id)}}" method="POST">
@csrf
@method('DELETE')
<input type="submit" value="DELETE" class="btn btn-danger">
</form>
</div>
@endcan
</td>
</tr>
@empty
<p>Sin docentes.</p>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
@include('layouts._partials.tablaScript')
@include('layouts._partials.delete')
@endsection
+2 -2
View File
@@ -9,7 +9,7 @@
<div class="card-header py-3">
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Crear documentación</h6>
<a href="{{route('documentotipo.index')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Regresar</a>
<a href="{{route('documentoTipo.index')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Regresar</a>
</div>
</div>
@@ -23,7 +23,7 @@
</div>
@endif
<form method="POST" action="{{ route('documentotipo.store') }}">
<form method="POST" action="{{ route('documentoTipo.store') }}">
@csrf
{{-- NOMBRE --}}
+8 -8
View File
@@ -9,7 +9,7 @@
<div class="card-header py-3">
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Editar documentación</h6>
<a href="{{route('documentotipo.index')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Regresar</a>
<a href="{{route('documentoTipo.index')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Regresar</a>
</div>
</div>
@@ -19,19 +19,19 @@
<strong>{{session('info')}}</strong>
</div>
@endif
<form action="{{route('documentotipo.update',$documentotipo->id)}}" method="POST">
<form action="{{route('documentoTipo.update',$documentoTipo->id)}}" method="POST">
@method('PUT')
@csrf
{{-- NOMBRE --}}
<div class="mb-3">
<label>Nombre</label>
<input type="text" name="name" class="form-control" value="{{$documentotipo->name}}" required>
<input type="text" name="name" class="form-control" value="{{$documentoTipo->name}}" required>
</div>
{{-- SLUG --}}
<div class="mb-3">
<label>Slug</label>
<input type="text" name="slug" class="form-control" value="{{$documentotipo->slug}}" required>
<input type="text" name="slug" class="form-control" value="{{$documentoTipo->slug}}" required>
</div>
{{-- EXTENSIONES --}}
@@ -40,21 +40,21 @@
<div class="form-check">
<label>
<input type="checkbox" name="extensiones[]" value="pdf" class="form-check-input cb" {{ in_array('pdf', $documentotipo->extensiones ?? []) ? 'checked' : '' }}>
<input type="checkbox" name="extensiones[]" value="pdf" class="form-check-input cb" {{ in_array('pdf', $documentoTipo->extensiones ?? []) ? 'checked' : '' }}>
PDF
</label>
</div>
<div class="form-check">
<label>
<input type="checkbox" name="extensiones[]" value="jpg" class="form-check-input cb" {{ in_array('jpg', $documentotipo->extensiones ?? []) ? 'checked' : '' }}>
<input type="checkbox" name="extensiones[]" value="jpg" class="form-check-input cb" {{ in_array('jpg', $documentoTipo->extensiones ?? []) ? 'checked' : '' }}>
JPG
</label>
</div>
<div class="form-check">
<label>
<input type="checkbox" name="extensiones[]" value="png" class="form-check-input cb" {{ in_array('png', $documentotipo->extensiones ?? []) ? 'checked' : '' }}>
<input type="checkbox" name="extensiones[]" value="png" class="form-check-input cb" {{ in_array('png', $documentoTipo->extensiones ?? []) ? 'checked' : '' }}>
PNG
</label>
</div>
@@ -70,7 +70,7 @@
<input type="checkbox" class="form-check-input cb"
id="n-{{ $nivel->id }}"
name="nivels[]" value="{{ $nivel->id }}"
{{ $documentotipo->niveles->contains($nivel->id) ? 'checked' : '' }}
{{ $documentoTipo->niveles->contains($nivel->id) ? 'checked' : '' }}
>
<label class="form-check-label" for="n-{{ $nivel->id }}">
{{ $nivel->name }}
+5 -5
View File
@@ -13,7 +13,7 @@
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Documentación</h6>
@can('documentoTipo.create')
<a href="{{route('documentotipo.create')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Crear documentación</a>
<a href="{{route('documentoTipo.create')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Crear documentación</a>
@endcan
</div>
</div>
@@ -29,18 +29,18 @@
</tr>
</thead>
<tbody>
@forelse ($documentotipos as $row)
@forelse ($documentoTipos as $row)
<tr style="width:100%">
<td>{{$row->id}}</td>
<td><a href="{{route('documentotipo.show',$row->id)}}">{{$row->name}}</a></td>
<td><a href="{{route('documentoTipo.show',$row->id)}}">{{$row->name}}</a></td>
<td class="row mx-auto">
@can('documentoTipo.edit')
<div class="col-sm-6 col-md-6"><a class="btn btn-primary" href="{{route('documentotipo.edit',$row->id)}}">Edit</a></div>
<div class="col-sm-6 col-md-6"><a class="btn btn-primary" href="{{route('documentoTipo.edit',$row->id)}}">Edit</a></div>
@endcan
@can('documentoTipo.destroy')
<div class="col-sm-6 col-md-6">
<form class="delete-form" action="{{route('documentotipo.destroy',$row->id)}}" method="POST">
<form class="delete-form" action="{{route('documentoTipo.destroy',$row->id)}}" method="POST">
@csrf
@method('DELETE')
<input type="submit" value="DELETE" class="btn btn-danger">
@@ -14,7 +14,6 @@
{{ __('You may accept this invitation by clicking the button below:') }}
@endif
@component('mail::button', ['url' => $acceptUrl])
{{ __('Accept Invitation') }}
@endcomponent
+134 -71
View File
@@ -5,144 +5,164 @@
@section('content')
<div class="container-fluid">
{{-- Card editar grupo --}}
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Editar grupo</h6>
<a href="{{route('grupo.index')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Regresar</a>
<h6 class="m-0 font-weight-bold text-primary">Editar grupo</h6>
<a href="{{route('grupo.index')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm">
<i class="fas fa-download fa-sm text-white-50"></i> Regresar
</a>
</div>
</div>
<div class="card-body">
@if (session('info'))
<div class="alert alert-success">
<strong>{{session('info')}}</strong>
</div>
@endif
<form action="{{route('grupo.update',$grupo->id)}}" method="POST">
@method('PUT')
@csrf
<div class="mb-3">
<label for="status">Seleccionar Carrera</label>
<label>Seleccionar Carrera</label>
<select class="form-control" name="plan_id">
<option value="">Seleccionar plan</option>
@foreach ($plans as $nivel => $grupos)
<optgroup label="{{ $nivel }}">
@foreach ($grupos as $plan)
<option value="{{ $plan->id }}" {{ $plan->id == $grupo->id ? 'selected' : '' }}>
<option value="{{ $plan->id }}" {{ $plan->id == $grupo->plan_id ? 'selected' : '' }}>
{{ $plan->carreraRel->name }}
({{ $plan->name }}-{{ $plan->rvoe }})
</option>
@endforeach
</optgroup>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="status">Seleccionar ciclo</label>
<label>Seleccionar ciclo</label>
<select class="form-control" name="ciclo">
<option value="0">Seleccionar ciclo</option>
@for ($i=1 ; $i <= $ciclos->duracion ; $i++)
<option value="{{ $i }}" @selected($i == $grupo->ciclo)>{{$i}}</option>
<option value="{{ $i }}" @selected($i == $grupo->ciclo)>{{$i}}</option>
@endfor
</select>
</div>
<div class="mb-3">
<label for="status">Seleccionar turno</label>
<label>Seleccionar turno</label>
<select class="form-control" name="turno">
<option value="0">Seleccionar turno</option>
@foreach ($turnos as $turno)
<option value="{{ $turno->id }}" {{ $turno->id == $grupo->turno ? 'selected' : '' }}>{{$turno->name}}</option>
<option value="{{ $turno->id }}" {{ $turno->id == $grupo->turno ? 'selected' : '' }}>
{{$turno->name}}
</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="status">Seleccionar plantel</label>
<label>Seleccionar plantel</label>
<select class="form-control" name="plantel">
<option value="0">Seleccionar plantel</option>
@foreach ($planteles as $plantel)
<option value="{{ $plantel->id }}" {{ $plantel->id == $grupo->plantel ? 'selected' : '' }}>{{$plantel->name}}</option>
<option value="{{ $plantel->id }}" {{ $plantel->id == $grupo->plantel ? 'selected' : '' }}>
{{$plantel->name}}
</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="status">Seleccionar status</label>
<select class="form-control" name="status" id="status">
<label>Seleccionar status</label>
<select class="form-control" name="status">
<option value="1" {{ 1 == $grupo->status ? 'selected' : '' }}>Activo</option>
<option value="0" {{ 0 == $grupo->status ? 'selected' : '' }}>Inactivo</option>
</select>
</div>
<input class="btn btn-primary" type="submit" value="Guardar">
<input class="btn btn-primary" type="submit" value="Guardar">
</form>
</div>
</div>
{{-- contenedor de materias --}}
{{-- Card Materias y Docentes --}}
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Alumnos</h6>
@can('grupo.create')
<button onclick="Livewire.dispatch('create-grupo')" class="d-sm-inline-block btn btn-sm btn-success shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Agregar</button>
@endcan
<h6 class="m-0 font-weight-bold text-primary">Materias</h6>
@hasrole('Coordinación académica')
<button onclick="$('#modalDocente').modal('show')"
class="d-sm-inline-block btn btn-sm btn-success shadow-sm">
<i class="fas fa-plus fa-sm text-white-50"></i> Asignar materia a docente
</button>
@endcan
</div>
</div>
<div class="card-body">
@if (session('infogrupo'))
<div class="alert alert-success">
<strong>{{session('infogrupo')}}</strong>
</div>
@endif
<livewire:grupo-docente :grupo="$grupo"/>
</div>
</div>
<div class="container-fluid">
{{-- Card Alumnos --}}
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Alumnos</h6>
@can('grupo.create')
<button onclick="Livewire.dispatch('create-grupo')"
class="d-sm-inline-block btn btn-sm btn-success shadow-sm">
<i class="fas fa-plus fa-sm text-white-50"></i> Agregar alumno
</button>
@endcan
</div>
</div>
<table id="tcont" class="table table-striped table-bordered nowrap table-hover" style="width:100%;">
<thead>
<div class="card-body">
<div class="container-fluid">
<table id="tcont2" class="table table-striped table-bordered nowrap table-hover" style="width:100%;">
<thead>
<tr>
<th>Id</th>
<th>Nombre</th>
<th>Opciones</th>
</tr>
</thead>
<tbody>
@forelse ($grupo->alumnos as $alumno)
<tr>
<th>Id</th>
<th>Nombre</th>
<th>Opciones</th>
<td>{{$alumno->id}}</td>
<td>
{{$alumno->usuario->first()?->name}}
{{$alumno->usuario->first()?->apellidoPaterno}}
{{$alumno->usuario->first()?->apellidoMaterno}}
</td>
<td>
@can('grupo.destroy')
<form class="delete-form"
action="{{route('grupo.destroy',$grupo->id)}}"
method="POST">
@csrf
@method('DELETE')
<input class="d-none" name="alumno" value="{{$alumno->id}}">
<button type="submit" style="border:none; background:none;">
<i class="fa-solid fa-circle-xmark fa-xl"
style="color:#e66565;"></i>
</button>
</form>
@endcan
</td>
</tr>
</thead>
<tbody>
@forelse ($grupo->alumnos as $alumno)
<tr style="width:100%">
<td>{{$alumno->id}}</td>
<td>{{$alumno->usuario->first()?->name}} {{$alumno->usuario->first()?->apellidoPaterno}} {{$alumno->usuario->first()?->apellidoMaterno}}</td>
<td>
@can('grupo.destroy')
<div>
<form class="delete-form" action="{{route('grupo.destroy',$grupo->id)}}" method="POST">
@csrf
@method('DELETE')
<input class="d-none" name="alumno" value="{{$alumno->id}}">
<button type="submit" style="border:none; background:none;">
<i class="fa-duotone fa-regular fa-circle-user-circle-xmark fa-2xl" style="--fa-primary-color: rgb(172, 5, 18); --fa-secondary-color: rgb(245, 112, 123);"></i>
</button>
</form>
</div>
@endcan
</td>
</tr>
@empty
<p>Sin alumnos.</p>
@endforelse
</tbody>
</table>
</div>
@empty
<tr><td colspan="3">Sin alumnos.</td></tr>
@endforelse
</tbody>
</table>
</div>
<livewire:grupo-alumno :grupo="$grupo"/>
</div>
@@ -160,12 +180,55 @@ document.addEventListener('livewire:init', () => {
Livewire.on('open-grupo-modal', () => {
$('#exampleModal').modal('show');
});
});
document.addEventListener('livewire:init', () => {
Livewire.on('close-modal', () => {
$('#exampleModal').modal('hide');
});
});
</script>
<script> new DataTable('#tcont2', {
responsive: true,
language: {
"decimal": "",
"emptyTable": "No hay información",
"info": "Mostrando _START_ a _END_ de _TOTAL_ Entradas",
"infoEmpty": "Mostrando 0 to 0 of 0 Entradas",
"infoFiltered": "(Filtrado de _MAX_ total entradas)",
"infoPostFix": "",
"thousands": ",",
"lengthMenu": "Mostrar _MENU_ Entradas",
"loadingRecords": "Cargando...",
"processing": "Procesando...",
"search": "Buscar:",
"zeroRecords": "Sin resultados encontrados"
},
lengthMenu: [
[10, 25, 50, -1],
['10 filas', '25 filas', '50 filas', 'Todos']
],
layout: {
topStart: {
buttons: ['colvis', 'pageLength']
},
topEnd: ['search'],
bottomStart: [{
buttons: [{
extend: 'excel',
title: 'Excel'
},
{
extend: 'pdfHtml5',
title: 'PDF'
},
{
extend: 'print'
}
]
}, 'info'],
}
});
$("#tcont2_wrapper").removeClass("form-inline");
$("#tcont2_wrapper").addClass("w-100"); </script>
@endsection
@@ -55,7 +55,7 @@
@endcan
@can('documentoTipo.index')
<a class="collapse-item" href="{{ route('documentotipo.index') }}" style="color:#85888e">Documentación</a>
<a class="collapse-item" href="{{ route('documentoTipo.index') }}" style="color:#85888e">Documentación</a>
@endcan
@can('permission.index')
@@ -166,9 +166,9 @@
<div class="bg-white py-2 collapse-inner rounded">
<h6 class="collapse-header">Herramientas</h6>
{{-- @can('docente.index')
@can('docente.index')
<a class="collapse-item" href="{{ route('docente.index') }}" style="color:#85888e">Docentes</a>
@endcan --}}
@endcan
@can('grupo.index')
<a class="collapse-item" href="{{ route('grupo.index') }}" style="color:#85888e">Grupos</a>
@@ -0,0 +1,114 @@
<div>
{{-- Modal --}}
<div wire:ignore.self class="modal fade" id="modalDocente" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Agregar Docente al Grupo</h5>
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<div class="modal-body">
{{-- Docente --}}
<div class="mb-3">
<label>Docente</label>
<select class="form-control" wire:model="docente_id">
<option value="">Seleccionar docente...</option>
@foreach ($docentes as $docente)
@php $usr = $docente->docentes->first() @endphp
<option value="{{ $docente->id }}">
{{ $usr?->name }}
{{ $usr?->apellidoPaterno }}
</option>
@endforeach
</select>
@error('docente_id')
<span class="text-danger small">{{ $message }}</span>
@enderror
</div>
{{-- Materia --}}
<div class="mb-3">
<label>Materia</label>
<select class="form-control" wire:model="materia_id">
<option value="">Seleccionar materia...</option>
@foreach ($materiasSelect as $materia)
<option value="{{ $materia->id }}">
ciclo {{ $materia->ciclo }} - {{ $materia->name }}
</option>
@endforeach
</select>
@error('materia_id')
<span class="text-danger small">{{ $message }}</span>
@enderror
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancelar</button>
<button wire:click="guardar" class="btn btn-success">Guardar</button>
</div>
</div>
</div>
</div>
{{-- Tabla docentes asignados --}}
<table id="tcont" class="table table-striped table-bordered table-hover" style="width:100%;">
<thead>
<tr>
<th>Id</th>
<th>Materia</th>
<th>Ciclo</th>
<th>Docente asignado</th>
<th>Opciones</th>
</tr>
</thead>
<tbody>
@forelse ($materias as $materia)
@php
$docenteAsignado = $grupo->docentes->firstWhere('pivot.materia_id', $materia->id);
$usr = $docenteAsignado?->docentes->first();
@endphp
<tr>
<td>{{ $materia->id }}</td>
<td>{{ $materia->name }}</td>
<td>{{ $materia->ciclo }}</td>
<td>
@if($usr)
{{ $usr->name }} {{ $usr->apellidoPaterno }}
@else
<span class="badge badge-secondary">Sin docente</span>
@endif
</td>
<td>
@if($docenteAsignado)
@can('grupo.destroy')
<button wire:click="eliminar({{ $docenteAsignado->id }})"
style="border:none; background:none;">
<i class="fa-solid fa-circle-xmark fa-xl" style="color:#e66565;"></i>
</button>
@endcan
@endif
</td>
</tr>
@empty
<tr><td colspan="5">Sin materias en este plan.</td></tr>
@endforelse
</tbody>
</table>
</div>
@push('scripts')
<script>
document.addEventListener('livewire:init', () => {
Livewire.on('open-modal-docente', () => {
$('#modalDocente').modal('show');
});
Livewire.on('close-modal-docente', () => {
$('#modalDocente').modal('hide');
});
});
</script>
@endpush
+213 -82
View File
@@ -1,117 +1,248 @@
@extends('layouts.landing')
@section('title', 'Mi perfil')
@section('title',"Editar")
@section('content')
<style>
.custom-file-upload {
display: flex;
align-items: center;
gap: 10px;
}
.custom-file-upload span {
font-size: 13px;
}
</style>
<div class="container-fluid">
{{-- Card editar grupo --}}
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Editar grupo</h6>
<a href="{{route('grupo.index')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm">
<i class="fas fa-download fa-sm text-white-50"></i> Regresar
</a>
</div>
</div>
<div class="card-header py-3">
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Mi perfil</h6>
<div class="card-body">
@if (session('info'))
<div class="alert alert-success">
<strong>{{session('info')}}</strong>
</div>
@endif
<form action="{{route('grupo.update',$grupo->id)}}" method="POST">
@method('PUT')
@csrf
<div class="mb-3">
<label>Seleccionar Carrera</label>
<select class="form-control" name="plan_id">
<option value="">Seleccionar plan</option>
@foreach ($plans as $nivel => $grupos)
<optgroup label="{{ $nivel }}">
@foreach ($grupos as $plan)
<option value="{{ $plan->id }}" {{ $plan->id == $grupo->plan_id ? 'selected' : '' }}>
{{ $plan->carreraRel->name }}
({{ $plan->name }}-{{ $plan->rvoe }})
</option>
@endforeach
</optgroup>
@endforeach
</select>
</div>
@hasrole('Alumno')
<button onclick="Livewire.dispatch('documentos')"
class="btn btn-sm btn-success shadow-sm">
<i class="fas fa-file fa-sm text-white-50"></i> Expediente
</button>
@endrole
<div class="mb-3">
<label>Seleccionar ciclo</label>
<select class="form-control" name="ciclo">
<option value="0">Seleccionar ciclo</option>
@for ($i=1 ; $i <= $ciclos->duracion ; $i++)
<option value="{{ $i }}" @selected($i == $grupo->ciclo)>{{$i}}</option>
@endfor
</select>
</div>
<div class="mb-3">
<label>Seleccionar turno</label>
<select class="form-control" name="turno">
<option value="0">Seleccionar turno</option>
@foreach ($turnos as $turno)
<option value="{{ $turno->id }}" {{ $turno->id == $grupo->turno ? 'selected' : '' }}>
{{$turno->name}}
</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label>Seleccionar plantel</label>
<select class="form-control" name="plantel">
<option value="0">Seleccionar plantel</option>
@foreach ($planteles as $plantel)
<option value="{{ $plantel->id }}" {{ $plantel->id == $grupo->plantel ? 'selected' : '' }}>
{{$plantel->name}}
</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label>Seleccionar status</label>
<select class="form-control" name="status">
<option value="1" {{ 1 == $grupo->status ? 'selected' : '' }}>Activo</option>
<option value="0" {{ 0 == $grupo->status ? 'selected' : '' }}>Inactivo</option>
</select>
</div>
<input class="btn btn-primary" type="submit" value="Guardar">
</form>
</div>
</div>
<div class="card-body">
@hasrole('Alumno')
<div>
<h5>Expediente</h5>
{{-- Card Materias y Docentes --}}
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Materias</h6>
@can('grupo.create')
<button onclick="$('#modalDocente').modal('show')"
class="d-sm-inline-block btn btn-sm btn-success shadow-sm">
<i class="fas fa-plus fa-sm text-white-50"></i> Asignar materia a docente
</button>
@endcan
</div>
</div>
<livewire:documentos/>
<div class="card-body">
@if (session('infogrupo'))
<div class="alert alert-success">
<strong>{{session('infogrupo')}}</strong>
</div>
@endif
@endrole
@livewire('profile.update-profile-information-form')
<hr>
@livewire('profile.update-password-form')
<hr>
@livewire('profile.logout-other-browser-sessions-form')
<div class="container-fluid">
<table id="tcont" class="table table-striped table-bordered nowrap table-hover" style="width:100%;">
<thead>
<tr>
<th>Id</th>
<th>Ciclo</th>
<th>Nombre de la materia</th>
<th>Docente</th>
<th>Docente asignado</th>
</tr>
</thead>
<tbody>
@forelse ($grupo->plan->carreraRel->carreraMaterial as $material)
@php
$docenteAsignado = $grupo->docentes->firstWhere('pivot.materia_id', $material->id);
$usr = $docenteAsignado?->docentes->first();
@endphp
<tr>
<td>{{ $material->id }}</td>
<td>{{ $material->ciclo }}</td>
<td>{{ $material->name }}</td>
<td>{{ $usr?->name }} {{ $usr?->apellidoPaterno ?? 'Sin docente' }}</td>
<td>
@if($docenteAsignado)
@can('grupo.destroy')
<form class="delete-form"
action="{{route('grupo.destroy',$grupo->id)}}"
method="POST">
@csrf
@method('DELETE')
<input class="d-none" name="docente" value="{{$docenteAsignado->id}}">
<button type="submit" style="border:none; background:none;">
<i class="fa-solid fa-circle-xmark fa-xl" style="color:#e66565;"></i>
</button>
</form>
@endcan
@endif
</td>
</tr>
@empty
<tr><td colspan="5">Sin materias en este plan.</td></tr>
@endforelse
</tbody>
</table>
</div>
<livewire:grupo-docente :grupo="$grupo"/>
</div>
</div>
</div>
</div>
<!-- 🔥 MODAL VISOR -->
<div class="modal fade" id="visorModal" tabindex="-1">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Vista previa</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<iframe id="visorFrame" width="100%" height="600px" style="border:none;"></iframe>
{{-- Card Alumnos --}}
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="d-sm-flex align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Alumnos</h6>
@can('grupo.create')
<button onclick="Livewire.dispatch('create-grupo')"
class="d-sm-inline-block btn btn-sm btn-success shadow-sm">
<i class="fas fa-plus fa-sm text-white-50"></i> Agregar alumno
</button>
@endcan
</div>
</div>
</div>
</div>
<div class="card-body">
<div class="container-fluid">
<table id="tcont2" class="table table-striped table-bordered nowrap table-hover" style="width:100%;">
<thead>
<tr>
<th>Id</th>
<th>Nombre</th>
<th>Opciones</th>
</tr>
</thead>
<tbody>
@forelse ($grupo->alumnos as $alumno)
<tr>
<td>{{$alumno->id}}</td>
<td>
{{$alumno->usuario->first()?->name}}
{{$alumno->usuario->first()?->apellidoPaterno}}
{{$alumno->usuario->first()?->apellidoMaterno}}
</td>
<td>
@can('grupo.destroy')
<form class="delete-form"
action="{{route('grupo.destroy',$grupo->id)}}"
method="POST">
@csrf
@method('DELETE')
<input class="d-none" name="alumno" value="{{$alumno->id}}">
<button type="submit" style="border:none; background:none;">
<i class="fa-solid fa-circle-xmark fa-xl" style="color:#e66565;"></i>
</button>
</form>
@endcan
</td>
</tr>
@empty
<tr><td colspan="3">Sin alumnos.</td></tr>
@endforelse
</tbody>
</table>
</div>
<livewire:grupo-alumno :grupo="$grupo"/>
</div>
</div>
</div>
@endsection
@section('scripts')
@include('layouts._partials.tablaScript')
@include('layouts._partials.delete')
<script>
document.addEventListener('livewire:init', () => {
Livewire.on('open-documentos-modal', () => {
// Modal agregar alumno
Livewire.on('open-grupo-modal', () => {
$('#exampleModal').modal('show');
});
});
Livewire.on('close-modal', () => {
$('#exampleModal').modal('hide');
});
// 🔥 abrir documento en modal
function verDocumento(url) {
document.getElementById('visorFrame').src = url + '?t=' + new Date().getTime();
var modal = new bootstrap.Modal(document.getElementById('visorModal'));
modal.show();
}
// 🔥 limpiar iframe al cerrar
document.getElementById('visorModal').addEventListener('hidden.bs.modal', function () {
document.getElementById('visorFrame').src = '';
// Modal agregar docente
Livewire.on('open-modal-docente', () => {
$('#modalDocente').modal('show');
});
Livewire.on('close-modal-docente', () => {
$('#modalDocente').modal('hide');
});
});
</script>
<script>
function updateFileName(input, targetId) {
const fileName = input.files[0]?.name || 'Ningún archivo seleccionado';
document.getElementById(targetId).textContent = fileName;
}
</script>
@endsection