@argusoft/medplat-product-management 1.0.4 → 1.0.6

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 (68) hide show
  1. package/dist/{BrandsPage-BE3kn-8b.js → BrandsPage-DM5ZRz8L.js} +7 -6
  2. package/dist/{BrandsPage-BE3kn-8b.js.map → BrandsPage-DM5ZRz8L.js.map} +1 -1
  3. package/dist/{CategoriesPage-COqi3pMi.js → CategoriesPage-v7vz_i2N.js} +7 -6
  4. package/dist/{CategoriesPage-COqi3pMi.js.map → CategoriesPage-v7vz_i2N.js.map} +1 -1
  5. package/dist/{DashboardPage-C_H1Jrey.js → DashboardPage-CW77OzUg.js} +3 -3
  6. package/dist/{DashboardPage-C_H1Jrey.js.map → DashboardPage-CW77OzUg.js.map} +1 -1
  7. package/dist/{FacilityPicker-Diq2hnYg.js → FacilityPicker-C2drWyqo.js} +2 -2
  8. package/dist/{FacilityPicker-Diq2hnYg.js.map → FacilityPicker-C2drWyqo.js.map} +1 -1
  9. package/dist/InventoryPage-_VWlqD2e.js +686 -0
  10. package/dist/InventoryPage-_VWlqD2e.js.map +1 -0
  11. package/dist/{MemberProfileCard-BLUVRILO.js → MemberProfileCard-D9jepThR.js} +3 -3
  12. package/dist/{MemberProfileCard-BLUVRILO.js.map → MemberProfileCard-D9jepThR.js.map} +1 -1
  13. package/dist/{PaymentCreatePage-B5VOgTx9.js → PaymentCreatePage-DAUWv5RO.js} +7 -7
  14. package/dist/{PaymentCreatePage-B5VOgTx9.js.map → PaymentCreatePage-DAUWv5RO.js.map} +1 -1
  15. package/dist/{PaymentsPage-DY6BclkN.js → PaymentsPage-B6Fs2xey.js} +4 -4
  16. package/dist/{PaymentsPage-DY6BclkN.js.map → PaymentsPage-B6Fs2xey.js.map} +1 -1
  17. package/dist/{PickupCreatePage-CCSiyFQF.js → PickupCreatePage-4ffB1_yq.js} +4 -4
  18. package/dist/{PickupCreatePage-CCSiyFQF.js.map → PickupCreatePage-4ffB1_yq.js.map} +1 -1
  19. package/dist/{PickupsPage-DGi6T5Of.js → PickupsPage-C-21LwTf.js} +7 -7
  20. package/dist/{PickupsPage-DGi6T5Of.js.map → PickupsPage-C-21LwTf.js.map} +1 -1
  21. package/dist/{PmGuard-C90yhpsN.js → PmGuard-DrbbysnW.js} +3 -3
  22. package/dist/{PmGuard-C90yhpsN.js.map → PmGuard-DrbbysnW.js.map} +1 -1
  23. package/dist/{PmTable-BkK65bJQ.js → PmTable-BMFiuHdG.js} +2 -2
  24. package/dist/{PmTable-BkK65bJQ.js.map → PmTable-BMFiuHdG.js.map} +1 -1
  25. package/dist/{ProductEditPage-CQj9egzW.js → ProductEditPage-BinNxjlB.js} +174 -116
  26. package/dist/ProductEditPage-BinNxjlB.js.map +1 -0
  27. package/dist/{ProductsPage-i8QVw_Jm.js → ProductsPage-DFgK9-13.js} +5 -5
  28. package/dist/{ProductsPage-i8QVw_Jm.js.map → ProductsPage-DFgK9-13.js.map} +1 -1
  29. package/dist/{PurchaseCreatePage-Bp6bl9n8.js → PurchaseCreatePage-B1eV15aS.js} +9 -9
  30. package/dist/{PurchaseCreatePage-Bp6bl9n8.js.map → PurchaseCreatePage-B1eV15aS.js.map} +1 -1
  31. package/dist/{PurchaseRequestDetailPage-CNAqIFef.js → PurchaseRequestDetailPage-52S6Nf7a.js} +6 -5
  32. package/dist/{PurchaseRequestDetailPage-CNAqIFef.js.map → PurchaseRequestDetailPage-52S6Nf7a.js.map} +1 -1
  33. package/dist/{PurchaseRequestsPage-BJqDlNrc.js → PurchaseRequestsPage-DNNUnXy4.js} +4 -4
  34. package/dist/{PurchaseRequestsPage-BJqDlNrc.js.map → PurchaseRequestsPage-DNNUnXy4.js.map} +1 -1
  35. package/dist/{PurchasesPage-BQEToymQ.js → PurchasesPage-Bsrqxvb1.js} +4 -4
  36. package/dist/{PurchasesPage-BQEToymQ.js.map → PurchasesPage-Bsrqxvb1.js.map} +1 -1
  37. package/dist/SaleCreatePage-CPyVj3Dh.js +544 -0
  38. package/dist/SaleCreatePage-CPyVj3Dh.js.map +1 -0
  39. package/dist/{SalesPage-CTBJMxZe.js → SalesPage-BWpgPKz_.js} +4 -4
  40. package/dist/{SalesPage-CTBJMxZe.js.map → SalesPage-BWpgPKz_.js.map} +1 -1
  41. package/dist/{SettingsPage-CiwVmzM3.js → SettingsPage-Ch-37E5R.js} +4 -4
  42. package/dist/{SettingsPage-CiwVmzM3.js.map → SettingsPage-Ch-37E5R.js.map} +1 -1
  43. package/dist/{StorageUnitsPage-BV7nK_iE.js → StorageUnitsPage-DF0MC356.js} +7 -7
  44. package/dist/{StorageUnitsPage-BV7nK_iE.js.map → StorageUnitsPage-DF0MC356.js.map} +1 -1
  45. package/dist/{TransactionsPage-Cocn4901.js → TransactionsPage-DQBjCHoN.js} +18 -18
  46. package/dist/{TransactionsPage-Cocn4901.js.map → TransactionsPage-DQBjCHoN.js.map} +1 -1
  47. package/dist/{TransferCreatePage-DbjcjuOg.js → TransferCreatePage-DdVExUif.js} +4 -4
  48. package/dist/{TransferCreatePage-DbjcjuOg.js.map → TransferCreatePage-DdVExUif.js.map} +1 -1
  49. package/dist/{TransfersPage-BFVF7Xvc.js → TransfersPage-C1qS9kNL.js} +5 -5
  50. package/dist/{TransfersPage-BFVF7Xvc.js.map → TransfersPage-C1qS9kNL.js.map} +1 -1
  51. package/dist/{VialsPage-BNzYTLVd.js → VialsPage-rTAYlXGZ.js} +8 -8
  52. package/dist/{VialsPage-BNzYTLVd.js.map → VialsPage-rTAYlXGZ.js.map} +1 -1
  53. package/dist/{constants-5ZCZo-Zm.js → constants-CdzV0PxZ.js} +25 -12
  54. package/dist/constants-CdzV0PxZ.js.map +1 -0
  55. package/dist/format-UOyOu75i.js.map +1 -1
  56. package/dist/index.js +5 -5
  57. package/dist/index.js.map +1 -1
  58. package/dist/{settingsStore-KW217unV.js → settingsStore-GLCtI-tv.js} +17 -14
  59. package/dist/{settingsStore-KW217unV.js.map → settingsStore-GLCtI-tv.js.map} +1 -1
  60. package/dist/{validation-Ba7puFIO.js → validation-BkUPqrdA.js} +11 -12
  61. package/dist/{validation-Ba7puFIO.js.map → validation-BkUPqrdA.js.map} +1 -1
  62. package/package.json +1 -1
  63. package/dist/InventoryPage-Bjpw6vTz.js +0 -508
  64. package/dist/InventoryPage-Bjpw6vTz.js.map +0 -1
  65. package/dist/ProductEditPage-CQj9egzW.js.map +0 -1
  66. package/dist/SaleCreatePage-DbfBK4PH.js +0 -523
  67. package/dist/SaleCreatePage-DbfBK4PH.js.map +0 -1
  68. package/dist/constants-5ZCZo-Zm.js.map +0 -1
