Update ShowPlanes.php
This commit is contained in:
@@ -312,12 +312,45 @@ class ShowPlanes extends Component
|
||||
]);
|
||||
|
||||
|
||||
|
||||
Log_historial::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'detalle' => 'El usuario ha renovado y liberado la cuenta ' . $cuenta_renovar->correo
|
||||
]);
|
||||
|
||||
if ($this->estado === 'activo') {
|
||||
$servicioPantallas = Servicio::find($this->servicio_newCuenta)->pantallas;
|
||||
|
||||
$cuentasPendientes = Pendientes::where('estado', 'pendiente')->where('servicio_id', $this->servicio_newCuenta)->take($servicioPantallas)->get();
|
||||
|
||||
foreach ($cuentasPendientes as $i => $cuentaPendiente) {
|
||||
$servicioName = $cuentaPendiente->servicio->nombre;
|
||||
|
||||
$historial_cuenta = new Historial_cuenta();
|
||||
$historial_cuenta->historial_id = $cuentaPendiente->historial_id;
|
||||
$historial_cuenta->cuenta_id = $id->id;
|
||||
$historial_cuenta->perfil = $i + 1;
|
||||
$historial_cuenta->save();
|
||||
$cuentaPendiente->update(['estado' => 'cerrado']);
|
||||
|
||||
$cuentaPendiente->historial->vendedor->notify(new NotificacionPendiente($servicioName));
|
||||
|
||||
$consulta = new Notificacion();
|
||||
$consulta->remitente_id = Auth::user()->id;
|
||||
$consulta->destinatario_id = $historial_cuenta->historial->vendedor_id;
|
||||
$consulta->titulo = "Licencia asignada para $servicioName";
|
||||
$consulta->descripcion = 'La licencia de ' . $servicioName . ' ha sido activada y ahora puedes utilizar tu cuenta sin problemas. Tus credenciales son: correo: ' . $historial_cuenta->cuenta->correo . ' contraseña: ' . $historial_cuenta->cuenta->password;
|
||||
$consulta->estado = true;
|
||||
$consulta->todos = false;
|
||||
$consulta->save();
|
||||
|
||||
Log_historial::create([
|
||||
'user_id' => $cuentaPendiente->historial->cliente->id,
|
||||
'detalle' => 'La cuenta de ' . $servicioName . ' ha sido renovada y asignada desde pendiente, correo: ' . $historial_cuenta->cuenta->correo . ' contraseña: ' . $historial_cuenta->cuenta->password . ', al usuario ' . $cuentaPendiente->historial->cliente->name,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->alert('success', 'Cuenta renovada y liberada correctamente!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
@@ -453,6 +486,11 @@ class ShowPlanes extends Component
|
||||
$consulta->estado = true;
|
||||
$consulta->todos = false;
|
||||
$consulta->save();
|
||||
|
||||
Log_historial::create([
|
||||
'user_id' => $cuentaPendiente->historial->cliente->id,
|
||||
'detalle' => 'La cuenta de ' . $servicioName . ' ha sido creada y asignada desde pendiente, correo: ' . $historial_cuenta->cuenta->correo . ' contraseña: ' . $historial_cuenta->cuenta->password . ', al usuario ' . $cuentaPendiente->historial->cliente->name,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user