The Products module is the heart of Tienda Mi Cholo’s inventory system. It stores every item sold at the point of sale, along with its purchase cost, sale price, current stock level, and active/inactive status. All authenticated users can browse the product list; creating, editing, deleting, and toggling the status of products is restricted to the Administrador and Gerente roles.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/interezante456-pixel/nuevo-proyecto-viernes/llms.txt
Use this file to discover all available pages before exploring further.
Product Fields
Each product in the system carries the following fields, as defined in theProducto model:
The display name of the product. Maximum 100 characters. Shown in the product list, the POS search, and every sale detail line.
An optional short description of the product. Maximum 200 characters. Appears as a subtitle under the product name in the list view and is also matched when using the search bar.
The purchase cost paid to the supplier, stored as a decimal with two decimal places (e.g.,
S/ 3.50). Used to calculate margins and to enforce the pricing validation rule.The retail sale price charged to customers. Must be greater than or equal to
PrecioCompra. The controller rejects any submission where PrecioVenta < PrecioCompra with the error: “El precio de venta no puede ser menor al precio de compra.”The current quantity of units available in inventory. Decremented automatically when a sale is completed through the POS. The list view shows colored badges based on the stock level — see Stock Level Indicators below.
Controls whether the product is active (
true) or inactive (false). New products are always saved as active. Only products with Estado = true and Stock > 0 appear in the POS product search. Toggle this field using the Activar / Desactivar button in the list — no form editing required.Foreign key referencing the
Categoria table. A product must belong to exactly one category. The create/edit form loads all categories from the database as a dropdown.Searching and Pagination
The product list supports full-text search across bothNombreProducto and Descripcion. Results are paginated at 15 products per page, ordered by ID_Producto.
URL pattern:
| Query Parameter | Type | Description |
|---|---|---|
buscar | string | Optional. Filters products whose name or description contains the value. Case-insensitive on SQL Server. |
pagina | int | Optional. The page number to display. Defaults to 1. Automatically clamped to the last available page. |
buscar parameter so the filter is preserved across pages.
Stock Level Indicators
The product list highlights each product’sStock value with a colored badge so staff can identify inventory problems at a glance.
| Condition | Badge color | Meaning |
|---|---|---|
Stock <= 5 | 🔴 Red | Critical — reorder immediately. |
Stock <= 10 | 🟡 Amber | Low — reorder soon. |
Stock > 10 | 🟢 Green | OK — sufficient inventory. |
The dashboard’s low-stock summary table also surfaces any product with
Stock <= 10, giving managers a quick overview without opening the full product list.Activating and Deactivating Products
Every product row in the list exposes a toggle button that flips theEstado field between true (active) and false (inactive) with a single click. No confirmation dialog is shown — the change takes effect immediately.
Endpoint:
Estado == true(product is active)Stock > 0(at least one unit is available)
Estado = false) are hidden from the POS even if stock is available.
Deactivating is safer than deleting. If a product already has sales history (records in
DetalleVenta), deactivating it preserves all historical data and prevents referential integrity errors. The product simply stops appearing at the checkout without removing any records from the database.Creating a Product
Open the New Product form
Click Nuevo Producto from the top-right corner of the product list. This button is only visible to Administrador and Gerente users.
Fill in the product details
Complete all required fields in the form:
- Nombre del Producto — unique, descriptive name (e.g., Arroz Extra 5kg).
- Categoría — select one category from the dropdown. The list is loaded live from the
Categoriastable. - Descripción — optional; a short description visible in the list and matched during search.
- Precio Compra — supplier cost in Soles (e.g.,
3.50). - Precio Venta — retail price in Soles. Must be ≥ Precio Compra.
- Stock Inicial — number of units currently in stock (minimum
0).
Required fields
NombreProducto, PrecioCompra, PrecioVenta, Stock, and Categoria_ID are all required. The form will not submit if any of these are empty.Precio de venta rule
PrecioVenta must be ≥ PrecioCompra. Both the browser (JavaScript) and the server (ModelState) enforce this rule independently.Deleting a Product
The Eliminar button is available in the product list row for Administrador and Gerente users. A JavaScript confirmation dialog appears before the deletion is processed. Endpoint:Access Control Summary
| Operation | Roles allowed |
|---|---|
View product list (Lista) | All authenticated users |
| Search products | All authenticated users |
Create product (Nuevo) | Administrador, Gerente |
Edit product (Editar) | Administrador, Gerente |
Toggle status (CambiarEstado) | Administrador, Gerente |
Delete product (Eliminar) | Administrador, Gerente |
[Authorize] at the class level. Privileged actions additionally carry [Authorize(Roles = "Administrador,Gerente")]. Unauthenticated requests are redirected to the login page automatically.