@burdenoff/microfe-healthybowl 2026.714.3 → 2026.714.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/healthybowl/HealthyBowlRoutes.js +137 -113
  2. package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
  3. package/dist/healthybowl/hooks/useHealthyBowlContacts.js +149 -0
  4. package/dist/healthybowl/hooks/useHealthyBowlContacts.js.map +1 -0
  5. package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js +200 -0
  6. package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js.map +1 -0
  7. package/dist/healthybowl/hooks/useHealthyBowlStorage.js +162 -0
  8. package/dist/healthybowl/hooks/useHealthyBowlStorage.js.map +1 -0
  9. package/dist/healthybowl/pages/contacts/ContactDetailPage.js +224 -0
  10. package/dist/healthybowl/pages/contacts/ContactDetailPage.js.map +1 -0
  11. package/dist/healthybowl/pages/contacts/ContactFormModal.js +147 -0
  12. package/dist/healthybowl/pages/contacts/ContactFormModal.js.map +1 -0
  13. package/dist/healthybowl/pages/contacts/ContactsPage.js +241 -0
  14. package/dist/healthybowl/pages/contacts/ContactsPage.js.map +1 -0
  15. package/dist/healthybowl/pages/contacts/CsvImportModal.js +155 -0
  16. package/dist/healthybowl/pages/contacts/CsvImportModal.js.map +1 -0
  17. package/dist/healthybowl/pages/contacts/RecordOrderModal.js +131 -0
  18. package/dist/healthybowl/pages/contacts/RecordOrderModal.js.map +1 -0
  19. package/dist/healthybowl/pages/contacts/labels.js +46 -0
  20. package/dist/healthybowl/pages/contacts/labels.js.map +1 -0
  21. package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js +152 -0
  22. package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js.map +1 -0
  23. package/dist/healthybowl/pages/livestock/AnimalDepthPage.js +245 -0
  24. package/dist/healthybowl/pages/livestock/AnimalDepthPage.js.map +1 -0
  25. package/dist/healthybowl/pages/livestock/AnimalGroupModal.js +210 -0
  26. package/dist/healthybowl/pages/livestock/AnimalGroupModal.js.map +1 -0
  27. package/dist/healthybowl/pages/livestock/HerdDepthPage.js +189 -0
  28. package/dist/healthybowl/pages/livestock/HerdDepthPage.js.map +1 -0
  29. package/dist/healthybowl/pages/livestock/RecordWeightModal.js +100 -0
  30. package/dist/healthybowl/pages/livestock/RecordWeightModal.js.map +1 -0
  31. package/dist/healthybowl/pages/livestock/depthLabels.js +31 -0
  32. package/dist/healthybowl/pages/livestock/depthLabels.js.map +1 -0
  33. package/dist/healthybowl/pages/storage/PlaceLotModal.js +150 -0
  34. package/dist/healthybowl/pages/storage/PlaceLotModal.js.map +1 -0
  35. package/dist/healthybowl/pages/storage/RecordMovementModal.js +140 -0
  36. package/dist/healthybowl/pages/storage/RecordMovementModal.js.map +1 -0
  37. package/dist/healthybowl/pages/storage/StorageLocationFormModal.js +139 -0
  38. package/dist/healthybowl/pages/storage/StorageLocationFormModal.js.map +1 -0
  39. package/dist/healthybowl/pages/storage/StorageLotDetailPage.js +150 -0
  40. package/dist/healthybowl/pages/storage/StorageLotDetailPage.js.map +1 -0
  41. package/dist/healthybowl/pages/storage/StoragePage.js +251 -0
  42. package/dist/healthybowl/pages/storage/StoragePage.js.map +1 -0
  43. package/dist/healthybowl/pages/storage/labels.js +67 -0
  44. package/dist/healthybowl/pages/storage/labels.js.map +1 -0
  45. package/package.json +1 -1
