The Inventory module is the backbone of Kantuta POS. It is split into three sub-sections — Products, Categories, and Purchases — each accessible from theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Eleazarguitar18/kantuta_pos_front/llms.txt
Use this file to discover all available pages before exploring further.
/inventario route tree. Together they let you maintain a live product catalog, keep stock levels accurate, and record every incoming purchase from suppliers.
Products
View, search, and manage every SKU in your catalog. Monitor stock levels with color-coded badges.
Categories
Group products into named categories. Soft-delete preserves history while hiding inactive entries.
Purchases
Register supplier deliveries. Each line item increments
stock_actual. Optionally charge the purchase directly to an open cash register.Products
Navigate to/inventario/productos to reach the ProductosMain page. The data table lists every product returned from GET /inventario/producto and refreshes automatically over Socket.IO whenever the dataChanged event fires for the producto or venta entity.
Producto Interface
| Field | Description |
|---|---|
nombre | Display name shown throughout the POS. |
codigo_barras | Optional barcode — used by the POS search field to find products by scan. |
precio_venta | Unit sale price in Bolivianos (Bs.). |
costo_compra | Unit purchase cost — used for margin reporting. |
stock_actual | Current on-hand quantity. Decremented on each completed sale, incremented on each purchase. |
stock_minimo | Alert threshold. When stock_actual drops to or below this value, a low-stock badge is shown. |
id_categoria | Foreign key to the parent Categoria. |
Stock Badge Indicator
The stock column renders a color-coded badge computed from the ratiostock_actual / stock_minimo:
| Ratio | Badge color | Meaning |
|---|---|---|
| ≥ 0.50 | 🟢 Green | Stock is healthy. |
| 0.25 – 0.49 | 🟡 Yellow | Stock is running low. |
| < 0.25 | 🔴 Red (bold) | Critical — restock immediately. |
Searching Products
The POS terminal (/ventas/pos) provides a real-time text filter that matches against both nombre and codigo_barras. The same filter logic is reproduced inline in ProductosMain for quick lookups in the catalog view.
Products REST Endpoints
createProduct and updateProduct automatically inject the logged-in user’s ID as id_user_create / id_user_update from localStorage.Categories
Navigate to/inventario/categorias to manage product groupings.
Categoria Interface
id, a human-readable nombre, and standard audit timestamps. There are no hard-deletes — calling DELETE /inventario/categorias/:id performs a soft-delete that sets an internal estado flag to false, preserving the category name on any historical product records.
Categories REST Endpoints
Purchases
Navigate to/inventario/compras to view purchase history, or /inventario/compras/registrar to open the ComprasRegister form.
CrearCompraRequest Interface
How Stock is Updated
When a purchase is confirmed (POST /compras), the backend iterates every DetalleCompraInput and adds cantidad to the corresponding product’s stock_actual. No manual stock adjustment is needed.
Paying with the Cash Register
Toggling “Pagar en efectivo (desde Caja POS)” setspagar_con_caja: true and attaches the id_sesion_caja from CajaContext.sesionActiva. The backend automatically records an EGRESO movement on that cash-register session equal to the total purchase value, keeping the cash-register balance accurate.
Registering a Purchase
Fill general data
Optionally enter a Proveedor (supplier name). Enable Pagar con Caja if the purchase is paid in cash from the current shift.
Add line items
Select a product, set Cantidad and Costo Unitario, then click Agregar. Adding the same product a second time increments its quantity and updates the unit cost.
Role Restrictions
Administrador-only actions
Administrador-only actions
The following actions require the Administrador role. Regular users can view the catalog and purchase history but cannot modify it.
Route protection is enforced at the React Router level via a
| Action | Route |
|---|---|
| Create product | /inventario/productos/registrar |
| Edit product | /inventario/productos/editar/:id_producto |
| Delete product | Button on /inventario/productos |
| Create category | /inventario/categorias/registrar |
| Edit category | /inventario/categorias/editar/:id_categoria |
| Delete category | Button on /inventario/categorias |
ProtectedRoute allowedRoles={['Administrador']} wrapper. The edit and delete buttons are also hidden in the UI for non-admin users via the useRole() hook’s isAdmin flag.URL Routes
| Page | Path |
|---|---|
| Product catalog | /inventario/productos |
| Register product (Admin) | /inventario/productos/registrar |
| Edit product (Admin) | /inventario/productos/editar/:id_producto |
| Category list | /inventario/categorias |
| Register category (Admin) | /inventario/categorias/registrar |
| Purchase history | /inventario/compras |
| Register purchase | /inventario/compras/registrar |