Update ShowPlanes.php
This commit is contained in:
@@ -183,7 +183,7 @@ class ShowPlanes extends Component
|
|||||||
$this->searchTerm = $this->selectedOption;
|
$this->searchTerm = $this->selectedOption;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->selectedOption = null;
|
$this->selectedOption = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cont = $consulta_cuentas->toArray();
|
$this->cont = $consulta_cuentas->toArray();
|
||||||
@@ -213,8 +213,8 @@ class ShowPlanes extends Component
|
|||||||
$this->password_renovar = $renovarCuenta->password;
|
$this->password_renovar = $renovarCuenta->password;
|
||||||
$this->fecha_inicial_renovar_old = $renovarCuenta->inicio;
|
$this->fecha_inicial_renovar_old = $renovarCuenta->inicio;
|
||||||
$this->fecha_inicial_renovar = $renovarCuenta->inicio;
|
$this->fecha_inicial_renovar = $renovarCuenta->inicio;
|
||||||
$this->fecha_final_renovar_old = $renovarCuenta->vencimiento;
|
$this->fecha_final_renovar_old = $renovarCuenta->vencimiento;
|
||||||
$this->fecha_final_renovar = $renovarCuenta->vencimiento;
|
$this->fecha_final_renovar = $renovarCuenta->vencimiento;
|
||||||
$this->estado = $renovarCuenta->estado;
|
$this->estado = $renovarCuenta->estado;
|
||||||
|
|
||||||
$this->renovar = true;
|
$this->renovar = true;
|
||||||
@@ -230,7 +230,8 @@ class ShowPlanes extends Component
|
|||||||
public function getListeners()
|
public function getListeners()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'siRenovar', 'noRenovar',
|
'siRenovar',
|
||||||
|
'noRenovar',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public function saveRenovar()
|
public function saveRenovar()
|
||||||
@@ -280,11 +281,19 @@ class ShowPlanes extends Component
|
|||||||
$id = $this->id_cuentaVer;
|
$id = $this->id_cuentaVer;
|
||||||
|
|
||||||
$historial = Historial_cuenta::where('cuenta_id', $id)->first();
|
$historial = Historial_cuenta::where('cuenta_id', $id)->first();
|
||||||
//dd($historial);
|
if ($historial) {
|
||||||
$consultaFechaFinal = Historiale::find($historial->historial_id)->fecha_final;
|
$consultaFechaFinal = Historiale::find($historial->historial_id)->fecha_final;
|
||||||
|
|
||||||
//dd($consultaFechaFinal);
|
// Convertir cadena a objeto fecha usando Carbon
|
||||||
$nuevaFecha= $consultaFechaFinal->addDays($this->tiempo_usuario);
|
$consultaFechaFinal = \Carbon\Carbon::parse($consultaFechaFinal);
|
||||||
|
|
||||||
|
// Ahora puedes realizar operaciones con fechas
|
||||||
|
$nuevaFecha = $consultaFechaFinal->addDays($this->tiempo_usuario);
|
||||||
|
} else {
|
||||||
|
$this->alert('warning', 'Error en el proceso de renovación. ', [
|
||||||
|
'position' => 'top'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
Historiale::where('id', $historial->historial_id)->update([
|
Historiale::where('id', $historial->historial_id)->update([
|
||||||
'fecha_final' => date('Y-m-d', strtotime(strval($nuevaFecha))),
|
'fecha_final' => date('Y-m-d', strtotime(strval($nuevaFecha))),
|
||||||
@@ -304,7 +313,7 @@ class ShowPlanes extends Component
|
|||||||
|
|
||||||
Log_historial::create([
|
Log_historial::create([
|
||||||
'user_id' => Auth::user()->id,
|
'user_id' => Auth::user()->id,
|
||||||
'detalle' => 'El usuario ha renovado y liberado la cuenta ' . $cuenta_renovar->correo
|
'detalle' => 'El usuario ha renovado y liberado la cuenta ' . $cuenta_renovar->correo
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->alert('success', 'Cuenta renovada y liberada correctamente!', [
|
$this->alert('success', 'Cuenta renovada y liberada correctamente!', [
|
||||||
@@ -484,7 +493,7 @@ class ShowPlanes extends Component
|
|||||||
|
|
||||||
Log_historial::create([
|
Log_historial::create([
|
||||||
'user_id' => Auth::user()->id,
|
'user_id' => Auth::user()->id,
|
||||||
'detalle' => 'El usuario ha eliminado la cuenta ' . $cuenta->correo . ' nota de eliminacion: ' . $this->nota_eliminacion
|
'detalle' => 'El usuario ha eliminado la cuenta ' . $cuenta->correo . ' nota de eliminacion: ' . $this->nota_eliminacion
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$cuenta->delete();
|
$cuenta->delete();
|
||||||
@@ -513,7 +522,7 @@ class ShowPlanes extends Component
|
|||||||
foreach ($cuentas as $cuenta) {
|
foreach ($cuentas as $cuenta) {
|
||||||
Log_historial::create([
|
Log_historial::create([
|
||||||
'user_id' => Auth::user()->id,
|
'user_id' => Auth::user()->id,
|
||||||
'detalle' => 'El usuario ha eliminado la cuenta ' . $cuenta->correo . ' nota de eliminacion: ' . $this->nota_eliminacion
|
'detalle' => 'El usuario ha eliminado la cuenta ' . $cuenta->correo . ' nota de eliminacion: ' . $this->nota_eliminacion
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -663,7 +672,7 @@ class ShowPlanes extends Component
|
|||||||
|
|
||||||
for ($i = 0; $i < $perfiles; $i++) {
|
for ($i = 0; $i < $perfiles; $i++) {
|
||||||
$historial_cuenta = new Historial_cuenta;
|
$historial_cuenta = new Historial_cuenta;
|
||||||
$historial_cuenta->cuenta_id = $this->consulta_verUsuarios->id;
|
$historial_cuenta->cuenta_id = $this->consulta_verUsuarios->id;
|
||||||
$historial_cuenta->historial_id = $historial->id;
|
$historial_cuenta->historial_id = $historial->id;
|
||||||
$historial_cuenta->perfil = $i + 1;
|
$historial_cuenta->perfil = $i + 1;
|
||||||
$historial_cuenta->save();
|
$historial_cuenta->save();
|
||||||
@@ -674,7 +683,7 @@ class ShowPlanes extends Component
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$this->addUser = false;
|
$this->addUser = false;
|
||||||
$this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $this->id_cuentaVer)->first();
|
$this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $this->id_cuentaVer)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->consulta_verUsuarios->estado == 'activo') { // pantallas
|
if ($this->consulta_verUsuarios->estado == 'activo') { // pantallas
|
||||||
@@ -683,7 +692,7 @@ class ShowPlanes extends Component
|
|||||||
if ($consultaHC) {
|
if ($consultaHC) {
|
||||||
if ($consultaHC < $perfiles) {
|
if ($consultaHC < $perfiles) {
|
||||||
$historial_cuenta = new Historial_cuenta;
|
$historial_cuenta = new Historial_cuenta;
|
||||||
$historial_cuenta->cuenta_id = $this->consulta_verUsuarios->id;
|
$historial_cuenta->cuenta_id = $this->consulta_verUsuarios->id;
|
||||||
$historial_cuenta->historial_id = $historial->id;
|
$historial_cuenta->historial_id = $historial->id;
|
||||||
$historial_cuenta->perfil = $consultaHC + 1;
|
$historial_cuenta->perfil = $consultaHC + 1;
|
||||||
$historial_cuenta->save();
|
$historial_cuenta->save();
|
||||||
@@ -693,7 +702,7 @@ class ShowPlanes extends Component
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$this->addUser = false;
|
$this->addUser = false;
|
||||||
$this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $this->id_cuentaVer)->first();
|
$this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $this->id_cuentaVer)->first();
|
||||||
} else {
|
} else {
|
||||||
$historial->delete();
|
$historial->delete();
|
||||||
$this->alert('warning', 'Ya haz alcanzado el maximo de perfiles!', [
|
$this->alert('warning', 'Ya haz alcanzado el maximo de perfiles!', [
|
||||||
@@ -702,7 +711,7 @@ class ShowPlanes extends Component
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$historial_cuenta = new Historial_cuenta;
|
$historial_cuenta = new Historial_cuenta;
|
||||||
$historial_cuenta->cuenta_id = $this->consulta_verUsuarios->id;
|
$historial_cuenta->cuenta_id = $this->consulta_verUsuarios->id;
|
||||||
$historial_cuenta->historial_id = $historial->id;
|
$historial_cuenta->historial_id = $historial->id;
|
||||||
$historial_cuenta->perfil = $consultaHC + 1;
|
$historial_cuenta->perfil = $consultaHC + 1;
|
||||||
$historial_cuenta->save();
|
$historial_cuenta->save();
|
||||||
@@ -719,7 +728,7 @@ class ShowPlanes extends Component
|
|||||||
$logsGeneral->save();
|
$logsGeneral->save();
|
||||||
|
|
||||||
$this->addUser = false;
|
$this->addUser = false;
|
||||||
$this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $this->id_cuentaVer)->first();
|
$this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $this->id_cuentaVer)->first();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user