The Dashboard is the central command screen of Tienda Mi Cholo S.A.C. Every authenticated user lands here after logging in and can see six live KPI cards computed against the database at request time, a table of the five most recent sales, and a low-stock alert table listing the five products most urgently needing a restock. The page is protected by theDocumentation 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.
[Authorize] attribute on HomeController, so any unauthenticated visitor is automatically redirected to /Acceso/Login.
KPI Cards
Six stat cards are rendered across the top of the page. Each one is populated by aViewBag property that HomeController.Index() resolves asynchronously before returning the view.
Ingresos Hoy
ViewBag key:
IngresoHoyThe sum of MontoTotal across every Venta record whose FechaVenta.Date equals today’s date (DateTime.Today). Displayed as a Peruvian sol amount formatted to two decimal places (S/ 0.00). Returns 0 when there are no sales today.Ventas Hoy
ViewBag key:
VentasHoyThe count of Venta records where FechaVenta.Date == DateTime.Today. Gives cashiers and managers an instant view of how busy the current day has been.Total Ventas
ViewBag key:
TotalVentasThe total count of every sale ever recorded in the system, regardless of date. Useful as a lifetime business metric.Productos
ViewBag key:
TotalProductosThe count of all rows in the Productos table — the full product catalogue size, including items that may currently have zero stock.Stock Bajo
ViewBag key:
ProductosBajoStockThe count of products whose Stock value is 10 or fewer units. This card is styled with a red accent to draw immediate attention. Click through to the Productos list to identify which items need ordering.Clientes
ViewBag key:
TotalClientesThe total number of client records registered in the Clientes table — the store’s full customer base.Controller code
The following method inHomeController runs all six database queries sequentially and also fetches the two detail lists used by the lower section of the page.
Recent Sales Table
Below the KPI cards, the left panel shows the five most recent sales ordered byFechaVenta descending. The table includes the following columns:
| Column | Source field | Notes |
|---|---|---|
| # | ID_Venta | Auto-incremented sale ID |
| Cliente | Cliente.Nombres + Cliente.Apellidos | Navigational property, eager-loaded via Include |
| Comprobante | TipoComprobante | Receipt type — see badge rules below |
| Fecha | FechaVenta | Formatted as dd/MM/yyyy HH:mm |
| Total | MontoTotal | Formatted as S/ 0.00 |
- Boleta → green (
badge-emerald) badge - Factura → blue (
badge-blue) badge
Low Stock Alert Table
The right panel shows up to five products with the lowest stock levels, sorted byStock ascending so the most critical shortages appear first. All displayed products have Stock ≤ 10. The table columns are:
| Column | Source field | Notes |
|---|---|---|
| Producto | NombreProducto | Product display name |
| Categoría | Categoria.NombreCategoria | Eager-loaded; rendered with an amber badge |
| Stock | Stock | Units on hand — colour-coded by severity |
| Condition | CSS class | Colour | Meaning |
|---|---|---|---|
Stock <= 5 | stock-low | Red | Critical — reorder immediately |
Stock <= 10 | stock-medium | Amber | Low — plan a restock soon |
Sidebar Navigation
The sidebar is rendered byViews/Shared/_Layout.cshtml and adapts its links based on the authenticated user’s identity and role.
Principal
Always visible. Contains a single link:
- Dashboard →
/Home/Index
Operaciones
Visible to all authenticated users.
- Ventas →
/Venta/Lista - Clientes →
/Cliente/Lista
Inventario
Visible to all authenticated users.
- Productos →
/Producto/Lista - Categorías →
/Categoria/Lista
Administración
Visible only to users with the
Administrador role (User.IsInRole("Administrador")).- Usuarios →
/Usuario/Lista - Roles →
/Rol/Lista
NomCompleto claim), their role (from ClaimTypes.Role), and a logout button that calls /Acceso/Logout.