Bin slot count: discrete products fill by unit, not by row
Build and push image / build (push) Successful in 54s
Build and push image / build (push) Successful in 54s
A 3ct pre-roll was filling one slot of its bin instead of three. Bins visualise physical capacity, so each unit of a discrete product (rolls, edibles, vapes) should take its own slot; bulk jars still take one slot each. The slot tally and fill bar both use the current count (countLastAudit ?? countOriginal) so the bin frees up as units are audited away. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -74,7 +74,14 @@ export function BinsView({
|
|||||||
>
|
>
|
||||||
{data.bins.map((bin) => {
|
{data.bins.map((bin) => {
|
||||||
const items = data.products.filter((p) => p.binId === bin.id && p.status === "active");
|
const items = data.products.filter((p) => p.binId === bin.id && p.status === "active");
|
||||||
const fillPct = items.length / bin.capacity;
|
// Discrete products (pre-rolls, edibles, vapes) take a slot per unit;
|
||||||
|
// bulk products take one slot per jar/container.
|
||||||
|
const slotsUsed = items.reduce(
|
||||||
|
(s, p) =>
|
||||||
|
s + (p.kind === "discrete" ? (p.countLastAudit ?? p.countOriginal) : 1),
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
const fillPct = slotsUsed / bin.capacity;
|
||||||
const totalValue = items.reduce(
|
const totalValue = items.reduce(
|
||||||
(s, p) => s + p.price * helpers.pctRemaining(p, TODAY_STR),
|
(s, p) => s + p.price * helpers.pctRemaining(p, TODAY_STR),
|
||||||
0,
|
0,
|
||||||
@@ -95,7 +102,7 @@ export function BinsView({
|
|||||||
{bin.name}
|
{bin.name}
|
||||||
</h3>
|
</h3>
|
||||||
<div style={{ display: "flex", alignItems: "center", gap: 6 }}>
|
<div style={{ display: "flex", alignItems: "center", gap: 6 }}>
|
||||||
<Pill tone="outline">{items.length} / {bin.capacity}</Pill>
|
<Pill tone="outline">{slotsUsed} / {bin.capacity}</Pill>
|
||||||
<button
|
<button
|
||||||
onClick={() => onEditBin(bin)}
|
onClick={() => onEditBin(bin)}
|
||||||
title="Edit bin"
|
title="Edit bin"
|
||||||
|
|||||||
Reference in New Issue
Block a user