From e3f3956b845c029bb4b99711a75487f3d587b8e2 Mon Sep 17 00:00:00 2001 From: Felipe Date: Mon, 20 Nov 2023 18:08:07 -0500 Subject: [PATCH] liberar cuenta --- app/Http/Livewire/ShowPlanes.php | 48 ++++++++++++++++--- .../views/livewire/show-planes.blade.php | 2 +- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/app/Http/Livewire/ShowPlanes.php b/app/Http/Livewire/ShowPlanes.php index 4659fa1..4d08333 100755 --- a/app/Http/Livewire/ShowPlanes.php +++ b/app/Http/Livewire/ShowPlanes.php @@ -34,6 +34,7 @@ class ShowPlanes extends Component public $renovar = false; public $serviciosModal = false; public $modTarifas = false; + public $ver = false; public $roles_modTarifas; public $pantallas_modTarifas; @@ -79,6 +80,7 @@ class ShowPlanes extends Component public $password_renovar; public $fecha_inicial_renovar; public $fecha_final_renovar; + public $fecha_final_renovar_old; public $servicio; @@ -203,9 +205,40 @@ class ShowPlanes extends Component $this->estado = $renovarCuenta->estado; } public function saveRenovar() + { + $this->alert('warning', '¿Desea también desvincular todos los usuarios de esta cuenta?', [ + 'position' => 'center', + 'timer' => '10000', + 'toast' => false, + 'text' => 'Esta seguro', + 'showConfirmButton' => true, + 'onConfirmed' => 'siRenovar', + 'showDenyButton' => false, + 'onDenied' => 'noRenovar', + 'showCancelButton' => true, + 'onDismissed' => 'noRenovar', + 'cancelButtonText' => 'No, solo renovar', + 'confirmButtonText' => 'Si, liberar cuenta', + ]); + } + + public function siRenovar() { $id = $this->id_cuentaVer; + Historial_cuenta::where('cuenta_id', $id)->delete(); + + $this->alert('success', 'Cuenta renovada y liberada correctamente!', [ + 'position' => 'top' + ]); + + $this->renovar = false; + $this->ver = false; + } + + public function noRenovar() + { + $id = $this->id_cuentaVer; Cuentas::where('id', $id)->update([ 'correo' => $this->usuario_renovar, @@ -220,6 +253,14 @@ class ShowPlanes extends Component ]); $this->renovar = false; + $this->ver = false; + } + + public function getListeners() + { + return [ + 'confirmed', 'siRenovar', 'noRenovar' + ]; } /* ------------- CREAR ------------- */ @@ -353,13 +394,6 @@ class ShowPlanes extends Component ]); } - public function getListeners() - { - return [ - 'confirmed' - ]; - } - public function confirmed() { Cuentas::where('id', $this->delete_cuenta)->delete(); diff --git a/resources/views/livewire/show-planes.blade.php b/resources/views/livewire/show-planes.blade.php index 5ee1b42..62f7877 100755 --- a/resources/views/livewire/show-planes.blade.php +++ b/resources/views/livewire/show-planes.blade.php @@ -4,7 +4,7 @@ newCuenta: @entangle('newCuenta'), modTarifas: @entangle('modTarifas'), serviciosModal: @entangle('serviciosModal'), - ver: false, + ver: @entangle('ver'), renovar: @entangle('renovar'), addUser: @entangle('addUser'), editarTarifaRol: @entangle('editarTarifaRol'),