@burdenoff/microfe-healthybowl 2026.714.2 → 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 (79) hide show
  1. package/dist/healthybowl/HealthyBowlRoutes.js +149 -109
  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/satellite/CropHealthAlertsPage.js +188 -0
  34. package/dist/healthybowl/pages/satellite/CropHealthAlertsPage.js.map +1 -0
  35. package/dist/healthybowl/pages/satellite/NdviComparePanel.js +196 -0
  36. package/dist/healthybowl/pages/satellite/NdviComparePanel.js.map +1 -0
  37. package/dist/healthybowl/pages/satellite/NdviGridThumbnail.js +44 -0
  38. package/dist/healthybowl/pages/satellite/NdviGridThumbnail.js.map +1 -0
  39. package/dist/healthybowl/pages/satellite/NdviHeatmapMap.js +144 -0
  40. package/dist/healthybowl/pages/satellite/NdviHeatmapMap.js.map +1 -0
  41. package/dist/healthybowl/pages/satellite/SatelliteCropHealthPage.js +278 -0
  42. package/dist/healthybowl/pages/satellite/SatelliteCropHealthPage.js.map +1 -0
  43. package/dist/healthybowl/pages/satellite/SatelliteFieldDetailPage.js +447 -0
  44. package/dist/healthybowl/pages/satellite/SatelliteFieldDetailPage.js.map +1 -0
  45. package/dist/healthybowl/pages/satellite/SatelliteSettingsPage.js +252 -0
  46. package/dist/healthybowl/pages/satellite/SatelliteSettingsPage.js.map +1 -0
  47. package/dist/healthybowl/pages/satellite/YieldReportPanel.js +236 -0
  48. package/dist/healthybowl/pages/satellite/YieldReportPanel.js.map +1 -0
  49. package/dist/healthybowl/pages/satellite/YieldSimulationPanel.js +363 -0
  50. package/dist/healthybowl/pages/satellite/YieldSimulationPanel.js.map +1 -0
  51. package/dist/healthybowl/pages/satellite/ndviColors.js +116 -0
  52. package/dist/healthybowl/pages/satellite/ndviColors.js.map +1 -0
  53. package/dist/healthybowl/pages/satellite/satelliteApi.js +191 -0
  54. package/dist/healthybowl/pages/satellite/satelliteApi.js.map +1 -0
  55. package/dist/healthybowl/pages/satellite/useSatelliteApi.js +15 -0
  56. package/dist/healthybowl/pages/satellite/useSatelliteApi.js.map +1 -0
  57. package/dist/healthybowl/pages/storage/PlaceLotModal.js +150 -0
  58. package/dist/healthybowl/pages/storage/PlaceLotModal.js.map +1 -0
  59. package/dist/healthybowl/pages/storage/RecordMovementModal.js +140 -0
  60. package/dist/healthybowl/pages/storage/RecordMovementModal.js.map +1 -0
  61. package/dist/healthybowl/pages/storage/StorageLocationFormModal.js +139 -0
  62. package/dist/healthybowl/pages/storage/StorageLocationFormModal.js.map +1 -0
  63. package/dist/healthybowl/pages/storage/StorageLotDetailPage.js +150 -0
  64. package/dist/healthybowl/pages/storage/StorageLotDetailPage.js.map +1 -0
  65. package/dist/healthybowl/pages/storage/StoragePage.js +251 -0
  66. package/dist/healthybowl/pages/storage/StoragePage.js.map +1 -0
  67. package/dist/healthybowl/pages/storage/labels.js +67 -0
  68. package/dist/healthybowl/pages/storage/labels.js.map +1 -0
  69. package/dist/node_modules/recharts/es6/cartesian/Scatter.js +368 -0
  70. package/dist/node_modules/recharts/es6/cartesian/Scatter.js.map +1 -0
  71. package/dist/node_modules/recharts/es6/cartesian/ZAxis.js +103 -0
  72. package/dist/node_modules/recharts/es6/cartesian/ZAxis.js.map +1 -0
  73. package/dist/node_modules/recharts/es6/chart/ComposedChart.js +38 -0
  74. package/dist/node_modules/recharts/es6/chart/ComposedChart.js.map +1 -0
  75. package/dist/node_modules/recharts/es6/util/DataUtils.js +12 -2
  76. package/dist/node_modules/recharts/es6/util/DataUtils.js.map +1 -1
  77. package/dist/node_modules/recharts/es6/util/ScatterUtils.js +48 -0
  78. package/dist/node_modules/recharts/es6/util/ScatterUtils.js.map +1 -0
  79. package/package.json +1 -1
