The inventory panel is the primary workspace for managing the UniSierra Eats product catalog. Located atDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/JuseAR27/Unisierra-eats/llms.txt
Use this file to discover all available pages before exploring further.
admin/panel_admin.html, it is powered by the iniciarPanelInventario() function in admin.js, which is called automatically when the admin router detects the current URL includes panel_admin.html.
Dashboard Statistics
At the top of the inventory panel, three summary statistics are computed and displayed by theactualizarEstadisticas() function each time the product list is loaded:
| Stat | Source | DOM Element |
|---|---|---|
| Total Products | productos.length from GET /api/productos | #total-productos |
| Total Reviews | Sum of numResenas for all products that have at least one review | #total-resenas |
| Average Rating | Weighted average of calificacion × numResenas across reviewed products | #promedio-calificacion |
totalResenas or sumaCalificaciones:
Product Table
The product table is populated byGET /api/productos, which returns all products joined with their aggregated review data. The columns displayed are:
| Column | Source Field |
|---|---|
| ID | id_producto (formatted as #00X) |
| Name | nombre |
| Category | categoria |
| Price | precio (formatted as $X.XX) |
| Status | Always displayed as Disponible |
| Actions | Edit (pencil) and Delete (trash) buttons |
Search and Filter
The table supports two simultaneous filters, both of which trigger a freshcargarProductos() call on each change:
- Text search — filters by product name or ID (case-insensitive). Bound to the
inputevent on the search bar (input) inside.table-toolbar .search-bar. - Category dropdown — filters by the
categoriafield. The select element has the IDfiltro-categoria-admin.
Creating a Product
Open the Inventory Panel
Navigate to
admin/panel_admin.html. The product table loads automatically on page load.Click 'Registrar Nuevo Producto'
Click the primary button (
.btn-solid) in .content-header. This resets the form, sets the modal title to Registrar Nuevo Producto, and opens the #productModal overlay.Fill in the Product Form
Complete all fields in the modal form:
| Field | Input Type | Notes |
|---|---|---|
nombre | Text | Product display name |
precio | Number | Decimal price value |
descripcion | Textarea | Product description |
imagen | URL | Image URL; defaults to a placeholder if left blank |
categoria | Select | One of: comidas, bebidas, snacks, sanas |
precioNivel ($, $$, $$$) is a column in the Productos table and the server accepts it on POST /api/productos. However, the admin inventory form does not expose this field — admin.js never sends precioNivel in the payload. If price tier metadata is needed, it must be set directly in the database or via a custom request.Editing a Product
Clicking the pencil icon on any table row opens the same modal form pre-populated with the product’s current values. TheproductoEnEdicionId variable is set to the product’s id_producto, which the form handler uses to switch from POST to PUT:
Productos table row where id_producto matches the given :id.
Deleting a Product
Clicking the trash icon opens a custom confirmation modal rendered dynamically in the DOM —admin.js does not use window.confirm() for deletions. The overlay displays the product ID and offers Cancelar and Eliminar buttons. On confirmation, the handler calls:
Productos table in SQLite and the table reloads automatically.