The Management page (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Edwin950821/BodegaX/llms.txt
Use this file to discover all available pages before exploring further.
/management) is BodegaX’s warehouse inventory dashboard, labelled Mi Bodega (My Warehouse) in the interface. When an admin navigates here, the page immediately fetches all products from the backend and computes a live stock total by summing every product’s stock value. The result — displayed prominently as total — tells the warehouse team exactly how many crates are currently on hand across all beer brands. Below the counter, a table breaks the total down by product, giving a brand-by-brand view of available crates. When a new shipment arrives, the Recibir button opens the RecibirCaja dialog to log the incoming stock without requiring a page reload.
The Mi Bodega page is intended for administrators. Ensure the user’s session stored in
sessionStorage under the key bodegax carries role: 'admin' before navigating to /management.Warehouse Summary Cards
Total Crates in Warehouse
The
total property is initialised to 0 and incremented by each product’s stock during ngOnInit. It updates in real time after every successful stock receipt, without a page reload.Product Inventory Table
The table iterates over
productos (fetched from GET /productos/all) and renders one row per beer brand, showing producto.nombre and producto.stock.Recibir Button
Opens the
RecibirCaja dialog, passing the current productos array. After the dialog closes, the component updates the matching product’s stock in place and recalculates total.Terminar Jornada Button
The orange Terminar Jornada button is present in the template, but its handler (
terminar()) is currently an empty stub and does not open any dialog. End-of-day reporting from this page is not yet implemented.Product Data Structure
ThePUT /productos/edit endpoint — called during stock receipt and during dispatch — expects and returns the full product object. The table below documents every field:
| Field | Type | Description |
|---|---|---|
uuid | string | Unique identifier for the product |
nombre | string | Beer brand name displayed in the UI |
precio | number | Unit price per crate, used in sales total calculations |
stock | number | Current crate count in the warehouse |
Receiving Incoming Stock
Click the Recibir Button
From the Mi Bodega dashboard, click the blue Recibir button. The
recibirCaja() method opens the RecibirCaja dialog and passes the current productos array as dialog data.Select a Product
Inside the dialog, choose a beer brand from the product dropdown. The selection is bound to the
producto property, which stores the selected product’s uuid. If no product is selected when confirming, the dialog closes with false and no changes are made.Enter the Incoming Quantity
Type the number of crates being received into the quantity field, bound to the
quantity property. This value is added to the product’s existing stock — it is not a replacement.Confirm — Stock Update API Call
Clicking Confirmar triggers the following sequence inside
RecibirCaja:- The component locates the selected product via
productos.find(p => p.uuid == this.producto). - It sets
selected.stock = selected.stock + this.quantityon the local object. - It calls
PUT /productos/editwith the full updated product object. - On success, the dialog closes and returns the updated
selectedobject to the Management component.
Real-Time Total Recalculation
The Management component’s
afterClosed() subscription receives the returned product object. It finds the matching entry in this.productos by uuid and updates its stock in place. Then it resets total to 0 and re-sums all product stocks, so the dashboard reflects the new warehouse total immediately.Initialisation Flow
When the Management component initialises (ngOnInit), it performs a single GET /productos/all request. On success, it stores the response in this.productos and loops through every product to accumulate this.total. If the request fails, the error is logged to the console and both productos and total remain at their default empty/zero values.