Product List View
The main inventory page displays all registered products in a sortable table:Table Columns
| Column | Description | Data Source |
|---|---|---|
| Nº Ítem | Product ID number | product.id_product |
| Nombre | Product name | product.product_name |
| Categoría | Product category | category.category_name (joined) |
| Stock | Current quantity with status badge | product.stock |
| Unidad | Unit of measure | product.unit_measure |
| Acciones | Edit/Delete buttons | - |
Stock Status Badges
Stock levels are color-coded for quick visual assessment:BAJO
Red badge: Stock < 10 units - Immediate reorder needed
MEDIO
Amber badge: Stock between 10-49 units - Monitor closely
OK
Green badge: Stock ≥ 50 units - Adequate supply
Creating Products
Permission required: Director or Madre Procesadora roles only
Product Form Fields
Required Fields
Product name (e.g., “Arroz”, “Aceite de girasol”)
Unit of measurement:
kg- Kilogramoslt- Litrosunidades- Units
Optional Fields
Category selection from predefined list:
- Lacteos (Dairy)
- Proteinas (Proteins)
- Carbohidratos (Carbohydrates)
- Legumbres (Legumes)
- Vegetales (Vegetables)
- Frutas (Fruits)
- Aceites y grasas (Oils and fats)
- Condimentos (Condiments)
- Otros (Other)
Additional product details or notes
Database Fields
When submitted, the form creates/updates records with:Editing Products
Click the Editar button to modify product details:- Product name
- Unit of measure
- Category assignment
- Description
Stock cannot be edited directly. Stock levels update automatically when:
- Entry guides are approved (increases stock)
- Daily operations are registered (decreases stock via FIFO)
Deleting Products
Attempting to delete a product will:- Show a confirmation dialog: “¿Eliminar rubro? Esta acción no se puede deshacer”
- Check for foreign key constraints
- Block deletion if the product is referenced in:
receta_porcion(portion recipes)input(entry guide details)output(daily operation outputs)
Error Message
If deletion is blocked:Role-Based Access
Supervisor Role (id_rol = 3)
Supervisors have read-only access:- ✅ View product list
- ✅ See stock levels
- ❌ Cannot create products
- ❌ Cannot edit products
- ❌ Cannot delete products
- ❌ Form hidden entirely
Madre Procesadora (id_rol = 2)
- ✅ View products
- ✅ Create new products
- ✅ Edit existing products
- ❌ Cannot delete products
Director (id_rol = 1)
- ✅ Full access to all operations
- ✅ Can delete products (with constraint validation)
Data Loading
Initial Load
On page mount (src/pages/Products.jsx:22-25):
Product Query
Loading State
Displays global loader while fetching:Empty State
When no products exist:Technical Implementation
File location:
src/pages/Products.jsx:1-311Form Validation
- Required fields: Product name, unit of measure
- Optional fields: Category, description
- Client-side: HTML5
requiredattribute - Server-side: Database NOT NULL constraints
Stock Management
Use Cases
Catalog Setup
Initial configuration of all food items the school program uses
Stock Monitoring
Real-time visibility into inventory levels for reorder planning
Category Organization
Group products by type for easier reporting and management
Unit Standardization
Ensure consistent measurement units across all operations