Documentation Index
Fetch the complete documentation index at: https://mintlify.com/raceliciouss/YUSEN-LIMO-WAREHOUSE/llms.txt
Use this file to discover all available pages before exploring further.
The Inventory page (pages/inventory.html) presents a consolidated view of all warehouse stock. Rather than displaying raw shipment records, it aggregates them by reference using aggregateShipmentsByReference() and maps the output through normalizeShipmentForInventory() before rendering. Every row in the inventory table represents a unique shipment reference (HAWB or MAWB) with its combined inbound quantity, total quantity released, and remaining cargo on hand.
How Aggregation Works
aggregateShipmentsByReference() reads the full warehouseShipments array from Local Storage and groups records by their primary key — the HAWB if present, or the MAWB if HAWB is absent. For each grouped reference, it computes:
qtyInValue — cumulative sum of qtyIn (or quantity) across all inbound records for that reference.
qtyOutValue — cumulative sum of qtyOut, releaseQty, or quantity across all outbound records for that reference.
remainingValue — the difference between qtyInValue and qtyOutValue.
remainingValue = qtyInValue - qtyOutValue
Each outbound record also pushes an entry into the outboundDetails array of its group, capturing date, time, qty, plate, driver, remarks, and savedAt. After all records are processed, outboundDetails is sorted chronologically by outbound date and time.
The most recently saved record for a reference (determined by savedAt timestamp) wins for metadata fields like client, location, transactionType, and status. If two records share the same reference, only the newer one’s metadata is used for display.
Search
The #inventorySearchInput field performs a live, case-insensitive substring match. It searches across the following fields of each aggregated row:
Results update on every input event. The search is applied before any active dropdown filters, so all active constraints are combined.
Filters
Clicking the Filters toggle (#inventoryFilterToggle) opens #inventoryFilterPanel, which contains:
| Filter | Element ID | data-field | Behaviour |
|---|
| Warehouse Location | inventory-location | inventory-location | Case-insensitive substring match against location |
| Transaction Type | inventory-transaction | inventory-transaction | Case-insensitive substring match against transactionType |
| Sort by Remaining Quantity | inventory-sort | — | asc = Lowest to Highest, desc = Highest to Lowest |
The Clear filters button (#inventoryClearFilters) resets the location and transaction inputs, resets the sort select to its default state, and calls refreshInventory().
Sort
The sort control in the filter panel applies an ascending or descending numeric sort on remainingValue. Selecting Lowest to Highest (asc) surfaces shipments closest to zero stock first, making it easy to identify cargo that has been nearly or fully released. Selecting Highest to Lowest (desc) surfaces the shipments with the most cargo remaining.
Row count per page is controlled by the .page-size-button group: 5, 10, 20, and All. The default active size is 10. Page navigation controls are rendered into #inventoryPagination. Changing the page size or applying a filter resets the view to page 1.
QR Scan Integration
The #inventorySearchInput area includes an inline scan button (.inline-scan-btn, data-target="scanModal"). Clicking it opens the #scanModal camera overlay and starts startQrScanner(). When a QR code is decoded:
- If the payload is a JSON object,
normalizeShipmentPayload() extracts the hawb or mawb value and writes it into #inventorySearchInput.
- If the payload is plain text, the decoded string is used directly as the search term.
In either case, refreshInventory() is called after the value is applied, filtering the table to matching rows.
Inventory Table Columns
| Column header | Source field |
|---|
| Client | client |
| HAWB | hawb |
| MAWB | mawb |
| Transaction Type | transactionType |
| Location | location |
| Qty In | qtyInValue |
| Qty Out | qtyOutValue |
| Remaining Qty | remainingValue |
| Action | Row-level detail button |
Detail Drawer
Clicking the action button on any inventory row opens the #inventoryDrawer slide-in panel. The drawer overlays the page with #inventoryDrawerBackdrop and renders all available information for the selected aggregated shipment.
| Drawer label | Source field | Element ID |
|---|
| Client | client | drawerClient |
| Destination | destination | drawerDestination |
| HAWB | hawb | drawerHawb |
| MAWB | mawb | drawerMawb |
| Invoice / Markings | invoice | drawerInvoice |
| Transaction Type | transactionType | drawerTransaction |
| Module | module | drawerModule |
| Flight | flight | drawerFlight |
| Drawer label | Source field | Element ID |
|---|
| Date | date | drawerDate |
| Time | time | drawerTime |
| Received By | receivedBy | drawerReceivedBy |
| Plate Number | receivingPlate | drawerReceivingPlate |
| Trucker | trucker | drawerTrucker |
| Driver | driver | drawerDriver |
| Cargo Condition | cargoCondition | drawerCargoCondition |
| Drawer label | Source field | Element ID |
|---|
| Location | location | drawerLocation |
| Cargo Handling | cargoHandling | drawerCargoHandling |
| Status | status | drawerStatus |
| Partial / Full | partialFull | drawerPartialFull |
| Drawer label | Source field | Element ID |
|---|
| Quantity | quantity | drawerQty |
| Unit | unit | drawerUnit |
| Remaining Quantity | remainingValue | drawerRemainingQuantity |
The #drawerReleaseList container renders the full outboundDetails array as a chronological list of release events. Each entry shows the release date, time, quantity, plate number, driver, and remarks for that event. This gives operators a complete history of every partial and full release against the shipment.
Below the list, the latest release summary fields are shown individually:
| Drawer label | Source field | Element ID |
|---|
| Latest Release Date | releaseDate | drawerReleaseDate |
| Latest Release Time | releaseTime | drawerReleaseTime |
| Latest Plate Number | releasePlate | drawerReleasePlate |
| Latest Driver | releaseDriver | drawerReleaseDriver |
| Latest Remarks | remarks | drawerRemarks |
The drawer is closed by clicking #inventoryDrawerClose (the × button) or clicking the #inventoryDrawerBackdrop overlay.
Remaining Quantity Formula
remainingValue = qtyInValue - qtyOutValue
Where:
qtyInValue is the sum of all parseQuantityNumber(shipment.qtyIn || shipment.quantity) values across every inbound record grouped under the same HAWB or MAWB.
qtyOutValue is the sum of all parseQuantityNumber(shipment.qtyOut || shipment.releaseQty || shipment.quantity) values across every outbound record in the same group.
- Malformed or empty quantity strings are treated as
0 by parseQuantityNumber().
refreshInventory() is the function assigned to re-render the inventory table at the current page. It is set up during DOMContentLoaded and is called in two situations:
- After every save —
saveStoredShipments() dispatches warehouse:data-updated, and the global event listener in app.js calls refreshInventory() if it is defined.
- Directly on filter/search input events — every
input and change event on #inventorySearchInput, #inventory-location, #inventory-transaction, and #inventory-sort triggers refreshInventory() immediately.
This means the inventory table always reflects the latest stored data and the current filter state without requiring a manual page reload.