diff --git a/app/Http/Controllers/MenuController.php b/app/Http/Controllers/MenuController.php index 0a87a7c..9e4f655 100755 --- a/app/Http/Controllers/MenuController.php +++ b/app/Http/Controllers/MenuController.php @@ -31,230 +31,258 @@ use AshAllenDesign\ShortURL\Facades\ShortURL; class MenuController extends Controller { - - - public function showwelcome(){ + public function showwelcome() + { $consulta_promociones = slider::get(); - return view('welcome',[ + return view('welcome', [ 'promociones' => $consulta_promociones, ]); } - - public function showclientes(){ + public function showtarifas() + { + return view('menu/tarifas'); + } + public function showclientes() + { return view('menu/clientes'); } - public function showservicios(){ + public function showservicios() + { return view('menu/servicios'); } - public function showtop(){ + public function showtop() + { return view('menu/top'); } - public function showreportes(){ + public function showreportes() + { return view('menu/reportes'); } - public function showperfil(){ + public function showperfil() + { return view('menu/perfil'); } - public function showpendientes(){ + public function showpendientes() + { return view('menu/pendientes'); } - public function showconfiguracion(){ + public function showconfiguracion() + { return view('menu/configuracion'); } - public function showplanes(){ + public function showplanes() + { return view('menu/planes'); } - public function showusuarios(){ + public function showusuarios() + { return view('menu/usuarios'); } - public function showadmin(){ + public function showadmin() + { return view('menu/admin'); } - public function showrecarga(){ + public function showrecarga() + { return view('menu/recarga'); } - public function showcomprar(){ + public function showcomprar() + { return view('menu/comprar'); } - public function showLogRecargas(){ + public function showLogRecargas() + { return view('menu/logs_recargas'); } - public function showLogGeneral(){ + public function showLogGeneral() + { return view('menu/log_general'); } - public function showLogHistorial(){ + public function showLogHistorial() + { return view('menu/log_historial'); } - public function showroles(){ + public function showroles() + { return view('menu/roles'); } - public function mantenimiento(){ + public function mantenimiento() + { return view('menu/mantenimiento'); } - public function pay($estado){ - return view('menu/order',[ + public function pay($estado) + { + return view('menu/order', [ 'estado' => $estado, ]); } - public function showcredenciales(Request $request){ + public function showcredenciales(Request $request) + { $credencial = Crypt::decryptString($request->id); - $consulta_historiales = Historiale::where('id',$credencial)->with('cuentas')->first(); - $msj = Configuracione::orderby('id','desc')->select('msj_compra','msj_wp','clave_1','clave_2','clave_3','clave_4','clave_5','clave_6','iptv')->first(); + $consulta_historiales = Historiale::where('id', $credencial)->with('cuentas')->first(); + $msj = Configuracione::orderby('id', 'desc')->select('msj_compra', 'msj_wp', 'clave_1', 'clave_2', 'clave_3', 'clave_4', 'clave_5', 'clave_6', 'iptv')->first(); - return view('menu/credenciales',[ - 'consulta' =>$consulta_historiales, + return view('menu/credenciales', [ + 'consulta' => $consulta_historiales, 'msj' => $msj, ]); } - public function order( Request $request ){ + public function order(Request $request) + { - $payment_id= $request->get('payment_id'); + $payment_id = $request->get('payment_id'); $response = Http::get("https://api.mercadopago.com/v1/payments/$payment_id" . "?access_token=APP_USR-7353579040069171-102716-58fdd1f52a604a1febd18a638227f603-260361439"); $response = json_decode($response); $status = $response->status; if ($status == 'approved') { - $metodo_pago = $response->payment_method_id; - $referencia = $response->external_reference; - $consulta = recarga::where('reference',$referencia)->where('status',$status)->exists(); - if ($consulta == false){ - $update_recargas = recarga::where('reference',$referencia)->update(['status' => $status,'payment_method_id'=> $metodo_pago]); - $recarga = recarga::where('reference',$referencia)->with('usuario')->first(); - $usuario= $recarga->usuario; + $metodo_pago = $response->payment_method_id; + $referencia = $response->external_reference; + $consulta = recarga::where('reference', $referencia)->where('status', $status)->exists(); + if ($consulta == false) { + $update_recargas = recarga::where('reference', $referencia)->update(['status' => $status, 'payment_method_id' => $metodo_pago]); + $recarga = recarga::where('reference', $referencia)->with('usuario')->first(); + $usuario = $recarga->usuario; - $saldo = $usuario->saldo; - $saldo_anterior = $saldo->valor; - $rol = $usuario->rol->nombre; - $monto = $recarga->valor_recarga; + $saldo = $usuario->saldo; + $saldo_anterior = $saldo->valor; + $rol = $usuario->rol->nombre; + $monto = $recarga->valor_recarga; - if (!empty($saldo_anterior)) { + if (!empty($saldo_anterior)) { - $valor= (float)$saldo_anterior + (float)$monto ; - $nuevo_saldo = $saldo->update(['valor'=>$valor]); + $valor = (float)$saldo_anterior + (float)$monto; + $nuevo_saldo = $saldo->update(['valor' => $valor]); + } else { + $nuevo_saldo = $saldo->update(['valor' => $monto]); + } - }else{ - $nuevo_saldo = $saldo->update(['valor'=>$monto]); - } + $consulta_recarga = recarga::where('reference', $referencia)->where('status', $status)->first(); - $consulta_recarga= recarga::where('reference',$referencia)->where('status',$status)->first(); + $usuario_a_recargar = User::find($consulta_recarga->usuario_id); + $nombre = $usuario_a_recargar->name; + $email = $usuario_a_recargar->email; - $usuario_a_recargar = User::find($consulta_recarga->usuario_id); - $nombre = $usuario_a_recargar->name; - $email = $usuario_a_recargar->email; - - $logsGeneral = new Log_general(); - $logsGeneral->user_id = $consulta_recarga->usuario_id; - $logsGeneral->detalle = 'El usuario '.$nombre.' - '.$email.'ha recargador por MP el monto de ' . $monto . ', Nuevo saldo disponible: $'.$nuevo_saldo; - $logsGeneral->tipo = 'recarga'; - $logsGeneral->historial_id = null; - $logsGeneral->save(); - - } - $estado= 'aprobado'; - - }elseif($status == 'pending'){ + $logsGeneral = new Log_general(); + $logsGeneral->user_id = $consulta_recarga->usuario_id; + $logsGeneral->detalle = 'El usuario ' . $nombre . ' - ' . $email . 'ha recargador por MP el monto de ' . $monto . ', Nuevo saldo disponible: $' . $nuevo_saldo; + $logsGeneral->tipo = 'recarga'; + $logsGeneral->historial_id = null; + $logsGeneral->save(); + } + $estado = 'aprobado'; + } elseif ($status == 'pending') { - $metodo_pago = $response->payment_method_id; - $referencia = $response->external_reference; - $update_recargas = recarga::where('reference',$referencia)->update(['status' => $status,'payment_method_id'=> $metodo_pago]); - $usuario = recarga::where('reference',$referencia)->with('usuario')->first()->usuario; + $metodo_pago = $response->payment_method_id; + $referencia = $response->external_reference; + $update_recargas = recarga::where('reference', $referencia)->update(['status' => $status, 'payment_method_id' => $metodo_pago]); + $usuario = recarga::where('reference', $referencia)->with('usuario')->first()->usuario; - $estado= 'pendiente'; - }else{ + $estado = 'pendiente'; + } else { - $metodo_pago = $response->payment_method_id; - $referencia = $response->external_reference; - $update_recargas = recarga::where('reference',$referencia)->update(['status' => $status,'payment_method_id'=> $metodo_pago]); - $usuario = recarga::where('reference',$referencia)->with('usuario')->first()->usuario; + $metodo_pago = $response->payment_method_id; + $referencia = $response->external_reference; + $update_recargas = recarga::where('reference', $referencia)->update(['status' => $status, 'payment_method_id' => $metodo_pago]); + $usuario = recarga::where('reference', $referencia)->with('usuario')->first()->usuario; - $estado ='rechazado'; - }; + $estado = 'rechazado'; + }; - return redirect()->route('pay',$estado); - - - } - - - public function showwebhooks(Request $request){ - + return redirect()->route('pay', $estado); } - public function recargas(){ + + public function showwebhooks(Request $request) {} + + public function recargas() + { return view('menu/recargas'); } - public function showutilidad(){ + public function showutilidad() + { return view('menu/utilidades'); } - public function showwompi($monto){ - return view('menu/wompi',[ + public function showwompi($monto) + { + return view('menu/wompi', [ 'monto' => $monto, ]); } - public function showoferta(){ + public function showoferta() + { return view('portadaservicio'); } - public function showsingle(){ + public function showsingle() + { return view('menu/single'); } - public function showpromo(){ + public function showpromo() + { return view('menu/promo'); } - public function showlogs(){ + public function showlogs() + { return view('menu/logs'); } - public function showpromociones(){ + public function showpromociones() + { return view('menu/promociones'); } - public function showimport(){ + public function showimport() + { return view('menu/importar'); } - public function showcategoria(){ + public function showcategoria() + { return view('menu/categoria'); } - public function showcategorias(){ + public function showcategorias() + { return view('menu/ver'); } - public function showservicio(){ + public function showservicio() + { return view('menu/servicio'); } - public function compras( Request $request ){ + public function compras(Request $request) + { - $payment_id= $request->get('payment_id'); + $payment_id = $request->get('payment_id'); $response = Http::get("https://api.mercadopago.com/v1/payments/$payment_id" . "?access_token=APP_USR-7353579040069171-102716-58fdd1f52a604a1febd18a638227f603-260361439"); $response = json_decode($response); @@ -262,519 +290,483 @@ class MenuController extends Controller $status = $response->status; if ($status == 'approved') { - foreach($response->additional_info->items as $item){ + foreach ($response->additional_info->items as $item) { $consulta = Historiale::where('id', $item->id)->first(); - $tarifa_id=$consulta->tarifa_id; + $tarifa_id = $consulta->tarifa_id; } $date = Carbon::now()->subDay(30); - $fecha= $date->format('Y-m-d'); + $fecha = $date->format('Y-m-d'); //SERVICIO// - if (!empty($consulta->tarifa_id)) { + if (!empty($consulta->tarifa_id)) { - $pantallas = Tarifas::where('id', $tarifa_id)->with('servicio')->first(); - $servicio_id= $pantallas->servicio_id; - $pantalla_servicio = $pantallas->servicio->pantallas; - $pantalla_servicio_completa = $pantallas->servicio->completa; + $pantallas = Tarifas::where('id', $tarifa_id)->with('servicio')->first(); + $servicio_id = $pantallas->servicio_id; + $pantalla_servicio = $pantallas->servicio->pantallas; + $pantalla_servicio_completa = $pantallas->servicio->completa; - $pantallas= $pantallas ->pantallas ?? null; - $cantidad_tarjetaPlan = $consulta->cantidad; + $pantallas = $pantallas->pantallas ?? null; + $cantidad_tarjetaPlan = $consulta->cantidad; - $cantidad_solicitada = (int)$cantidad_tarjetaPlan*(int)$pantallas; - //dd($cantidad_tarjetaPlan); - if((int)$pantalla_servicio_completa >= (int)$cantidad_solicitada ){ - $suma = $pantalla_servicio-$cantidad_solicitada; - $cuenta = Cuentas::where('servicio_id', $servicio_id) - ->whereDate('inicio', '>=', $fecha) - ->where('estado', 'activo') - ->orderBy('created_at', 'ASC') - ->withCount('historiales') // Contar los historiales - ->first(); - - if ($cuenta && $cuenta->historiales_count <= $suma) { - // La cuenta cumple con el filtro de cantidad de historiales. - } else { - // La cuenta no cumple con el filtro (tiene más historiales de los permitidos o no existe). - $cuenta = null; - } - - }elseif((int)$pantalla_servicio_completa == (int)$cantidad_solicitada){ - $this->fecha_final_1 = $today = Carbon::now()->addDays($pantallas->dias-15); - $this->fecha_final_2 = $today = Carbon::now()->addDays($pantallas->dias+15); - //completas - $cuentas = Cuentas::where('servicio_id', $this->servicio_id) - ->whereDate('inicio', '>=', $this->fecha) - ->whereDate('vencimiento', '>=', $this->fecha_final_1) - ->whereDate('vencimiento', '<=', $this->fecha_final_2) - ->orderBy('created_at', 'ASC') - ->withCount('historiales') // Contar los historiales - ->where('estado', 'pendiente') // Filtrar por estado pendiente - ->get(); // Obtener todas las cuentas que coincidan con los filtros - - $cuenta = $cuentas->first(function ($cuenta) { - return $cuenta->historiales_count == 0; // Filtrar solo cuentas que no tengan historiales - }); - - }else{ - $cuenta=null; - } - - - if (!empty($cuenta) ) { - - $perfil = $cuenta->historiales_count; - for ($n=1; $n <= $cantidad_solicitada ; $n++) { - - $historial_cuenta = new Historial_cuenta(); - $historial_cuenta->cuenta_id = $cuenta->id; - $historial_cuenta->historial_id = $item->id; - $historial_cuenta->perfil = (int)$perfil + (int)$n; - $historial_cuenta->save(); - //dd($historial_cuenta->id); - } - - if (($n-1) == $cantidad_solicitada) { - - $consulta->update(['estado'=>'activo']); - $this->cred($consulta); - $encryptado = Crypt::encryptString($consulta->id); - //dd('llegue'); - return redirect('/credenciales?id='.$encryptado); - - }else{ - - return 'Error en la asignacion de cuentas, comuniquese con soporte!'; - - } - - - }else{ - //dd($cuenta); - $suma2= $pantalla_servicio - $pantallas; - - - for ($h=0; $h < (int)$cantidad_tarjetaPlan ; $h++) { - //dd($n); - $cuentas = Cuentas::where('servicio_id', $servicio_id) - ->whereDate('inicio', '>=', $fecha) - ->orderBy('created_at', 'ASC') - ->with('historiales') // Obtener los historiales relacionados - ->withCount('historiales') // Contar los historiales asociados - ->where('estado', 'activo') // Filtrar por estado 'activo' - ->get(); // Obtener todas las cuentas que coincidan con los filtros - $cuenta = $cuentas->first(function ($cuenta) use ($suma2) { - return $cuenta->historiales_count <= (int)$suma2; // Filtrar por el número de historiales - }); - - //dd($cuenta); - if (!empty($cuenta)) { - $perfil = $cuenta->historiales_count; - for ($y=0; $y < (int)$pantallas ; $y++) { - //dd($pantallas); - $historial_cuenta = new Historial_cuenta; - $historial_cuenta->cuenta_id = $cuenta->id; - $historial_cuenta->historial_id = $item->id; - $historial_cuenta->perfil = (int)$perfil + (int)$y+1; - $historial_cuenta->save(); - - } - - }else{ - return 'No hay cuentas disponibles, comuniquese con soporte!'; - } - } - - - $consulta->update(['estado'=>'activo']); - $this->cred($consulta); - $encryptado = Crypt::encryptString($consulta->id); - return redirect('/credenciales?id='.$encryptado); - - - } - - - - - } - - //PROMOCION - if (!empty($consulta->promocion_id)){ - - for ($p = 0; $p < (int)$consulta->cantidad; $p++) { - //dd($this->cantidad_comprarPromo); - foreach ($consulta->promocion->tarifas as $tarifa) { - - $pantallas_tarifa = $tarifa->pantallas; - $servicio_id = $tarifa->servicio_id; - $pantalla_servicio = $tarifa->servicio->pantallas; - $pantalla_servicio_completa = $tarifa->servicio->completa; - - $faltante = $pantalla_servicio - $pantallas_tarifa; - if ($pantalla_servicio_completa == $pantallas_tarifa) { - $this->fecha_final_1 = $today = Carbon::now()->addDays($tarifa->dias-15); - $this->fecha_final_2 = $today = Carbon::now()->addDays($tarifa->dias+15); - $cuentas = Cuentas::where('servicio_id', $servicio_id) + $cantidad_solicitada = (int)$cantidad_tarjetaPlan * (int)$pantallas; + //dd($cantidad_tarjetaPlan); + if ((int)$pantalla_servicio_completa >= (int)$cantidad_solicitada) { + $suma = $pantalla_servicio - $cantidad_solicitada; + $cuenta = Cuentas::where('servicio_id', $servicio_id) ->whereDate('inicio', '>=', $fecha) + ->where('estado', 'activo') + ->orderBy('created_at', 'ASC') + ->withCount('historiales') // Contar los historiales + ->first(); + + if ($cuenta && $cuenta->historiales_count <= $suma) { + // La cuenta cumple con el filtro de cantidad de historiales. + } else { + // La cuenta no cumple con el filtro (tiene más historiales de los permitidos o no existe). + $cuenta = null; + } + } elseif ((int)$pantalla_servicio_completa == (int)$cantidad_solicitada) { + $this->fecha_final_1 = $today = Carbon::now()->addDays($pantallas->dias - 15); + $this->fecha_final_2 = $today = Carbon::now()->addDays($pantallas->dias + 15); + //completas + $cuentas = Cuentas::where('servicio_id', $this->servicio_id) + ->whereDate('inicio', '>=', $this->fecha) ->whereDate('vencimiento', '>=', $this->fecha_final_1) ->whereDate('vencimiento', '<=', $this->fecha_final_2) ->orderBy('created_at', 'ASC') - ->with('historiales') // Relación con los historiales ->withCount('historiales') // Contar los historiales - ->where('estado', 'pendiente') // Filtrar por estado 'pendiente' + ->where('estado', 'pendiente') // Filtrar por estado pendiente ->get(); // Obtener todas las cuentas que coincidan con los filtros - $cuenta = $cuentas->first(function ($cuenta) { - return $cuenta->historiales_count == 0; // Filtrar solo cuentas que no tengan historiales - }); - - }else{ - $cuentas = Cuentas::where('servicio_id', $servicio_id) - ->whereDate('inicio', '>=', $fecha) - ->orderBy('created_at', 'ASC') - ->with('historiales') // Relación con los historiales - ->withCount('historiales') // Contar los historiales asociados - ->where('estado', 'activo') // Filtrar por el estado 'activo' - ->get(); // Obtener todas las cuentas que cumplan con los filtros - - $cuenta = $cuentas->first(function ($cuenta) use ($faltante) { - return $cuenta->historiales_count <= (int) $faltante; - }); - - - } - //dd($tarifa); - - - if (!empty($cuenta)) { - $perfil = $cuenta->historiales_count; - for ($y = 0; $y < (int)$pantallas_tarifa; $y++) { - - $historial_cuenta = new Historial_cuenta(); - $historial_cuenta->cuenta_id = $cuenta->id; - $historial_cuenta->historial_id = $item->id; - $historial_cuenta->perfil = (int)$perfil + (int)$y+1; - $historial_cuenta->save(); - } - - - } else { - - return 'No hay cuentas disponibles, comuniquese con soporte!'; - } + $cuenta = $cuentas->first(function ($cuenta) { + return $cuenta->historiales_count == 0; // Filtrar solo cuentas que no tengan historiales + }); + } else { + $cuenta = null; } - } - if (!empty($y)) { - $consulta->update(['estado'=>'activo']); + if (!empty($cuenta)) { + + $perfil = $cuenta->historiales_count; + for ($n = 1; $n <= $cantidad_solicitada; $n++) { + + $historial_cuenta = new Historial_cuenta(); + $historial_cuenta->cuenta_id = $cuenta->id; + $historial_cuenta->historial_id = $item->id; + $historial_cuenta->perfil = (int)$perfil + (int)$n; + $historial_cuenta->save(); + //dd($historial_cuenta->id); + } + + if (($n - 1) == $cantidad_solicitada) { + + $consulta->update(['estado' => 'activo']); $this->cred($consulta); $encryptado = Crypt::encryptString($consulta->id); //dd('llegue'); - return redirect('/credenciales?id='.$encryptado); + return redirect('/credenciales?id=' . $encryptado); + } else { - }else{ - return 'No hay cuentas disponibles, comuniquese con soporte!'; + return 'Error en la asignacion de cuentas, comuniquese con soporte!'; + } + } else { + //dd($cuenta); + $suma2 = $pantalla_servicio - $pantallas; + + + for ($h = 0; $h < (int)$cantidad_tarjetaPlan; $h++) { + //dd($n); + $cuentas = Cuentas::where('servicio_id', $servicio_id) + ->whereDate('inicio', '>=', $fecha) + ->orderBy('created_at', 'ASC') + ->with('historiales') // Obtener los historiales relacionados + ->withCount('historiales') // Contar los historiales asociados + ->where('estado', 'activo') // Filtrar por estado 'activo' + ->get(); // Obtener todas las cuentas que coincidan con los filtros + $cuenta = $cuentas->first(function ($cuenta) use ($suma2) { + return $cuenta->historiales_count <= (int)$suma2; // Filtrar por el número de historiales + }); + + //dd($cuenta); + if (!empty($cuenta)) { + $perfil = $cuenta->historiales_count; + for ($y = 0; $y < (int)$pantallas; $y++) { + //dd($pantallas); + $historial_cuenta = new Historial_cuenta; + $historial_cuenta->cuenta_id = $cuenta->id; + $historial_cuenta->historial_id = $item->id; + $historial_cuenta->perfil = (int)$perfil + (int)$y + 1; + $historial_cuenta->save(); + } + } else { + return 'No hay cuentas disponibles, comuniquese con soporte!'; + } + } + + + $consulta->update(['estado' => 'activo']); + $this->cred($consulta); + $encryptado = Crypt::encryptString($consulta->id); + return redirect('/credenciales?id=' . $encryptado); + } } - } + //PROMOCION + if (!empty($consulta->promocion_id)) { + + for ($p = 0; $p < (int)$consulta->cantidad; $p++) { + //dd($this->cantidad_comprarPromo); + foreach ($consulta->promocion->tarifas as $tarifa) { + + $pantallas_tarifa = $tarifa->pantallas; + $servicio_id = $tarifa->servicio_id; + $pantalla_servicio = $tarifa->servicio->pantallas; + $pantalla_servicio_completa = $tarifa->servicio->completa; + + $faltante = $pantalla_servicio - $pantallas_tarifa; + if ($pantalla_servicio_completa == $pantallas_tarifa) { + $this->fecha_final_1 = $today = Carbon::now()->addDays($tarifa->dias - 15); + $this->fecha_final_2 = $today = Carbon::now()->addDays($tarifa->dias + 15); + $cuentas = Cuentas::where('servicio_id', $servicio_id) + ->whereDate('inicio', '>=', $fecha) + ->whereDate('vencimiento', '>=', $this->fecha_final_1) + ->whereDate('vencimiento', '<=', $this->fecha_final_2) + ->orderBy('created_at', 'ASC') + ->with('historiales') // Relación con los historiales + ->withCount('historiales') // Contar los historiales + ->where('estado', 'pendiente') // Filtrar por estado 'pendiente' + ->get(); // Obtener todas las cuentas que coincidan con los filtros + + $cuenta = $cuentas->first(function ($cuenta) { + return $cuenta->historiales_count == 0; // Filtrar solo cuentas que no tengan historiales + }); + } else { + $cuentas = Cuentas::where('servicio_id', $servicio_id) + ->whereDate('inicio', '>=', $fecha) + ->orderBy('created_at', 'ASC') + ->with('historiales') // Relación con los historiales + ->withCount('historiales') // Contar los historiales asociados + ->where('estado', 'activo') // Filtrar por el estado 'activo' + ->get(); // Obtener todas las cuentas que cumplan con los filtros + + $cuenta = $cuentas->first(function ($cuenta) use ($faltante) { + return $cuenta->historiales_count <= (int) $faltante; + }); + } + //dd($tarifa); - } + if (!empty($cuenta)) { + $perfil = $cuenta->historiales_count; + for ($y = 0; $y < (int)$pantallas_tarifa; $y++) { + $historial_cuenta = new Historial_cuenta(); + $historial_cuenta->cuenta_id = $cuenta->id; + $historial_cuenta->historial_id = $item->id; + $historial_cuenta->perfil = (int)$perfil + (int)$y + 1; + $historial_cuenta->save(); + } + } else { + return 'No hay cuentas disponibles, comuniquese con soporte!'; + } + } + } -} - -//wompi - -public function wompi_pagos(Request $request){ - - $response = Http::get("https://sandbox.wompi.co/v1/transactions/136099-1677473887-65588"); - $response = json_decode($response); - //dd($response); - -} - -public function wompi_hook(Request $request){ - //return json_encode('hola'); - - if (!empty($request)) { - - - - foreach($request->data as $item ){ - //return $item; - $status = $item['status']; - $user_id = $item['reference']; - $monto = substr($item['amount_in_cents'], 0, -2); - $metodo_pago = $item['payment_method_type']; - + if (!empty($y)) { + $consulta->update(['estado' => 'activo']); + $this->cred($consulta); + $encryptado = Crypt::encryptString($consulta->id); + //dd('llegue'); + return redirect('/credenciales?id=' . $encryptado); + } else { + return 'No hay cuentas disponibles, comuniquese con soporte!'; + } + } } - - $update_recargas = recarga::where('reference',$referencia)->update(['status' => $status,'payment_method_id'=> $metodo_pago]); - if ($status == 'APPROVED') { - - $usuario = recarga::where('reference',$referencia)->with('usuario')->first()->usuario; - $saldo = $usuario->saldo; - $saldo_anterior = $saldo->valor; - $rol = $usuario->rol->nombre; - //return $rol; - $monto_adicional = 0; - if ($rol == "super" || $rol == "administrador" || $rol == "distribuidor") { - $monto_adicional = 500; - } - - - if (!empty($saldo_anterior)) { - - $valor= (float)$saldo_anterior + (float)$monto - (float)$monto_adicional; - $nuevo_saldo = $saldo->update(['valor'=>$valor]); - - // return $nuevo_saldo; - - } - } } + //wompi + + public function wompi_pagos(Request $request) + { + + $response = Http::get("https://sandbox.wompi.co/v1/transactions/136099-1677473887-65588"); + $response = json_decode($response); + //dd($response); + + } + + public function wompi_hook(Request $request) + { + //return json_encode('hola'); + + if (!empty($request)) { -} -public function cred($consulta){ + foreach ($request->data as $item) { + //return $item; + $status = $item['status']; + $user_id = $item['reference']; + $monto = substr($item['amount_in_cents'], 0, -2); + $metodo_pago = $item['payment_method_type']; + } + + $update_recargas = recarga::where('reference', $referencia)->update(['status' => $status, 'payment_method_id' => $metodo_pago]); + if ($status == 'APPROVED') { + + $usuario = recarga::where('reference', $referencia)->with('usuario')->first()->usuario; + $saldo = $usuario->saldo; + $saldo_anterior = $saldo->valor; + $rol = $usuario->rol->nombre; + //return $rol; + $monto_adicional = 0; + if ($rol == "super" || $rol == "administrador" || $rol == "distribuidor") { + $monto_adicional = 500; + } - $encryptado = Crypt::encryptString($consulta->id); + if (!empty($saldo_anterior)) { - $enlace = '/credenciales?id='.$encryptado; + $valor = (float)$saldo_anterior + (float)$monto - (float)$monto_adicional; + $nuevo_saldo = $saldo->update(['valor' => $valor]); - $user=User::find($consulta->cliente); - if (!empty($consulta->promocion_id)){ { + // return $nuevo_saldo; - $shortURLObject = ShortURL::destinationUrl('https://app.sirpremium.com.co'.$enlace)->make(); - $shortURL = $shortURLObject->default_short_url; - $message = $consulta->promocion->nombre.'. Ver credenciales: '.$shortURL ; - $recipients= '+57'.$consulta->cliente->celular; - - $this->sendMessage($message, $recipients); - - $notificacion = [ - 'enlace' => $enlace, - 'fecha_final' => $consulta->fecha_final, - 'cliente' => $consulta->cliente->name, - 'servicio' => $consulta->promocion->nombre, - 'tipo' => 'compra', - 'vendedor' => Role::where('nombre','super')->first()->usuarios->first()->name, - - ]; - } - - if (!empty($consulta->tarifa_id)){ - - $shortURLObject = ShortURL::destinationUrl('https://app.sirpremium.com.co'.$enlace)->make(); - $shortURL = $shortURLObject->default_short_url; - $message = $consulta->tarifa->servicio->nombre.'-'.$consulta->tarifa->pantallas. 'P. Ver credenciales: '.$shortURL ; - $recipients= '+57'.$consulta->cliente->celular; - - $this->sendMessage($message, $recipients); - - - $notificacion = [ - 'enlace' => $enlace, - 'fecha_final' => $consulta->fecha_final, - 'cliente' => $consulta->cliente->name, - 'servicio' => $consulta->tarifa->servicio->nombre.'-'.$consulta->tarifa->pantallas. 'pantallas', - 'tipo' => 'compra', - 'vendedor' => Role::where('nombre','super')->first()->usuarios->first()->name, - - ]; + } + } } + } + + public function cred($consulta) + { + + + $encryptado = Crypt::encryptString($consulta->id); + + $enlace = '/credenciales?id=' . $encryptado; + + $user = User::find($consulta->cliente); + if (!empty($consulta->promocion_id)) { { + + $shortURLObject = ShortURL::destinationUrl('https://app.sirpremium.com.co' . $enlace)->make(); + $shortURL = $shortURLObject->default_short_url; + $message = $consulta->promocion->nombre . '. Ver credenciales: ' . $shortURL; + $recipients = '+57' . $consulta->cliente->celular; + + $this->sendMessage($message, $recipients); + + $notificacion = [ + 'enlace' => $enlace, + 'fecha_final' => $consulta->fecha_final, + 'cliente' => $consulta->cliente->name, + 'servicio' => $consulta->promocion->nombre, + 'tipo' => 'compra', + 'vendedor' => Role::where('nombre', 'super')->first()->usuarios->first()->name, + + ]; + } + + if (!empty($consulta->tarifa_id)) { + + $shortURLObject = ShortURL::destinationUrl('https://app.sirpremium.com.co' . $enlace)->make(); + $shortURL = $shortURLObject->default_short_url; + $message = $consulta->tarifa->servicio->nombre . '-' . $consulta->tarifa->pantallas . 'P. Ver credenciales: ' . $shortURL; + $recipients = '+57' . $consulta->cliente->celular; + + $this->sendMessage($message, $recipients); + + + $notificacion = [ + 'enlace' => $enlace, + 'fecha_final' => $consulta->fecha_final, + 'cliente' => $consulta->cliente->name, + 'servicio' => $consulta->tarifa->servicio->nombre . '-' . $consulta->tarifa->pantallas . 'pantallas', + 'tipo' => 'compra', + 'vendedor' => Role::where('nombre', 'super')->first()->usuarios->first()->name, + + ]; + } Notification::send($user, new compra($notificacion)); + } + } + + public function sendMessage($message, $recipients) + { -} + $auth_basic = base64_encode(getenv("USER_LABSMOBILE") . ':' . getenv("PASS_LABSMOBILE")); -} + $curl = curl_init(); -public function sendMessage($message, $recipients) -{ + curl_setopt_array($curl, array( + CURLOPT_URL => "https://api.labsmobile.com/json/send", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "POST", + CURLOPT_POSTFIELDS => '{"message":"' . $message . '", "tpoa":"Sender","recipient":[{"msisdn":"' . $recipients . '"}]}', + CURLOPT_HTTPHEADER => array( + "Authorization: Basic " . $auth_basic, + "Cache-Control: no-cache", + "Content-Type: application/json" + ), + )); + $response = curl_exec($curl); + $err = curl_error($curl); - $auth_basic = base64_encode(getenv("USER_LABSMOBILE").':'.getenv("PASS_LABSMOBILE")); + curl_close($curl); - $curl = curl_init(); + if ($err) { + } else { + } + } + public function showmp(Request $request) + { - curl_setopt_array($curl, array( - CURLOPT_URL => "https://api.labsmobile.com/json/send", - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 30, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => "POST", - CURLOPT_POSTFIELDS => '{"message":"'.$message.'", "tpoa":"Sender","recipient":[{"msisdn":"'.$recipients.'"}]}', - CURLOPT_HTTPHEADER => array( - "Authorization: Basic ".$auth_basic, - "Cache-Control: no-cache", - "Content-Type: application/json" - ), - )); + Log::info('MercadoPago webhook received', $request->all()); - $response = curl_exec($curl); - $err = curl_error($curl); + // Aquí puedes agregar la lógica para manejar las notificaciones de MercadoPago + $data = json_decode($request->getContent(), true); + $paymentId = $data['data']['id']; - curl_close($curl); + $response = Http::get("https://api.mercadopago.com/v1/payments/$paymentId" . "?access_token=APP_USR-7353579040069171-102716-58fdd1f52a604a1febd18a638227f603-260361439"); + //return $response; + $response = json_decode($response); + $status = $response->status; - if ($err) { + if ($status == 'approved') { + $metodo_pago = $response->payment_method_id; + $referencia = $response->external_reference; + $consulta = recarga::where('reference', $referencia)->where('status', $status)->exists(); + if ($consulta == false) { + $update_recargas = recarga::where('reference', $referencia)->update(['status' => $status, 'payment_method_id' => $metodo_pago]); + $recarga = recarga::where('reference', $referencia)->with('usuario')->first(); + $usuario = $recarga->usuario; + + $saldo = $usuario->saldo; + $saldo_anterior = $saldo->valor; + $monto = $recarga->valor_recarga; + + $valor = (float)$saldo_anterior + (float)$monto; + $nuevo_saldo = $saldo->update(['valor' => $valor]); + } + } - } else { + return response()->json(['status' => 'ok']); + } + public function pruebas() + { + $fechaHoy = Carbon::now()->format('Y-m-d'); + + $consulta_historial = Historiale::whereDate('fecha_final', $fechaHoy)->with('cliente')->get(); + + foreach ($consulta_historial as $item) { + + $user = User::find($item->cliente->id); + + if (!empty($item->promocion_id)) { + + $nombre = $item->promocion->nombre; + } + if (!empty($item->tarifa_id)) { + $nombre = $item->tarifa->servicio->nombre . '-' . $item->tarifa->pantallas . 'P'; + } + + $notificacion = [ + //'valor' => $value['precio'], + 'fecha_final' => $item->fecha_final, + 'cliente' => $item->cliente->name, + 'servicio' => $nombre, + 'tipo' => 'vencimiento', + 'vendedor' => $item->vendedor->name, + + ]; + + Notification::sendNow($user, new Vencimiento($notificacion)); + + // $fecha=Carbon::parse($item->fecha_final)->format('d/m/Y'); + + //$message = 'Su '.$nombre.', Vence Hoy, '.$fecha.'. Renueva ahora!!' ; + //$recipients= '+57'.$item->cliente->celular; + + //$auth_basic = base64_encode('admin@jaguarws.ga:9u3xxXhHt8maeiOexg07pFKI0rpYazI0'); + + //$curl = curl_init(); + + //curl_setopt_array($curl, array( + //CURLOPT_URL => "https://api.labsmobile.com/json/send", + //CURLOPT_RETURNTRANSFER => true, + //CURLOPT_ENCODING => "", + //CURLOPT_MAXREDIRS => 10, + //CURLOPT_TIMEOUT => 30, + //CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + //CURLOPT_CUSTOMREQUEST => "POST", + //CURLOPT_POSTFIELDS => '{"message":"'.$message.'", "tpoa":"Sender","recipient":[{"msisdn":"'.$recipients.'"}]}', + //CURLOPT_HTTPHEADER => array( + // "Authorization: Basic ".$auth_basic, + // "Cache-Control: no-cache", + // "Content-Type: application/json" + //), + //)); + + //$response = curl_exec($curl); + //$err = curl_error($curl); + + //curl_close($curl); + //return $response; + //if ($err) { + + + //} else { + + //} + + + } + + $fechaHoy1 = Carbon::now(); + $fechaHoy1 = Carbon::parse($fechaHoy1)->subDay(1); + + $consulta_historial1 = Historiale::whereDate('fecha_final', '<', $fechaHoy1)->with('cliente', 'cuentas')->get(); + foreach ($consulta_historial1 as $item1) { + + foreach ($item1->cuentas->unique() as $item2) { + //dd($item2); + $logs = new log; + $logs->historial_id = $item1->id; + $logs->cuenta_id = $item2->id; + $logs->save(); + } + //$eliminar_cuentas = Historial_cuenta::where('historial_id',$item1->id)->truncate(); + //dd('termine'); + + } + } + + public function click_compra(Request $request) + { + // Aquí puedes guardar, registrar o procesar la info + RegistroCompra::create([ + 'user_id' => auth()->id(), + 'nombre' => $request->nombre, + 'email' => $request->email, + 'saldo' => $request->saldo, + ]); + + return response()->json(['success' => true]); } } -public function showmp(Request $request){ - - Log::info('MercadoPago webhook received', $request->all()); - - // Aquí puedes agregar la lógica para manejar las notificaciones de MercadoPago - $data = json_decode($request->getContent(), true); - $paymentId = $data['data']['id']; - - $response = Http::get("https://api.mercadopago.com/v1/payments/$paymentId" . "?access_token=APP_USR-7353579040069171-102716-58fdd1f52a604a1febd18a638227f603-260361439"); - //return $response; - $response = json_decode($response); - $status = $response->status; - - if ($status == 'approved') { - $metodo_pago = $response->payment_method_id; - $referencia = $response->external_reference; - $consulta = recarga::where('reference',$referencia)->where('status',$status)->exists(); - if ($consulta == false){ - $update_recargas = recarga::where('reference',$referencia)->update(['status' => $status,'payment_method_id'=> $metodo_pago]); - $recarga = recarga::where('reference',$referencia)->with('usuario')->first(); - $usuario= $recarga->usuario; - - $saldo = $usuario->saldo; - $saldo_anterior = $saldo->valor; - $monto = $recarga->valor_recarga; - - $valor= (float)$saldo_anterior + (float)$monto ; - $nuevo_saldo = $saldo->update(['valor'=>$valor]); - - - } - } - - - - return response()->json(['status' => 'ok']); - - -} - -public function pruebas (){ - $fechaHoy = Carbon::now()->format('Y-m-d'); - -$consulta_historial = Historiale::whereDate('fecha_final', $fechaHoy)->with('cliente')->get(); - - foreach ($consulta_historial as $item) { - - $user = User::find($item->cliente->id); - - if (!empty($item->promocion_id)) { - - $nombre= $item->promocion->nombre; - } - if (!empty($item->tarifa_id)) { - $nombre = $item->tarifa->servicio->nombre . '-' . $item->tarifa->pantallas . 'P'; - } - - $notificacion = [ - //'valor' => $value['precio'], - 'fecha_final' => $item->fecha_final, - 'cliente' => $item->cliente->name, - 'servicio' => $nombre, - 'tipo' => 'vencimiento', - 'vendedor' =>$item->vendedor->name, - - ]; - - Notification::sendNow($user, new Vencimiento($notificacion)); - - // $fecha=Carbon::parse($item->fecha_final)->format('d/m/Y'); - - //$message = 'Su '.$nombre.', Vence Hoy, '.$fecha.'. Renueva ahora!!' ; - //$recipients= '+57'.$item->cliente->celular; - - //$auth_basic = base64_encode('admin@jaguarws.ga:9u3xxXhHt8maeiOexg07pFKI0rpYazI0'); - - //$curl = curl_init(); - - //curl_setopt_array($curl, array( - //CURLOPT_URL => "https://api.labsmobile.com/json/send", - //CURLOPT_RETURNTRANSFER => true, - //CURLOPT_ENCODING => "", - //CURLOPT_MAXREDIRS => 10, - //CURLOPT_TIMEOUT => 30, - //CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - //CURLOPT_CUSTOMREQUEST => "POST", - //CURLOPT_POSTFIELDS => '{"message":"'.$message.'", "tpoa":"Sender","recipient":[{"msisdn":"'.$recipients.'"}]}', - //CURLOPT_HTTPHEADER => array( - // "Authorization: Basic ".$auth_basic, - // "Cache-Control: no-cache", - // "Content-Type: application/json" - //), - //)); - - //$response = curl_exec($curl); - //$err = curl_error($curl); - - //curl_close($curl); - //return $response; - //if ($err) { - - - //} else { - - //} - - - } - - $fechaHoy1 = Carbon::now(); - $fechaHoy1 = Carbon::parse($fechaHoy1)->subDay(1); - - $consulta_historial1= Historiale::whereDate('fecha_final','<',$fechaHoy1)->with('cliente','cuentas')->get(); - foreach ($consulta_historial1 as $item1) { - - foreach($item1->cuentas->unique() as $item2){ - //dd($item2); - $logs = new log; - $logs->historial_id = $item1->id; - $logs->cuenta_id = $item2->id; - $logs->save(); - } - //$eliminar_cuentas = Historial_cuenta::where('historial_id',$item1->id)->truncate(); - //dd('termine'); - - } -} - -public function click_compra(Request $request) { - // Aquí puedes guardar, registrar o procesar la info - RegistroCompra::create([ - 'user_id' => auth()->id(), - 'nombre' => $request->nombre, - 'email' => $request->email, - 'saldo' => $request->saldo, -]); - -return response()->json(['success' => true]); -} -} diff --git a/app/Http/Livewire/ShowTarifas.php b/app/Http/Livewire/ShowTarifas.php index 2ec8cc7..49bc96c 100644 --- a/app/Http/Livewire/ShowTarifas.php +++ b/app/Http/Livewire/ShowTarifas.php @@ -2,12 +2,78 @@ namespace App\Http\Livewire; +use App\Models\Promociones; +use App\Models\Role; +use App\Models\Servicio; +use App\Models\Tarifas; use Livewire\Component; +use Livewire\WithPagination; +use Jantinnerezo\LivewireAlert\LivewireAlert; +use Illuminate\Support\Facades\Auth; class ShowTarifas extends Component { + use LivewireAlert; + use WithPagination; + + public $tarifas; + public $planes; + + // Tarifa datos + public $pantallas; + public $dias = 30; + public $precio; + public $utilidad; + public $estado; + public $servicio_id; + public $plan_id; + public $rol_id; + public function render() { - return view('livewire.show-tarifas'); + $this->tarifas = Tarifas::where('servicio_id', $this->servicio_id)->where('rol_id', Auth::user()->rol->id)->where('estado', 'activo')->get(); + $this->planes = Tarifas::where('servicio_id', $this->servicio_id)->where('rol_id', Auth::user()->rol->id)->where('estado', 'activo')->get(); + + return view('livewire.show-tarifas', [ + 'roles' => Role::where('subvendedor_id', auth()->user()->id)->get(), + 'promo' => Promociones::where('visible', 'true')->get(), + 'servicios' => Servicio::where('estado', 'activo')->get(), + ]); + } + + public function guardarTarifa() + { + $this->validate([ + 'pantallas' => 'required', + 'dias' => 'required', + 'precio' => 'required', + 'utilidad' => 'required', + 'estado' => 'required', + 'servicio_id' => 'required', + 'rol_id' => 'required', + ], [ + 'pantallas.required' => 'El campo pantallas es obligatorio', + 'dias.required' => 'El campo días es obligatorio', + 'precio.required' => 'El campo precio es obligatorio', + 'utilidad.required' => 'El campo utilidad es obligatorio', + 'estado.required' => 'El campo estado es obligatorio', + 'servicio_id.required' => 'El campo servicio es obligatorio', + 'rol_id.required' => 'El campo rol es obligatorio', + ]); + + Tarifas::create([ + 'pantallas' => $this->pantallas, + 'dias' => $this->dias, + 'valor' => $this->precio, + 'utilidad' => $this->utilidad, + 'estado' => $this->estado ? 'activo' : 'inactivo', + 'servicio_id' => $this->servicio_id, + 'rol_id' => $this->rol_id, + 'subvendedor_id' => Auth::user()->id, + ]); + + $this->alert('success', '¡Tarifas creada correctamente!', [ + 'position' => 'top' + ]); } } diff --git a/app/Http/Livewire/ShowUsuarios.php b/app/Http/Livewire/ShowUsuarios.php index d9dbe11..31c299b 100755 --- a/app/Http/Livewire/ShowUsuarios.php +++ b/app/Http/Livewire/ShowUsuarios.php @@ -100,12 +100,11 @@ class ShowUsuarios extends Component public function render() { - $consulta_tarifas = TarifaPromo::take(1); $consulta_usuarios = User::withCount(['usuario_tarifas as active_tarifas' => function ($query) { - $query->where('visible', 'true'); - }]) + $query->where('visible', 'true'); + }]) ->withCount(['usuario_promos as active_promos' => function ($query) { $query->where('visible', 'true'); }]) @@ -114,9 +113,15 @@ class ShowUsuarios extends Component ->orWhere('email', 'ILIKE', '%' . $this->buscar . '%'); }); - if ($this->verPreciosPersonalizados) { - $consulta_usuarios = $consulta_usuarios->havingRaw('active_tarifas > 0 OR active_promos > 0'); + $consulta_usuarios = $consulta_usuarios->where(function ($query) { + $query->whereHas('usuario_tarifas', function ($q) { + $q->where('visible', true); + }) + ->orWhereHas('usuario_promos', function ($q) { + $q->where('visible', true); + }); + }); } if (!(Auth::user()->rol->nombre == "super")) { @@ -316,6 +321,23 @@ class ShowUsuarios extends Component $this->limpiarSaldo(); } + public function quitarSubvendedor($id) + { + User::FindOrFail($id); + + User::find($id)->update([ + 'subvendedor' => false + ]); + } + public function ponerSubvendedor($id) + { + User::FindOrFail($id); + + User::find($id)->update([ + 'subvendedor' => true + ]); + } + public function editar($id) { $this->id_edit = $id; diff --git a/app/Models/Tarifas.php b/app/Models/Tarifas.php index 5a0716e..b4c0494 100755 --- a/app/Models/Tarifas.php +++ b/app/Models/Tarifas.php @@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Model; class Tarifas extends Model { use HasFactory; + protected $fillable = [ 'pantallas', 'dias', @@ -15,37 +16,42 @@ class Tarifas extends Model 'utilidad', 'estado', 'servicio_id', - 'rol_id' - + 'rol_id', + 'subvendedor_id', ]; - public function servicio(){ - return $this ->belongsTo(Servicio::class); + public function servicio() + { + return $this->belongsTo(Servicio::class); } - public function preferenciales(){ - return $this ->hasMany(Preferencial::class,'tarifa_id'); + public function preferenciales() + { + return $this->hasMany(Preferencial::class, 'tarifa_id'); } - public function cuentas(){ - return $this ->hasMany(Cuentas::class,'tarifa_id'); + public function cuentas() + { + return $this->hasMany(Cuentas::class, 'tarifa_id'); } - public function historiales(){ - return $this ->hasMany(Historiale::class,'tarifa_id'); + public function historiales() + { + return $this->hasMany(Historiale::class, 'tarifa_id'); } - public function promociones(){ - return $this ->belongsToMany(Promociones::class,'promocion_tarifas','tarifa_id','promocion_id'); + public function promociones() + { + return $this->belongsToMany(Promociones::class, 'promocion_tarifas', 'tarifa_id', 'promocion_id'); } - public function rol(){ - return $this ->belongsTo(Role::class); + public function rol() + { + return $this->belongsTo(Role::class); } - public function usuario_tarifas(){ - return $this ->hasMany(Usuario_tarifa::class,'tarifa_id'); + public function usuario_tarifas() + { + return $this->hasMany(Usuario_tarifa::class, 'tarifa_id'); } - - } diff --git a/resources/views/layouts/navigation.blade.php b/resources/views/layouts/navigation.blade.php index 5111bf9..94ec6c0 100755 --- a/resources/views/layouts/navigation.blade.php +++ b/resources/views/layouts/navigation.blade.php @@ -113,10 +113,11 @@
+
@if (auth()->user()->subvendedor) Gestión Roles Gestión Usuarios + Gestión Tarifas @if ( auth()->user()->rol->nombre == 'super' || auth()->user()->rol->nombre == 'administrador' || auth()->user()->rol->nombre == 'editor') Gestión Planes Importar cuentas diff --git a/resources/views/livewire/show-planes.blade.php b/resources/views/livewire/show-planes.blade.php index 1cb8c40..20399dc 100755 --- a/resources/views/livewire/show-planes.blade.php +++ b/resources/views/livewire/show-planes.blade.php @@ -24,53 +24,36 @@ {{-- Buscador --}} -
+ Cargando
+| Estado | +Rol | +Pantallas | +Valor | +Dias | +Utilidad | ++ | + |
|---|---|---|---|---|---|---|---|
| + @if ($tarifa->estado == 'activo') + + @else + + @endif + | +{{ $tarifa->rol->nombre ?? '' }} | +{{ $tarifa->pantallas ?? '' }} | +{{ number_format($tarifa->valor ?? 0) }} | +{{ $tarifa->dias ?? '' }} | +{{ number_format($tarifa->utilidad ?? 0) }} | ++ + | +
@@ -19,36 +18,33 @@