diff --git a/web/src/views/Inventory.tsx b/web/src/views/Inventory.tsx index f8aa433..a7980ca 100644 --- a/web/src/views/Inventory.tsx +++ b/web/src/views/Inventory.tsx @@ -296,7 +296,7 @@ function Segmented({ } const COL_SORT: (SortKey | null)[] = [null, "name", null, null, "thc", "price", "remaining", "audit", null]; -const COL_LABELS = ["", "Item", "Brand", "Shop", "THC %", "Price", "Remaining", "Last checked", "Bin"]; +const COL_LABELS = ["", "Item", "Brand", "Shop", "THC", "Price", "Remaining", "Last checked", "Bin"]; function HeaderRow({ sortBy, onSort }: { sortBy: SortKey; onSort: (k: SortKey) => void }) { return ( @@ -358,13 +358,12 @@ function GroupHeader({ items: Item[]; }; }) { - // Aggregate remaining: bulk uses estimatedRemaining; discrete uses unitWeight × count. + // Aggregate remaining: bulk uses estimatedRemaining; discrete uses raw count. // Counts use status === "active" only — archived rows shouldn't inflate "on hand." const active = group.items.filter((i) => i.status === "active"); const totalRemaining = active.reduce((s, i) => { if (i.kind === "bulk") return s + helpers.estimatedRemaining(i, TODAY_STR); - const cur = i.countLastAudit ?? i.countOriginal; - return s + cur * (i.unitWeight || 0); + return s + (i.countLastAudit ?? i.countOriginal); }, 0); const lastBuy = group.items.reduce((max, i) => { const t = +new Date(i.purchaseDate); @@ -495,7 +494,11 @@ function ItemRow({
{helpers.brandName(data, i.brandId)}
{helpers.shopName(data, i.shopId)}
-
{i.thc.toFixed(1)}
+
+ {TYPES.find((t) => t.id === i.type)?.showCannabinoidPct !== false + ? `${i.thc.toFixed(1)}%` + : `${i.unitWeight} mg`} +
{fmt.money(i.price)}