This commit is contained in:
Felipe
2024-10-10 15:38:15 -05:00
parent 54a674f49d
commit 2515815e57
+12 -12
View File
@@ -224,8 +224,6 @@ class ShowPlanes extends Component
{
$this->fecha_inicial_renovar = Carbon::now()->format('Y-m-d');
$this->fecha_final_renovar = Carbon::now()->addDays(30)->format('Y-m-d');
}
@@ -319,22 +317,24 @@ class ShowPlanes extends Component
$servicio_id = $cuenta_renovar->servicio->id;
$servicioPantallas = Servicio::find($servicio_id)->pantallas;
if($this->estado == 'activo'){
if ($this->estado == 'activo') {
$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));
if ($cuentaPendiente->historial->vendedor !== null) {
$cuentaPendiente->historial->vendedor->notify(new NotificacionPendiente($servicioName));
}
$consulta = new Notificacion();
$consulta->remitente_id = Auth::user()->id;
$consulta->destinatario_id = $historial_cuenta->historial->vendedor_id;
@@ -343,7 +343,7 @@ class ShowPlanes extends Component
$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';
@@ -476,7 +476,9 @@ class ShowPlanes extends Component
$historial_cuenta->save();
$cuentaPendiente->update(['estado' => 'cerrado']);
$cuentaPendiente->historial->vendedor->notify(new NotificacionPendiente($servicioName));
if ($cuentaPendiente->historial->vendedor !== null) {
$cuentaPendiente->historial->vendedor->notify(new NotificacionPendiente($servicioName));
}
$consulta = new Notificacion();
$consulta->remitente_id = Auth::user()->id;
@@ -871,7 +873,5 @@ class ShowPlanes extends Component
} else {
$this->delete_1 = [];
}
}
}