Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ProyectoFerretek/FerreMarket/llms.txt

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

The Reports module (/reportes) focuses exclusively on inventory health. Rather than offering a broad analytics suite, it gives store managers a fast, actionable view of which products are running critically low and which have already hit zero stock — along with supplier contact details, reorder tools, and one-click export to PDF or Excel. It is the primary tool for preventing stock-outs and managing purchase orders.

Views

Two mutually exclusive views are toggled via tab buttons at the top of the report table. Both views share the same filter panel and export controls.

Stock Crítico

Shows products where stock > 0 but stock ≤ nivelMinimo. The row background is yellow (bg-yellow-50) to signal urgency. The Nivel Mínimo column is visible in this view.

Sin Stock

Shows products where stock === 0. The row background is red (bg-red-50). The Tiempo Sin Stock column replaces the Nivel Mínimo column in this view.
nivelMinimo is calculated automatically by the Reports module and is not a user-configurable field in the current version. It is derived at runtime as:
nivelMinimo = Math.max(10, Math.floor(producto.stock * 0.2))
// At least 10 units, or 20% of current stock — whichever is greater
This means the threshold scales with stock level and cannot be overridden per-product. A future version of FerreMarket may expose this as a configurable field on the product record.

KPI Summary

Four cards at the top of the page summarise the overall inventory state:
CardMetricSource
Total ProductosCount of all product rows in the catalogueproductos.length
Valor InventarioSUM(precio × stock) across all products (CLP)calcularValorInventario(productos) from formatters.ts
Sin StockCount of products with stock === 0Filtered from productosExtendidos
Stock CríticoCount of products with 0 < stock ≤ nivelMinimoFiltered from productosExtendidos
The Sin Stock and Stock Crítico counts also appear in parentheses next to their respective tab labels to give an at-a-glance count before switching views.

Supplier Information

Each product row in the report table is extended at runtime with a randomly assigned supplier drawn from the proveedores constant defined in Reportes.tsx:
Supplier fieldDescription
nombreCompany name (e.g. “Ferretería Central”)
contactoSupplier email address
telefonoSupplier phone number
The table displays both the supplier nombre and contacto email in the Proveedor column so managers can reach suppliers directly without leaving FerreMarket. The Proveedor column header is sortable via the ArrowUpDown icon — sorting is delegated to the supplier’s nombre string.

Requesting Reorders

1

Identify the product

Locate the critical or out-of-stock product in the table. Its stock level and supplier details are shown on the same row.
2

Click Solicitar Reposición

Click the orange Solicitar Reposición button (with a Truck icon) on the product row. This stores the product in productoSeleccionado state and opens ReposicionModal.
3

Complete the purchase order

Inside ReposicionModal, fill in the order quantity and any notes. The modal pre-populates with the product’s name, SKU, and supplier contact. Confirm to generate the purchase order.

Filtering

The filter panel sits inside the report card, directly above the product table. All filters apply to both Crítico and Sin Stock views simultaneously:
FilterColumn filteredControl type
Searchnombre and sku (case-insensitive)Text input
Categoríacategoria IDSelect dropdown — all six categories
Proveedorproveedor.idSelect dropdown — all four suppliers
Precio mínimoprecio ≥ valueNumber input
Precio máximoprecio ≤ valueNumber input
Último pedido desdeultimoPedido.split('T')[0] ≥ dateDate input
Click Limpiar to reset all six filters at once and return to the unfiltered list. Columns are sortable via their ArrowUpDown header buttons: SKU, Stock Actual, Proveedor, and Último Pedido all support ascending/descending toggle.

Exporting

Two export buttons appear in the page header, always visible regardless of which view tab is active:

Exportar PDF

Calls generatePDF() which uses jsPDF with the jspdf-autotable plugin. The output is an A4 portrait document containing:
  • A centred title: “FerreMarket - Reporte de Inventario”
  • A subtitle indicating the current view (stock crítico or sin stock)
  • The generation date
  • A summary table with total products, inventory value, out-of-stock count, and critical-stock count
  • The full filtered product table with alternating grey/white row fills
  • A paginated footer: “FerreMarket - Reporte de Inventario - Página X de Y”
The file is saved as ferremarket_reporte_inventario_YYYY-MM-DD.pdf.

Exportar Excel

Calls exportarReporte('excel'). The Excel export handler is a placeholder in the current version — it logs to the console and is intended for a future implementation using a library such as SheetJS.
The PDF export respects the current filter state — only the rows visible in productosFiltrados are included in the exported document. Apply filters before exporting to produce targeted reports for specific categories, suppliers, or price ranges.

Estimated Days Without Stock

The tiempoSinStock field tracks how many calendar days a product has been continuously out of stock. It is computed at runtime when the productosExtendidos array is built:
tiempoSinStock: producto.stock === 0
  ? Math.floor(Math.random() * 15) + 1  // 1–15 days (mock value)
  : 0
In the Sin Stock table view, this value is shown in a red text-red-600 cell as “X días”. It also appears in the PDF export column header as “Tiempo Sin Stock” (replacing “Nivel Mínimo” which is used in the Crítico view).

Build docs developers (and LLMs) love