The dashboard is the home screen for administrators, surfacing the most important business metrics at a glance. It loads all data in parallel on mount and re-fetches on every navigation to the route, ensuring figures are always current. A manual Actualizar button with a spinning icon is available in the header for on-demand refreshes.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DragonesMagicos/ferromax_v0.8/llms.txt
Use this file to discover all available pages before exploring further.
KPI Cards
Four metric cards are rendered at the top of the page, sourced from a singleGET /api/dashboard/resumen call that returns a DashboardDTO:
| Card | Field | Color |
|---|---|---|
| Ventas del día | ventasHoy (ARS) + cantidadVentasHoy subtitle | Green |
| Stock crítico | productosStockCritico | Red |
| Pedidos online | pedidosPendientes | Blue |
| Caja efectivo | saldoCaja (ARS) | Orange |
KPICard component (components/dashboard/KPICard.jsx), which accepts a color prop (verde, rojo, azul, naranja) and a staggerIndex to produce a cascading entrance animation via Framer Motion.
Weekly Sales Chart
A bar chart rendered below the KPI cards shows daily revenue for the last 7 days. The data comes from:America/Argentina/Buenos_Aires) and queries the sum of COMPLETADA sales per day. The response is a List<VentaDiariaDTO>:
VentasBarChart, which is composed inside a SectionCard wrapper and takes up two-thirds of the grid on large screens. The Y-axis is formatted in ARS without decimals.
Recent Transactions
The last 10 completed sales across all payment methods are shown in a compact table, fetched from:DashboardService.ultimasTransacciones(10), ordering by fecha DESC. Each row is a VentaResponse:
estado cell uses colour-coded pill badges (emerald for COMPLETADA, amber for PENDIENTE, red for ANULADA).
Stock Alerts Panel
TheAlertaStockPanel component (components/dashboard/AlertaStockPanel.jsx) occupies the right column of the chart row. It shows every product whose stockActual has dropped below its stockMinimo threshold.
Backend endpoints:
| Method | Path | Description |
|---|---|---|
GET | /api/alertas | Returns all unread AlertaStock records |
PUT | /api/alertas/{id}/leer | Marks a single alert as read and removes it from the panel |
PUT | /api/alertas/leer-todas | Marks all alerts read at once |
stockActual === 0, amber otherwise), and the configured minimum. Two action buttons appear on hover: a shopping-cart icon (create purchase order — coming soon) and a checkmark to mark as read.
When all alerts have been dismissed the panel displays a PackageCheck icon with the message “Todo el stock en orden”.
Real-time Updates
The dashboard subscribes to a WebSocket STOMP topic so that stock changes are reflected without a full page reload.POS.jsx) additionally subscribes to per-product topics:
productoId and stockActual. The frontend receives the message, updates local state for the affected product, and—if the new stock falls below stockMinimo—a new alert appears in the AlertaStockPanel without requiring a refresh.
The STOMP client is initialised with SockJS at /api/ws and reconnects automatically every 5 seconds if the connection drops.
Access
The dashboard is restricted to the ADMIN role via
@PreAuthorize("hasRole('ADMIN')") on DashboardController. Users who log in with the EMPLEADO role are redirected to the POS terminal at /pos. Users with the CLIENTE role are redirected to the storefront at /tienda.