Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/teofilobetancourt/Restaurant-Equis/llms.txt

Use this file to discover all available pages before exploring further.

The Inventory module gives the warehouse and kitchen teams a single place to track every ingredient and supply item used in Restaurant Equis. It loads current stock levels from the database, highlights items that have fallen to or below their minimum threshold in red, and provides full create / edit / delete controls through a modal form. A live badge in the page header shows the count of low-stock items at a glance.

Inventory Items

All items are fetched on mount via GET /api/inventario. The table columns map to the following fields in the Inventario.Insumos PostgreSQL table:
nombre
string
required
Human-readable name of the ingredient or supply item (maps to Nombre_Insumo in the database schema). Example: Carne de res.
stock
number
required
Current quantity on hand (maps to Stock_Actual). Compared against stock_minimo to determine alert status.
unidad
string
required
Unit of measure (maps to Unidad_Medida). Accepted values: kg, g, L, mL, unidad, paquete, caja, bolsa, litro.
stock_minimo
number
Minimum acceptable stock level (maps to Stock_Minimo). When stock ≤ stock_minimo, the item is flagged as low-stock.
Punto_Reorden
number
Reorder point (maps to Punto_Reorden). When not provided on creation, defaults to stock_minimo × 1.5. Returned in the API response for reference.

Stock Alerts

The system evaluates each item using the condition:
stock <= stock_minimo
When that condition is true, the item row is highlighted with a red background tint and the status column shows a Stock Bajo badge (with a warning triangle icon). Items within their acceptable range show a green ✓ OK badge. The stock quantity itself is also rendered in red when low, making it instantly visible when scanning the table. A header-level counter (e.g. 3 ítems con stock bajo) is displayed above the table whenever at least one item is in alert state.

Adding Items

Click Agregar Ítem to open the creation modal. Fill in the required fields and click Guardar. The frontend sends:
POST /api/inventario
Content-Type: application/json
{
  "nombre": "Carne de res",
  "stock": 50,
  "unidad": "kg",
  "stock_minimo": 10
}
On success the API returns the created item (including the assigned id_inventario) and the row is appended to the table without a full page reload.

Editing Items

Click the pencil icon on any row to open the edit modal pre-populated with that item’s current values. Modify any field and click Guardar. The frontend calls:
PUT /api/inventario/{id_inventario}
Content-Type: application/json
{
  "nombre": "Carne de res",
  "stock": 35,
  "unidad": "kg",
  "stock_minimo": 10
}
The updated row replaces the old one in the table immediately upon a successful response.

Deleting Items

Click the trash icon on any row. A browser confirmation dialog asks:
¿Eliminar este ítem del inventario? Esta acción no se puede deshacer.
If confirmed, the frontend calls:
DELETE /api/inventario/{id_inventario}
The row is removed from the table on success.

Database Schema

Inventory items are stored in the Inventario.Insumos table inside a PostgreSQL schema named Inventario. The canonical column names used by the database differ from the simplified field names used by the frontend API adapter:
API fieldDatabase column
id_inventarioID_Insumos
nombreNombre_Insumo
stockStock_Actual
unidadUnidad_Medida
stock_minimoStock_Minimo
Punto_ReordenPunto_Reorden
The frontend API layer (src/api/index.ts) normalises both naming conventions so that the UI works regardless of which form the backend returns.

Build docs developers (and LLMs) love