Skip to content

Commit 1e7bef7

Browse files
authored
Merge pull request #39 from PiruloDev/desarrollo
Ajuste de rutas
2 parents 63b8f6c + 891890c commit 1e7bef7

10 files changed

Lines changed: 669 additions & 18 deletions

File tree

API (SpringBoot)/Proyecto/mvnw

100755100644
File mode changed.

Frontend/app/Http/Controllers/Estadisticas/EstadisticasController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ public function index()
2525
$productosMasVendidos = $this->productosMasVendidosService->obtenerProductosMasVendidos(10);
2626
$usuariosRegistrados = $this->usuariosRegistradosService->obtenerUsuariosRegistrados();
2727

28-
return view('estadisticas.index', compact('productosMasVendidos', 'usuariosRegistrados'));
28+
return view('Estadisticas.index', compact('productosMasVendidos', 'usuariosRegistrados'));
2929
}
3030
}

Frontend/app/Http/Controllers/Inventario/InventarioController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Http\Request;
66
use App\Services\Inventario\InventarioService;
77
use Illuminate\Support\Facades\Validator;
8+
use App\Http\Controllers\Controller;
89

910
class InventarioController extends Controller
1011
{

Frontend/app/Http/Controllers/Productos/Categoriaproductos.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
class Categoriaproductos extends Controller
1010
{
11-
protected $baseUrl;
11+
private $apiBaseUrl;
1212

1313
public function __construct()
1414
{
15-
$this->baseUrl = env('API_BASE_URL', 'http://32.193.167.191:8080');
15+
$this->apiBaseUrl = env('API_BASE_URL', 'http://localhost:8080');
1616
}
1717

1818
public function index()

Frontend/app/Http/Controllers/Productos/Menuproductos.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,18 @@
99

1010
class Menuproductos extends Controller
1111
{
12-
protected $baseUrl;
12+
private $apiBaseUrl;
1313

1414
public function __construct()
1515
{
16-
// Obtiene la URL base de la API desde el archivo .env
17-
$this->baseUrl = env('API_BASE_URL', 'http://32.193.167.191:8080');
16+
$this->apiBaseUrl = env('API_BASE_URL', 'http://localhost:8080');
1817
}
1918
public function index()
2019
{
2120
try {
2221
$responseCategorias = Http::get($this->apiBaseUrl . '/categorias');
2322
$responseProductos = Http::get($this->apiBaseUrl . '/productos');
24-
23+
2524
$categorias = collect([]);
2625
$productos = collect([]);
2726

@@ -45,7 +44,6 @@ public function index()
4544
'DESCRIPCION_PRODUCTO' => $prod['Descripcion Producto:'] ?? 'Producto fresco y delicioso',
4645
'PRECIO_PRODUCTO' => $prod['Precio:'] ?? 0,
4746
'STOCK_ACTUAL' => $prod['Stock Minímo:'] ?? 0,
48-
// Si la API no devuelve imagen, usar el helper para obtenerla
4947
'imagen' => $imagenApi ?? ProductImageHelper::getImage($nombreProducto, $prod['Id Producto:'] ?? null, $categoria['nombreCategoriaProducto'] ?? null)
5048
];
5149
});
@@ -67,7 +65,6 @@ public function index()
6765
'DESCRIPCION_PRODUCTO' => $prod['Descripcion Producto:'] ?? 'Producto fresco y delicioso',
6866
'PRECIO_PRODUCTO' => $prod['Precio:'] ?? 0,
6967
'STOCK_ACTUAL' => $prod['Stock Minímo:'] ?? 0,
70-
// Si la API no devuelve imagen, usar el helper para obtenerla
7168
'imagen' => $imagenApi ?? ProductImageHelper::getImage($nombreProducto, $prod['Id Producto:'] ?? null)
7269
];
7370
});
@@ -83,4 +80,4 @@ public function index()
8380
]);
8481
}
8582
}
86-
}
83+
}

Frontend/app/Http/Controllers/Productos/ProductoController.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99

1010
class ProductoController extends Controller
1111
{
12-
protected $baseUrl;
12+
protected $apiUrl;
1313

1414
public function __construct()
15-
{
16-
// Obtiene la URL base de la API desde el archivo .env
17-
$this->baseUrl = env('API_BASE_URL', 'http://32.193.167.191:8080');
18-
}
15+
{
16+
$this->apiUrl = env('API_BASE_URL', 'http://localhost:8080') . '/productos';
17+
}
1918

2019
public function index()
2120
{
@@ -41,13 +40,13 @@ public function index()
4140
10 => 'Pasteles Pollo',
4241
];
4342

44-
return view('productos.index', compact('productos', 'categorias'));
43+
return view('Productos.index', compact('productos', 'categorias'));
4544

4645
} catch (\Exception $e) {
4746
Log::error('Excepción en ProductoController@index: ' . $e->getMessage());
4847
$productos = [];
4948
$categorias = [];
50-
return view('productos.index', compact('productos', 'categorias'))
49+
return view('Productos.index', compact('productos', 'categorias'))
5150
->withErrors('No se pudo conectar con el servicio de productos.');
5251
}
5352
}

Frontend/app/Services/Inventario/InventarioService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace App\Services;
3+
namespace App\Services\Inventario;
44

55
use Illuminate\Support\Facades\Http;
66

Frontend/resources/views/inventarioviews/ingredientes/inventario.blade.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@
120120
</div>
121121
@endif
122122

123+
@if (session('error') ?? $error ?? false)
124+
<div class="alert alert-danger border-0 shadow-sm mb-4" style="border-radius: 15px;">
125+
<i class="fas fa-exclamation-triangle me-2"></i> {{ session('error') ?? $error }}
126+
</div>
127+
@endif
128+
123129
{{-- ESTADÍSTICAS RÁPIDAS --}}
124130
<div class="row g-3 mb-4">
125131
<div class="col-md-4">

0 commit comments

Comments
 (0)