editar cuentas planes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user