@argusoft/medplat-product-management 1.0.0 → 1.0.2

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 (77) hide show
  1. package/dist/BrandsPage-CSA3meke.js +385 -0
  2. package/dist/BrandsPage-CSA3meke.js.map +1 -0
  3. package/dist/CategoriesPage-BrspzkJL.js +340 -0
  4. package/dist/CategoriesPage-BrspzkJL.js.map +1 -0
  5. package/dist/{DashboardPage-BNKUQj46.js → DashboardPage-CqaquOs2.js} +21 -22
  6. package/dist/{DashboardPage-BNKUQj46.js.map → DashboardPage-CqaquOs2.js.map} +1 -1
  7. package/dist/{FacilityPicker-Coi8I3yE.js → FacilityPicker-Dv_H95WW.js} +13 -13
  8. package/dist/{FacilityPicker-Coi8I3yE.js.map → FacilityPicker-Dv_H95WW.js.map} +1 -1
  9. package/dist/{InventoryPage-BR6jOzg2.js → InventoryPage-CPbzfDMR.js} +12 -12
  10. package/dist/{InventoryPage-BR6jOzg2.js.map → InventoryPage-CPbzfDMR.js.map} +1 -1
  11. package/dist/{MemberProfileCard-DbHZCS5n.js → MemberProfileCard-0vjO3Gzd.js} +2 -2
  12. package/dist/{MemberProfileCard-DbHZCS5n.js.map → MemberProfileCard-0vjO3Gzd.js.map} +1 -1
  13. package/dist/{PaymentCreatePage-Ci3ERnby.js → PaymentCreatePage-BYmDZAIB.js} +9 -10
  14. package/dist/{PaymentCreatePage-Ci3ERnby.js.map → PaymentCreatePage-BYmDZAIB.js.map} +1 -1
  15. package/dist/{PaymentsPage-sdg902zX.js → PaymentsPage-BXPvKon-.js} +16 -16
  16. package/dist/{PaymentsPage-sdg902zX.js.map → PaymentsPage-BXPvKon-.js.map} +1 -1
  17. package/dist/PickupCreatePage-CMGwoAXj.js +426 -0
  18. package/dist/PickupCreatePage-CMGwoAXj.js.map +1 -0
  19. package/dist/{PickupsPage-Ci2Ll0Kn.js → PickupsPage-D66_Wta4.js} +84 -39
  20. package/dist/PickupsPage-D66_Wta4.js.map +1 -0
  21. package/dist/PmTable-B9970kPY.js +375 -0
  22. package/dist/PmTable-B9970kPY.js.map +1 -0
  23. package/dist/{ProductEditPage-DL8gy85Y.js → ProductEditPage-B8qFTCW9.js} +226 -243
  24. package/dist/ProductEditPage-B8qFTCW9.js.map +1 -0
  25. package/dist/ProductsPage-C7_r9cKn.js +254 -0
  26. package/dist/ProductsPage-C7_r9cKn.js.map +1 -0
  27. package/dist/{PurchaseCreatePage-C3KMfBxJ.js → PurchaseCreatePage-CDfNDcKG.js} +150 -149
  28. package/dist/PurchaseCreatePage-CDfNDcKG.js.map +1 -0
  29. package/dist/{PurchaseRequestDetailPage-C0GYFJDl.js → PurchaseRequestDetailPage-C7aAwEqw.js} +15 -15
  30. package/dist/{PurchaseRequestDetailPage-C0GYFJDl.js.map → PurchaseRequestDetailPage-C7aAwEqw.js.map} +1 -1
  31. package/dist/{PurchaseRequestsPage-DvFH_tWe.js → PurchaseRequestsPage-BwCkbpaX.js} +14 -14
  32. package/dist/{PurchaseRequestsPage-DvFH_tWe.js.map → PurchaseRequestsPage-BwCkbpaX.js.map} +1 -1
  33. package/dist/{PurchasesPage-BCvLvSp4.js → PurchasesPage-CvaZouVy.js} +11 -12
  34. package/dist/{PurchasesPage-BCvLvSp4.js.map → PurchasesPage-CvaZouVy.js.map} +1 -1
  35. package/dist/{SaleCreatePage-DpkQMoTq.js → SaleCreatePage-DP1Qmltu.js} +30 -31
  36. package/dist/{SaleCreatePage-DpkQMoTq.js.map → SaleCreatePage-DP1Qmltu.js.map} +1 -1
  37. package/dist/{SalesPage-DUwgkEO-.js → SalesPage-CO3cdYX5.js} +18 -19
  38. package/dist/{SalesPage-DUwgkEO-.js.map → SalesPage-CO3cdYX5.js.map} +1 -1
  39. package/dist/{SettingsPage-CusC0jqJ.js → SettingsPage-DvVRwSFw.js} +104 -103
  40. package/dist/SettingsPage-DvVRwSFw.js.map +1 -0
  41. package/dist/StorageUnitsPage-B9Hr_RkW.js +470 -0
  42. package/dist/StorageUnitsPage-B9Hr_RkW.js.map +1 -0
  43. package/dist/{TransactionsPage-DDaK4VyY.js → TransactionsPage-HKIGwEZN.js} +127 -123
  44. package/dist/TransactionsPage-HKIGwEZN.js.map +1 -0
  45. package/dist/{TransferCreatePage-BxudLfhS.js → TransferCreatePage-DMuZqQ3c.js} +9 -9
  46. package/dist/{TransferCreatePage-BxudLfhS.js.map → TransferCreatePage-DMuZqQ3c.js.map} +1 -1
  47. package/dist/{TransfersPage-zgmt7teZ.js → TransfersPage-COIyouL4.js} +16 -16
  48. package/dist/{TransfersPage-zgmt7teZ.js.map → TransfersPage-COIyouL4.js.map} +1 -1
  49. package/dist/{VialsPage-CjqPfgpV.js → VialsPage-BNPUwGCU.js} +291 -224
  50. package/dist/VialsPage-BNPUwGCU.js.map +1 -0
  51. package/dist/{constants-BrA_hfAI.js → constants-5ZCZo-Zm.js} +5 -2
  52. package/dist/{constants-BrA_hfAI.js.map → constants-5ZCZo-Zm.js.map} +1 -1
  53. package/dist/{PmGuard-CjJBisaN.js → currency-ClRLIEg2.js} +186 -9
  54. package/dist/currency-ClRLIEg2.js.map +1 -0
  55. package/dist/index.js +1 -1
  56. package/package.json +1 -1
  57. package/dist/BrandsPage-DCMCVvDY.js +0 -334
  58. package/dist/BrandsPage-DCMCVvDY.js.map +0 -1
  59. package/dist/CategoriesPage-BpRhwfrc.js +0 -284
  60. package/dist/CategoriesPage-BpRhwfrc.js.map +0 -1
  61. package/dist/PickupCreatePage-CieMsgWV.js +0 -310
  62. package/dist/PickupCreatePage-CieMsgWV.js.map +0 -1
  63. package/dist/PickupsPage-Ci2Ll0Kn.js.map +0 -1
  64. package/dist/PmGuard-CjJBisaN.js.map +0 -1
  65. package/dist/PmTable-BuXZQZCU.js +0 -302
  66. package/dist/PmTable-BuXZQZCU.js.map +0 -1
  67. package/dist/ProductEditPage-DL8gy85Y.js.map +0 -1
  68. package/dist/ProductsPage-BANTKxLb.js +0 -221
  69. package/dist/ProductsPage-BANTKxLb.js.map +0 -1
  70. package/dist/PurchaseCreatePage-C3KMfBxJ.js.map +0 -1
  71. package/dist/SettingsPage-CusC0jqJ.js.map +0 -1
  72. package/dist/StorageUnitsPage-BlC2AgrJ.js +0 -469
  73. package/dist/StorageUnitsPage-BlC2AgrJ.js.map +0 -1
  74. package/dist/TransactionsPage-DDaK4VyY.js.map +0 -1
  75. package/dist/VialsPage-CjqPfgpV.js.map +0 -1
  76. package/dist/currency-BDDCDgeE.js +0 -169
  77. package/dist/currency-BDDCDgeE.js.map +0 -1
