diff --git a/app/Http/Livewire/ShowPlanes.php b/app/Http/Livewire/ShowPlanes.php index 235d15d..6962e3b 100755 --- a/app/Http/Livewire/ShowPlanes.php +++ b/app/Http/Livewire/ShowPlanes.php @@ -79,6 +79,7 @@ class ShowPlanes extends Component public $usuario_renovar; public $password_renovar; public $fecha_inicial_renovar; + public $fecha_inicial_renovar_old; public $fecha_final_renovar; public $fecha_final_renovar_old; @@ -206,27 +207,39 @@ class ShowPlanes extends Component $renovarCuenta = Cuentas::findOrFail($id); $this->usuario_renovar = $renovarCuenta->correo; $this->password_renovar = $renovarCuenta->password; + $this->fecha_inicial_renovar_old = $renovarCuenta->inicio; + $this->fecha_final_renovar_old = $renovarCuenta->vencimiento; $this->fecha_inicial_renovar = $renovarCuenta->inicio; $this->fecha_final_renovar = $renovarCuenta->vencimiento; $this->estado = $renovarCuenta->estado; } public function saveRenovar() { - $this->alert('warning', '¿Desea también desvincular todos los usuarios de esta cuenta?', [ - 'position' => 'center', - 'timer' => '60000', - 'toast' => false, - 'text' => 'Esta seguro', - 'showConfirmButton' => true, - 'onConfirmed' => 'siRenovar', - 'showDenyButton' => false, - 'onDenied' => 'noRenovar', - 'showCancelButton' => true, - 'allowOutsideClick' => false, - 'allowEscapeKey' => false, - 'cancelButtonText' => 'No, solo renovar', - 'confirmButtonText' => 'Si, liberar cuenta', - ]); + if($this->fecha_inicial_renovar_old !== $this->fecha_inicial_renovar || $this->fecha_final_renovar_old !== $this->fecha_final_renovar){ + $this->alert('warning', '¿Desea también desvincular todos los usuarios de esta cuenta?', [ + 'position' => 'center', + 'timer' => '60000', + 'toast' => false, + 'text' => 'Esta seguro', + 'showConfirmButton' => true, + 'onConfirmed' => 'siRenovar', + 'showDenyButton' => false, + 'onDenied' => 'noRenovar', + 'showCancelButton' => true, + 'allowOutsideClick' => false, + 'allowEscapeKey' => false, + 'cancelButtonText' => 'No, solo renovar', + 'confirmButtonText' => 'Si, liberar cuenta', + ]); + }else{ + Cuentas::where('id', $this->id_cuentaVer)->update([ + 'correo' => $this->usuario_renovar, + 'password' => $this->password_renovar, + 'inicio' => date('Y-m-d', strtotime(strval($this->fecha_inicial_renovar))), + 'vencimiento' => date('Y-m-d', strtotime(strval($this->fecha_final_renovar))), + 'estado' => $this->estado, + ]); + } } public function siRenovar() @@ -237,6 +250,14 @@ class ShowPlanes extends Component $cuenta_renovar = Cuentas::find($id); + Cuentas::where('id', $id)->update([ + 'correo' => $this->usuario_renovar, + 'password' => $this->password_renovar, + 'inicio' => date('Y-m-d', strtotime(strval($this->fecha_inicial_renovar))), + 'vencimiento' => date('Y-m-d', strtotime(strval($this->fecha_final_renovar))), + 'estado' => $this->estado, + ]); + Log_historial::create([ 'user_id' => Auth::user()->id, 'detalle' => 'El usuario ha renovado la cuenta ' . $cuenta_renovar->correo diff --git a/resources/views/livewire/show-planes.blade.php b/resources/views/livewire/show-planes.blade.php index 1f61f7b..47d5d29 100755 --- a/resources/views/livewire/show-planes.blade.php +++ b/resources/views/livewire/show-planes.blade.php @@ -182,7 +182,6 @@ - {{-- Modal ver --}}
-
Email:{{ $consulta_verUsuarios->correo ?? '' }} +
Email:{{ $consulta_verUsuarios->correo ?? '' }}
-
Password:{{ $consulta_verUsuarios->password ?? '' }} +
Password:{{ $consulta_verUsuarios->password ?? '' }}
@if ($consulta_verUsuarios) @@ -359,17 +356,16 @@ @endif @endif - +
- +
@@ -388,15 +384,12 @@
- +
- - + +
@@ -412,29 +405,23 @@
- - + +
- +
- {{ $fecha_final_renovar }}
- + - +