solo asignar cuentas por pantallas
This commit is contained in:
@@ -319,38 +319,38 @@ class ShowPlanes extends Component
|
||||
|
||||
$servicio_id = $cuenta_renovar->servicio->id;
|
||||
$servicioPantallas = Servicio::find($servicio_id)->pantallas;
|
||||
|
||||
if($this->estado === 'activo'){
|
||||
$cuentasPendientes = Pendientes::where('estado', 'pendiente')->where('servicio_id', $servicio_id)->take($servicioPantallas)->get();
|
||||
|
||||
$cuentasPendientes = Pendientes::where('estado', 'pendiente')->where('servicio_id', $servicio_id)->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;
|
||||
$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();
|
||||
|
||||
$logsGeneral = new Log_general();
|
||||
$logsGeneral->user_id = $historial_cuenta->historial->vendedor_id;
|
||||
$logsGeneral->detalle = 'Se asigno una cuenta ' . $servicioName . ', con credenciales: ' . $historial_cuenta->cuenta->correo . ' contraseña: ' . $historial_cuenta->cuenta->password . ' Que se encontraba en estado pendiente';
|
||||
$logsGeneral->save();
|
||||
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;
|
||||
$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();
|
||||
|
||||
$logsGeneral = new Log_general();
|
||||
$logsGeneral->user_id = $historial_cuenta->historial->vendedor_id;
|
||||
$logsGeneral->detalle = 'Se asigno una cuenta ' . $servicioName . ', con credenciales: ' . $historial_cuenta->cuenta->correo . ' contraseña: ' . $historial_cuenta->cuenta->password . ' Que se encontraba en estado pendiente';
|
||||
$logsGeneral->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->alert('success', 'Cuenta renovada y liberada correctamente!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
@@ -464,7 +464,7 @@ class ShowPlanes extends Component
|
||||
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();
|
||||
$cuentasPendientes = ('estado', 'pendiente')->where('servicio_id', $this->servicio_newCuenta)->take($servicioPantallas)->get();
|
||||
|
||||
foreach ($cuentasPendientes as $i => $cuentaPendiente) {
|
||||
$servicioName = $cuentaPendiente->servicio->nombre;
|
||||
|
||||
Reference in New Issue
Block a user