Update ShowPlanes.php
This commit is contained in:
@@ -238,46 +238,56 @@ class ShowPlanes extends Component
|
||||
}
|
||||
public function saveRenovar()
|
||||
{
|
||||
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',
|
||||
'timerProgressBar' => true,
|
||||
'showDenyButton' => true,
|
||||
'onDenied' => 'noRenovar',
|
||||
'denyButtonText' => 'No, solo renovar',
|
||||
'showConfirmButton' => true,
|
||||
'onConfirmed' => 'siRenovar',
|
||||
'confirmButtonText' => 'Si, liberar cuenta',
|
||||
'customClass' => [
|
||||
'confirmButton' => 'bg-green-500',
|
||||
'denyButton' => 'bg-red-500',
|
||||
]
|
||||
]);
|
||||
} else {
|
||||
$cuenta_renovar = Cuentas::find($this->id_cuentaVer);
|
||||
|
||||
Cuentas::where('id', $this->id_cuentaVer)->update([
|
||||
'correo' => $this->usuario_renovar,
|
||||
'password' => $this->password_renovar,
|
||||
'estado' => $this->estado,
|
||||
]);
|
||||
|
||||
if ($this->usuario_renovar_old !== $this->usuario_renovar) {
|
||||
Log_historial::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'detalle' => 'El usuario ha editado el usuario de la cuenta ' . $cuenta_renovar->correo
|
||||
$correo_existe = Cuentas::where('correo', $this->usuario_renovar)->exists();
|
||||
if (!$correo_existe) {
|
||||
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',
|
||||
'timerProgressBar' => true,
|
||||
'showDenyButton' => true,
|
||||
'onDenied' => 'noRenovar',
|
||||
'denyButtonText' => 'No, solo renovar',
|
||||
'showConfirmButton' => true,
|
||||
'onConfirmed' => 'siRenovar',
|
||||
'confirmButtonText' => 'Si, liberar cuenta',
|
||||
'customClass' => [
|
||||
'confirmButton' => 'bg-green-500',
|
||||
'denyButton' => 'bg-red-500',
|
||||
]
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
$cuenta_renovar = Cuentas::find($this->id_cuentaVer);
|
||||
|
||||
$this->alert('success', 'Cuenta actualizada correctamente!', [
|
||||
Cuentas::where('id', $this->id_cuentaVer)->update([
|
||||
'correo' => $this->usuario_renovar,
|
||||
'password' => $this->password_renovar,
|
||||
'estado' => $this->estado,
|
||||
]);
|
||||
|
||||
if ($this->usuario_renovar_old !== $this->usuario_renovar) {
|
||||
Log_historial::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'detalle' => 'El usuario ha editado el usuario de la cuenta ' . $cuenta_renovar->correo
|
||||
]);
|
||||
}
|
||||
$this->alert('success', 'Cuenta actualizada correctamente!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->renovar = false;
|
||||
$this->ver = false;
|
||||
}
|
||||
} else {
|
||||
$this->alert('warning', 'Esta cuenta ya existe!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
$this->renovar = false;
|
||||
$this->ver = false;
|
||||
}
|
||||
}
|
||||
public function siRenovar()
|
||||
|
||||
Reference in New Issue
Block a user