FUNCIONA VENTAS (quedo horrible la vista, despues la cambio, pero anda!)

This commit is contained in:
BryamE
2026-01-08 04:23:06 -03:00
parent 37e8f498be
commit 8f10e3595d
9 changed files with 263 additions and 236 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ class ClientController extends Controller
*/
public function create()
{
//
return view('clients.create');
}
/**
@@ -169,21 +169,4 @@ class ProductosController extends Controller
return redirect()->route('productos.index')
->with('success', 'Producto eliminado.');
}
/**
* Vista simplificada para consultar precios (empleados).
*/
public function checker(Request $request)
{
$search = $request->input('query');
$result = null;
if ($search) {
$result = Product::where('sku', $search)
->orWhere('name', 'like', "%{$search}%")
->first(); // Devuelve el primer resultado encontrado
}
return view('productos.checker', compact('result', 'search'));
}
}
+2 -2
View File
@@ -46,10 +46,10 @@ class SaleController extends Controller
foreach ($request->items as $item) {
$product = Product::find($item['product_id']);
$totalSale += $product->precio * $item['quantity'];
$totalSale += $product->price * $item['quantity'];
if ($product->stock_quantity < $item['quantity']) {
throw new \Exception("No hay suficiente stock de " . $product->nombre);
throw new \Exception("No hay suficiente stock de " . $product->name);
}
}