Update ShowPlanes.php
This commit is contained in:
@@ -238,46 +238,56 @@ class ShowPlanes extends Component
|
|||||||
}
|
}
|
||||||
public function saveRenovar()
|
public function saveRenovar()
|
||||||
{
|
{
|
||||||
if ($this->fecha_inicial_renovar_old !== $this->fecha_inicial_renovar || $this->fecha_final_renovar_old !== $this->fecha_final_renovar) {
|
$correo_existe = Cuentas::where('correo', $this->usuario_renovar)->exists();
|
||||||
$this->alert('warning', '¿Desea también desvincular todos los usuarios de esta cuenta? ', [
|
if (!$correo_existe) {
|
||||||
'position' => 'center',
|
if ($this->fecha_inicial_renovar_old !== $this->fecha_inicial_renovar || $this->fecha_final_renovar_old !== $this->fecha_final_renovar) {
|
||||||
'timer' => '60000',
|
$this->alert('warning', '¿Desea también desvincular todos los usuarios de esta cuenta? ', [
|
||||||
'toast' => false,
|
'position' => 'center',
|
||||||
'text' => 'Esta seguro',
|
'timer' => '60000',
|
||||||
'timerProgressBar' => true,
|
'toast' => false,
|
||||||
'showDenyButton' => true,
|
'text' => 'Esta seguro',
|
||||||
'onDenied' => 'noRenovar',
|
'timerProgressBar' => true,
|
||||||
'denyButtonText' => 'No, solo renovar',
|
'showDenyButton' => true,
|
||||||
'showConfirmButton' => true,
|
'onDenied' => 'noRenovar',
|
||||||
'onConfirmed' => 'siRenovar',
|
'denyButtonText' => 'No, solo renovar',
|
||||||
'confirmButtonText' => 'Si, liberar cuenta',
|
'showConfirmButton' => true,
|
||||||
'customClass' => [
|
'onConfirmed' => 'siRenovar',
|
||||||
'confirmButton' => 'bg-green-500',
|
'confirmButtonText' => 'Si, liberar cuenta',
|
||||||
'denyButton' => 'bg-red-500',
|
'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
|
|
||||||
]);
|
]);
|
||||||
}
|
} 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'
|
'position' => 'top'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->renovar = false;
|
|
||||||
$this->ver = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function siRenovar()
|
public function siRenovar()
|
||||||
|
|||||||
Reference in New Issue
Block a user