Se crean las especificaciones de los documentos a requerir por nivel, a su vez permitir al alumno subirlos

This commit is contained in:
2026-03-31 11:56:34 -06:00
parent cfd9d2ac68
commit 588a63ed24
61 changed files with 1487 additions and 326 deletions
@@ -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 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>
</div>
</div>
<div class="card-body">
<h3>Crear tipo de documento</h3>
@if(session('success'))
<div class="alert alert-success">
{{ session('success') }}
</div>
@endif
<form method="POST" action="{{ route('documentotipo.store') }}">
@csrf
{{-- NOMBRE --}}
<div class="mb-3">
<label>Nombre</label>
<input type="text" name="name" class="form-control" required>
</div>
{{-- SLUG --}}
<div class="mb-3">
<label>Slug</label>
<input type="text" name="slug" class="form-control" required>
</div>
{{-- EXTENSIONES --}}
<div class="mb-3">
<label>Extensiones permitidas</label>
<div class="form-check">
<label>
<input type="checkbox" name="extensiones[]" value="pdf" class="form-check-input cb">
PDF
</label>
</div>
<div class="form-check">
<label>
<input type="checkbox" name="extensiones[]" value="jpg" class="form-check-input cb">
JPG
</label>
</div>
<div class="form-check">
<label>
<input type="checkbox" name="extensiones[]" value="png" class="form-check-input cb">
PNG
</label>
</div>
</div>
<div class="mb-3">
<label>Niveles a impartir</label>
@foreach ($nivels as $nivel)
<div class="form-check">
<input type="checkbox" class="form-check-input cb"
id="n-{{ $nivel->id }}"
name="nivels[]" value="{{ $nivel->id }}"
>
<label class="form-check-label" for="n-{{ $nivel->id }}">
{{ $nivel->name }}
</label>
</div>
@endforeach
</div>
<button class="btn btn-primary">Guardar</button>
</form>
</div>
</div>
</div>
@endsection
+87
View File
@@ -0,0 +1,87 @@
@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 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>
</div>
</div>
<div class="card-body">
@if (session('info'))
<div class="alert alert-success">
<strong>{{session('info')}}</strong>
</div>
@endif
<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>
</div>
{{-- SLUG --}}
<div class="mb-3">
<label>Slug</label>
<input type="text" name="slug" class="form-control" value="{{$documentotipo->slug}}" required>
</div>
{{-- EXTENSIONES --}}
<div class="mb-3">
<label>Extensiones permitidas</label>
<div class="form-check">
<label>
<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' : '' }}>
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' : '' }}>
PNG
</label>
</div>
</div>
<div class="mb-3">
<label>Niveles a impartir</label>
@foreach ($nivels as $nivel)
<div class="form-check">
<input type="checkbox" class="form-check-input cb"
id="n-{{ $nivel->id }}"
name="nivels[]" value="{{ $nivel->id }}"
{{ $documentotipo->niveles->contains($nivel->id) ? 'checked' : '' }}
>
<label class="form-check-label" for="n-{{ $nivel->id }}">
{{ $nivel->name }}
</label>
</div>
@endforeach
</div>
<input class="btn btn-primary" type="submit" value="Actualizar">
</form>
</div>
</div>
</div>
@endsection
+70
View File
@@ -0,0 +1,70 @@
@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">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>
@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>row</th>
</tr>
</thead>
<tbody>
@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 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>
@endcan
@can('documentoTipo.destroy')
<div class="col-sm-6 col-md-6">
<form class="delete-form" action="{{route('documentotipo.destroy',$row->id)}}" method="POST">
@csrf
@method('DELETE')
<input type="submit" value="DELETE" class="btn btn-danger">
</form>
</div>
@endcan
</td>
</tr>
@empty
<p>Sin documentación.</p>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
@include('layouts._partials.tablaScript')
@include('layouts._partials.delete')
@endsection
@@ -54,6 +54,10 @@
<a class="collapse-item" href="{{ route('nivel.index') }}" style="color:#85888e">Niveles</a>
@endcan
@can('documentoTipo.index')
<a class="collapse-item" href="{{ route('documentotipo.index') }}" style="color:#85888e">Documentación</a>
@endcan
@can('permission.index')
<a class="collapse-item" href="{{ route('permission.index') }}" style="color:#85888e">Permisos</a>
@endcan
@@ -199,17 +199,23 @@
<h5>Expediente del alumno</h5>
@php
$tipos = ['curp', 'acta', 'comprobante','certificadoPrepa','certificadoLicenciatura'];
$nivel = $prospecto->nivelRel ?? null;
$tipos = $nivel
? $nivel->documentosRequeridos
: collect();
$documentos = collect($prospecto?->documentos)->keyBy('tipo');
@endphp
@foreach($tipos as $tipo)
@php
$doc = $documentos[$tipo] ?? null;
@endphp
@php
$doc = $documentos[$tipo->slug] ?? null;
@endphp
<div class="mb-3">
<strong>{{ strtoupper($tipo) }}</strong> :
<strong>{{ strtoupper($tipo->name) }}</strong> :
@if($doc)
@@ -239,6 +245,8 @@
@endforeach
</div>
</div>
@else
+93 -92
View File
@@ -1,3 +1,43 @@
<div>
<div class="mb-4">
@foreach($tiposDocumentos as $tipo)
@php
$doc = $documentosPorTipo[$tipo->slug] ?? null;
@endphp
<div class="mb-2">
<strong>{{ strtoupper($tipo->name) }}</strong> :
@if($doc)
@if($doc->status == 1)
<span class="badge bg-success"> Validado</span>
@elseif($doc->status == 2)
<span class="badge bg-danger"> Rechazado</span>
@else
<span class="badge bg-warning">Pendiente</span>
@endif
<button
onclick="verDocumento('{{ url('documento/ver/'.$doc->id) }}', {{ $doc->id }})"
class="btn btn-sm btn-primary ms-2"
>
Ver
</button>
@else
<span class="text-danger"> Faltante</span>
@endif
</div>
@endforeach
</div>
<div wire:ignore.self
class="modal fade"
id="exampleModal"
@@ -14,114 +54,75 @@
</button>
</div>
<div class="modal-body">
@php
$pendientes = $tiposDocumentos->filter(function($tipo) {
$doc = $this->documentosPorTipo[$tipo->slug] ?? null;
return !$doc || $doc->status == 2;
});
@endphp
@php
$pendientes = collect(['curp','acta','comprobante'])->filter(function($tipo) {
$doc = $documentosPorTipo[$tipo] ?? null;
return !$doc || $doc->status == 2;
});
@endphp
@if($pendientes->isEmpty())
<div class="alert alert-success">
Todos los documentos están validados
</div>
@endif
@if($pendientes->isEmpty())
<div class="alert alert-success">
Todos los documentos están validados
</div>
<form wire:submit.prevent="store" enctype="multipart/form-data">
@foreach($tiposDocumentos as $tipo)
@php
$doc = $documentosPorTipo[$tipo->slug] ?? null;
@endphp
@if(!$doc || $doc->status == 2)
<div class="mb-4">
<label class="fw-bold">{{ $tipo->name }}</label>
@if($doc && $doc->status == 2)
<span class="badge bg-danger ms-2">Rechazado</span>
@endif
<form wire:submit.prevent="store" enctype="multipart/form-data">
<div class="d-flex align-items-center gap-2 mt-2">
@php
$doc = $documentosPorTipo['curp'] ?? null;
@endphp
{{-- input oculto --}}
<input type="file"
id="{{ $tipo->slug }}"
wire:model="archivos.{{ $tipo->slug }}"
class="d-none">
@if(!$doc || $doc->status == 2)
<div class="mb-3">
<label class="small mb-1">CURP:</label>
{{-- botón bonito --}}
<label for="{{ $tipo->slug }}" class="btn btn-outline-primary btn-sm">
📄 Seleccionar archivo
</label>
{{-- nombre dinámico --}}
<span class="text-muted small">
@if(isset($archivos[$tipo->slug]))
&nbsp;&nbsp;&nbsp; {{ $archivos[$tipo->slug]->getClientOriginalName() }}
@else
@if($doc && $doc->status == 2)
<span class="badge bg-danger"> Rechazado</span>
@endif
</span>
<div class="custom-file-upload" wire:ignore>
<input type="file" id="curp" hidden
onchange="updateFileName(this, 'curp-name')"
wire:model="curp">
</div>
<label for="curp" class="btn btn-outline-primary btn-sm">
📄 Seleccionar archivo
</label>
</div>
<span id="curp-name" class="ml-2 text-muted">
Ningún archivo seleccionado
</span>
</div>
</div>
@endif
@endif
{{-- acta --}}
@php
$doc = $documentosPorTipo['acta'] ?? null;
@endphp
@endforeach
@if(!$doc || $doc->status == 2)
<div class="mb-3">
<label class="small mb-1">Acta:</label>
<button class="btn btn-primary" type="submit">Subir</button>
@if($doc && $doc->status == 2)
<span class="badge bg-danger"> Rechazado</span>
@endif
<div class="custom-file-upload" wire:ignore>
<input type="file" id="acta" hidden
onchange="updateFileName(this, 'acta-name')"
wire:model="acta">
<label for="acta" class="btn btn-outline-primary btn-sm">
📄 Seleccionar archivo
</label>
<span id="acta-name" class="ml-2 text-muted">
Ningún archivo seleccionado
</span>
</div>
</div>
@endif
{{-- acta --}}
@php
$doc = $documentosPorTipo['comprobante'] ?? null;
@endphp
@if(!$doc || $doc->status == 2)
<div class="mb-3">
<label class="small mb-1">Comprobante de domicilio:</label>
@if($doc && $doc->status == 2)
<span class="badge bg-danger"> Rechazado</span>
@endif
<div class="custom-file-upload" wire:ignore>
<input type="file" id="comprobante" hidden
onchange="updateFileName(this, 'comprobante-name')"
wire:model="comprobante">
<label for="comprobante" class="btn btn-outline-primary btn-sm">
📄 Seleccionar archivo
</label>
<span id="comprobante-name" class="ml-2 text-muted">
Ningún archivo seleccionado
</span>
</div>
</div>
@endif
<button class="btn btn-primary" type="submit">Subir</button>
</form>
</form>
</div>
</div>
</div>
</div>
</div>
-39
View File
@@ -39,45 +39,6 @@
<div>
<h5>Expediente</h5>
@php
$tipos = ['curp', 'acta', 'comprobante'];
$alumno = Auth::user()->alumnos()->first();
@endphp
@foreach($tipos as $tipo)
@php
$doc = $alumno?->documentos->firstWhere('tipo', $tipo);
@endphp
<div class="mb-3">
<strong>{{ strtoupper($tipo) }}</strong> :
@if($doc)
@if($doc->status == 1)
<span class="badge bg-success"> Validado</span>
@elseif($doc->status == 2)
<span class="badge bg-danger"> Rechazado</span>
@else
<span class="badge bg-warning">Pendiente de revision</span>
@endif
<br>
<button
onclick="verDocumento('{{ url('documento/ver/'.$doc->id) }}')"
class="btn btn-sm btn-primary mt-2">
<i class="fa-duotone fa-solid fa-eye"></i> Ver documento
</button>
@else
<span class="text-danger"> Faltante</span>
@endif
</div>
@endforeach
</div>