@@ -0,0 +1,686 @@
1
+ import { E as e, U as t, X as n, nt as ee } from "./settingsStore-GLCtI-tv.js";
2
+ import { a as te, c as ne, o as r, s as re, t as ie } from "./PmTable-BMFiuHdG.js";
3
+ import { a as i, m as a, p as ae, t as o } from "./constants-CdzV0PxZ.js";
4
+ import { a as oe, i as s, t as se } from "./format-UOyOu75i.js";
5
+ import { m as c } from "./validation-BkUPqrdA.js";
6
+ import { a as ce, i as le, n as ue, r as de, t as fe } from "./PmGuard-DrbbysnW.js";
7
+ import { useMemo as pe, useState as l } from "react";
8
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
+ import { Alert as me, Box as f, Button as p, Chip as m, Dialog as h, DialogActions as g, DialogContent as _, DialogTitle as v, FormControl as he, InputAdornment as ge, InputLabel as _e, LinearProgress as ve, MenuItem as y, Select as ye, Skeleton as be, Stack as b, TableBody as xe, TableCell as x, TableHead as Se, TableRow as S, TextField as C, Tooltip as Ce, Typography as w } from "@mui/material";
10
+ import { showToast as T } from "@/common/toaster/toaster";
11
+ import { alpha as we, useTheme as Te } from "@mui/material/styles";
12
+ import { v4 as E } from "uuid";
13
+ import Ee from "@mui/icons-material/RefreshRounded";
14
+ import De from "@mui/icons-material/WidgetsRounded";
15
+ import Oe from "@mui/icons-material/LockRounded";
16
+ import ke from "@mui/icons-material/LockOpenRounded";
17
+ import Ae from "@mui/icons-material/ReportRounded";
18
+ import je from "@mui/icons-material/SearchRounded";
19
+ //#region src/views/InventoryPage.jsx
20
+ function D(e) {
21
+ return e ? e.status === "EXPIRED" || s(e.expiryDate) : !1;
22
+ }
23
+ function O() {
24
+ let s = le().has("update.manage.productManagement.inventory"), [O, Me] = l([]), [Ne, Pe] = l(!1), [k, A] = l(""), [j, M] = l({
25
+ open: !1,
26
+ batch: null,
27
+ reason: "OTHER",
28
+ notes: ""
29
+ }), [N, P] = l({
30
+ open: !1,
31
+ batch: null,
32
+ qty: 1,
33
+ reason: "DAMAGED",
34
+ comments: ""
35
+ }), [F, I] = l(!1), Fe = Te(), [L, R] = l(""), [z, B] = l("ALL"), [V, H] = l(!1), [U, W] = l(!1), [G, K] = l(!1);
36
+ async function q() {
37
+ Pe(!0), A("");
38
+ try {
39
+ Me(await e());
40
+ } catch (e) {
41
+ let t = e?.response?.data?.message ?? e?.message ?? "Failed to load inventory";
42
+ A(t), T({
43
+ message: t,
44
+ type: "error"
45
+ });
46
+ } finally {
47
+ Pe(!1);
48
+ }
49
+ }
50
+ de("view.manage.productManagement.inventory", () => {
51
+ q();
52
+ }, []);
53
+ let J = pe(() => {
54
+ let e = L.trim().toLowerCase();
55
+ return O.filter((t) => !(e && !`${t.productName ?? ""} ${t.lotNumber ?? ""}`.toLowerCase().includes(e) || z !== "ALL" && t.status !== z || V && D(t) || U && !(Number(t.qtyRemaining ?? 0) > 0) || G && !(Number(t.wastedQty ?? 0) > 0)));
56
+ }, [
57
+ O,
58
+ L,
59
+ z,
60
+ V,
61
+ U,
62
+ G
63
+ ]), Y = L.trim() !== "" || z !== "ALL" || V || U || G;
64
+ function X() {
65
+ R(""), B("ALL"), H(!1), W(!1), K(!1);
66
+ }
67
+ function Ie(e) {
68
+ P({
69
+ open: !0,
70
+ batch: e,
71
+ qty: e.qtyRemaining ?? 1,
72
+ reason: "DAMAGED",
73
+ comments: ""
74
+ });
75
+ }
76
+ let Z = Number(N.qty), Q = Number(N.batch?.qtyRemaining ?? 0), $ = !Number.isInteger(Z) || Z <= 0 ? "Enter a whole number greater than 0." : Z > Q ? `Only ${Q} available to waste.` : "", Le = !$ && !!N.reason;
77
+ async function Re() {
78
+ if (!(!N.batch || !Le)) {
79
+ I(!0);
80
+ try {
81
+ await ee({
82
+ id: E(),
83
+ batchId: N.batch.id,
84
+ wastedQty: Z,
85
+ reason: N.reason,
86
+ comments: N.comments || null
87
+ }), T({
88
+ message: "Wastage recorded.",
89
+ type: "success"
90
+ }), P({
91
+ open: !1,
92
+ batch: null,
93
+ qty: 1,
94
+ reason: "DAMAGED",
95
+ comments: ""
96
+ }), await q();
97
+ } catch (e) {
98
+ T({
99
+ message: e?.response?.data?.message ?? e?.message ?? "Failed to record wastage",
100
+ type: "error"
101
+ });
102
+ } finally {
103
+ I(!1);
104
+ }
105
+ }
106
+ }
107
+ async function ze() {
108
+ try {
109
+ await t({
110
+ id: E(),
111
+ batchId: j.batch.id,
112
+ reason: j.reason,
113
+ notes: j.notes || null
114
+ }), T({
115
+ message: "Batch quarantined.",
116
+ type: "success"
117
+ }), M({
118
+ open: !1,
119
+ batch: null,
120
+ reason: "OTHER",
121
+ notes: ""
122
+ }), await q();
123
+ } catch (e) {
124
+ T({
125
+ message: e?.response?.data?.message ?? e?.message ?? "Failed to quarantine",
126
+ type: "error"
127
+ });
128
+ }
129
+ }
130
+ async function Be(e) {
131
+ try {
132
+ await n({
133
+ id: E(),
134
+ batchId: e.id
135
+ }), T({
136
+ message: "Quarantine lifted.",
137
+ type: "success"
138
+ }), await q();
139
+ } catch (e) {
140
+ T({
141
+ message: e?.response?.data?.message ?? e?.message ?? "Failed to unquarantine",
142
+ type: "error"
143
+ });
144
+ }
145
+ }
146
+ return /* @__PURE__ */ d(f, { children: [/* @__PURE__ */ u(ue, {}), /* @__PURE__ */ d(fe, {
147
+ perm: "view.manage.productManagement.inventory",
148
+ children: [
149
+ /* @__PURE__ */ d(ce, {
150
+ title: "Inventory",
151
+ subtitle: "Your stock batches. Click to see history or quarantine items if there's a problem.",
152
+ chips: ["Stock"],
153
+ actions: /* @__PURE__ */ u(b, {
154
+ direction: "row",
155
+ spacing: 1,
156
+ children: /* @__PURE__ */ u(p, {
157
+ variant: "outlined",
158
+ startIcon: /* @__PURE__ */ u(Ee, {}),
159
+ onClick: () => void q(),
160
+ children: "Refresh"
161
+ })
162
+ }),
163
+ children: [k ? /* @__PURE__ */ u(me, {
164
+ severity: "error",
165
+ sx: { mb: 2 },
166
+ children: k
167
+ }) : null, /* @__PURE__ */ d(ne, {
168
+ eyebrow: "Stock on hand",
169
+ title: "Inventory batches",
170
+ subtitle: Ne ? "Loading…" : Y ? `${J.length} of ${O.length} ${O.length === 1 ? "batch" : "batches"} match` : `${O.length} ${O.length === 1 ? "batch" : "batches"} visible`,
171
+ children: [/* @__PURE__ */ d(b, {
172
+ direction: {
173
+ xs: "column",
174
+ md: "row"
175
+ },
176
+ spacing: 1.5,
177
+ sx: { mb: 2 },
178
+ alignItems: { md: "center" },
179
+ children: [
180
+ /* @__PURE__ */ u(C, {
181
+ size: "small",
182
+ fullWidth: !0,
183
+ placeholder: "Search product or lot…",
184
+ value: L,
185
+ onChange: (e) => R(e.target.value),
186
+ InputProps: { startAdornment: /* @__PURE__ */ u(ge, {
187
+ position: "start",
188
+ children: /* @__PURE__ */ u(je, { fontSize: "small" })
189
+ }) },
190
+ sx: { maxWidth: { md: 360 } }
191
+ }),
192
+ /* @__PURE__ */ d(he, {
193
+ size: "small",
194
+ sx: { minWidth: 160 },
195
+ children: [/* @__PURE__ */ u(_e, { children: "Status" }), /* @__PURE__ */ d(ye, {
196
+ label: "Status",
197
+ value: z,
198
+ onChange: (e) => {
199
+ let t = e.target.value;
200
+ B(t), t === "EXPIRED" && H(!1), t === "EXHAUSTED" && W(!1);
201
+ },
202
+ children: [/* @__PURE__ */ u(y, {
203
+ value: "ALL",
204
+ children: "All statuses"
205
+ }), o.map((e) => {
206
+ let t = e.value === "EXPIRED" && V || e.value === "EXHAUSTED" && U;
207
+ return /* @__PURE__ */ d(y, {
208
+ value: e.value,
209
+ disabled: t,
210
+ children: [e.label, t ? /* @__PURE__ */ u(w, {
211
+ component: "span",
212
+ variant: "caption",
213
+ color: "text.disabled",
214
+ sx: { ml: 1 },
215
+ children: "(clear chip first)"
216
+ }) : null]
217
+ }, e.value);
218
+ })]
219
+ })]
220
+ }),
221
+ /* @__PURE__ */ d(b, {
222
+ direction: "row",
223
+ spacing: 1,
224
+ useFlexGap: !0,
225
+ flexWrap: "wrap",
226
+ children: [
227
+ /* @__PURE__ */ u(m, {
228
+ label: "Not yet expired",
229
+ size: "small",
230
+ disabled: z === "EXPIRED",
231
+ onClick: () => {
232
+ H((e) => {
233
+ let t = !e;
234
+ return t && z === "EXPIRED" && B("ALL"), t;
235
+ });
236
+ },
237
+ color: V ? "primary" : "default",
238
+ variant: V ? "filled" : "outlined",
239
+ sx: {
240
+ fontWeight: 700,
241
+ borderRadius: 1.5
242
+ }
243
+ }),
244
+ /* @__PURE__ */ u(m, {
245
+ label: "Stock still left",
246
+ size: "small",
247
+ disabled: z === "EXHAUSTED",
248
+ onClick: () => {
249
+ W((e) => {
250
+ let t = !e;
251
+ return t && z === "EXHAUSTED" && B("ALL"), t;
252
+ });
253
+ },
254
+ color: U ? "primary" : "default",
255
+ variant: U ? "filled" : "outlined",
256
+ sx: {
257
+ fontWeight: 700,
258
+ borderRadius: 1.5
259
+ }
260
+ }),
261
+ /* @__PURE__ */ u(m, {
262
+ label: "Has wastage",
263
+ size: "small",
264
+ onClick: () => K((e) => !e),
265
+ color: G ? "primary" : "default",
266
+ variant: G ? "filled" : "outlined",
267
+ sx: {
268
+ fontWeight: 700,
269
+ borderRadius: 1.5
270
+ }
271
+ })
272
+ ]
273
+ }),
274
+ /* @__PURE__ */ u(f, { sx: { flexGrow: 1 } }),
275
+ /* @__PURE__ */ u(p, {
276
+ variant: "text",
277
+ onClick: X,
278
+ disabled: !Y,
279
+ children: "Clear"
280
+ })
281
+ ]
282
+ }), /* @__PURE__ */ d(re, {
283
+ dense: !0,
284
+ children: [/* @__PURE__ */ u(Se, { children: /* @__PURE__ */ d(S, { children: [
285
+ /* @__PURE__ */ u(x, { children: "Product" }),
286
+ /* @__PURE__ */ u(x, { children: "Lot" }),
287
+ /* @__PURE__ */ u(x, { children: "Owner" }),
288
+ /* @__PURE__ */ u(x, { children: "Expiry" }),
289
+ /* @__PURE__ */ u(x, {
290
+ align: "right",
291
+ children: "Stock"
292
+ }),
293
+ /* @__PURE__ */ u(x, { children: "Storage" }),
294
+ /* @__PURE__ */ u(x, { children: "Status" }),
295
+ /* @__PURE__ */ u(x, {
296
+ align: "right",
297
+ children: "Action"
298
+ })
299
+ ] }) }), /* @__PURE__ */ u(xe, { children: Ne ? Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ u(S, { children: Array.from({ length: 8 }).map((e, t) => /* @__PURE__ */ u(x, { children: /* @__PURE__ */ u(be, { height: 22 }) }, t)) }, t)) : J.length === 0 ? /* @__PURE__ */ u(ie, {
300
+ colSpan: 8,
301
+ icon: De,
302
+ title: Y ? "No batches match your filters" : "No batches in stock",
303
+ hint: Y ? "Adjust your search or filters." : "Record a purchase to add stock.",
304
+ action: Y ? /* @__PURE__ */ u(p, {
305
+ variant: "text",
306
+ size: "small",
307
+ onClick: X,
308
+ children: "Clear filters"
309
+ }) : null
310
+ }) : J.map((e) => {
311
+ let t = D(e), n = e.qtyPurchased > 0 ? e.qtyRemaining / e.qtyPurchased : 0;
312
+ return /* @__PURE__ */ d(S, {
313
+ hover: !0,
314
+ children: [
315
+ /* @__PURE__ */ u(x, { children: /* @__PURE__ */ d(b, {
316
+ direction: "row",
317
+ alignItems: "baseline",
318
+ spacing: 1,
319
+ sx: { minWidth: 0 },
320
+ children: [/* @__PURE__ */ u(w, {
321
+ variant: "body2",
322
+ sx: {
323
+ fontWeight: 700,
324
+ lineHeight: 1.2
325
+ },
326
+ children: e.productName
327
+ }), /* @__PURE__ */ u(te, { id: e.serialId })]
328
+ }) }),
329
+ /* @__PURE__ */ u(x, { children: e.lotNumber ? /* @__PURE__ */ u(f, {
330
+ component: "span",
331
+ sx: {
332
+ display: "inline-flex",
333
+ px: .7,
334
+ py: .1,
335
+ borderRadius: 1,
336
+ bgcolor: we(Fe.palette.primary.main, .06),
337
+ color: "primary.dark",
338
+ fontFamily: "monospace",
339
+ fontSize: "0.72rem",
340
+ fontWeight: 700
341
+ },
342
+ children: e.lotNumber
343
+ }) : /* @__PURE__ */ u(w, {
344
+ variant: "caption",
345
+ color: "text.disabled",
346
+ children: "—"
347
+ }) }),
348
+ /* @__PURE__ */ d(x, { children: [/* @__PURE__ */ u(w, {
349
+ variant: "body2",
350
+ sx: { fontWeight: 700 },
351
+ children: e.ownerName || (e.ownerType === "USER" ? "Personal" : "Facility")
352
+ }), /* @__PURE__ */ u(w, {
353
+ variant: "caption",
354
+ color: "text.secondary",
355
+ children: e.ownerType
356
+ })] }),
357
+ /* @__PURE__ */ u(x, { children: e.expiryDate ? /* @__PURE__ */ u(Ce, {
358
+ title: t ? "Past printed expiry" : "",
359
+ children: /* @__PURE__ */ u(w, {
360
+ variant: "body2",
361
+ sx: {
362
+ fontWeight: 700,
363
+ fontVariantNumeric: "tabular-nums",
364
+ color: t ? "error.dark" : "text.primary"
365
+ },
366
+ children: se(e.expiryDate)
367
+ })
368
+ }) : /* @__PURE__ */ u(w, {
369
+ variant: "caption",
370
+ color: "text.disabled",
371
+ children: "—"
372
+ }) }),
373
+ /* @__PURE__ */ u(x, {
374
+ align: "right",
375
+ sx: { minWidth: 150 },
376
+ children: /* @__PURE__ */ d(b, {
377
+ alignItems: "flex-end",
378
+ spacing: .5,
379
+ children: [
380
+ /* @__PURE__ */ d(w, {
381
+ variant: "body2",
382
+ sx: {
383
+ fontWeight: 800,
384
+ fontVariantNumeric: "tabular-nums"
385
+ },
386
+ children: [e.qtyRemaining, /* @__PURE__ */ d(w, {
387
+ component: "span",
388
+ variant: "caption",
389
+ color: "text.secondary",
390
+ sx: {
391
+ ml: .5,
392
+ fontVariantNumeric: "tabular-nums"
393
+ },
394
+ children: ["/ ", e.qtyPurchased]
395
+ })]
396
+ }),
397
+ /* @__PURE__ */ u(f, {
398
+ sx: { width: 80 },
399
+ children: /* @__PURE__ */ u(ve, {
400
+ variant: "determinate",
401
+ value: Math.min(100, Math.max(0, n * 100)),
402
+ sx: {
403
+ height: 4,
404
+ borderRadius: 2
405
+ },
406
+ color: n < .25 ? "warning" : "primary"
407
+ })
408
+ }),
409
+ Number(e.wastedQty ?? 0) > 0 ? /* @__PURE__ */ d(w, {
410
+ variant: "caption",
411
+ sx: {
412
+ color: "warning.dark",
413
+ fontWeight: 700
414
+ },
415
+ children: [e.wastedQty, " wasted"]
416
+ }) : null
417
+ ]
418
+ })
419
+ }),
420
+ /* @__PURE__ */ u(x, { children: e.storageUnitName ? /* @__PURE__ */ u(w, {
421
+ variant: "caption",
422
+ sx: { fontWeight: 700 },
423
+ children: e.storageUnitName
424
+ }) : /* @__PURE__ */ u(w, {
425
+ variant: "caption",
426
+ color: "text.disabled",
427
+ children: "—"
428
+ }) }),
429
+ /* @__PURE__ */ u(x, { children: /* @__PURE__ */ d(b, {
430
+ direction: "row",
431
+ spacing: .5,
432
+ flexWrap: "wrap",
433
+ useFlexGap: !0,
434
+ children: [
435
+ /* @__PURE__ */ u(m, {
436
+ size: "small",
437
+ color: oe(e.status),
438
+ label: a(o, e.status),
439
+ sx: {
440
+ fontWeight: 700,
441
+ borderRadius: 1.5,
442
+ height: 22
443
+ }
444
+ }),
445
+ e.isQuarantined ? /* @__PURE__ */ u(m, {
446
+ size: "small",
447
+ color: "error",
448
+ label: a(i, e.quarantineReason) || "Quarantined",
449
+ sx: {
450
+ fontWeight: 700,
451
+ borderRadius: 1.5,
452
+ height: 22
453
+ }
454
+ }) : null,
455
+ t && e.status !== "EXPIRED" ? /* @__PURE__ */ u(m, {
456
+ size: "small",
457
+ color: "warning",
458
+ label: "Expired",
459
+ sx: {
460
+ fontWeight: 700,
461
+ borderRadius: 1.5,
462
+ height: 22
463
+ }
464
+ }) : null,
465
+ e.sourceType ? /* @__PURE__ */ u(m, {
466
+ size: "small",
467
+ variant: "outlined",
468
+ color: e.sourceType === "PICKUP" ? "info" : e.sourceType === "TRANSFER_IN" ? "primary" : "default",
469
+ label: e.sourceType === "TRANSFER_IN" ? "Transfer" : e.sourceType === "PICKUP" ? "Pickup" : e.sourceType === "PURCHASE" ? "Purchase" : e.sourceType,
470
+ sx: {
471
+ fontWeight: 700,
472
+ borderRadius: 1.5,
473
+ height: 22
474
+ }
475
+ }) : null
476
+ ]
477
+ }) }),
478
+ /* @__PURE__ */ u(x, {
479
+ align: "right",
480
+ children: s ? e.isQuarantined ? /* @__PURE__ */ u(p, {
481
+ size: "small",
482
+ variant: "outlined",
483
+ color: "success",
484
+ startIcon: /* @__PURE__ */ u(ke, {}),
485
+ onClick: () => void Be(e),
486
+ children: "Unquarantine"
487
+ }) : /* @__PURE__ */ d(b, {
488
+ direction: "row",
489
+ spacing: 1,
490
+ justifyContent: "flex-end",
491
+ children: [t || e.status === "EXHAUSTED" || e.status === "IN_USE" || e.canBeQuarantined === !1 ? null : /* @__PURE__ */ u(p, {
492
+ size: "small",
493
+ variant: "outlined",
494
+ color: "error",
495
+ startIcon: /* @__PURE__ */ u(Oe, {}),
496
+ onClick: () => M({
497
+ open: !0,
498
+ batch: e,
499
+ reason: "OTHER",
500
+ notes: ""
501
+ }),
502
+ children: "Quarantine"
503
+ }), Number(e.qtyRemaining ?? 0) > 0 ? /* @__PURE__ */ u(p, {
504
+ size: "small",
505
+ variant: "outlined",
506
+ color: "warning",
507
+ startIcon: /* @__PURE__ */ u(Ae, {}),
508
+ onClick: () => Ie(e),
509
+ children: "Waste"
510
+ }) : null]
511
+ }) : null
512
+ })
513
+ ]
514
+ }, e.id);
515
+ }) })]
516
+ })]
517
+ })]
518
+ }),
519
+ /* @__PURE__ */ d(h, {
520
+ open: j.open,
521
+ onClose: () => M({
522
+ ...j,
523
+ open: !1
524
+ }),
525
+ fullWidth: !0,
526
+ maxWidth: "sm",
527
+ children: [
528
+ /* @__PURE__ */ u(v, { children: "Quarantine Batch" }),
529
+ /* @__PURE__ */ u(_, {
530
+ dividers: !0,
531
+ children: /* @__PURE__ */ d(b, {
532
+ spacing: 2,
533
+ sx: { pt: 1 },
534
+ children: [
535
+ /* @__PURE__ */ d(w, {
536
+ variant: "body2",
537
+ children: [
538
+ "Product: ",
539
+ /* @__PURE__ */ u("strong", { children: j.batch?.productName }),
540
+ /* @__PURE__ */ u("br", {}),
541
+ "Lot: ",
542
+ /* @__PURE__ */ u("strong", { children: j.batch?.lotNumber || "—" }),
543
+ /* @__PURE__ */ u("br", {}),
544
+ "Remaining: ",
545
+ /* @__PURE__ */ u("strong", { children: j.batch?.qtyRemaining })
546
+ ]
547
+ }),
548
+ /* @__PURE__ */ u(r, {
549
+ label: "Reason",
550
+ required: !0,
551
+ value: j.reason,
552
+ onChange: (e) => M({
553
+ ...j,
554
+ reason: e
555
+ }),
556
+ options: i,
557
+ error: !!c(j.reason, "Reason"),
558
+ helperText: c(j.reason, "Reason") || ""
559
+ }),
560
+ /* @__PURE__ */ u(C, {
561
+ label: "Notes",
562
+ size: "small",
563
+ multiline: !0,
564
+ minRows: 2,
565
+ fullWidth: !0,
566
+ value: j.notes,
567
+ onChange: (e) => M({
568
+ ...j,
569
+ notes: e.target.value
570
+ })
571
+ })
572
+ ]
573
+ })
574
+ }),
575
+ /* @__PURE__ */ d(g, { children: [/* @__PURE__ */ u(p, {
576
+ onClick: () => M({
577
+ ...j,
578
+ open: !1
579
+ }),
580
+ children: "Cancel"
581
+ }), /* @__PURE__ */ u(p, {
582
+ variant: "contained",
583
+ color: "error",
584
+ disabled: !!c(j.reason, "Reason"),
585
+ onClick: () => void ze(),
586
+ children: "Quarantine"
587
+ })] })
588
+ ]
589
+ }),
590
+ /* @__PURE__ */ d(h, {
591
+ open: N.open,
592
+ onClose: () => {
593
+ F || P({
594
+ ...N,
595
+ open: !1
596
+ });
597
+ },
598
+ fullWidth: !0,
599
+ maxWidth: "sm",
600
+ children: [
601
+ /* @__PURE__ */ u(v, { children: "Mark Wastage" }),
602
+ /* @__PURE__ */ u(_, {
603
+ dividers: !0,
604
+ children: /* @__PURE__ */ d(b, {
605
+ spacing: 2,
606
+ sx: { pt: 1 },
607
+ children: [
608
+ /* @__PURE__ */ d(w, {
609
+ variant: "body2",
610
+ children: [
611
+ "Product: ",
612
+ /* @__PURE__ */ u("strong", { children: N.batch?.productName }),
613
+ /* @__PURE__ */ u("br", {}),
614
+ "Lot: ",
615
+ /* @__PURE__ */ u("strong", { children: N.batch?.lotNumber || "—" }),
616
+ /* @__PURE__ */ u("br", {}),
617
+ "Available to waste: ",
618
+ /* @__PURE__ */ u("strong", { children: N.batch?.qtyRemaining ?? 0 })
619
+ ]
620
+ }),
621
+ /* @__PURE__ */ u(C, {
622
+ required: !0,
623
+ label: "Quantity to waste",
624
+ size: "small",
625
+ type: "number",
626
+ fullWidth: !0,
627
+ inputProps: {
628
+ min: 1,
629
+ max: Q
630
+ },
631
+ value: N.qty,
632
+ onChange: (e) => P({
633
+ ...N,
634
+ qty: e.target.value
635
+ }),
636
+ error: !!$,
637
+ helperText: $ || `Units to write off (max ${Q}).`
638
+ }),
639
+ /* @__PURE__ */ u(r, {
640
+ label: "Reason",
641
+ required: !0,
642
+ value: N.reason,
643
+ onChange: (e) => P({
644
+ ...N,
645
+ reason: e
646
+ }),
647
+ options: ae
648
+ }),
649
+ /* @__PURE__ */ u(C, {
650
+ label: "Comments",
651
+ size: "small",
652
+ multiline: !0,
653
+ minRows: 2,
654
+ fullWidth: !0,
655
+ value: N.comments,
656
+ onChange: (e) => P({
657
+ ...N,
658
+ comments: e.target.value
659
+ })
660
+ })
661
+ ]
662
+ })
663
+ }),
664
+ /* @__PURE__ */ d(g, { children: [/* @__PURE__ */ u(p, {
665
+ onClick: () => P({
666
+ ...N,
667
+ open: !1
668
+ }),
669
+ disabled: F,
670
+ children: "Cancel"
671
+ }), /* @__PURE__ */ u(p, {
672
+ variant: "contained",
673
+ color: "warning",
674
+ disabled: !Le || F,
675
+ onClick: () => void Re(),
676
+ children: F ? "Recording…" : "Mark Wastage"
677
+ })] })
678
+ ]
679
+ })
680
+ ]
681
+ })] });
682
+ }
683
+ //#endregion
684
+ export { O as default };
685
+
686
+ //# sourceMappingURL=InventoryPage-_VWlqD2e.js.map