Desarrollo del modulo de alumno y control escolar para subir archivos de expediente

This commit is contained in:
2026-03-26 17:36:09 -06:00
parent 1bcebeb8a1
commit 3061a64418
137 changed files with 7234 additions and 57 deletions
+59 -10
View File
@@ -3,21 +3,22 @@
namespace App\Livewire;
use App\Models\Alumno;
use App\Models\Pago;
use App\Models\Plan;
use App\Models\Campan;
use App\Models\Concepto;
use App\Models\Documento;
use App\Models\Medio;
use App\Models\Nivel;
use App\Models\Pago;
use App\Models\Plan;
use App\Models\Plane;
use App\Models\Turno;
use App\Models\Campan;
use App\Models\Plantel;
use Livewire\Component;
use App\Models\Concepto;
use Livewire\Attributes\On;
use Illuminate\Validation\Rule;
use App\Models\Role;
use App\Models\Turno;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\Rule;
use Illuminate\Validation\ValidationException;
use Livewire\Attributes\On;
use Livewire\Component;
class DataProspecto extends Component
{
@@ -53,7 +54,9 @@ class DataProspecto extends Component
public $active = "disabled";
public $prospecto = null;
public $prospecto;
public $documentoSeleccionado;
public function failedValidation(ValidationException $e)
{
@@ -69,6 +72,52 @@ class DataProspecto extends Component
throw $e;
}
#[On('set-documento')]
public function setDocumento($id)
{
$this->documentoSeleccionado = $id;
}
public function aprobarDocumento()
{
if (!$this->documentoSeleccionado) return;
Documento::where('id', $this->documentoSeleccionado)
->update(['status' => 1]);
$this->dispatch('cerrar-modal');
$this->dispatch('swal',
icon: 'success',
title: 'Validádo',
text: 'notificado',
timer: 2000,
confirm: false,
closeModal: true
);
$this->prospecto->refresh();
}
public function rechazarDocumento()
{
if (!$this->documentoSeleccionado) return;
Documento::where('id', $this->documentoSeleccionado)
->update(['status' => 2]);
$this->dispatch('cerrar-modal');
$this->dispatch('swal',
icon: 'error',
title: 'Rechazado',
text: 'notificado',
timer: 2000,
confirm: false,
closeModal: true
);
$this->prospecto->refresh();
}
public function updatedPplantels()
{
$this->selectedNivel = null;
@@ -219,7 +268,7 @@ class DataProspecto extends Component
$this->pname = $user->name;
$this->papellidoPaterno = $user->apellidoPaterno;
$this->papellidoMaterno = $user->apellidoPaterno;
$this->papellidoMaterno = $user->apellidoMaterno;
$this->pemail = $user->email;
$this->ptelefono = $user->telefono;
$this->pdireccion = $user->direccion;
+102
View File
@@ -0,0 +1,102 @@
<?php
namespace App\Livewire;
use App\Models\Alumno;
use Illuminate\Support\Facades\Auth;
use Livewire\Attributes\On;
use Livewire\Component;
use Livewire\WithFileUploads;
class Documentos extends Component
{
use WithFileUploads;
public $curp;
public $acta;
public $comprobante;
public $user;
public $alumno;
public $documentosPorTipo = [];
#[On('documentos')]
public function documentos()
{
$this->dispatch('open-documentos-modal');
}
public function cargarDocumentos()
{
$this->alumno = Auth::user()->alumnos()->first();
if ($this->alumno) {
$this->documentosPorTipo = $this->alumno
->documentos()
->get()
->keyBy('tipo');
}
}
public function store()
{
$this->validate([
'curp' => 'nullable|file|mimes:pdf,jpg,png',
'acta' => 'nullable|file|mimes:pdf,jpg,png',
'comprobante' => 'nullable|file|mimes:pdf,jpg,png',
]);
$alumno = Auth::user()->alumnos->first();
if (!$alumno) {
abort(404, 'Alumno no encontrado');
}
$tipos = ['curp', 'acta', 'comprobante'];
foreach ($tipos as $tipo) {
if ($this->$tipo) {
$ruta = $this->$tipo->store('documentos', 'public');
$alumno->documentos()->updateOrCreate(
['tipo' => $tipo],
[
'archivo' => $ruta,
'status' => 0
]
);
}
}
// 🔥 recargar correctamente
$this->cargarDocumentos();
$this->reset(['curp', 'acta', 'comprobante']);
$this->dispatch('close-documentos-modal');
$this->dispatch('swal',
icon: 'success',
title: 'Éxito!',
text: 'Documentos cargados',
timer: 2000,
confirm: false,
closeModal: true,
reload: 2000
);
}
public function mount()
{
$this->cargarDocumentos();
}
public function render()
{
return view('livewire.documentos');
}
}