@@ -0,0 +1,139 @@
1
+ import { cn as e } from "../../utils/helpers.js";
2
+ import { Modal as t } from "../../components/Modal.js";
3
+ import "../../components/index.js";
4
+ import { STORAGE_TYPES as n } from "./labels.js";
5
+ import { useEffect as r, useState as i } from "react";
6
+ import { useI18n as a } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
7
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
+ import { Button as c, Input as l, Select as u, SelectContent as d, SelectItem as f, SelectTrigger as p, SelectValue as m, Textarea as h } from "@burdenoff/fe-libs/ui";
9
+ //#region src/healthybowl/pages/storage/StorageLocationFormModal.tsx
10
+ var g = "mb-1 block text-sm font-medium text-text-primary", _ = ({ open: _, onClose: v, location: y, warehouses: b, defaultKind: x = "WAREHOUSE", onSubmit: S }) => {
11
+ let { t: C } = a(), w = !!y, [T, E] = i(""), [D, O] = i(x), [k, A] = i("COLD_STORE"), [j, M] = i(""), [N, P] = i(""), [F, I] = i("kg"), [L, R] = i(""), [z, B] = i(!1), [V, H] = i(null);
12
+ r(() => {
13
+ _ && (H(null), y ? (E(y.name), O(y.kind === "BIN" ? "BIN" : "WAREHOUSE"), A(y.storageType ?? "COLD_STORE"), M(y.parentId ?? ""), P(y.capacity === null ? "" : String(y.capacity)), I(y.capacityUnit ?? "kg"), R(y.notes ?? "")) : (E(""), O(x), A("COLD_STORE"), M(b[0]?.id ?? ""), P(""), I("kg"), R("")));
14
+ }, [
15
+ _,
16
+ y,
17
+ x,
18
+ b
19
+ ]);
20
+ let U = T.trim().length > 0 && !(D === "BIN" && !j) && !z, W = async () => {
21
+ if (U) {
22
+ B(!0), H(null);
23
+ try {
24
+ let e = {
25
+ name: T.trim(),
26
+ capacity: N.trim() ? Number(N) : null,
27
+ capacityUnit: F.trim() || "kg",
28
+ notes: L.trim() || null
29
+ };
30
+ w ? (e.id = y.id, D === "WAREHOUSE" && (e.storageType = k)) : (e.kind = D, D === "WAREHOUSE" && (e.storageType = k), D === "BIN" && (e.parentId = j)), await S(e), v();
31
+ } catch (e) {
32
+ H(e instanceof Error ? e.message : String(e));
33
+ } finally {
34
+ B(!1);
35
+ }
36
+ }
37
+ };
38
+ return /* @__PURE__ */ o(t, {
39
+ open: _,
40
+ onClose: v,
41
+ title: w ? C("healthybowl.storage.location.editTitle", "Edit Location") : C("healthybowl.storage.location.newTitle", "Add Storage Location"),
42
+ size: "md",
43
+ footer: /* @__PURE__ */ s("div", {
44
+ className: "flex items-center justify-end gap-2",
45
+ children: [/* @__PURE__ */ o(c, {
46
+ variant: "ghost",
47
+ onClick: v,
48
+ disabled: z,
49
+ children: C("common.cancel", "Cancel")
50
+ }), /* @__PURE__ */ o(c, {
51
+ onClick: () => void W(),
52
+ disabled: !U,
53
+ children: C("healthybowl.storage.location.save", "Save")
54
+ })]
55
+ }),
56
+ children: /* @__PURE__ */ s("div", {
57
+ className: "space-y-4",
58
+ children: [
59
+ V ? /* @__PURE__ */ o("div", {
60
+ className: "rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text",
61
+ children: V
62
+ }) : null,
63
+ /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("label", {
64
+ className: g,
65
+ children: C("healthybowl.storage.location.name", "Name")
66
+ }), /* @__PURE__ */ o(l, {
67
+ value: T,
68
+ onChange: (e) => E(e.target.value),
69
+ placeholder: "Cold Store A / Bin A-3"
70
+ })] }),
71
+ w ? null : /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("label", {
72
+ className: g,
73
+ children: C("healthybowl.storage.location.kind", "Type")
74
+ }), /* @__PURE__ */ o("div", {
75
+ className: "flex gap-2",
76
+ children: ["WAREHOUSE", "BIN"].map((t) => /* @__PURE__ */ o("button", {
77
+ type: "button",
78
+ onClick: () => O(t),
79
+ className: e("flex-1 rounded-md px-3 py-2 text-sm font-medium transition-colors", D === t ? "bg-accent-teal text-white" : "bg-bg-sunken text-text-secondary hover:text-text-primary"),
80
+ children: t === "WAREHOUSE" ? C("healthybowl.storage.location.warehouse", "Warehouse") : C("healthybowl.storage.location.bin", "Bin")
81
+ }, t))
82
+ })] }),
83
+ D === "WAREHOUSE" ? /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("label", {
84
+ className: g,
85
+ children: C("healthybowl.storage.location.storageType", "Storage Type")
86
+ }), /* @__PURE__ */ s(u, {
87
+ value: k,
88
+ onValueChange: A,
89
+ children: [/* @__PURE__ */ o(p, { children: /* @__PURE__ */ o(m, {}) }), /* @__PURE__ */ o(d, { children: n.map((e) => /* @__PURE__ */ o(f, {
90
+ value: e.value,
91
+ children: e.label
92
+ }, e.value)) })]
93
+ })] }) : null,
94
+ D === "BIN" && !w ? /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("label", {
95
+ className: g,
96
+ children: C("healthybowl.storage.location.parent", "Parent Warehouse")
97
+ }), /* @__PURE__ */ s(u, {
98
+ value: j,
99
+ onValueChange: M,
100
+ children: [/* @__PURE__ */ o(p, { children: /* @__PURE__ */ o(m, { placeholder: C("healthybowl.storage.location.selectWarehouse", "Select a warehouse") }) }), /* @__PURE__ */ o(d, { children: b.map((e) => /* @__PURE__ */ o(f, {
101
+ value: e.id,
102
+ children: e.name
103
+ }, e.id)) })]
104
+ })] }) : null,
105
+ /* @__PURE__ */ s("div", {
106
+ className: "grid grid-cols-2 gap-4",
107
+ children: [/* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("label", {
108
+ className: g,
109
+ children: C("healthybowl.storage.location.capacity", "Capacity")
110
+ }), /* @__PURE__ */ o(l, {
111
+ type: "number",
112
+ value: N,
113
+ onChange: (e) => P(e.target.value),
114
+ placeholder: "4000"
115
+ })] }), /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("label", {
116
+ className: g,
117
+ children: C("healthybowl.storage.location.unit", "Unit")
118
+ }), /* @__PURE__ */ o(l, {
119
+ value: F,
120
+ onChange: (e) => I(e.target.value),
121
+ placeholder: "kg"
122
+ })] })]
123
+ }),
124
+ /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("label", {
125
+ className: g,
126
+ children: C("healthybowl.storage.location.notes", "Notes")
127
+ }), /* @__PURE__ */ o(h, {
128
+ value: L,
129
+ onChange: (e) => R(e.target.value),
130
+ rows: 2
131
+ })] })
132
+ ]
133
+ })
134
+ });
135
+ };
136
+ //#endregion
137
+ export { _ as StorageLocationFormModal };
138
+
139
+ //# sourceMappingURL=StorageLocationFormModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageLocationFormModal.js","names":[],"sources":["../../../../src/healthybowl/pages/storage/StorageLocationFormModal.tsx"],"sourcesContent":["/**\n * Create / edit a storage location — a warehouse or a bin within one (BOFF-2890 · K-1).\n * Bins require a parent warehouse. All fields are user-entered and persisted via the real\n * mutation — no fabricated data.\n */\nimport { useEffect, useState } from 'react';\nimport {\n Button,\n Input,\n Textarea,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Modal } from '../../components';\nimport { cn } from '../../utils/helpers';\nimport type { StorageLocation } from '../../hooks/useHealthyBowlStorage';\nimport { STORAGE_TYPES } from './labels';\n\ninterface StorageLocationFormModalProps {\n open: boolean;\n onClose: () => void;\n location?: StorageLocation | null;\n /** Warehouses available as bin parents (for the parent Select). */\n warehouses: StorageLocation[];\n /** Default kind when creating (e.g. opening \"Add Bin\" preselects BIN). */\n defaultKind?: 'WAREHOUSE' | 'BIN';\n onSubmit: (input: Record<string, unknown>) => Promise<void>;\n}\n\nconst fieldLabel = 'mb-1 block text-sm font-medium text-text-primary';\n\nexport const StorageLocationFormModal = ({\n open,\n onClose,\n location,\n warehouses,\n defaultKind = 'WAREHOUSE',\n onSubmit,\n}: StorageLocationFormModalProps) => {\n const { t } = useI18n();\n const isEdit = Boolean(location);\n\n const [name, setName] = useState('');\n const [kind, setKind] = useState<'WAREHOUSE' | 'BIN'>(defaultKind);\n const [storageType, setStorageType] = useState('COLD_STORE');\n const [parentId, setParentId] = useState('');\n const [capacity, setCapacity] = useState('');\n const [capacityUnit, setCapacityUnit] = useState('kg');\n const [notes, setNotes] = useState('');\n const [submitting, setSubmitting] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n if (!open) return;\n setError(null);\n if (location) {\n setName(location.name);\n setKind(location.kind === 'BIN' ? 'BIN' : 'WAREHOUSE');\n setStorageType(location.storageType ?? 'COLD_STORE');\n setParentId(location.parentId ?? '');\n setCapacity(location.capacity === null ? '' : String(location.capacity));\n setCapacityUnit(location.capacityUnit ?? 'kg');\n setNotes(location.notes ?? '');\n } else {\n setName('');\n setKind(defaultKind);\n setStorageType('COLD_STORE');\n setParentId(warehouses[0]?.id ?? '');\n setCapacity('');\n setCapacityUnit('kg');\n setNotes('');\n }\n }, [open, location, defaultKind, warehouses]);\n\n const canSubmit = name.trim().length > 0 && !(kind === 'BIN' && !parentId) && !submitting;\n\n const handleSubmit = async () => {\n if (!canSubmit) return;\n setSubmitting(true);\n setError(null);\n try {\n const input: Record<string, unknown> = {\n name: name.trim(),\n capacity: capacity.trim() ? Number(capacity) : null,\n capacityUnit: capacityUnit.trim() || 'kg',\n notes: notes.trim() || null,\n };\n if (isEdit) {\n input.id = location!.id;\n if (kind === 'WAREHOUSE') input.storageType = storageType;\n } else {\n input.kind = kind;\n if (kind === 'WAREHOUSE') input.storageType = storageType;\n if (kind === 'BIN') input.parentId = parentId;\n }\n await onSubmit(input);\n onClose();\n } catch (err) {\n setError(err instanceof Error ? err.message : String(err));\n } finally {\n setSubmitting(false);\n }\n };\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n title={\n isEdit\n ? t('healthybowl.storage.location.editTitle', 'Edit Location')\n : t('healthybowl.storage.location.newTitle', 'Add Storage Location')\n }\n size=\"md\"\n footer={\n <div className=\"flex items-center justify-end gap-2\">\n <Button variant=\"ghost\" onClick={onClose} disabled={submitting}>\n {t('common.cancel', 'Cancel')}\n </Button>\n <Button onClick={() => void handleSubmit()} disabled={!canSubmit}>\n {t('healthybowl.storage.location.save', 'Save')}\n </Button>\n </div>\n }\n >\n <div className=\"space-y-4\">\n {error ? (\n <div className=\"rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text\">\n {error}\n </div>\n ) : null}\n\n <div>\n <label className={fieldLabel}>{t('healthybowl.storage.location.name', 'Name')}</label>\n <Input value={name} onChange={(e) => setName(e.target.value)} placeholder=\"Cold Store A / Bin A-3\" />\n </div>\n\n {!isEdit ? (\n <div>\n <label className={fieldLabel}>{t('healthybowl.storage.location.kind', 'Type')}</label>\n <div className=\"flex gap-2\">\n {(['WAREHOUSE', 'BIN'] as const).map((k) => (\n <button\n key={k}\n type=\"button\"\n onClick={() => setKind(k)}\n className={cn(\n 'flex-1 rounded-md px-3 py-2 text-sm font-medium transition-colors',\n kind === k\n ? 'bg-accent-teal text-white'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {k === 'WAREHOUSE'\n ? t('healthybowl.storage.location.warehouse', 'Warehouse')\n : t('healthybowl.storage.location.bin', 'Bin')}\n </button>\n ))}\n </div>\n </div>\n ) : null}\n\n {kind === 'WAREHOUSE' ? (\n <div>\n <label className={fieldLabel}>{t('healthybowl.storage.location.storageType', 'Storage Type')}</label>\n <Select value={storageType} onValueChange={setStorageType}>\n <SelectTrigger>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {STORAGE_TYPES.map((s) => (\n <SelectItem key={s.value} value={s.value}>\n {s.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n ) : null}\n\n {kind === 'BIN' && !isEdit ? (\n <div>\n <label className={fieldLabel}>{t('healthybowl.storage.location.parent', 'Parent Warehouse')}</label>\n <Select value={parentId} onValueChange={setParentId}>\n <SelectTrigger>\n <SelectValue placeholder={t('healthybowl.storage.location.selectWarehouse', 'Select a warehouse')} />\n </SelectTrigger>\n <SelectContent>\n {warehouses.map((w) => (\n <SelectItem key={w.id} value={w.id}>\n {w.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n ) : null}\n\n <div className=\"grid grid-cols-2 gap-4\">\n <div>\n <label className={fieldLabel}>{t('healthybowl.storage.location.capacity', 'Capacity')}</label>\n <Input type=\"number\" value={capacity} onChange={(e) => setCapacity(e.target.value)} placeholder=\"4000\" />\n </div>\n <div>\n <label className={fieldLabel}>{t('healthybowl.storage.location.unit', 'Unit')}</label>\n <Input value={capacityUnit} onChange={(e) => setCapacityUnit(e.target.value)} placeholder=\"kg\" />\n </div>\n </div>\n\n <div>\n <label className={fieldLabel}>{t('healthybowl.storage.location.notes', 'Notes')}</label>\n <Textarea value={notes} onChange={(e) => setNotes(e.target.value)} rows={2} />\n </div>\n </div>\n </Modal>\n );\n};\n"],"mappings":";;;;;;;;;AAiCA,IAAM,IAAa,oDAEN,KAA4B,EACvC,SACA,YACA,aACA,eACA,iBAAc,aACd,kBACmC;CACnC,IAAM,EAAE,SAAM,GAAS,EACjB,IAAS,EAAQ,GAEjB,CAAC,GAAM,KAAW,EAAS,GAAG,EAC9B,CAAC,GAAM,KAAW,EAA8B,EAAY,EAC5D,CAAC,GAAa,KAAkB,EAAS,aAAa,EACtD,CAAC,GAAU,KAAe,EAAS,GAAG,EACtC,CAAC,GAAU,KAAe,EAAS,GAAG,EACtC,CAAC,GAAc,KAAmB,EAAS,KAAK,EAChD,CAAC,GAAO,KAAY,EAAS,GAAG,EAChC,CAAC,GAAY,KAAiB,EAAS,GAAM,EAC7C,CAAC,GAAO,KAAY,EAAwB,KAAK;AAEvD,SAAgB;AACT,QACL,EAAS,KAAK,EACV,KACF,EAAQ,EAAS,KAAK,EACtB,EAAQ,EAAS,SAAS,QAAQ,QAAQ,YAAY,EACtD,EAAe,EAAS,eAAe,aAAa,EACpD,EAAY,EAAS,YAAY,GAAG,EACpC,EAAY,EAAS,aAAa,OAAO,KAAK,OAAO,EAAS,SAAS,CAAC,EACxE,EAAgB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eAAe;eAAxC,CACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAa,aAAa,EAAE,gDAAgD,qBAAqB,EAAI,CAAA,EACvF,CAAA,EAChB,kBAAC,GAAD,EAAA,UACG,EAAW,KAAK,MACf,kBAAC,GAAD;MAAuB,OAAO,EAAE;gBAC7B,EAAE;MACQ,EAFI,EAAE,GAEN,CACb,EACY,CAAA,CACT;OACL,EAAA,CAAA,GACJ;IAEJ,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;MAAO,WAAW;gBAAa,EAAE,yCAAyC,WAAW;MAAS,CAAA,EAC9F,kBAAC,GAAD;MAAO,MAAK;MAAS,OAAO;MAAU,WAAW,MAAM,EAAY,EAAE,OAAO,MAAM;MAAE,aAAY;MAAS,CAAA,CACrG,EAAA,CAAA,EACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;MAAO,WAAW;gBAAa,EAAE,qCAAqC,OAAO;MAAS,CAAA,EACtF,kBAAC,GAAD;MAAO,OAAO;MAAc,WAAW,MAAM,EAAgB,EAAE,OAAO,MAAM;MAAE,aAAY;MAAO,CAAA,CAC7F,EAAA,CAAA,CACF;;IAEN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;KAAO,WAAW;eAAa,EAAE,sCAAsC,QAAQ;KAAS,CAAA,EACxF,kBAAC,GAAD;KAAU,OAAO;KAAO,WAAW,MAAM,EAAS,EAAE,OAAO,MAAM;KAAE,MAAM;KAAK,CAAA,CAC1E,EAAA,CAAA;IACF;;EACA,CAAA"}
@@ -0,0 +1,150 @@
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 { StatCard as r } from "../../components/StatCard.js";
5
+ import { StatusBadge as i } from "../../components/StatusBadge.js";
6
+ import { ErrorState as a } from "../../components/ErrorState.js";
7
+ import { PageLoader as o } from "../../components/PageLoader.js";
8
+ import { useToast as s } from "../../hooks/useToast.js";
9
+ import "../../components/index.js";
10
+ import { useHealthyBowlStorage as c } from "../../hooks/useHealthyBowlStorage.js";
11
+ import { lotStatusVariant as l, reasonLabel as u } from "./labels.js";
12
+ import { RecordMovementModal as d } from "./RecordMovementModal.js";
13
+ import { useState as f } from "react";
14
+ import { useI18n as p } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
15
+ import { ArrowDown as m, ArrowLeft as h, ArrowUp as g, Plus as _ } from "lucide-react";
16
+ import { useNavigate as v, useParams as y } from "react-router-dom";
17
+ import { jsx as b, jsxs as x } from "react/jsx-runtime";
18
+ import { Button as S } from "@burdenoff/fe-libs/ui";
19
+ //#region src/healthybowl/pages/storage/StorageLotDetailPage.tsx
20
+ var C = () => {
21
+ let { t: C } = p(), w = v(), { buildPath: T } = t(), { toast: E } = s(), { lotId: D } = y(), { lotDetail: O, loading: k, errors: A, refetchLot: j, recordMovement: M } = c({ lotId: D ?? null }), [N, P] = f(!1), F = async (e) => {
22
+ await M(e), E({
23
+ title: C("healthybowl.storage.toast.movementRecorded", "Movement recorded"),
24
+ variant: "success"
25
+ });
26
+ };
27
+ if (k.lot && !O) return /* @__PURE__ */ b(o, {});
28
+ if (A.lot && !O || !O) return /* @__PURE__ */ b("div", {
29
+ className: "p-4",
30
+ children: /* @__PURE__ */ b(a, {
31
+ description: A.lot?.message ?? C("healthybowl.storage.lot.notFound", "Lot not found."),
32
+ onRetry: () => void j()
33
+ })
34
+ });
35
+ let { lot: I, movements: L } = O;
36
+ return /* @__PURE__ */ x(n, {
37
+ title: `${I.produce} · ${I.lotCode}`,
38
+ description: `${I.warehouseName} · ${I.locationName}`,
39
+ hideHelp: !0,
40
+ children: [
41
+ /* @__PURE__ */ x("button", {
42
+ type: "button",
43
+ onClick: () => w(T("storage")),
44
+ className: "mb-3 inline-flex items-center gap-1 text-sm text-text-secondary hover:text-text-primary",
45
+ children: [/* @__PURE__ */ b(h, { className: "h-4 w-4" }), C("healthybowl.storage.lot.backToStorage", "Storage")]
46
+ }),
47
+ /* @__PURE__ */ x("div", {
48
+ className: "flex flex-wrap items-center justify-between gap-3",
49
+ children: [/* @__PURE__ */ x("div", {
50
+ className: "flex items-center gap-2",
51
+ children: [/* @__PURE__ */ b(i, {
52
+ variant: l(I.status),
53
+ label: I.status.toLowerCase(),
54
+ dot: !0
55
+ }), I.expiryDate ? /* @__PURE__ */ b("span", {
56
+ className: "text-xs text-text-tertiary",
57
+ children: C("healthybowl.storage.lot.expires", "Expires {{date}}", { date: I.expiryDate.slice(0, 10) })
58
+ }) : null]
59
+ }), /* @__PURE__ */ x(S, {
60
+ onClick: () => P(!0),
61
+ children: [/* @__PURE__ */ b(_, { className: "h-4 w-4" }), C("healthybowl.storage.movement.record", "Record Movement")]
62
+ })]
63
+ }),
64
+ /* @__PURE__ */ x("div", {
65
+ className: "mt-4 grid grid-cols-1 gap-3 sm:grid-cols-3",
66
+ children: [
67
+ /* @__PURE__ */ b(r, {
68
+ label: C("healthybowl.storage.lot.onHand", "On hand"),
69
+ value: `${I.quantity} ${I.unit}`,
70
+ hero: !0
71
+ }),
72
+ /* @__PURE__ */ b(r, {
73
+ label: C("healthybowl.storage.lot.location", "Location"),
74
+ value: I.locationName
75
+ }),
76
+ /* @__PURE__ */ b(r, {
77
+ label: C("healthybowl.storage.lot.received", "Received"),
78
+ value: I.receivedAt ? I.receivedAt.slice(0, 10) : "—"
79
+ })
80
+ ]
81
+ }),
82
+ /* @__PURE__ */ x("div", {
83
+ className: "mt-4 rounded-xl border border-border-subtle bg-bg-surface p-4",
84
+ children: [/* @__PURE__ */ b("h3", {
85
+ className: "mb-3 text-sm font-semibold text-text-primary",
86
+ children: C("healthybowl.storage.movementHistory", "Movement History")
87
+ }), L.length === 0 ? /* @__PURE__ */ b("div", {
88
+ className: "py-6 text-center text-sm text-text-secondary",
89
+ children: C("healthybowl.storage.noMovements", "No stock movements yet.")
90
+ }) : /* @__PURE__ */ b("ol", {
91
+ className: "space-y-3",
92
+ children: L.map((t) => {
93
+ let n = t.direction === "IN";
94
+ return /* @__PURE__ */ x("li", {
95
+ className: "flex items-start gap-3",
96
+ children: [/* @__PURE__ */ b("span", {
97
+ 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"),
98
+ children: b(n ? g : m, { className: "h-3.5 w-3.5" })
99
+ }), /* @__PURE__ */ x("div", {
100
+ className: "min-w-0 flex-1",
101
+ children: [
102
+ /* @__PURE__ */ x("div", {
103
+ className: "text-sm",
104
+ children: [
105
+ /* @__PURE__ */ x("span", {
106
+ className: e("font-semibold", n ? "text-status-success-text" : "text-status-error-text"),
107
+ children: [
108
+ n ? "IN +" : "OUT −",
109
+ t.quantity,
110
+ " ",
111
+ t.unit
112
+ ]
113
+ }),
114
+ t.reason ? /* @__PURE__ */ b("span", {
115
+ className: "ml-2 text-xs text-text-tertiary",
116
+ children: u(t.reason)
117
+ }) : null,
118
+ t.reference ? /* @__PURE__ */ b("span", {
119
+ className: "ml-2 text-xs text-text-secondary",
120
+ children: t.reference
121
+ }) : null
122
+ ]
123
+ }),
124
+ /* @__PURE__ */ b("div", {
125
+ className: "text-xs tabular-nums text-text-tertiary",
126
+ children: t.occurredAt.slice(0, 10)
127
+ }),
128
+ t.notes ? /* @__PURE__ */ b("div", {
129
+ className: "mt-0.5 text-xs text-text-secondary",
130
+ children: t.notes
131
+ }) : null
132
+ ]
133
+ })]
134
+ }, t.id);
135
+ })
136
+ })]
137
+ }),
138
+ /* @__PURE__ */ b(d, {
139
+ open: N,
140
+ onClose: () => P(!1),
141
+ lot: I,
142
+ onSubmit: F
143
+ })
144
+ ]
145
+ });
146
+ };
147
+ //#endregion
148
+ export { C as StorageLotDetailPage };
149
+
150
+ //# sourceMappingURL=StorageLotDetailPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageLotDetailPage.js","names":[],"sources":["../../../../src/healthybowl/pages/storage/StorageLotDetailPage.tsx"],"sourcesContent":["/**\n * Storage lot detail (BOFF-2890 · K-1).\n * A lot's on-hand quantity + location + its full IN/OUT movement history, with a \"Record\n * Movement\" action. All from the backend ledger — no fabricated data.\n */\nimport { useState } from 'react';\nimport { useNavigate, useParams } from 'react-router-dom';\nimport { ArrowDown, ArrowLeft, ArrowUp, Plus } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PageLayout, StatCard, StatusBadge, ErrorState, PageLoader } from '../../components';\nimport { useToast } from '../../hooks/useToast';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport { cn } from '../../utils/helpers';\nimport { useHealthyBowlStorage } from '../../hooks/useHealthyBowlStorage';\nimport { RecordMovementModal } from './RecordMovementModal';\nimport { lotStatusVariant, reasonLabel } from './labels';\n\nexport const StorageLotDetailPage = () => {\n const { t } = useI18n();\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const { toast } = useToast();\n const { lotId } = useParams<{ lotId: string }>();\n\n const { lotDetail, loading, errors, refetchLot, recordMovement } = useHealthyBowlStorage({ lotId: lotId ?? null });\n const [moveOpen, setMoveOpen] = useState(false);\n\n const handleRecord = async (input: Record<string, unknown>) => {\n await recordMovement(input);\n toast({ title: t('healthybowl.storage.toast.movementRecorded', 'Movement recorded'), variant: 'success' });\n };\n\n if (loading.lot && !lotDetail) {\n return <PageLoader />;\n }\n if ((errors.lot && !lotDetail) || !lotDetail) {\n return (\n <div className=\"p-4\">\n <ErrorState\n description={errors.lot?.message ?? t('healthybowl.storage.lot.notFound', 'Lot not found.')}\n onRetry={() => void refetchLot()}\n />\n </div>\n );\n }\n\n const { lot, movements } = lotDetail;\n\n return (\n <PageLayout\n title={`${lot.produce} · ${lot.lotCode}`}\n description={`${lot.warehouseName} · ${lot.locationName}`}\n hideHelp\n >\n <button\n type=\"button\"\n onClick={() => navigate(buildPath('storage'))}\n className=\"mb-3 inline-flex items-center gap-1 text-sm text-text-secondary hover:text-text-primary\"\n >\n <ArrowLeft className=\"h-4 w-4\" />\n {t('healthybowl.storage.lot.backToStorage', 'Storage')}\n </button>\n\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex items-center gap-2\">\n <StatusBadge variant={lotStatusVariant(lot.status)} label={lot.status.toLowerCase()} dot />\n {lot.expiryDate ? (\n <span className=\"text-xs text-text-tertiary\">\n {t('healthybowl.storage.lot.expires', 'Expires {{date}}', { date: lot.expiryDate.slice(0, 10) })}\n </span>\n ) : null}\n </div>\n <Button onClick={() => setMoveOpen(true)}>\n <Plus className=\"h-4 w-4\" />\n {t('healthybowl.storage.movement.record', 'Record Movement')}\n </Button>\n </div>\n\n <div className=\"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <StatCard label={t('healthybowl.storage.lot.onHand', 'On hand')} value={`${lot.quantity} ${lot.unit}`} hero />\n <StatCard label={t('healthybowl.storage.lot.location', 'Location')} value={lot.locationName} />\n <StatCard\n label={t('healthybowl.storage.lot.received', 'Received')}\n value={lot.receivedAt ? lot.receivedAt.slice(0, 10) : '—'}\n />\n </div>\n\n <div className=\"mt-4 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 {movements.length === 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 {movements.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('font-semibold', isIn ? 'text-status-success-text' : 'text-status-error-text')}\n >\n {isIn ? 'IN +' : 'OUT −'}\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 {m.reference ? <span className=\"ml-2 text-xs text-text-secondary\">{m.reference}</span> : null}\n </div>\n <div className=\"text-xs tabular-nums text-text-tertiary\">{m.occurredAt.slice(0, 10)}</div>\n {m.notes ? <div className=\"mt-0.5 text-xs text-text-secondary\">{m.notes}</div> : null}\n </div>\n </li>\n );\n })}\n </ol>\n )}\n </div>\n\n <RecordMovementModal open={moveOpen} onClose={() => setMoveOpen(false)} lot={lot} onSubmit={handleRecord} />\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,IAAa,UAA6B;CACxC,IAAM,EAAE,SAAM,GAAS,EACjB,IAAW,GAAa,EACxB,EAAE,iBAAc,GAAa,EAC7B,EAAE,aAAU,GAAU,EACtB,EAAE,aAAU,GAA8B,EAE1C,EAAE,cAAW,YAAS,WAAQ,eAAY,sBAAmB,EAAsB,EAAE,OAAO,KAAS,MAAM,CAAC,EAC5G,CAAC,GAAU,KAAe,EAAS,GAAM,EAEzC,IAAe,OAAO,MAAmC;AAE7D,EADA,MAAM,EAAe,EAAM,EAC3B,EAAM;GAAE,OAAO,EAAE,8CAA8C,oBAAoB;GAAE,SAAS;GAAW,CAAC;;AAG5G,KAAI,EAAQ,OAAO,CAAC,EAClB,QAAO,kBAAC,GAAD,EAAc,CAAA;AAEvB,KAAK,EAAO,OAAO,CAAC,KAAc,CAAC,EACjC,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,GAAD;GACE,aAAa,EAAO,KAAK,WAAW,EAAE,oCAAoC,iBAAiB;GAC3F,eAAe,K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AAC,MAAD;KAAI,WAAU;eACX,EAAE,uCAAuC,mBAAmB;KAC1D,CAAA,EACJ,EAAU,WAAW,IACpB,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAE,mCAAmC,0BAA0B;KAC5D,CAAA,GAEN,kBAAC,MAAD;KAAI,WAAU;eACX,EAAU,KAAK,MAAM;MACpB,IAAM,IAAO,EAAE,cAAc;AAC7B,aACE,kBAAC,MAAD;OAAe,WAAU;iBAAzB,CACE,kBAAC,QAAD;QACE,WAAW,EACT,yEACA,IACI,kDACA,4CACL;kBAEO,EAAP,IAAQ,IAAsC,GAAvC,EAAS,WAAU,eAAgB,CAAwC;QAC9E,CAAA,EACP,kBAAC,OAAD;QAAK,WAAU;kBAAf;SACE,kBAAC,OAAD;UAAK,WAAU;oBAAf;WACE,kBAAC,QAAD;YACE,WAAW,EAAG,iBAAiB,IAAO,6BAA6B,yBAAyB;sBAD9F;aAGG,IAAO,SAAS;aAChB,EAAE;aAAS;aAAE,EAAE;aACX;;WACN,EAAE,SACD,kBAAC,QAAD;YAAM,WAAU;sBAAmC,EAAY,EAAE,OAAO;YAAQ,CAAA,GAC9E;WACH,EAAE,YAAY,kBAAC,QAAD;YAAM,WAAU;sBAAoC,EAAE;YAAiB,CAAA,GAAG;WACrF;;SACN,kBAAC,OAAD;UAAK,WAAU;oBAA2C,EAAE,WAAW,MAAM,GAAG,GAAG;UAAO,CAAA;SACzF,EAAE,QAAQ,kBAAC,OAAD;UAAK,WAAU;oBAAsC,EAAE;UAAY,CAAA,GAAG;SAC7E;UACH;SA3BI,EAAE,GA2BN;OAEP;KACC,CAAA,CAEH;;GAEN,kBAAC,GAAD;IAAqB,MAAM;IAAU,eAAe,EAAY,GAAM;IAAO;IAAK,UAAU;IAAgB,CAAA;GACjG"}
@@ -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,IAAM,EAAE,SAAM,GAAS,EACjB,IAAW,GAAa,EACxB,EAAE,iBAAc,GAAa,EAC7B,EAAE,aAAU,GAAU,EAEtB,EAAE,aAAU,YAAS,WAAQ,oBAAiB,mBAAgB,gBAAa,EAAsB,EACrG,UAAU,IACX,CAAC,EAEI,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAS,KAAc,EAA8B,YAAY,EAClE,CAAC,GAAW,KAAgB,EAAS,GAAM,EAE3C,IAAa,GAAU,cAAc,EAAE,EACvC,IAAwB,QAAiC,EAAW,KAAK,MAAM,EAAE,UAAU,EAAE,CAAC,EAAW,CAAC,EAC1G,IAAU,QACR,EAAW,SAAS,MAAM,EAAE,KAAK,KAAK,MAAM,EAAE,SAAS,CAAC,EAC9D,CAAC,EAAW,CACb,EAEK,UAAyB;AAE7B,EADA,EAAW,YAAY,EACvB,EAAW,GAAK;IAEZ,UAAmB;AAEvB,EADA,EAAW,MAAM,EACjB,EAAW,GAAK;IAGZ,IAAuB,OAAO,MAAmC;AAErE,EADA,MAAM,EAAe,EAAM,EAC3B,EAAM;GACJ,OAAO,EAAE,2CAA2C,iBAAiB;GACrE,aAAa,OAAO,EAAM,QAAQ,GAAG;GACrC,SAAS;GACV,CAAC;IAGE,IAAiB,OAAO,MAAmC;AAE/D,EADA,MAAM,EAAS,EAAM,EACrB,EAAM;GACJ,OAAO,EAAE,uCAAuC,aAAa;GAC7D,aAAa,OAAO,EAAM,WAAW,GAAG;GACxC,SAAS;GACV,CAAC;IAGE,KAAW,MAAoB,EAAS,EAAU,gBAAgB,EAAI,KAAK,CAAC;AAMlF,QAJI,EAAQ,YAAY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