@@ -0,0 +1,251 @@
1
+ import { cn as e } from "../../utils/helpers.js";
2
+ import { useBasePath as t } from "../../hooks/useBasePath.js";
3
+ import { PageLayout as n } from "../../components/PageLayout.js";
4
+ import { EmptyState as r } from "../../components/EmptyState.js";
5
+ import { ErrorState as i } from "../../components/ErrorState.js";
6
+ import { PageLoader as a } from "../../components/PageLoader.js";
7
+ import { useToast as o } from "../../hooks/useToast.js";
8
+ import "../../components/index.js";
9
+ import { useHealthyBowlStorage as s } from "../../hooks/useHealthyBowlStorage.js";
10
+ import { capacityBarClass as c, capacityLabel as l, reasonLabel as u, storageTypeLabel as d } from "./labels.js";
11
+ import { StorageLocationFormModal as f } from "./StorageLocationFormModal.js";
12
+ import { PlaceLotModal as p } from "./PlaceLotModal.js";
13
+ import { useMemo as m, useState as h } from "react";
14
+ import { useI18n as g } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
15
+ import { ArrowDown as _, ArrowUp as v, Boxes as y, ChevronRight as b, Package as x, Plus as S, Warehouse as C } from "lucide-react";
16
+ import { useNavigate as w } from "react-router-dom";
17
+ import { jsx as T, jsxs as E } from "react/jsx-runtime";
18
+ import { Button as D } from "@burdenoff/fe-libs/ui";
19
+ //#region src/healthybowl/pages/storage/StoragePage.tsx
20
+ var O = () => {
21
+ let { t: O } = g(), k = w(), { buildPath: A } = t(), { toast: j } = o(), { overview: M, loading: N, errors: P, refetchOverview: F, createLocation: I, placeLot: L } = s({ overview: !0 }), [R, z] = h(!1), [B, V] = h("WAREHOUSE"), [H, U] = h(!1), W = M?.warehouses ?? [], G = m(() => W.map((e) => e.warehouse), [W]), K = m(() => W.flatMap((e) => e.bins.map((e) => e.location)), [W]), q = () => {
22
+ V("WAREHOUSE"), z(!0);
23
+ }, J = () => {
24
+ V("BIN"), z(!0);
25
+ }, Y = async (e) => {
26
+ await I(e), j({
27
+ title: O("healthybowl.storage.toast.locationSaved", "Location saved"),
28
+ description: String(e.name ?? ""),
29
+ variant: "success"
30
+ });
31
+ }, X = async (e) => {
32
+ await L(e), j({
33
+ title: O("healthybowl.storage.toast.lotPlaced", "Lot placed"),
34
+ description: String(e.lotCode ?? ""),
35
+ variant: "success"
36
+ });
37
+ }, Z = (e) => k(A(`storage/lots/${e.id}`));
38
+ return N.overview && !M ? /* @__PURE__ */ T(a, {}) : /* @__PURE__ */ E(n, {
39
+ title: O("healthybowl.storage.title", "Storage"),
40
+ titleAccent: O("healthybowl.storage.titleAccent", "Storage"),
41
+ description: O("healthybowl.storage.description", "Warehouses, cold-stores and bins — where each batch of produce and milk is stored, and its in/out history."),
42
+ actions: /* @__PURE__ */ E("div", {
43
+ className: "flex items-center gap-2",
44
+ children: [
45
+ /* @__PURE__ */ E(D, {
46
+ variant: "outline",
47
+ onClick: q,
48
+ children: [/* @__PURE__ */ T(C, { className: "h-4 w-4" }), O("healthybowl.storage.actions.addWarehouse", "Add Warehouse")]
49
+ }),
50
+ /* @__PURE__ */ E(D, {
51
+ variant: "outline",
52
+ onClick: J,
53
+ disabled: G.length === 0,
54
+ children: [/* @__PURE__ */ T(y, { className: "h-4 w-4" }), O("healthybowl.storage.actions.addBin", "Add Bin")]
55
+ }),
56
+ /* @__PURE__ */ E(D, {
57
+ onClick: () => U(!0),
58
+ disabled: K.length === 0,
59
+ children: [/* @__PURE__ */ T(S, { className: "h-4 w-4" }), O("healthybowl.storage.actions.placeLot", "Place Lot")]
60
+ })
61
+ ]
62
+ }),
63
+ children: [
64
+ P.overview && !M ? /* @__PURE__ */ T(i, {
65
+ description: P.overview.message,
66
+ onRetry: () => void F()
67
+ }) : W.length === 0 ? /* @__PURE__ */ T(r, {
68
+ icon: /* @__PURE__ */ T(C, { className: "h-8 w-8 text-text-secondary" }),
69
+ title: O("healthybowl.storage.empty.title", "No warehouses yet"),
70
+ description: O("healthybowl.storage.empty.description", "Add a warehouse or cold-store, create bins inside it, then place lots of produce or milk."),
71
+ action: /* @__PURE__ */ E(D, {
72
+ onClick: q,
73
+ children: [/* @__PURE__ */ T(C, { className: "h-4 w-4" }), O("healthybowl.storage.actions.addWarehouse", "Add Warehouse")]
74
+ })
75
+ }) : /* @__PURE__ */ E("div", {
76
+ className: "space-y-6",
77
+ children: [/* @__PURE__ */ E("section", { children: [/* @__PURE__ */ T("h3", {
78
+ className: "mb-2 text-sm font-semibold text-text-primary",
79
+ children: O("healthybowl.storage.capacity", "Warehouse capacity")
80
+ }), /* @__PURE__ */ T("div", {
81
+ className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4",
82
+ children: W.map((t) => /* @__PURE__ */ E("div", {
83
+ className: "rounded-xl border border-border-subtle bg-bg-surface p-4",
84
+ children: [
85
+ /* @__PURE__ */ E("div", {
86
+ className: "flex items-start justify-between gap-2",
87
+ children: [/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("div", {
88
+ className: "font-medium text-text-primary",
89
+ children: t.warehouse.name
90
+ }), t.warehouse.storageType ? /* @__PURE__ */ T("div", {
91
+ className: "text-xs text-text-tertiary",
92
+ children: d(t.warehouse.storageType)
93
+ }) : null] }), /* @__PURE__ */ T("div", {
94
+ className: "text-right text-sm font-semibold text-text-primary",
95
+ children: l(t.capacityPct)
96
+ })]
97
+ }),
98
+ /* @__PURE__ */ E("div", {
99
+ className: "mt-1 text-xs tabular-nums text-text-secondary",
100
+ children: [
101
+ t.usedCapacity,
102
+ t.capacity === null ? "" : ` / ${t.capacity}`,
103
+ " ",
104
+ t.capacityUnit
105
+ ]
106
+ }),
107
+ /* @__PURE__ */ T("div", {
108
+ className: "mt-2 h-2 w-full overflow-hidden rounded-full bg-bg-sunken",
109
+ children: /* @__PURE__ */ T("div", {
110
+ className: e("h-full rounded-full transition-all", c(t.capacityPct)),
111
+ style: { width: `${Math.min(100, t.capacityPct ?? 0)}%` }
112
+ })
113
+ }),
114
+ /* @__PURE__ */ T("div", {
115
+ className: "mt-2 text-xs text-text-tertiary",
116
+ children: O("healthybowl.storage.binCount", "{{bins}} bins · {{lots}} lots", {
117
+ bins: t.binCount,
118
+ lots: t.lotCount
119
+ })
120
+ })
121
+ ]
122
+ }, t.warehouse.id))
123
+ })] }), /* @__PURE__ */ E("div", {
124
+ className: "grid grid-cols-1 gap-6 lg:grid-cols-2",
125
+ children: [/* @__PURE__ */ E("section", {
126
+ className: "rounded-xl border border-border-subtle bg-bg-surface p-4",
127
+ children: [/* @__PURE__ */ T("h3", {
128
+ className: "mb-3 text-sm font-semibold text-text-primary",
129
+ children: O("healthybowl.storage.binsLots", "Bins & Lots")
130
+ }), /* @__PURE__ */ T("div", {
131
+ className: "space-y-4",
132
+ children: W.map((e) => /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("div", {
133
+ className: "text-sm font-medium text-text-primary",
134
+ children: e.warehouse.name
135
+ }), /* @__PURE__ */ T("div", {
136
+ className: "mt-1 space-y-2 border-l border-border-subtle pl-3",
137
+ children: e.bins.length === 0 ? /* @__PURE__ */ T("div", {
138
+ className: "text-xs text-text-tertiary",
139
+ children: O("healthybowl.storage.noBins", "No bins yet")
140
+ }) : e.bins.map((e) => /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ E("div", {
141
+ className: "flex items-center gap-1 text-xs font-medium text-text-secondary",
142
+ children: [/* @__PURE__ */ T(b, { className: "h-3 w-3" }), e.location.name]
143
+ }), /* @__PURE__ */ T("div", {
144
+ className: "ml-4 mt-1 space-y-1",
145
+ children: e.lots.length === 0 ? /* @__PURE__ */ T("div", {
146
+ className: "text-xs text-text-tertiary",
147
+ children: O("healthybowl.storage.empty2", "empty")
148
+ }) : e.lots.map((e) => /* @__PURE__ */ E("button", {
149
+ type: "button",
150
+ onClick: () => Z(e),
151
+ className: "flex w-full items-center justify-between gap-2 rounded-md bg-bg-sunken px-2.5 py-1.5 text-left text-sm hover:bg-accent-teal/5",
152
+ children: [/* @__PURE__ */ E("span", {
153
+ className: "inline-flex items-center gap-1.5 text-text-primary",
154
+ children: [
155
+ /* @__PURE__ */ T(x, { className: "h-3.5 w-3.5 text-text-tertiary" }),
156
+ /* @__PURE__ */ T("span", {
157
+ className: "font-medium",
158
+ children: e.produce
159
+ }),
160
+ /* @__PURE__ */ E("span", {
161
+ className: "text-text-tertiary",
162
+ children: ["· ", e.lotCode]
163
+ })
164
+ ]
165
+ }), /* @__PURE__ */ E("span", {
166
+ className: "tabular-nums text-text-secondary",
167
+ children: [
168
+ e.quantity,
169
+ " ",
170
+ e.unit
171
+ ]
172
+ })]
173
+ }, e.id))
174
+ })] }, e.location.id))
175
+ })] }, e.warehouse.id))
176
+ })]
177
+ }), /* @__PURE__ */ E("section", {
178
+ className: "rounded-xl border border-border-subtle bg-bg-surface p-4",
179
+ children: [/* @__PURE__ */ T("h3", {
180
+ className: "mb-3 text-sm font-semibold text-text-primary",
181
+ children: O("healthybowl.storage.movementHistory", "Movement History")
182
+ }), (M?.recentMovements.length ?? 0) === 0 ? /* @__PURE__ */ T("div", {
183
+ className: "py-6 text-center text-sm text-text-secondary",
184
+ children: O("healthybowl.storage.noMovements", "No stock movements yet.")
185
+ }) : /* @__PURE__ */ T("ol", {
186
+ className: "space-y-3",
187
+ children: M.recentMovements.map((t) => {
188
+ let n = t.direction === "IN";
189
+ return /* @__PURE__ */ E("li", {
190
+ className: "flex items-start gap-3",
191
+ children: [/* @__PURE__ */ T("span", {
192
+ className: e("mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full", n ? "bg-status-success-bg text-status-success-text" : "bg-status-error-bg text-status-error-text"),
193
+ children: T(n ? v : _, { className: "h-3.5 w-3.5" })
194
+ }), /* @__PURE__ */ E("div", {
195
+ className: "min-w-0 flex-1",
196
+ children: [/* @__PURE__ */ E("div", {
197
+ className: "text-sm",
198
+ children: [/* @__PURE__ */ E("span", {
199
+ className: e("font-semibold", n ? "text-status-success-text" : "text-status-error-text"),
200
+ children: [
201
+ n ? "IN" : "OUT",
202
+ " ",
203
+ n ? "+" : "−",
204
+ t.quantity,
205
+ " ",
206
+ t.unit
207
+ ]
208
+ }), t.reason ? /* @__PURE__ */ T("span", {
209
+ className: "ml-2 text-xs text-text-tertiary",
210
+ children: u(t.reason)
211
+ }) : null]
212
+ }), /* @__PURE__ */ E("div", {
213
+ className: "truncate text-sm text-text-primary",
214
+ children: [
215
+ t.produce ?? O("healthybowl.storage.lot.produce", "Produce"),
216
+ " → ",
217
+ t.reference ?? t.locationName ?? "—",
218
+ /* @__PURE__ */ T("span", {
219
+ className: "ml-2 text-xs tabular-nums text-text-tertiary",
220
+ children: t.occurredAt.slice(0, 10)
221
+ })
222
+ ]
223
+ })]
224
+ })]
225
+ }, t.id);
226
+ })
227
+ })]
228
+ })]
229
+ })]
230
+ }),
231
+ /* @__PURE__ */ T(f, {
232
+ open: R,
233
+ onClose: () => z(!1),
234
+ location: null,
235
+ warehouses: G,
236
+ defaultKind: B,
237
+ onSubmit: Y
238
+ }),
239
+ /* @__PURE__ */ T(p, {
240
+ open: H,
241
+ onClose: () => U(!1),
242
+ bins: K,
243
+ onSubmit: X
244
+ })
245
+ ]
246
+ });
247
+ };
248
+ //#endregion
249
+ export { O as StoragePage };
250
+
251
+ //# sourceMappingURL=StoragePage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StoragePage.js","names":[],"sources":["../../../../src/healthybowl/pages/storage/StoragePage.tsx"],"sourcesContent":["/**\n * Warehouse storage overview (BOFF-2890 · K-1).\n * Per-warehouse capacity bars, a warehouse → bin → lot tree, and a stock-movement timeline.\n * Every number comes from the backend (lots summed into capacity, real IN/OUT ledger). No\n * fabricated data.\n */\nimport { useMemo, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { ArrowDown, ArrowUp, Boxes, ChevronRight, Package, Plus, Warehouse } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PageLayout, EmptyState, ErrorState, PageLoader } from '../../components';\nimport { useToast } from '../../hooks/useToast';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport { cn } from '../../utils/helpers';\nimport { useHealthyBowlStorage, type StorageLocation, type StorageLot } from '../../hooks/useHealthyBowlStorage';\nimport { StorageLocationFormModal } from './StorageLocationFormModal';\nimport { PlaceLotModal } from './PlaceLotModal';\nimport { capacityBarClass, capacityLabel, reasonLabel, storageTypeLabel } from './labels';\n\nexport const StoragePage = () => {\n const { t } = useI18n();\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const { toast } = useToast();\n\n const { overview, loading, errors, refetchOverview, createLocation, placeLot } = useHealthyBowlStorage({\n overview: true,\n });\n\n const [locOpen, setLocOpen] = useState(false);\n const [locKind, setLocKind] = useState<'WAREHOUSE' | 'BIN'>('WAREHOUSE');\n const [placeOpen, setPlaceOpen] = useState(false);\n\n const warehouses = overview?.warehouses ?? [];\n const allWarehouseLocations = useMemo<StorageLocation[]>(() => warehouses.map((w) => w.warehouse), [warehouses]);\n const allBins = useMemo<StorageLocation[]>(\n () => warehouses.flatMap((w) => w.bins.map((b) => b.location)),\n [warehouses]\n );\n\n const openAddWarehouse = () => {\n setLocKind('WAREHOUSE');\n setLocOpen(true);\n };\n const openAddBin = () => {\n setLocKind('BIN');\n setLocOpen(true);\n };\n\n const handleCreateLocation = async (input: Record<string, unknown>) => {\n await createLocation(input);\n toast({\n title: t('healthybowl.storage.toast.locationSaved', 'Location saved'),\n description: String(input.name ?? ''),\n variant: 'success',\n });\n };\n\n const handlePlaceLot = async (input: Record<string, unknown>) => {\n await placeLot(input);\n toast({\n title: t('healthybowl.storage.toast.lotPlaced', 'Lot placed'),\n description: String(input.lotCode ?? ''),\n variant: 'success',\n });\n };\n\n const goToLot = (lot: StorageLot) => navigate(buildPath(`storage/lots/${lot.id}`));\n\n if (loading.overview && !overview) {\n return <PageLoader />;\n }\n\n return (\n <PageLayout\n title={t('healthybowl.storage.title', 'Storage')}\n titleAccent={t('healthybowl.storage.titleAccent', 'Storage')}\n description={t(\n 'healthybowl.storage.description',\n 'Warehouses, cold-stores and bins — where each batch of produce and milk is stored, and its in/out history.'\n )}\n actions={\n <div className=\"flex items-center gap-2\">\n <Button variant=\"outline\" onClick={openAddWarehouse}>\n <Warehouse className=\"h-4 w-4\" />\n {t('healthybowl.storage.actions.addWarehouse', 'Add Warehouse')}\n </Button>\n <Button variant=\"outline\" onClick={openAddBin} disabled={allWarehouseLocations.length === 0}>\n <Boxes className=\"h-4 w-4\" />\n {t('healthybowl.storage.actions.addBin', 'Add Bin')}\n </Button>\n <Button onClick={() => setPlaceOpen(true)} disabled={allBins.length === 0}>\n <Plus className=\"h-4 w-4\" />\n {t('healthybowl.storage.actions.placeLot', 'Place Lot')}\n </Button>\n </div>\n }\n >\n {errors.overview && !overview ? (\n <ErrorState description={errors.overview.message} onRetry={() => void refetchOverview()} />\n ) : warehouses.length === 0 ? (\n <EmptyState\n icon={<Warehouse className=\"h-8 w-8 text-text-secondary\" />}\n title={t('healthybowl.storage.empty.title', 'No warehouses yet')}\n description={t(\n 'healthybowl.storage.empty.description',\n 'Add a warehouse or cold-store, create bins inside it, then place lots of produce or milk.'\n )}\n action={\n <Button onClick={openAddWarehouse}>\n <Warehouse className=\"h-4 w-4\" />\n {t('healthybowl.storage.actions.addWarehouse', 'Add Warehouse')}\n </Button>\n }\n />\n ) : (\n <div className=\"space-y-6\">\n {/* Warehouse capacity cards */}\n <section>\n <h3 className=\"mb-2 text-sm font-semibold text-text-primary\">\n {t('healthybowl.storage.capacity', 'Warehouse capacity')}\n </h3>\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4\">\n {warehouses.map((w) => (\n <div key={w.warehouse.id} className=\"rounded-xl border border-border-subtle bg-bg-surface p-4\">\n <div className=\"flex items-start justify-between gap-2\">\n <div>\n <div className=\"font-medium text-text-primary\">{w.warehouse.name}</div>\n {w.warehouse.storageType ? (\n <div className=\"text-xs text-text-tertiary\">{storageTypeLabel(w.warehouse.storageType)}</div>\n ) : null}\n </div>\n <div className=\"text-right text-sm font-semibold text-text-primary\">\n {capacityLabel(w.capacityPct)}\n </div>\n </div>\n <div className=\"mt-1 text-xs tabular-nums text-text-secondary\">\n {w.usedCapacity}\n {w.capacity !== null ? ` / ${w.capacity}` : ''} {w.capacityUnit}\n </div>\n <div className=\"mt-2 h-2 w-full overflow-hidden rounded-full bg-bg-sunken\">\n <div\n className={cn('h-full rounded-full transition-all', capacityBarClass(w.capacityPct))}\n style={{ width: `${Math.min(100, w.capacityPct ?? 0)}%` }}\n />\n </div>\n <div className=\"mt-2 text-xs text-text-tertiary\">\n {t('healthybowl.storage.binCount', '{{bins}} bins · {{lots}} lots', {\n bins: w.binCount,\n lots: w.lotCount,\n })}\n </div>\n </div>\n ))}\n </div>\n </section>\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-2\">\n {/* Bins & Lots tree */}\n <section className=\"rounded-xl border border-border-subtle bg-bg-surface p-4\">\n <h3 className=\"mb-3 text-sm font-semibold text-text-primary\">\n {t('healthybowl.storage.binsLots', 'Bins & Lots')}\n </h3>\n <div className=\"space-y-4\">\n {warehouses.map((w) => (\n <div key={w.warehouse.id}>\n <div className=\"text-sm font-medium text-text-primary\">{w.warehouse.name}</div>\n <div className=\"mt-1 space-y-2 border-l border-border-subtle pl-3\">\n {w.bins.length === 0 ? (\n <div className=\"text-xs text-text-tertiary\">\n {t('healthybowl.storage.noBins', 'No bins yet')}\n </div>\n ) : (\n w.bins.map((bin) => (\n <div key={bin.location.id}>\n <div className=\"flex items-center gap-1 text-xs font-medium text-text-secondary\">\n <ChevronRight className=\"h-3 w-3\" />\n {bin.location.name}\n </div>\n <div className=\"ml-4 mt-1 space-y-1\">\n {bin.lots.length === 0 ? (\n <div className=\"text-xs text-text-tertiary\">\n {t('healthybowl.storage.empty2', 'empty')}\n </div>\n ) : (\n bin.lots.map((lot) => (\n <button\n key={lot.id}\n type=\"button\"\n onClick={() => goToLot(lot)}\n className=\"flex w-full items-center justify-between gap-2 rounded-md bg-bg-sunken px-2.5 py-1.5 text-left text-sm hover:bg-accent-teal/5\"\n >\n <span className=\"inline-flex items-center gap-1.5 text-text-primary\">\n <Package className=\"h-3.5 w-3.5 text-text-tertiary\" />\n <span className=\"font-medium\">{lot.produce}</span>\n <span className=\"text-text-tertiary\">· {lot.lotCode}</span>\n </span>\n <span className=\"tabular-nums text-text-secondary\">\n {lot.quantity} {lot.unit}\n </span>\n </button>\n ))\n )}\n </div>\n </div>\n ))\n )}\n </div>\n </div>\n ))}\n </div>\n </section>\n\n {/* Movement history timeline */}\n <section className=\"rounded-xl border border-border-subtle bg-bg-surface p-4\">\n <h3 className=\"mb-3 text-sm font-semibold text-text-primary\">\n {t('healthybowl.storage.movementHistory', 'Movement History')}\n </h3>\n {(overview?.recentMovements.length ?? 0) === 0 ? (\n <div className=\"py-6 text-center text-sm text-text-secondary\">\n {t('healthybowl.storage.noMovements', 'No stock movements yet.')}\n </div>\n ) : (\n <ol className=\"space-y-3\">\n {overview!.recentMovements.map((m) => {\n const isIn = m.direction === 'IN';\n return (\n <li key={m.id} className=\"flex items-start gap-3\">\n <span\n className={cn(\n 'mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full',\n isIn\n ? 'bg-status-success-bg text-status-success-text'\n : 'bg-status-error-bg text-status-error-text'\n )}\n >\n {isIn ? <ArrowUp className=\"h-3.5 w-3.5\" /> : <ArrowDown className=\"h-3.5 w-3.5\" />}\n </span>\n <div className=\"min-w-0 flex-1\">\n <div className=\"text-sm\">\n <span\n className={cn(\n 'font-semibold',\n isIn ? 'text-status-success-text' : 'text-status-error-text'\n )}\n >\n {isIn ? 'IN' : 'OUT'} {isIn ? '+' : '−'}\n {m.quantity} {m.unit}\n </span>\n {m.reason ? (\n <span className=\"ml-2 text-xs text-text-tertiary\">{reasonLabel(m.reason)}</span>\n ) : null}\n </div>\n <div className=\"truncate text-sm text-text-primary\">\n {m.produce ?? t('healthybowl.storage.lot.produce', 'Produce')}\n {' → '}\n {m.reference ?? m.locationName ?? '—'}\n <span className=\"ml-2 text-xs tabular-nums text-text-tertiary\">\n {m.occurredAt.slice(0, 10)}\n </span>\n </div>\n </div>\n </li>\n );\n })}\n </ol>\n )}\n </section>\n </div>\n </div>\n )}\n\n <StorageLocationFormModal\n open={locOpen}\n onClose={() => setLocOpen(false)}\n location={null}\n warehouses={allWarehouseLocations}\n defaultKind={locKind}\n onSubmit={handleCreateLocation}\n />\n <PlaceLotModal open={placeOpen} onClose={() => setPlaceOpen(false)} bins={allBins} onSubmit={handlePlaceLot} />\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,IAAa,UAAoB;CAC/B,I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,WAAW,EACT,iBACA,IAAO,6BAA6B,yBACrC;sBAJH;aAMG,IAAO,OAAO;aAAM;aAAE,IAAO,MAAM;aACnC,EAAE;aAAS;aAAE,EAAE;aACX;eACN,EAAE,SACD,kBAAC,QAAD;YAAM,WAAU;sBAAmC,EAAY,EAAE,OAAO;YAAQ,CAAA,GAC9E,KACA;cACN,kBAAC,OAAD;WAAK,WAAU;qBAAf;YACG,EAAE,WAAW,EAAE,mCAAmC,UAAU;YAC5D;YACA,EAAE,aAAa,EAAE,gBAAgB;YAClC,kBAAC,QAAD;aAAM,WAAU;uBACb,EAAE,WAAW,MAAM,GAAG,GAAG;aACrB,CAAA;YACH;aACF;YACH;WAnCI,EAAE,GAmCN;SAEP;OACC,CAAA,CAEC;QACN;OACF;;GAGR,kBAAC,GAAD;IACE,MAAM;IACN,eAAe,EAAW,GAAM;IAChC,UAAU;IACV,YAAY;IACZ,aAAa;IACb,UAAU;IACV,CAAA;GACF,kBAAC,GAAD;IAAe,MAAM;IAAW,eAAe,EAAa,GAAM;IAAE,MAAM;IAAS,UAAU;IAAkB,CAAA;GACpG"}
@@ -0,0 +1,67 @@
1
+ //#region src/healthybowl/pages/storage/labels.ts
2
+ var e = [
3
+ {
4
+ value: "COLD_STORE",
5
+ label: "Cold Store"
6
+ },
7
+ {
8
+ value: "DRY",
9
+ label: "Dry Store"
10
+ },
11
+ {
12
+ value: "AMBIENT",
13
+ label: "Ambient"
14
+ },
15
+ {
16
+ value: "FREEZER",
17
+ label: "Freezer"
18
+ },
19
+ {
20
+ value: "MILK_TANK",
21
+ label: "Milk Tank"
22
+ },
23
+ {
24
+ value: "OTHER",
25
+ label: "Other"
26
+ }
27
+ ], t = [
28
+ {
29
+ value: "HARVEST",
30
+ label: "Harvest"
31
+ },
32
+ {
33
+ value: "RECEIPT",
34
+ label: "Receipt"
35
+ },
36
+ {
37
+ value: "SALE",
38
+ label: "Sale"
39
+ },
40
+ {
41
+ value: "TRANSFER",
42
+ label: "Transfer"
43
+ },
44
+ {
45
+ value: "ADJUSTMENT",
46
+ label: "Adjustment"
47
+ },
48
+ {
49
+ value: "SPOILAGE",
50
+ label: "Spoilage"
51
+ },
52
+ {
53
+ value: "OTHER",
54
+ label: "Other"
55
+ }
56
+ ], n = (t) => t ? e.find((e) => e.value === t)?.label ?? t : "", r = (e) => e ? t.find((t) => t.value === e)?.label ?? e : "", i = (e) => {
57
+ switch (e) {
58
+ case "STORED": return "success";
59
+ case "EXPIRED": return "error";
60
+ case "DEPLETED": return "muted";
61
+ default: return "muted";
62
+ }
63
+ }, a = (e) => e === null ? "bg-border-default" : e > 90 ? "bg-status-error-text" : e >= 75 ? "bg-status-warning-text" : "bg-accent-teal", o = (e) => e === null ? "—" : `${Math.round(e)}% full`;
64
+ //#endregion
65
+ export { t as MOVEMENT_REASONS, e as STORAGE_TYPES, a as capacityBarClass, o as capacityLabel, i as lotStatusVariant, r as reasonLabel, n as storageTypeLabel };
66
+
67
+ //# sourceMappingURL=labels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels.js","names":[],"sources":["../../../../src/healthybowl/pages/storage/labels.ts"],"sourcesContent":["/**\n * Shared label + variant helpers for the Warehouse Storage views (BOFF-2890 · K-1).\n */\n\ntype BadgeVariant = 'success' | 'warning' | 'error' | 'info' | 'default' | 'muted';\n\nexport const STORAGE_TYPES: Array<{ value: string; label: string }> = [\n { value: 'COLD_STORE', label: 'Cold Store' },\n { value: 'DRY', label: 'Dry Store' },\n { value: 'AMBIENT', label: 'Ambient' },\n { value: 'FREEZER', label: 'Freezer' },\n { value: 'MILK_TANK', label: 'Milk Tank' },\n { value: 'OTHER', label: 'Other' },\n];\n\nexport const MOVEMENT_REASONS: Array<{ value: string; label: string }> = [\n { value: 'HARVEST', label: 'Harvest' },\n { value: 'RECEIPT', label: 'Receipt' },\n { value: 'SALE', label: 'Sale' },\n { value: 'TRANSFER', label: 'Transfer' },\n { value: 'ADJUSTMENT', label: 'Adjustment' },\n { value: 'SPOILAGE', label: 'Spoilage' },\n { value: 'OTHER', label: 'Other' },\n];\n\nexport const storageTypeLabel = (value: string | null): string => {\n if (!value) return '';\n return STORAGE_TYPES.find((s) => s.value === value)?.label ?? value;\n};\n\nexport const reasonLabel = (value: string | null): string => {\n if (!value) return '';\n return MOVEMENT_REASONS.find((r) => r.value === value)?.label ?? value;\n};\n\nexport const lotStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'STORED':\n return 'success';\n case 'EXPIRED':\n return 'error';\n case 'DEPLETED':\n return 'muted';\n default:\n return 'muted';\n }\n};\n\n/** Capacity-bar fill color by fullness: <75% brand green, 75–90% amber, >90% red. */\nexport const capacityBarClass = (pct: number | null): string => {\n if (pct === null) return 'bg-border-default';\n if (pct > 90) return 'bg-status-error-text';\n if (pct >= 75) return 'bg-status-warning-text';\n return 'bg-accent-teal';\n};\n\nexport const capacityLabel = (pct: number | null): string => (pct === null ? '—' : `${Math.round(pct)}% full`);\n"],"mappings":";AAMA,IAAa,IAAyD;CACpE;EAAE,OAAO;EAAc,OAAO;EAAc;CAC5C;EAAE,OAAO;EAAO,OAAO;EAAa;CACpC;EAAE,OAAO;EAAW,OAAO;EAAW;CACtC;EAAE,OAAO;EAAW,OAAO;EAAW;CACtC;EAAE,OAAO;EAAa,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAS,OAAO;EAAS;CACnC,EAEY,IAA4D;CACvE;EAAE,OAAO;EAAW,OAAO;EAAW;CACtC;EAAE,OAAO;EAAW,OAAO;EAAW;CACtC;EAAE,OAAO;EAAQ,OAAO;EAAQ;CAChC;EAAE,OAAO;EAAY,OAAO;EAAY;CACxC;EAAE,OAAO;EAAc,OAAO;EAAc;CAC5C;EAAE,OAAO;EAAY,OAAO;EAAY;CACxC;EAAE,OAAO;EAAS,OAAO;EAAS;CACnC,EAEY,KAAoB,MAC1B,IACE,EAAc,MAAM,MAAM,EAAE,UAAU,EAAM,EAAE,SAAS,IAD3C,IAIR,KAAe,MACrB,IACE,EAAiB,MAAM,MAAM,EAAE,UAAU,EAAM,EAAE,SAAS,IAD9C,IAIR,KAAoB,MAAiC;AAChE,SAAQ,GAAR;EACE,KAAK,SACH,QAAO;EACT,KAAK,UACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,QACE,QAAO;;GAKA,KAAoB,MAC3B,MAAQ,OAAa,sBACrB,IAAM,KAAW,yBACjB,KAAO,KAAW,2BACf,kBAGI,KAAiB,MAAgC,MAAQ,OAAO,MAAM,GAAG,KAAK,MAAM,EAAI,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-healthybowl",
3
- "version": "2026.714.3",
3
+ "version": "2026.714.4",
4
4
  "description": "Burdenoff HealthyBowl Microfrontend - Comprehensive organic farming and agro-foods management platform",
5
5
  "type": "module",
6
6
  "files": [