@@ -1,284 +0,0 @@
1
- import { S as e, a as t, i as n, n as r, ot as i, r as a, t as o } from "./PmGuard-CjJBisaN.js";
2
- import { a as s, o as c, t as ee } from "./PmTable-BuXZQZCU.js";
3
- import { m as te, n as l, t as u } from "./validation-Ba7puFIO.js";
4
- import { t as d } from "./useFieldErrors-hDG8ox_x.js";
5
- import { useState as f } from "react";
6
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
7
- import { v4 as ne } from "uuid";
8
- import { Alert as h, Box as g, Button as _, Chip as re, Dialog as v, DialogActions as y, DialogContent as b, DialogTitle as x, Skeleton as S, Stack as C, TableBody as w, TableCell as T, TableHead as ie, TableRow as E, TextField as D, Typography as O } from "@mui/material";
9
- import k from "@mui/icons-material/AddRounded";
10
- import A from "@mui/icons-material/RefreshRounded";
11
- import { showToast as j } from "@/common/toaster/toaster";
12
- import M from "@mui/icons-material/CategoryRounded";
13
- //#region src/views/CategoriesPage.jsx
14
- function N() {
15
- let N = n().has("update.manage.productManagement.category"), [P, F] = f([]), [I, L] = f(!1), [R, z] = f(""), [B, V] = f(!1), [H, U] = f(null), [W, G] = f(q()), K = d();
16
- function q() {
17
- return {
18
- id: "",
19
- name: "",
20
- code: "",
21
- description: "",
22
- icon: "",
23
- isActive: !0
24
- };
25
- }
26
- async function J() {
27
- L(!0), z("");
28
- try {
29
- F(await e());
30
- } catch (e) {
31
- let t = e?.response?.data?.message ?? e?.message ?? "Failed to load categories";
32
- z(t), j({
33
- message: t,
34
- type: "error"
35
- });
36
- } finally {
37
- L(!1);
38
- }
39
- }
40
- a("view.manage.productManagement.category", () => {
41
- J();
42
- }, []);
43
- function Y() {
44
- U(null), G({
45
- ...q(),
46
- id: ne()
47
- }), K.reset(), z(""), V(!0);
48
- }
49
- function ae(e) {
50
- U(e), K.reset(), z(""), G({
51
- id: e.id,
52
- name: e.name ?? "",
53
- code: e.code ?? "",
54
- description: e.description ?? "",
55
- icon: e.icon ?? "",
56
- isActive: e.isActive !== !1
57
- }), V(!0);
58
- }
59
- let X = l(W.code, { required: !0 }), Z = W.code.trim().toUpperCase(), oe = !X && Z && P.some((e) => e.id !== W.id && (e.code || "").toUpperCase() === Z), Q = {
60
- name: te(W.name, "Name"),
61
- code: X || (oe ? "Code is already in use — pick a different one." : "")
62
- }, $ = u(Q);
63
- async function se() {
64
- if (!$) {
65
- K.markAllTouched(), z("Please fix the highlighted fields.");
66
- return;
67
- }
68
- try {
69
- await i({
70
- id: W.id,
71
- name: W.name.trim(),
72
- code: W.code.trim().toUpperCase(),
73
- description: W.description || null,
74
- icon: W.icon || null,
75
- isActive: W.isActive
76
- }), j({
77
- message: "Category saved.",
78
- type: "success"
79
- }), V(!1), await J();
80
- } catch (e) {
81
- let t = e?.response?.data?.message ?? e?.message ?? "Failed to save category";
82
- z(t), j({
83
- message: t,
84
- type: "error"
85
- });
86
- }
87
- }
88
- return /* @__PURE__ */ m(g, { children: [/* @__PURE__ */ p(r, {}), /* @__PURE__ */ m(o, {
89
- perm: "view.manage.productManagement.category",
90
- children: [/* @__PURE__ */ m(t, {
91
- title: "Product Categories",
92
- subtitle: "Groups of products with similar handling requirements.",
93
- chips: ["Catalog"],
94
- actions: /* @__PURE__ */ m(C, {
95
- direction: "row",
96
- spacing: 1,
97
- children: [/* @__PURE__ */ p(_, {
98
- variant: "outlined",
99
- startIcon: /* @__PURE__ */ p(A, {}),
100
- onClick: () => void J(),
101
- children: "Refresh"
102
- }), N ? /* @__PURE__ */ p(_, {
103
- variant: "contained",
104
- startIcon: /* @__PURE__ */ p(k, {}),
105
- onClick: Y,
106
- children: "New Category"
107
- }) : null]
108
- }),
109
- children: [R ? /* @__PURE__ */ p(h, {
110
- severity: "error",
111
- sx: { mb: 2 },
112
- children: R
113
- }) : null, /* @__PURE__ */ p(c, {
114
- eyebrow: "Master data",
115
- title: "Product categories",
116
- subtitle: I ? "Loading…" : `${P.length} ${P.length === 1 ? "category" : "categories"}`,
117
- children: /* @__PURE__ */ m(s, { children: [/* @__PURE__ */ p(ie, { children: /* @__PURE__ */ m(E, { children: [
118
- /* @__PURE__ */ p(T, { children: "Code" }),
119
- /* @__PURE__ */ p(T, { children: "Name" }),
120
- /* @__PURE__ */ p(T, { children: "Description" }),
121
- /* @__PURE__ */ p(T, { children: "Status" }),
122
- /* @__PURE__ */ p(T, {
123
- align: "right",
124
- children: "Action"
125
- })
126
- ] }) }), /* @__PURE__ */ p(w, { children: I ? Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ p(E, { children: Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ p(T, { children: /* @__PURE__ */ p(S, { height: 22 }) }, t)) }, t)) : P.length === 0 ? /* @__PURE__ */ p(ee, {
127
- colSpan: 5,
128
- icon: M,
129
- title: "No categories yet",
130
- hint: "Categories control how products are managed. For example, vaccines need special configuration.",
131
- action: N ? /* @__PURE__ */ p(_, {
132
- variant: "contained",
133
- size: "small",
134
- startIcon: /* @__PURE__ */ p(k, {}),
135
- onClick: Y,
136
- children: "Create first category"
137
- }) : null
138
- }) : P.map((e) => /* @__PURE__ */ m(E, {
139
- hover: !0,
140
- children: [
141
- /* @__PURE__ */ p(T, { children: /* @__PURE__ */ p(g, {
142
- component: "span",
143
- sx: {
144
- display: "inline-flex",
145
- px: .85,
146
- py: .25,
147
- borderRadius: 1,
148
- bgcolor: "grey.100",
149
- fontFamily: "monospace",
150
- fontSize: "0.72rem",
151
- fontWeight: 800,
152
- letterSpacing: .4
153
- },
154
- children: e.code
155
- }) }),
156
- /* @__PURE__ */ p(T, { children: /* @__PURE__ */ p(O, {
157
- variant: "body2",
158
- sx: { fontWeight: 700 },
159
- children: e.name
160
- }) }),
161
- /* @__PURE__ */ p(T, {
162
- sx: { maxWidth: 360 },
163
- children: e.description ? /* @__PURE__ */ p(O, {
164
- variant: "caption",
165
- color: "text.secondary",
166
- sx: {
167
- display: "block",
168
- overflow: "hidden",
169
- textOverflow: "ellipsis",
170
- whiteSpace: "nowrap"
171
- },
172
- children: e.description
173
- }) : /* @__PURE__ */ p(O, {
174
- variant: "caption",
175
- color: "text.disabled",
176
- children: "—"
177
- })
178
- }),
179
- /* @__PURE__ */ p(T, { children: /* @__PURE__ */ p(re, {
180
- size: "small",
181
- label: e.isActive ? "Active" : "Inactive",
182
- color: e.isActive ? "success" : "default",
183
- variant: e.isActive ? "filled" : "outlined",
184
- sx: {
185
- fontWeight: 700,
186
- borderRadius: 1.5,
187
- height: 22
188
- }
189
- }) }),
190
- /* @__PURE__ */ p(T, {
191
- align: "right",
192
- children: N ? /* @__PURE__ */ p(_, {
193
- size: "small",
194
- variant: "outlined",
195
- onClick: () => ae(e),
196
- children: "Edit"
197
- }) : null
198
- })
199
- ]
200
- }, e.id)) })] })
201
- })]
202
- }), /* @__PURE__ */ m(v, {
203
- open: B,
204
- onClose: () => V(!1),
205
- fullWidth: !0,
206
- maxWidth: "sm",
207
- children: [
208
- /* @__PURE__ */ p(x, { children: H ? "Edit Category" : "New Category" }),
209
- /* @__PURE__ */ p(b, {
210
- dividers: !0,
211
- children: /* @__PURE__ */ m(C, {
212
- spacing: 2,
213
- sx: { pt: 1 },
214
- children: [
215
- /* @__PURE__ */ p(D, {
216
- required: !0,
217
- label: "Name",
218
- size: "small",
219
- fullWidth: !0,
220
- value: W.name,
221
- onChange: (e) => G({
222
- ...W,
223
- name: e.target.value
224
- }),
225
- onBlur: K.onBlur("name"),
226
- error: K.show("name") && !!Q.name,
227
- helperText: K.show("name") ? Q.name : ""
228
- }),
229
- /* @__PURE__ */ p(D, {
230
- required: !0,
231
- label: "Code (uppercase, A-Z, 0-9, _)",
232
- size: "small",
233
- fullWidth: !0,
234
- value: W.code,
235
- onChange: (e) => G({
236
- ...W,
237
- code: e.target.value.toUpperCase()
238
- }),
239
- onBlur: K.onBlur("code"),
240
- error: K.show("code") && !!Q.code,
241
- helperText: K.show("code") ? Q.code : "Must be unique."
242
- }),
243
- /* @__PURE__ */ p(D, {
244
- label: "Description",
245
- size: "small",
246
- multiline: !0,
247
- minRows: 2,
248
- fullWidth: !0,
249
- value: W.description,
250
- onChange: (e) => G({
251
- ...W,
252
- description: e.target.value
253
- })
254
- }),
255
- /* @__PURE__ */ p(D, {
256
- label: "Icon (optional)",
257
- size: "small",
258
- fullWidth: !0,
259
- value: W.icon,
260
- onChange: (e) => G({
261
- ...W,
262
- icon: e.target.value
263
- })
264
- })
265
- ]
266
- })
267
- }),
268
- /* @__PURE__ */ m(y, { children: [/* @__PURE__ */ p(_, {
269
- onClick: () => V(!1),
270
- children: "Cancel"
271
- }), /* @__PURE__ */ p(_, {
272
- variant: "contained",
273
- disabled: !$,
274
- onClick: () => void se(),
275
- children: "Save"
276
- })] })
277
- ]
278
- })]
279
- })] });
280
- }
281
- //#endregion
282
- export { N as default };
283
-
284
- //# sourceMappingURL=CategoriesPage-BpRhwfrc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CategoriesPage-BpRhwfrc.js","names":[],"sources":["../src/views/CategoriesPage.jsx"],"sourcesContent":["import { useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport {\n Alert,\n Box,\n Button,\n Chip,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Skeleton,\n Stack,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n TextField,\n Typography,\n} from '@mui/material';\nimport AddRoundedIcon from '@mui/icons-material/AddRounded';\nimport RefreshRoundedIcon from '@mui/icons-material/RefreshRounded';\nimport CategoryRoundedIcon from '@mui/icons-material/CategoryRounded';\nimport { showToast } from '@/common/toaster/toaster';\nimport PmPageShell from '@pm/components/PmPageShell';\nimport PmNav from '@pm/components/PmNav';\nimport PmGuard from '@pm/components/PmGuard';\nimport { usePermissionedEffect, usePmPermissions } from '@pm/utils/permissions';\nimport { PmEmptyRow, PmTable, PmTableCard } from '@pm/components/PmTable';\nimport { getCategories, upsertCategory } from '@pm/services/pmApi';\nimport { isClean, validateCode, validateRequired } from '@pm/utils/validation';\nimport { useFieldErrors } from '@pm/utils/useFieldErrors';\n\nexport default function CategoriesPage() {\n const perms = usePmPermissions();\n const canWrite = perms.has('update.manage.productManagement.category');\n const [items, setItems] = useState([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState('');\n const [openDialog, setOpenDialog] = useState(false);\n const [editing, setEditing] = useState(null);\n const [form, setForm] = useState(emptyForm());\n const fieldErrors = useFieldErrors();\n\n function emptyForm() {\n return { id: '', name: '', code: '', description: '', icon: '', isActive: true };\n }\n\n async function load() {\n setLoading(true);\n setError('');\n try {\n const data = await getCategories();\n setItems(data);\n } catch (err) {\n const message = err?.response?.data?.message ?? err?.message ?? 'Failed to load categories';\n setError(message);\n showToast({ message, type: 'error' });\n } finally {\n setLoading(false);\n }\n }\n\n usePermissionedEffect('view.manage.productManagement.category', () => {\n void load();\n }, []);\n\n function openCreate() {\n setEditing(null);\n setForm({ ...emptyForm(), id: uuidv4() });\n fieldErrors.reset();\n setError('');\n setOpenDialog(true);\n }\n\n function openEdit(item) {\n setEditing(item);\n fieldErrors.reset();\n setError('');\n setForm({\n id: item.id,\n name: item.name ?? '',\n code: item.code ?? '',\n description: item.description ?? '',\n icon: item.icon ?? '',\n isActive: item.isActive !== false,\n });\n setOpenDialog(true);\n }\n\n const codeBase = validateCode(form.code, { required: true });\n const codeNorm = form.code.trim().toUpperCase();\n const codeClash = !codeBase\n && codeNorm\n && items.some((c) => c.id !== form.id && (c.code || '').toUpperCase() === codeNorm);\n const formErrors = {\n name: validateRequired(form.name, 'Name'),\n code: codeBase || (codeClash ? 'Code is already in use — pick a different one.' : ''),\n };\n const formIsValid = isClean(formErrors);\n\n async function save() {\n if (!formIsValid) {\n fieldErrors.markAllTouched();\n setError('Please fix the highlighted fields.');\n return;\n }\n try {\n await upsertCategory({\n id: form.id,\n name: form.name.trim(),\n code: form.code.trim().toUpperCase(),\n description: form.description || null,\n icon: form.icon || null,\n isActive: form.isActive,\n });\n showToast({ message: 'Category saved.', type: 'success' });\n setOpenDialog(false);\n await load();\n } catch (err) {\n const message = err?.response?.data?.message ?? err?.message ?? 'Failed to save category';\n setError(message);\n showToast({ message, type: 'error' });\n }\n }\n\n return (\n <Box>\n <PmNav />\n <PmGuard perm={'view.manage.productManagement.category'}>\n <PmPageShell\n title=\"Product Categories\"\n subtitle=\"Groups of products with similar handling requirements.\"\n chips={['Catalog']}\n actions={\n <Stack direction=\"row\" spacing={1}>\n <Button variant=\"outlined\" startIcon={<RefreshRoundedIcon />} onClick={() => void load()}>Refresh</Button>\n {canWrite ? (\n <Button variant=\"contained\" startIcon={<AddRoundedIcon />} onClick={openCreate}>New Category</Button>\n ) : null}\n </Stack>\n }\n >\n {error ? <Alert severity=\"error\" sx={{ mb: 2 }}>{error}</Alert> : null}\n\n <PmTableCard\n eyebrow=\"Master data\"\n title=\"Product categories\"\n subtitle={loading ? 'Loading…' : `${items.length} ${items.length === 1 ? 'category' : 'categories'}`}\n >\n <PmTable>\n <TableHead>\n <TableRow>\n <TableCell>Code</TableCell>\n <TableCell>Name</TableCell>\n <TableCell>Description</TableCell>\n <TableCell>Status</TableCell>\n <TableCell align=\"right\">Action</TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {loading ? (\n Array.from({ length: 4 }).map((_, i) => (\n <TableRow key={i}>\n {Array.from({ length: 5 }).map((__, j) => (\n <TableCell key={j}><Skeleton height={22} /></TableCell>\n ))}\n </TableRow>\n ))\n ) : items.length === 0 ? (\n <PmEmptyRow\n colSpan={5}\n icon={CategoryRoundedIcon}\n title=\"No categories yet\"\n hint=\"Categories control how products are managed. For example, vaccines need special configuration.\"\n action={canWrite ? (\n <Button variant=\"contained\" size=\"small\" startIcon={<AddRoundedIcon />} onClick={openCreate}>\n Create first category\n </Button>\n ) : null}\n />\n ) : items.map((c) => (\n <TableRow key={c.id} hover>\n <TableCell>\n <Box component=\"span\" sx={{\n display: 'inline-flex', px: 0.85, py: 0.25, borderRadius: 1,\n bgcolor: 'grey.100', fontFamily: 'monospace', fontSize: '0.72rem', fontWeight: 800, letterSpacing: 0.4,\n }}>\n {c.code}\n </Box>\n </TableCell>\n <TableCell><Typography variant=\"body2\" sx={{ fontWeight: 700 }}>{c.name}</Typography></TableCell>\n <TableCell sx={{ maxWidth: 360 }}>\n {c.description\n ? <Typography variant=\"caption\" color=\"text.secondary\"\n sx={{ display: 'block', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>\n {c.description}\n </Typography>\n : <Typography variant=\"caption\" color=\"text.disabled\">—</Typography>}\n </TableCell>\n <TableCell>\n <Chip\n size=\"small\"\n label={c.isActive ? 'Active' : 'Inactive'}\n color={c.isActive ? 'success' : 'default'}\n variant={c.isActive ? 'filled' : 'outlined'}\n sx={{ fontWeight: 700, borderRadius: 1.5, height: 22 }}\n />\n </TableCell>\n <TableCell align=\"right\">\n {canWrite ? (\n <Button size=\"small\" variant=\"outlined\" onClick={() => openEdit(c)}>Edit</Button>\n ) : null}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </PmTable>\n </PmTableCard>\n </PmPageShell>\n\n <Dialog open={openDialog} onClose={() => setOpenDialog(false)} fullWidth maxWidth=\"sm\">\n <DialogTitle>{editing ? 'Edit Category' : 'New Category'}</DialogTitle>\n <DialogContent dividers>\n <Stack spacing={2} sx={{ pt: 1 }}>\n <TextField\n required\n label=\"Name\" size=\"small\" fullWidth\n value={form.name}\n onChange={(e) => setForm({ ...form, name: e.target.value })}\n onBlur={fieldErrors.onBlur('name')}\n error={fieldErrors.show('name') && !!formErrors.name}\n helperText={fieldErrors.show('name') ? formErrors.name : ''}\n />\n <TextField\n required\n label=\"Code (uppercase, A-Z, 0-9, _)\"\n size=\"small\" fullWidth\n value={form.code}\n onChange={(e) => setForm({ ...form, code: e.target.value.toUpperCase() })}\n onBlur={fieldErrors.onBlur('code')}\n error={fieldErrors.show('code') && !!formErrors.code}\n helperText={fieldErrors.show('code') ? formErrors.code : 'Must be unique.'}\n />\n <TextField label=\"Description\" size=\"small\" multiline minRows={2} fullWidth value={form.description}\n onChange={(e) => setForm({ ...form, description: e.target.value })} />\n <TextField label=\"Icon (optional)\" size=\"small\" fullWidth value={form.icon}\n onChange={(e) => setForm({ ...form, icon: e.target.value })} />\n </Stack>\n </DialogContent>\n <DialogActions>\n <Button onClick={() => setOpenDialog(false)}>Cancel</Button>\n <Button variant=\"contained\" disabled={!formIsValid} onClick={() => void save()}>Save</Button>\n </DialogActions>\n </Dialog>\n </PmGuard>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAiCA,SAAwB,IAAiB;CAEvC,IAAM,IADQ,EACG,EAAM,IAAI,0CAA0C,GAC/D,CAAC,GAAO,KAAY,EAAS,CAAC,CAAC,GAC/B,CAAC,GAAS,KAAc,EAAS,EAAK,GACtC,CAAC,GAAO,KAAY,EAAS,EAAE,GAC/B,CAAC,GAAY,KAAiB,EAAS,EAAK,GAC5C,CAAC,GAAS,KAAc,EAAS,IAAI,GACrC,CAAC,GAAM,KAAW,EAAS,EAAU,CAAC,GACtC,IAAc,EAAe;CAEnC,SAAS,IAAY;EACnB,OAAO;GAAE,IAAI;GAAI,MAAM;GAAI,MAAM;GAAI,aAAa;GAAI,MAAM;GAAI,UAAU;EAAK;CACjF;CAEA,eAAe,IAAO;EAEpB,AADA,EAAW,EAAI,GACf,EAAS,EAAE;EACX,IAAI;GAEF,EAAS,MADU,EAAc,CACpB;EACf,SAAS,GAAK;GACZ,IAAM,IAAU,GAAK,UAAU,MAAM,WAAW,GAAK,WAAW;GAEhE,AADA,EAAS,CAAO,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AO;OAC1D,CAAA;OACD,kBAAC,GAAD;QAAW,OAAM;QAAc,MAAK;QAAQ,WAAA;QAAU,SAAS;QAAG,WAAA;QAAU,OAAO,EAAK;QACtF,WAAW,MAAM,EAAQ;SAAE,GAAG;SAAM,aAAa,EAAE,OAAO;QAAM,CAAC;OAAI,CAAA;OACvE,kBAAC,GAAD;QAAW,OAAM;QAAkB,MAAK;QAAQ,WAAA;QAAU,OAAO,EAAK;QACpE,WAAW,MAAM,EAAQ;SAAE,GAAG;SAAM,MAAM,EAAE,OAAO;QAAM,CAAC;OAAI,CAAA;MAC3D;;IACM,CAAA;IACf,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;KAAQ,eAAe,EAAc,EAAK;eAAG;IAAc,CAAA,GAC3D,kBAAC,GAAD;KAAQ,SAAQ;KAAY,UAAU,CAAC;KAAa,eAAe,KAAK,GAAK;eAAG;IAAY,CAAA,CAC/E,EAAA,CAAA;GACT;IACC;GACN,EAAA,CAAA;AAET"}
@@ -1,310 +0,0 @@
1
- import { $ as e, I as t, L as n, P as ee, a as r, n as i, r as te, t as a } from "./PmGuard-CjJBisaN.js";
2
- import { n as o } from "./PmTable-BuXZQZCU.js";
3
- import { t as s } from "./format-UOyOu75i.js";
4
- import { useMemo as c, useState as l } from "react";
5
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
6
- import { v4 as f } from "uuid";
7
- import { Alert as p, Autocomplete as m, Box as h, Button as g, Card as _, CardContent as v, Chip as y, FormControl as b, FormHelperText as x, Grid as S, InputLabel as C, MenuItem as w, Select as T, Stack as E, TextField as D, Typography as O } from "@mui/material";
8
- import { showToast as k } from "@/common/toaster/toaster";
9
- import { useNavigate as A } from "react-router-dom";
10
- import j from "@mui/icons-material/SaveRounded";
11
- //#region src/views/PickupCreatePage.jsx
12
- function M(e) {
13
- return !(e.ownerType !== "FACILITY" || Number(e.qtyRemaining ?? 0) <= 0 || e.status === "EXPIRED" || e.status === "EXHAUSTED" || e.status === "QUARANTINED");
14
- }
15
- function N() {
16
- let N = A(), [P, F] = l([]), [I, ne] = l([]), [L, re] = l([]), [R, z] = l(!0), [B, V] = l(!1), [H, U] = l(""), [W, G] = l({
17
- id: f(),
18
- personalBatchId: f(),
19
- facilityId: "",
20
- sourceBatchId: "",
21
- pickedQty: 1,
22
- notes: ""
23
- });
24
- te("update.manage.productManagement.pickup", () => {
25
- async function e() {
26
- try {
27
- let [e, r, i] = await Promise.all([
28
- t(),
29
- ee(),
30
- n().catch(() => [])
31
- ]);
32
- F(e), ne(r), re(i);
33
- } catch (e) {
34
- U(e?.response?.data?.message ?? e?.message ?? "Failed to load reference data");
35
- } finally {
36
- z(!1);
37
- }
38
- }
39
- e();
40
- }, []);
41
- let K = L.length > 0, q = c(() => W.facilityId ? I.filter(M).filter((e) => e.ownerId === W.facilityId) : [], [I, W.facilityId]), J = c(() => I.find((e) => e.id === W.sourceBatchId) ?? null, [I, W.sourceBatchId]);
42
- function Y(e, t) {
43
- G((n) => ({
44
- ...n,
45
- [e]: t
46
- }));
47
- }
48
- function ie(e) {
49
- G((t) => ({
50
- ...t,
51
- facilityId: e,
52
- sourceBatchId: ""
53
- }));
54
- }
55
- let X = Number(W.pickedQty), Z = Number(J?.qtyRemaining ?? 0), Q = J ? !Number.isInteger(X) || X <= 0 ? "Enter a whole number greater than 0." : X > Z ? `Only ${Z} available in this batch.` : "" : "", $ = !!W.facilityId && !!W.sourceBatchId && !Q && !K;
56
- async function ae() {
57
- if ($) {
58
- V(!0), U("");
59
- try {
60
- let t = await e({
61
- id: W.id,
62
- personalBatchId: W.personalBatchId,
63
- sourceBatchId: W.sourceBatchId,
64
- pickedQty: X,
65
- notes: W.notes || null
66
- });
67
- k({
68
- message: `Picked up ${t.pickedQty} unit${t.pickedQty === 1 ? "" : "s"}.`,
69
- type: "success"
70
- }), N("/ui/medplat/manage/pm/pickups");
71
- } catch (e) {
72
- U(e?.response?.data?.message ?? e?.message ?? "Failed to record pickup");
73
- } finally {
74
- V(!1);
75
- }
76
- }
77
- }
78
- return /* @__PURE__ */ d(h, { children: [/* @__PURE__ */ u(i, {}), /* @__PURE__ */ u(a, {
79
- perm: "update.manage.productManagement.pickup",
80
- title: "You don’t have permission to record pickups",
81
- children: /* @__PURE__ */ d(r, {
82
- title: "Record Pickup",
83
- subtitle: "Check out stock from a facility for your field work. Record returns and wastage when you bring stock back.",
84
- actions: /* @__PURE__ */ d(E, {
85
- direction: "row",
86
- spacing: 1,
87
- children: [/* @__PURE__ */ u(g, {
88
- variant: "outlined",
89
- onClick: () => N("/ui/medplat/manage/pm/pickups"),
90
- children: "Cancel"
91
- }), /* @__PURE__ */ u(g, {
92
- variant: "contained",
93
- startIcon: /* @__PURE__ */ u(j, {}),
94
- disabled: !$ || B,
95
- onClick: () => void ae(),
96
- children: B ? "Recording…" : "Record Pickup"
97
- })]
98
- }),
99
- children: [
100
- H ? /* @__PURE__ */ u(p, {
101
- severity: "error",
102
- sx: { mb: 2 },
103
- children: H
104
- }) : null,
105
- K ? /* @__PURE__ */ d(p, {
106
- severity: "warning",
107
- sx: { mb: 2 },
108
- action: /* @__PURE__ */ u(g, {
109
- color: "inherit",
110
- size: "small",
111
- onClick: () => N("/ui/medplat/manage/pm/pickups"),
112
- children: "Go to Pickups"
113
- }),
114
- children: [
115
- "You already have ",
116
- /* @__PURE__ */ u("strong", { children: L.length }),
117
- " open outreach session",
118
- L.length === 1 ? "" : "s",
119
- ". End the active session",
120
- L.length === 1 ? "" : "s",
121
- " before starting a new pickup, or use ",
122
- /* @__PURE__ */ u("strong", { children: "Top Up" }),
123
- " on the Pickups page to add more stock to an active session."
124
- ]
125
- }) : null,
126
- /* @__PURE__ */ u(_, {
127
- sx: {
128
- borderRadius: 4,
129
- mb: 2,
130
- border: "1px solid",
131
- borderColor: "divider",
132
- boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
133
- },
134
- children: /* @__PURE__ */ d(v, {
135
- sx: { p: 2.5 },
136
- children: [/* @__PURE__ */ u(o, {
137
- eyebrow: "Step 1",
138
- title: "Source",
139
- hint: "Select a facility and then the batch to pick up.",
140
- sx: { mb: 2 }
141
- }), /* @__PURE__ */ d(S, {
142
- container: !0,
143
- spacing: 2,
144
- children: [/* @__PURE__ */ u(S, {
145
- item: !0,
146
- xs: 12,
147
- md: 5,
148
- children: /* @__PURE__ */ u(m, {
149
- size: "small",
150
- options: P,
151
- getOptionLabel: (e) => e?.name ?? "",
152
- isOptionEqualToValue: (e, t) => e?.id === t?.id,
153
- value: P.find((e) => e.id === W.facilityId) ?? null,
154
- onChange: (e, t) => ie(t?.id ?? ""),
155
- loading: R,
156
- renderInput: (e) => /* @__PURE__ */ u(D, {
157
- ...e,
158
- required: !0,
159
- label: "Source Facility",
160
- placeholder: "Pick a facility you're assigned to"
161
- })
162
- })
163
- }), /* @__PURE__ */ u(S, {
164
- item: !0,
165
- xs: 12,
166
- md: 7,
167
- children: /* @__PURE__ */ d(b, {
168
- required: !0,
169
- fullWidth: !0,
170
- size: "small",
171
- disabled: !W.facilityId,
172
- children: [
173
- /* @__PURE__ */ u(C, { children: "Source Batch" }),
174
- /* @__PURE__ */ u(T, {
175
- label: "Source Batch",
176
- value: W.sourceBatchId,
177
- onChange: (e) => Y("sourceBatchId", e.target.value),
178
- children: q.length === 0 ? /* @__PURE__ */ u(w, {
179
- disabled: !0,
180
- value: "",
181
- children: /* @__PURE__ */ u("em", { children: "No pickable stock in this facility" })
182
- }) : q.map((e) => /* @__PURE__ */ d(w, {
183
- value: e.id,
184
- children: [
185
- /* @__PURE__ */ u(h, {
186
- component: "span",
187
- sx: {
188
- fontWeight: 700,
189
- mr: 1
190
- },
191
- children: e.productName
192
- }),
193
- /* @__PURE__ */ d(O, {
194
- variant: "caption",
195
- color: "text.secondary",
196
- sx: { mr: 1 },
197
- children: ["qty ", e.qtyRemaining]
198
- }),
199
- e.lotNumber ? /* @__PURE__ */ u(O, {
200
- variant: "caption",
201
- sx: {
202
- fontFamily: "monospace",
203
- mr: 1
204
- },
205
- children: e.lotNumber
206
- }) : null,
207
- e.expiryDate ? /* @__PURE__ */ d(O, {
208
- variant: "caption",
209
- color: "text.secondary",
210
- children: ["exp ", s(e.expiryDate)]
211
- }) : null
212
- ]
213
- }, e.id))
214
- }),
215
- /* @__PURE__ */ u(x, { children: W.facilityId ? q.length === 0 ? "This facility has no in-stock batches you can pick up right now." : "Active facility batches only — quarantined / expired / exhausted stock is hidden." : "Pick a facility first." })
216
- ]
217
- })
218
- })]
219
- })]
220
- })
221
- }),
222
- J ? /* @__PURE__ */ u(_, {
223
- sx: {
224
- borderRadius: 4,
225
- mb: 2,
226
- border: "1px solid",
227
- borderColor: "divider",
228
- boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
229
- },
230
- children: /* @__PURE__ */ d(v, {
231
- sx: { p: 2.5 },
232
- children: [
233
- /* @__PURE__ */ u(o, {
234
- eyebrow: "Step 2",
235
- title: "Quantity",
236
- hint: `Available: ${Z}. You can pick up to this amount.`,
237
- sx: { mb: 2 }
238
- }),
239
- /* @__PURE__ */ d(S, {
240
- container: !0,
241
- spacing: 2,
242
- children: [/* @__PURE__ */ u(S, {
243
- item: !0,
244
- xs: 12,
245
- md: 4,
246
- children: /* @__PURE__ */ u(D, {
247
- required: !0,
248
- fullWidth: !0,
249
- size: "small",
250
- type: "number",
251
- label: "Pick Quantity",
252
- inputProps: {
253
- min: 1,
254
- max: Z
255
- },
256
- value: W.pickedQty,
257
- onChange: (e) => Y("pickedQty", e.target.value),
258
- error: !!Q,
259
- helperText: Q || `Out of ${Z} available`
260
- })
261
- }), /* @__PURE__ */ u(S, {
262
- item: !0,
263
- xs: 12,
264
- md: 8,
265
- children: /* @__PURE__ */ u(D, {
266
- fullWidth: !0,
267
- size: "small",
268
- label: "Notes (optional)",
269
- placeholder: "Anything worth recording about this pickup",
270
- value: W.notes,
271
- onChange: (e) => Y("notes", e.target.value)
272
- })
273
- })]
274
- }),
275
- /* @__PURE__ */ d(E, {
276
- direction: "row",
277
- spacing: 1,
278
- sx: { mt: 2 },
279
- flexWrap: "wrap",
280
- useFlexGap: !0,
281
- children: [
282
- /* @__PURE__ */ u(y, {
283
- size: "small",
284
- label: `Product · ${J.productName}`
285
- }),
286
- J.lotNumber ? /* @__PURE__ */ u(y, {
287
- size: "small",
288
- label: `Lot · ${J.lotNumber}`
289
- }) : null,
290
- J.expiryDate ? /* @__PURE__ */ u(y, {
291
- size: "small",
292
- label: `Expiry · ${s(J.expiryDate)}`
293
- }) : null,
294
- J.storageUnitName ? /* @__PURE__ */ u(y, {
295
- size: "small",
296
- label: `From · ${J.storageUnitName}`
297
- }) : null
298
- ]
299
- })
300
- ]
301
- })
302
- }) : null
303
- ]
304
- })
305
- })] });
306
- }
307
- //#endregion
308
- export { N as default };
309
-
310
- //# sourceMappingURL=PickupCreatePage-CieMsgWV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PickupCreatePage-CieMsgWV.js","names":[],"sources":["../src/views/PickupCreatePage.jsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { v4 as uuidv4 } from 'uuid';\nimport {\n Alert,\n Autocomplete,\n Box,\n Button,\n Card,\n CardContent,\n Chip,\n FormControl,\n FormHelperText,\n Grid,\n InputLabel,\n MenuItem,\n Select,\n Stack,\n TextField,\n Typography,\n} from '@mui/material';\nimport SaveRoundedIcon from '@mui/icons-material/SaveRounded';\nimport { showToast } from '@/common/toaster/toaster';\nimport PmPageShell from '@pm/components/PmPageShell';\nimport PmNav from '@pm/components/PmNav';\nimport PmGuard from '@pm/components/PmGuard';\nimport { usePermissionedEffect } from '@pm/utils/permissions';\nimport { PmFormSection } from '@pm/components/PmTable';\nimport {\n listBatches,\n listFacilities,\n listMyOpenPickups,\n recordPickup,\n} from '@pm/services/pmApi';\nimport { formatDate } from '@pm/utils/format';\n\n// Only facility-owned, in-stock, non-quarantined, non-terminal batches are\n// candidates for pickup. The backend enforces the same rules; filtering here\n// keeps the dropdown free of unactionable rows.\nfunction isPickable(batch) {\n if (batch.ownerType !== 'FACILITY') return false;\n if (Number(batch.qtyRemaining ?? 0) <= 0) return false;\n if (batch.status === 'EXPIRED' || batch.status === 'EXHAUSTED' || batch.status === 'QUARANTINED') return false;\n return true;\n}\n\nexport default function PickupCreatePage() {\n const navigate = useNavigate();\n const [facilities, setFacilities] = useState([]);\n const [batches, setBatches] = useState([]);\n // OPEN pickups already on this user — one-session-per-user rule means\n // any open session blocks a new pickup. The user has to end the session\n // or top it up instead.\n const [openSessions, setOpenSessions] = useState([]);\n const [loading, setLoading] = useState(true);\n const [submitting, setSubmitting] = useState(false);\n const [error, setError] = useState('');\n const [form, setForm] = useState({\n id: uuidv4(),\n personalBatchId: uuidv4(),\n facilityId: '',\n sourceBatchId: '',\n pickedQty: 1,\n notes: '',\n });\n\n usePermissionedEffect('update.manage.productManagement.pickup', () => {\n async function load() {\n try {\n const [f, b, open] = await Promise.all([\n listFacilities(),\n listBatches(),\n listMyOpenPickups().catch(() => []),\n ]);\n setFacilities(f);\n setBatches(b);\n setOpenSessions(open);\n } catch (err) {\n setError(err?.response?.data?.message ?? err?.message ?? 'Failed to load reference data');\n } finally {\n setLoading(false);\n }\n }\n void load();\n }, []);\n\n const hasOpenSession = openSessions.length > 0;\n\n // Batches limited to the picked facility (when one is selected). Reset\n // when the facility changes so the user can't carry over a stale batch.\n const eligibleBatches = useMemo(() => {\n if (!form.facilityId) return [];\n return batches.filter(isPickable).filter((b) => b.ownerId === form.facilityId);\n }, [batches, form.facilityId]);\n\n const selectedBatch = useMemo(\n () => batches.find((b) => b.id === form.sourceBatchId) ?? null,\n [batches, form.sourceBatchId],\n );\n\n function patch(k, v) {\n setForm((f) => ({ ...f, [k]: v }));\n }\n\n function patchFacility(id) {\n setForm((f) => ({ ...f, facilityId: id, sourceBatchId: '' }));\n }\n\n const qty = Number(form.pickedQty);\n const remaining = Number(selectedBatch?.qtyRemaining ?? 0);\n const qtyError = !selectedBatch\n ? ''\n : !Number.isInteger(qty) || qty <= 0\n ? 'Enter a whole number greater than 0.'\n : qty > remaining\n ? `Only ${remaining} available in this batch.`\n : '';\n const formIsValid = !!form.facilityId && !!form.sourceBatchId && !qtyError && !hasOpenSession;\n\n async function save() {\n if (!formIsValid) return;\n setSubmitting(true);\n setError('');\n try {\n const created = await recordPickup({\n id: form.id,\n personalBatchId: form.personalBatchId,\n sourceBatchId: form.sourceBatchId,\n pickedQty: qty,\n notes: form.notes || null,\n });\n showToast({ message: `Picked up ${created.pickedQty} unit${created.pickedQty === 1 ? '' : 's'}.`, type: 'success' });\n navigate('/ui/medplat/manage/pm/pickups');\n } catch (err) {\n setError(err?.response?.data?.message ?? err?.message ?? 'Failed to record pickup');\n } finally {\n setSubmitting(false);\n }\n }\n\n return (\n <Box>\n <PmNav />\n <PmGuard perm={'update.manage.productManagement.pickup'} title=\"You don’t have permission to record pickups\">\n <PmPageShell\n title=\"Record Pickup\"\n subtitle=\"Check out stock from a facility for your field work. Record returns and wastage when you bring stock back.\"\n actions={\n <Stack direction=\"row\" spacing={1}>\n <Button variant=\"outlined\" onClick={() => navigate('/ui/medplat/manage/pm/pickups')}>Cancel</Button>\n <Button variant=\"contained\" startIcon={<SaveRoundedIcon />}\n disabled={!formIsValid || submitting}\n onClick={() => void save()}>\n {submitting ? 'Recording…' : 'Record Pickup'}\n </Button>\n </Stack>\n }\n >\n {error ? <Alert severity=\"error\" sx={{ mb: 2 }}>{error}</Alert> : null}\n\n {hasOpenSession ? (\n <Alert\n severity=\"warning\"\n sx={{ mb: 2 }}\n action={\n <Button color=\"inherit\" size=\"small\"\n onClick={() => navigate('/ui/medplat/manage/pm/pickups')}>\n Go to Pickups\n </Button>\n }\n >\n You already have <strong>{openSessions.length}</strong> open outreach session{openSessions.length === 1 ? '' : 's'}.\n End the active session{openSessions.length === 1 ? '' : 's'} before starting a new pickup,\n or use <strong>Top Up</strong> on the Pickups page to add more stock to an active session.\n </Alert>\n ) : null}\n\n <Card sx={{ borderRadius: 4, mb: 2, border: '1px solid', borderColor: 'divider', boxShadow: '0 12px 32px rgba(15, 23, 42, 0.045)' }}>\n <CardContent sx={{ p: 2.5 }}>\n <PmFormSection\n eyebrow=\"Step 1\"\n title=\"Source\"\n hint=\"Select a facility and then the batch to pick up.\"\n sx={{ mb: 2 }}\n />\n <Grid container spacing={2}>\n <Grid item xs={12} md={5}>\n <Autocomplete\n size=\"small\"\n options={facilities}\n getOptionLabel={(f) => f?.name ?? ''}\n isOptionEqualToValue={(a, b) => a?.id === b?.id}\n value={facilities.find((f) => f.id === form.facilityId) ?? null}\n onChange={(_, next) => patchFacility(next?.id ?? '')}\n loading={loading}\n renderInput={(params) => (\n <TextField {...params} required label=\"Source Facility\" placeholder=\"Pick a facility you're assigned to\" />\n )}\n />\n </Grid>\n <Grid item xs={12} md={7}>\n <FormControl required fullWidth size=\"small\" disabled={!form.facilityId}>\n <InputLabel>Source Batch</InputLabel>\n <Select\n label=\"Source Batch\"\n value={form.sourceBatchId}\n onChange={(e) => patch('sourceBatchId', e.target.value)}\n >\n {eligibleBatches.length === 0 ? (\n <MenuItem disabled value=\"\">\n <em>No pickable stock in this facility</em>\n </MenuItem>\n ) : (\n eligibleBatches.map((b) => (\n <MenuItem key={b.id} value={b.id}>\n <Box component=\"span\" sx={{ fontWeight: 700, mr: 1 }}>{b.productName}</Box>\n <Typography variant=\"caption\" color=\"text.secondary\" sx={{ mr: 1 }}>\n qty {b.qtyRemaining}\n </Typography>\n {b.lotNumber ? (\n <Typography variant=\"caption\" sx={{ fontFamily: 'monospace', mr: 1 }}>\n {b.lotNumber}\n </Typography>\n ) : null}\n {b.expiryDate ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n exp {formatDate(b.expiryDate)}\n </Typography>\n ) : null}\n </MenuItem>\n ))\n )}\n </Select>\n <FormHelperText>\n {!form.facilityId\n ? 'Pick a facility first.'\n : eligibleBatches.length === 0\n ? 'This facility has no in-stock batches you can pick up right now.'\n : 'Active facility batches only — quarantined / expired / exhausted stock is hidden.'}\n </FormHelperText>\n </FormControl>\n </Grid>\n </Grid>\n </CardContent>\n </Card>\n\n {selectedBatch ? (\n <Card sx={{ borderRadius: 4, mb: 2, border: '1px solid', borderColor: 'divider', boxShadow: '0 12px 32px rgba(15, 23, 42, 0.045)' }}>\n <CardContent sx={{ p: 2.5 }}>\n <PmFormSection\n eyebrow=\"Step 2\"\n title=\"Quantity\"\n hint={`Available: ${remaining}. You can pick up to this amount.`}\n sx={{ mb: 2 }}\n />\n <Grid container spacing={2}>\n <Grid item xs={12} md={4}>\n <TextField\n required fullWidth size=\"small\" type=\"number\"\n label=\"Pick Quantity\"\n inputProps={{ min: 1, max: remaining }}\n value={form.pickedQty}\n onChange={(e) => patch('pickedQty', e.target.value)}\n error={!!qtyError}\n helperText={qtyError || `Out of ${remaining} available`}\n />\n </Grid>\n <Grid item xs={12} md={8}>\n <TextField\n fullWidth size=\"small\"\n label=\"Notes (optional)\"\n placeholder=\"Anything worth recording about this pickup\"\n value={form.notes}\n onChange={(e) => patch('notes', e.target.value)}\n />\n </Grid>\n </Grid>\n <Stack direction=\"row\" spacing={1} sx={{ mt: 2 }} flexWrap=\"wrap\" useFlexGap>\n <Chip size=\"small\" label={`Product · ${selectedBatch.productName}`} />\n {selectedBatch.lotNumber ? <Chip size=\"small\" label={`Lot · ${selectedBatch.lotNumber}`} /> : null}\n {selectedBatch.expiryDate ? <Chip size=\"small\" label={`Expiry · ${formatDate(selectedBatch.expiryDate)}`} /> : null}\n {selectedBatch.storageUnitName ? <Chip size=\"small\" label={`From · ${selectedBatch.storageUnitName}`} /> : null}\n </Stack>\n </CardContent>\n </Card>\n ) : null}\n </PmPageShell>\n </PmGuard>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;;AAuCA,SAAS,EAAW,GAAO;CAIzB,OADA,EAFI,EAAM,cAAc,cACpB,OAAO,EAAM,gBAAgB,CAAC,KAAK,KACnC,EAAM,WAAW,aAAa,EAAM,WAAW,eAAe,EAAM,WAAW;AAErF;AAEA,SAAw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