Actualización de moelo user y relación many con asistencias, creación del modelo de asistencia y control por middleware y autenticación
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
use Livewire\Attributes\On;
|
||||
|
||||
class CodeScanner extends Component
|
||||
{
|
||||
|
||||
#[On('qrLeido')]
|
||||
public function qrLeido($texto, $lat, $lng)
|
||||
{
|
||||
|
||||
|
||||
$this->dispatch('swal',
|
||||
icon: 'success',
|
||||
title: 'Asistencia registrada!',
|
||||
text: $lat,
|
||||
timer: 2000,
|
||||
confirm: false,
|
||||
closeModal: true
|
||||
);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.code-scanner');
|
||||
}
|
||||
}
|
||||
@@ -121,7 +121,7 @@ class DataProspecto extends Component
|
||||
|
||||
public function actualizarProspecto()
|
||||
{
|
||||
$user = $this->prospecto->prospectos()->first();
|
||||
$user = $this->prospecto->prospectos()->first();
|
||||
if (!$user) return;
|
||||
|
||||
try {
|
||||
@@ -331,6 +331,7 @@ class DataProspecto extends Component
|
||||
$this->niveles = [];
|
||||
$this->plans = [];
|
||||
$this->turnos = [];
|
||||
$this->conceptos = [];
|
||||
|
||||
$this->active = "disabled";
|
||||
$this->prospecto = null;
|
||||
|
||||
@@ -68,9 +68,6 @@ class ModalProspecto extends Component
|
||||
$this->active = "disabled";
|
||||
}
|
||||
|
||||
/* ------------------ EDITAR ------------------ */
|
||||
|
||||
|
||||
/* ------------------ NUEVO ------------------ */
|
||||
#[On('create-prospecto')]
|
||||
public function createProspecto()
|
||||
@@ -118,10 +115,16 @@ class ModalProspecto extends Component
|
||||
->orWhere('telefono', $this->ptelefono)
|
||||
->exists()) {
|
||||
|
||||
$this->dispatch('swal:error', [
|
||||
'title' => 'Registro duplicado',
|
||||
'text' => 'El correo o teléfono ya están registrados.'
|
||||
]);
|
||||
$this->dispatch('swal',
|
||||
icon: 'error',
|
||||
title: 'Registro duplicado',
|
||||
text: 'El correo o teléfono ya están registrados.',
|
||||
timer: 2000,
|
||||
confirm: false,
|
||||
closeModal: true
|
||||
);
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -149,8 +152,16 @@ class ModalProspecto extends Component
|
||||
|
||||
$prospecto->prospectos()->sync([$user->id]);
|
||||
|
||||
$this->dispatch('swal:success');
|
||||
$this->dispatch('prospecto-creado');
|
||||
$this->dispatch('swal',
|
||||
icon: 'success',
|
||||
title: 'Registrado!',
|
||||
text: 'Se registró el prospecto correctamente',
|
||||
timer: 2000,
|
||||
confirm: false,
|
||||
closeModal: true,
|
||||
reload: 2000
|
||||
);
|
||||
|
||||
$this->resetForm();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user