Skip to main content

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.
The #inventorySearchInput field performs a live, case-insensitive substring match. It searches across the following fields of each aggregated row:
  • hawb
  • mawb
  • client
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:
FilterElement IDdata-fieldBehaviour
Warehouse Locationinventory-locationinventory-locationCase-insensitive substring match against location
Transaction Typeinventory-transactioninventory-transactionCase-insensitive substring match against transactionType
Sort by Remaining Quantityinventory-sortasc = 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.

Pagination

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 headerSource field
Clientclient
HAWBhawb
MAWBmawb
Transaction TypetransactionType
Locationlocation
Qty InqtyInValue
Qty OutqtyOutValue
Remaining QtyremainingValue
ActionRow-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.

Shipment Information section

Drawer labelSource fieldElement ID
ClientclientdrawerClient
DestinationdestinationdrawerDestination
HAWBhawbdrawerHawb
MAWBmawbdrawerMawb
Invoice / MarkingsinvoicedrawerInvoice
Transaction TypetransactionTypedrawerTransaction
ModulemoduledrawerModule
FlightflightdrawerFlight

Receiving Information section

Drawer labelSource fieldElement ID
DatedatedrawerDate
TimetimedrawerTime
Received ByreceivedBydrawerReceivedBy
Plate NumberreceivingPlatedrawerReceivingPlate
TruckertruckerdrawerTrucker
DriverdriverdrawerDriver
Cargo ConditioncargoConditiondrawerCargoCondition

Warehouse Information section

Drawer labelSource fieldElement ID
LocationlocationdrawerLocation
Cargo HandlingcargoHandlingdrawerCargoHandling
StatusstatusdrawerStatus
Partial / FullpartialFulldrawerPartialFull

Quantity Information section

Drawer labelSource fieldElement ID
QuantityquantitydrawerQty
UnitunitdrawerUnit
Remaining QuantityremainingValuedrawerRemainingQuantity

Release Information section

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 labelSource fieldElement ID
Latest Release DatereleaseDatedrawerReleaseDate
Latest Release TimereleaseTimedrawerReleaseTime
Latest Plate NumberreleasePlatedrawerReleasePlate
Latest DriverreleaseDriverdrawerReleaseDriver
Latest RemarksremarksdrawerRemarks
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:
  1. After every savesaveStoredShipments() dispatches warehouse:data-updated, and the global event listener in app.js calls refreshInventory() if it is defined.
  2. 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.

Build docs developers (and LLMs) love