@argusoft/medplat-product-management 1.0.2 → 1.0.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 (83) hide show
  1. package/dist/{BrandsPage-CSA3meke.js → BrandsPage-BE3kn-8b.js} +77 -75
  2. package/dist/BrandsPage-BE3kn-8b.js.map +1 -0
  3. package/dist/{CategoriesPage-BrspzkJL.js → CategoriesPage-COqi3pMi.js} +71 -70
  4. package/dist/{CategoriesPage-BrspzkJL.js.map → CategoriesPage-COqi3pMi.js.map} +1 -1
  5. package/dist/{DashboardPage-CqaquOs2.js → DashboardPage-C_H1Jrey.js} +90 -89
  6. package/dist/DashboardPage-C_H1Jrey.js.map +1 -0
  7. package/dist/{FacilityPicker-Dv_H95WW.js → FacilityPicker-Diq2hnYg.js} +2 -2
  8. package/dist/{FacilityPicker-Dv_H95WW.js.map → FacilityPicker-Diq2hnYg.js.map} +1 -1
  9. package/dist/{InventoryPage-CPbzfDMR.js → InventoryPage-Bjpw6vTz.js} +106 -115
  10. package/dist/InventoryPage-Bjpw6vTz.js.map +1 -0
  11. package/dist/{MemberProfileCard-0vjO3Gzd.js → MemberProfileCard-BLUVRILO.js} +10 -9
  12. package/dist/MemberProfileCard-BLUVRILO.js.map +1 -0
  13. package/dist/{PaymentCreatePage-BYmDZAIB.js → PaymentCreatePage-B5VOgTx9.js} +173 -177
  14. package/dist/PaymentCreatePage-B5VOgTx9.js.map +1 -0
  15. package/dist/{PaymentsPage-BXPvKon-.js → PaymentsPage-DY6BclkN.js} +24 -23
  16. package/dist/{PaymentsPage-BXPvKon-.js.map → PaymentsPage-DY6BclkN.js.map} +1 -1
  17. package/dist/PickupCreatePage-CCSiyFQF.js +706 -0
  18. package/dist/PickupCreatePage-CCSiyFQF.js.map +1 -0
  19. package/dist/{PickupsPage-D66_Wta4.js → PickupsPage-DGi6T5Of.js} +83 -90
  20. package/dist/PickupsPage-DGi6T5Of.js.map +1 -0
  21. package/dist/PmGuard-C90yhpsN.js +592 -0
  22. package/dist/PmGuard-C90yhpsN.js.map +1 -0
  23. package/dist/{PmTable-B9970kPY.js → PmTable-BkK65bJQ.js} +98 -98
  24. package/dist/PmTable-BkK65bJQ.js.map +1 -0
  25. package/dist/{ProductEditPage-B8qFTCW9.js → ProductEditPage-CQj9egzW.js} +138 -137
  26. package/dist/ProductEditPage-CQj9egzW.js.map +1 -0
  27. package/dist/{ProductsPage-C7_r9cKn.js → ProductsPage-i8QVw_Jm.js} +65 -64
  28. package/dist/{ProductsPage-C7_r9cKn.js.map → ProductsPage-i8QVw_Jm.js.map} +1 -1
  29. package/dist/PurchaseCreatePage-Bp6bl9n8.js +591 -0
  30. package/dist/PurchaseCreatePage-Bp6bl9n8.js.map +1 -0
  31. package/dist/{PurchaseRequestDetailPage-C7aAwEqw.js → PurchaseRequestDetailPage-CNAqIFef.js} +216 -215
  32. package/dist/PurchaseRequestDetailPage-CNAqIFef.js.map +1 -0
  33. package/dist/{PurchaseRequestsPage-BwCkbpaX.js → PurchaseRequestsPage-BJqDlNrc.js} +57 -56
  34. package/dist/{PurchaseRequestsPage-BwCkbpaX.js.map → PurchaseRequestsPage-BJqDlNrc.js.map} +1 -1
  35. package/dist/{PurchasesPage-CvaZouVy.js → PurchasesPage-BQEToymQ.js} +76 -75
  36. package/dist/{PurchasesPage-CvaZouVy.js.map → PurchasesPage-BQEToymQ.js.map} +1 -1
  37. package/dist/{SaleCreatePage-DP1Qmltu.js → SaleCreatePage-DbfBK4PH.js} +149 -173
  38. package/dist/SaleCreatePage-DbfBK4PH.js.map +1 -0
  39. package/dist/{SalesPage-CO3cdYX5.js → SalesPage-CTBJMxZe.js} +50 -49
  40. package/dist/SalesPage-CTBJMxZe.js.map +1 -0
  41. package/dist/SettingsPage-CiwVmzM3.js +663 -0
  42. package/dist/SettingsPage-CiwVmzM3.js.map +1 -0
  43. package/dist/{StorageUnitsPage-B9Hr_RkW.js → StorageUnitsPage-BV7nK_iE.js} +57 -56
  44. package/dist/{StorageUnitsPage-B9Hr_RkW.js.map → StorageUnitsPage-BV7nK_iE.js.map} +1 -1
  45. package/dist/{TransactionsPage-HKIGwEZN.js → TransactionsPage-Cocn4901.js} +55 -54
  46. package/dist/TransactionsPage-Cocn4901.js.map +1 -0
  47. package/dist/TransferCreatePage-DbjcjuOg.js +316 -0
  48. package/dist/TransferCreatePage-DbjcjuOg.js.map +1 -0
  49. package/dist/TransfersPage-BFVF7Xvc.js +471 -0
  50. package/dist/TransfersPage-BFVF7Xvc.js.map +1 -0
  51. package/dist/VialsPage-BNzYTLVd.js +321 -0
  52. package/dist/VialsPage-BNzYTLVd.js.map +1 -0
  53. package/dist/index.js +652 -34
  54. package/dist/index.js.map +1 -1
  55. package/dist/settingsStore-KW217unV.js +417 -0
  56. package/dist/settingsStore-KW217unV.js.map +1 -0
  57. package/package.json +1 -1
  58. package/dist/BrandsPage-CSA3meke.js.map +0 -1
  59. package/dist/DashboardPage-CqaquOs2.js.map +0 -1
  60. package/dist/InventoryPage-CPbzfDMR.js.map +0 -1
  61. package/dist/MemberProfileCard-0vjO3Gzd.js.map +0 -1
  62. package/dist/PaymentCreatePage-BYmDZAIB.js.map +0 -1
  63. package/dist/PickupCreatePage-CMGwoAXj.js +0 -426
  64. package/dist/PickupCreatePage-CMGwoAXj.js.map +0 -1
  65. package/dist/PickupsPage-D66_Wta4.js.map +0 -1
  66. package/dist/PmTable-B9970kPY.js.map +0 -1
  67. package/dist/ProductEditPage-B8qFTCW9.js.map +0 -1
  68. package/dist/PurchaseCreatePage-CDfNDcKG.js +0 -627
  69. package/dist/PurchaseCreatePage-CDfNDcKG.js.map +0 -1
  70. package/dist/PurchaseRequestDetailPage-C7aAwEqw.js.map +0 -1
  71. package/dist/SaleCreatePage-DP1Qmltu.js.map +0 -1
  72. package/dist/SalesPage-CO3cdYX5.js.map +0 -1
  73. package/dist/SettingsPage-DvVRwSFw.js +0 -711
  74. package/dist/SettingsPage-DvVRwSFw.js.map +0 -1
  75. package/dist/TransactionsPage-HKIGwEZN.js.map +0 -1
  76. package/dist/TransferCreatePage-DMuZqQ3c.js +0 -363
  77. package/dist/TransferCreatePage-DMuZqQ3c.js.map +0 -1
  78. package/dist/TransfersPage-COIyouL4.js +0 -480
  79. package/dist/TransfersPage-COIyouL4.js.map +0 -1
  80. package/dist/VialsPage-BNPUwGCU.js +0 -922
  81. package/dist/VialsPage-BNPUwGCU.js.map +0 -1
  82. package/dist/currency-ClRLIEg2.js +0 -1372
  83. package/dist/currency-ClRLIEg2.js.map +0 -1
@@ -0,0 +1,592 @@
1
+ import { r as e, t } from "./settingsStore-KW217unV.js";
2
+ import { useEffect as n, useMemo as r } from "react";
3
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
4
+ import s from "prop-types";
5
+ import { Alert as c, Box as l, Button as u, Chip as d, Fade as f, LinearProgress as p, Stack as m, Tab as h, Tabs as g, Typography as _ } from "@mui/material";
6
+ import v from "@mui/icons-material/VaccinesRounded";
7
+ import { alpha as y, useTheme as b } from "@mui/material/styles";
8
+ import x from "@mui/icons-material/SellRounded";
9
+ import { useLocation as S, useNavigate as C } from "react-router-dom";
10
+ import w from "@mui/icons-material/SpaceDashboardRounded";
11
+ import T from "@mui/icons-material/SettingsRounded";
12
+ import E from "@mui/icons-material/LayersRounded";
13
+ import D from "@mui/icons-material/CategoryRounded";
14
+ import O from "@mui/icons-material/Inventory2Rounded";
15
+ import k from "@mui/icons-material/WarehouseRounded";
16
+ import A from "@mui/icons-material/LocalShippingRounded";
17
+ import j from "@mui/icons-material/WidgetsRounded";
18
+ import M from "@mui/icons-material/ShoppingCartRounded";
19
+ import N from "@mui/icons-material/FactCheckRounded";
20
+ import P from "@mui/icons-material/MoveDownRounded";
21
+ import F from "@mui/icons-material/SwapHorizRounded";
22
+ import I from "@mui/icons-material/PointOfSaleRounded";
23
+ import L from "@mui/icons-material/PaymentsRounded";
24
+ import R from "@mui/icons-material/ReceiptLongRounded";
25
+ import { useSelector as z } from "react-redux";
26
+ import B from "@mui/icons-material/LockOutlined";
27
+ //#region src/utils/workspaces.js
28
+ var V = {
29
+ id: "dashboard",
30
+ label: "Dashboard",
31
+ path: "/ui/medplat/manage/pm",
32
+ icon: w,
33
+ accent: "#6366f1",
34
+ accentDark: "#4338ca",
35
+ permissionId: "view.manage.productManagement"
36
+ }, H = {
37
+ id: "settings",
38
+ label: "Settings",
39
+ path: "/ui/medplat/manage/pm/settings",
40
+ icon: T,
41
+ accent: "#64748b",
42
+ accentDark: "#334155",
43
+ permissionId: "view.manage.productManagement.settings"
44
+ }, U = [
45
+ {
46
+ id: "catalog",
47
+ label: "Catalog",
48
+ description: "Define what you sell and where you keep it. Master data — configured once, used everywhere.",
49
+ icon: E,
50
+ accent: "#8b5cf6",
51
+ accentDark: "#6d28d9",
52
+ accentSoft: "#ede9fe",
53
+ items: [
54
+ {
55
+ id: "categories",
56
+ label: "Categories",
57
+ path: "/ui/medplat/manage/pm/categories",
58
+ icon: D,
59
+ permissionId: "view.manage.productManagement.category"
60
+ },
61
+ {
62
+ id: "brands",
63
+ label: "Brands",
64
+ path: "/ui/medplat/manage/pm/brands",
65
+ icon: x,
66
+ permissionId: "view.manage.productManagement.brand"
67
+ },
68
+ {
69
+ id: "products",
70
+ label: "Products",
71
+ path: "/ui/medplat/manage/pm/products",
72
+ icon: O,
73
+ permissionId: "view.manage.productManagement.product"
74
+ },
75
+ {
76
+ id: "storage",
77
+ label: "Storage Units",
78
+ path: "/ui/medplat/manage/pm/storage-units",
79
+ icon: k,
80
+ permissionId: "view.manage.productManagement.storageUnit"
81
+ }
82
+ ]
83
+ },
84
+ {
85
+ id: "operations",
86
+ label: "Operations",
87
+ description: "Run the day — receive stock, sell to customers, administer vaccines, collect payments.",
88
+ icon: A,
89
+ accent: "#10b981",
90
+ accentDark: "#047857",
91
+ accentSoft: "#d1fae5",
92
+ items: [
93
+ {
94
+ id: "purchase-requests",
95
+ label: "Purchase Requests",
96
+ path: "/ui/medplat/manage/pm/purchase-requests",
97
+ icon: N,
98
+ anyOfPermissionIds: ["view.manage.productManagement.purchase", "approve.manage.productManagement.purchase"],
99
+ purchaseApprovalGroup: !0
100
+ },
101
+ {
102
+ id: "purchases",
103
+ label: "Purchases",
104
+ path: "/ui/medplat/manage/pm/purchases",
105
+ icon: M,
106
+ permissionId: "view.manage.productManagement.purchase",
107
+ hiddenWhenConfirmationOn: !0
108
+ },
109
+ {
110
+ id: "inventory",
111
+ label: "Inventory",
112
+ path: "/ui/medplat/manage/pm/inventory",
113
+ icon: j,
114
+ permissionId: "view.manage.productManagement.inventory"
115
+ },
116
+ {
117
+ id: "pickups",
118
+ label: "Pickups",
119
+ path: "/ui/medplat/manage/pm/pickups",
120
+ icon: P,
121
+ permissionId: "view.manage.productManagement.pickup"
122
+ },
123
+ {
124
+ id: "transfers",
125
+ label: "Transfers",
126
+ path: "/ui/medplat/manage/pm/transfers",
127
+ icon: F,
128
+ permissionId: "view.manage.productManagement.transfer"
129
+ },
130
+ {
131
+ id: "sales",
132
+ label: "Sales",
133
+ path: "/ui/medplat/manage/pm/sales",
134
+ icon: I,
135
+ permissionId: "view.manage.productManagement.sale",
136
+ salesGroup: !0
137
+ },
138
+ {
139
+ id: "vials",
140
+ label: "Vial",
141
+ path: "/ui/medplat/manage/pm/vials",
142
+ icon: v,
143
+ permissionId: "view.manage.productManagement.vial"
144
+ },
145
+ {
146
+ id: "payments",
147
+ label: "Payments",
148
+ path: "/ui/medplat/manage/pm/payments",
149
+ icon: L,
150
+ permissionId: "view.manage.productManagement.payment",
151
+ salesGroup: !0
152
+ }
153
+ ]
154
+ },
155
+ {
156
+ id: "ledger",
157
+ label: "Ledger",
158
+ description: "Every stock and money movement, append-only, with full lot / volume / monetary detail.",
159
+ icon: R,
160
+ accent: "#f59e0b",
161
+ accentDark: "#b45309",
162
+ accentSoft: "#fef3c7",
163
+ items: [{
164
+ id: "transactions",
165
+ label: "Transactions",
166
+ path: "/ui/medplat/manage/pm/transactions",
167
+ icon: R,
168
+ permissionId: "view.manage.productManagement.ledger"
169
+ }]
170
+ }
171
+ ];
172
+ function W(e, t) {
173
+ let n = t?.manageSales !== !1, r = t?.requirePurchaseConfirmation === !0;
174
+ return U.map((t) => ({
175
+ ...t,
176
+ items: t.items.filter((t) => (t.anyOfPermissionIds ? !!e?.hasAny?.(t.anyOfPermissionIds) : !!e?.has?.(t.permissionId)) && (n || !t.salesGroup) && (r || !t.purchaseApprovalGroup) && (!r || !t.hiddenWhenConfirmationOn))
177
+ })).filter((e) => e.items.length > 0);
178
+ }
179
+ function G(e) {
180
+ if (!e) return null;
181
+ for (let t of U) if (t.items.some((t) => e.startsWith(t.path))) return t;
182
+ return null;
183
+ }
184
+ function K(e) {
185
+ if (!e) return null;
186
+ for (let t of U) {
187
+ let n = t.items.find((t) => e.startsWith(t.path));
188
+ if (n) return {
189
+ workspace: t,
190
+ item: n
191
+ };
192
+ }
193
+ return null;
194
+ }
195
+ //#endregion
196
+ //#region src/components/PmPageShell.jsx
197
+ function q({ title: e, subtitle: r, chips: s = [], actions: c, children: u }) {
198
+ let p = b(), { pathname: h } = S();
199
+ n(() => {
200
+ t().catch(() => {});
201
+ }, []);
202
+ let g = h.startsWith(V.path), v = h.startsWith(H.path), x = K(h), C = x?.workspace, w = g ? V.accent : v ? H.accent : C?.accent ?? p.palette.primary.main, T = g ? V.accentDark : v ? H.accentDark : C?.accentDark ?? p.palette.primary.dark;
203
+ return /* @__PURE__ */ o(l, {
204
+ sx: {
205
+ position: "relative",
206
+ px: {
207
+ xs: 1,
208
+ md: 2
209
+ },
210
+ py: {
211
+ xs: 1,
212
+ md: 2
213
+ }
214
+ },
215
+ children: [
216
+ /* @__PURE__ */ o(l, {
217
+ sx: {
218
+ position: "absolute",
219
+ inset: 0,
220
+ pointerEvents: "none",
221
+ overflow: "hidden"
222
+ },
223
+ children: [/* @__PURE__ */ a(l, { sx: {
224
+ position: "absolute",
225
+ top: -60,
226
+ right: -40,
227
+ width: 260,
228
+ height: 260,
229
+ borderRadius: "50%",
230
+ background: `radial-gradient(circle, ${y(w, .18)} 0%, transparent 70%)`,
231
+ filter: "blur(2px)"
232
+ } }), /* @__PURE__ */ a(l, { sx: {
233
+ position: "absolute",
234
+ top: 40,
235
+ left: -50,
236
+ width: 200,
237
+ height: 200,
238
+ borderRadius: "50%",
239
+ background: `radial-gradient(circle, ${y(p.palette.info.main, .08)} 0%, transparent 72%)`,
240
+ filter: "blur(2px)"
241
+ } })]
242
+ }),
243
+ /* @__PURE__ */ a(l, {
244
+ sx: {
245
+ position: "relative",
246
+ zIndex: 1,
247
+ mb: 2,
248
+ p: {
249
+ xs: 2,
250
+ md: 2.5
251
+ },
252
+ borderRadius: 1.5,
253
+ border: `1px solid ${y(w, .18)}`,
254
+ background: `linear-gradient(135deg, ${y(p.palette.background.paper, .98)} 0%, ${y(w, .07)} 100%)`,
255
+ boxShadow: `0 18px 44px ${y(p.palette.common.black, .06)}`,
256
+ overflow: "hidden",
257
+ "&::before": {
258
+ content: "\"\"",
259
+ position: "absolute",
260
+ left: 0,
261
+ top: 0,
262
+ bottom: 0,
263
+ width: 4,
264
+ background: `linear-gradient(180deg, ${w} 0%, ${T} 100%)`
265
+ }
266
+ },
267
+ children: /* @__PURE__ */ o(m, {
268
+ direction: {
269
+ xs: "column",
270
+ md: "row"
271
+ },
272
+ justifyContent: "space-between",
273
+ alignItems: {
274
+ xs: "flex-start",
275
+ md: "center"
276
+ },
277
+ spacing: 1.5,
278
+ children: [/* @__PURE__ */ o(l, {
279
+ sx: { minWidth: 0 },
280
+ children: [
281
+ C || g || v ? /* @__PURE__ */ o(m, {
282
+ direction: "row",
283
+ alignItems: "center",
284
+ spacing: .75,
285
+ sx: { mb: .75 },
286
+ children: [
287
+ (() => {
288
+ let e = g ? V.icon : v ? H.icon : C.icon;
289
+ return e ? /* @__PURE__ */ a(e, { sx: {
290
+ fontSize: 16,
291
+ color: T
292
+ } }) : null;
293
+ })(),
294
+ /* @__PURE__ */ a(_, {
295
+ variant: "overline",
296
+ sx: {
297
+ color: T,
298
+ fontWeight: 800,
299
+ letterSpacing: 1.1,
300
+ lineHeight: 1
301
+ },
302
+ children: g ? "Overview" : v ? "Configuration" : C.label
303
+ }),
304
+ x?.item ? /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(l, { sx: {
305
+ width: 4,
306
+ height: 4,
307
+ borderRadius: "50%",
308
+ bgcolor: y(w, .4),
309
+ mx: .5
310
+ } }), /* @__PURE__ */ a(_, {
311
+ variant: "overline",
312
+ sx: {
313
+ color: p.palette.text.secondary,
314
+ fontWeight: 700,
315
+ letterSpacing: .8
316
+ },
317
+ children: x.item.label
318
+ })] }) : null
319
+ ]
320
+ }) : null,
321
+ /* @__PURE__ */ a(_, {
322
+ variant: "h5",
323
+ sx: {
324
+ fontWeight: 800,
325
+ color: p.palette.text.primary,
326
+ lineHeight: 1.2
327
+ },
328
+ children: e
329
+ }),
330
+ r ? /* @__PURE__ */ a(_, {
331
+ variant: "body2",
332
+ sx: {
333
+ mt: .75,
334
+ maxWidth: 900,
335
+ color: p.palette.text.secondary
336
+ },
337
+ children: r
338
+ }) : null,
339
+ s?.length ? /* @__PURE__ */ a(m, {
340
+ direction: "row",
341
+ spacing: 1,
342
+ useFlexGap: !0,
343
+ flexWrap: "wrap",
344
+ sx: { mt: 1.5 },
345
+ children: s.map((e) => /* @__PURE__ */ a(d, {
346
+ label: e,
347
+ size: "small",
348
+ sx: {
349
+ borderRadius: 2,
350
+ backgroundColor: y(w, .1),
351
+ color: T,
352
+ fontWeight: 700,
353
+ border: `1px solid ${y(w, .2)}`
354
+ }
355
+ }, e))
356
+ }) : null
357
+ ]
358
+ }), c ? /* @__PURE__ */ a(l, { children: c }) : null]
359
+ })
360
+ }),
361
+ /* @__PURE__ */ a(f, {
362
+ in: !0,
363
+ timeout: 360,
364
+ children: /* @__PURE__ */ a(l, {
365
+ sx: {
366
+ position: "relative",
367
+ zIndex: 1,
368
+ "& .MuiInputLabel-root": {
369
+ fontSize: "0.95rem",
370
+ color: p.palette.text.primary
371
+ },
372
+ "& .MuiInputLabel-root.Mui-focused": { color: p.palette.primary.main },
373
+ "& .MuiFormHelperText-root": {
374
+ fontSize: "0.78rem",
375
+ color: y(p.palette.text.primary, .7)
376
+ }
377
+ },
378
+ children: u
379
+ })
380
+ }, h)
381
+ ]
382
+ });
383
+ }
384
+ q.propTypes = {
385
+ title: s.node,
386
+ subtitle: s.node,
387
+ chips: s.arrayOf(s.string),
388
+ actions: s.node,
389
+ children: s.node
390
+ };
391
+ //#endregion
392
+ //#region src/utils/permissions.js
393
+ var J = "techo.manage.pm";
394
+ function Y(e, t, r) {
395
+ let i = X(), a = Array.isArray(e) ? i.hasAny(e) : !!e && i.has(e);
396
+ n(() => {
397
+ if (a) return t();
398
+ }, [a, ...r ?? []]);
399
+ }
400
+ function X() {
401
+ let e = z((e) => e.Authenticate?.linearMenuItems);
402
+ return r(() => {
403
+ let t = e?.[J]?.featureJson;
404
+ if (typeof t == "string") try {
405
+ t = JSON.parse(t);
406
+ } catch {
407
+ t = {};
408
+ }
409
+ let n = t && typeof t == "object" ? t : {}, r = (e) => !!e && n[e] === !0;
410
+ return {
411
+ has: r,
412
+ hasAny: (e) => Array.isArray(e) && e.some(r)
413
+ };
414
+ }, [e]);
415
+ }
416
+ //#endregion
417
+ //#region src/components/PmNav.jsx
418
+ function Z() {
419
+ let t = C(), n = S(), i = b(), s = e(), c = X(), u = r(() => W(c, s), [c, s]), d = c.has(V.permissionId), f = c.has(H.permissionId), p = n.pathname.startsWith(V.path), v = n.pathname.startsWith(H.path), x = G(n.pathname), w = x ? u.find((e) => e.id === x.id) ?? null : null, T = p ? V.accent : v ? H.accent : x?.accent ?? i.palette.primary.main, E = w ? w.items.findIndex((e) => n.pathname.startsWith(e.path)) : -1;
420
+ function D(e, t) {
421
+ return {
422
+ px: 2,
423
+ py: .9,
424
+ borderRadius: 999,
425
+ cursor: "pointer",
426
+ display: "inline-flex",
427
+ alignItems: "center",
428
+ gap: 1,
429
+ fontWeight: 700,
430
+ fontSize: "0.875rem",
431
+ letterSpacing: .2,
432
+ transition: "all 220ms cubic-bezier(0.4, 0, 0.2, 1)",
433
+ color: e ? "#fff" : i.palette.text.secondary,
434
+ backgroundColor: e ? t : "transparent",
435
+ boxShadow: e ? `0 8px 22px ${y(t, .32)}` : "none",
436
+ "&:hover": {
437
+ color: e ? "#fff" : t,
438
+ backgroundColor: e ? t : y(t, .08),
439
+ transform: e ? "none" : "translateY(-1px)"
440
+ }
441
+ };
442
+ }
443
+ function O({ id: e, label: t, icon: n, active: r, onClick: i, hue: s }) {
444
+ return /* @__PURE__ */ o(l, {
445
+ role: "button",
446
+ onClick: i,
447
+ sx: D(r, s),
448
+ children: [n ? /* @__PURE__ */ a(n, { sx: { fontSize: 18 } }) : null, t]
449
+ }, e);
450
+ }
451
+ return /* @__PURE__ */ o(l, {
452
+ sx: { mb: 2 },
453
+ children: [/* @__PURE__ */ a(l, {
454
+ sx: {
455
+ position: "relative",
456
+ borderRadius: 1.5,
457
+ p: 1,
458
+ background: `linear-gradient(135deg, ${y(i.palette.background.paper, .96)} 0%, ${y(T, .06)} 100%)`,
459
+ border: `1px solid ${y(i.palette.divider, .7)}`,
460
+ boxShadow: `0 10px 28px ${y(i.palette.common.black, .04)}`
461
+ },
462
+ children: /* @__PURE__ */ o(m, {
463
+ direction: "row",
464
+ alignItems: "center",
465
+ spacing: .75,
466
+ flexWrap: "wrap",
467
+ useFlexGap: !0,
468
+ children: [
469
+ d ? O({
470
+ id: V.id,
471
+ label: V.label,
472
+ icon: V.icon,
473
+ active: p,
474
+ hue: V.accent,
475
+ onClick: () => t(V.path)
476
+ }) : null,
477
+ d && u.length > 0 ? /* @__PURE__ */ a(l, { sx: {
478
+ width: 1,
479
+ height: 22,
480
+ mx: .5,
481
+ bgcolor: "divider",
482
+ opacity: .7
483
+ } }) : null,
484
+ u.map((e) => O({
485
+ id: e.id,
486
+ label: e.label,
487
+ icon: e.icon,
488
+ active: x?.id === e.id,
489
+ hue: e.accent,
490
+ onClick: () => e.items[0] && t(e.items[0].path)
491
+ })),
492
+ /* @__PURE__ */ a(l, { sx: { flexGrow: 1 } }),
493
+ f ? O({
494
+ id: H.id,
495
+ label: H.label,
496
+ icon: H.icon,
497
+ active: v,
498
+ hue: H.accent,
499
+ onClick: () => t(H.path)
500
+ }) : null
501
+ ]
502
+ })
503
+ }), w && w.items.length > 0 ? /* @__PURE__ */ a(l, {
504
+ sx: {
505
+ mt: 1,
506
+ borderRadius: 1.5,
507
+ px: 1,
508
+ bgcolor: y(w.accent, .04),
509
+ border: `1px solid ${y(w.accent, .12)}`
510
+ },
511
+ children: /* @__PURE__ */ a(g, {
512
+ value: E === -1 ? !1 : E,
513
+ onChange: (e, n) => t(w.items[n].path),
514
+ variant: "scrollable",
515
+ scrollButtons: "auto",
516
+ slotProps: { indicator: { sx: {
517
+ backgroundColor: w.accent,
518
+ height: 3,
519
+ borderRadius: 2
520
+ } } },
521
+ sx: {
522
+ minHeight: 44,
523
+ "& .MuiTab-root": {
524
+ minHeight: 44,
525
+ fontWeight: 700,
526
+ textTransform: "none",
527
+ fontSize: "0.85rem",
528
+ color: i.palette.text.secondary,
529
+ transition: "color 180ms ease",
530
+ "&:hover": { color: w.accentDark },
531
+ "&.Mui-selected": { color: w.accentDark }
532
+ }
533
+ },
534
+ children: w.items.map((e) => {
535
+ let t = e.icon;
536
+ return /* @__PURE__ */ a(h, {
537
+ iconPosition: "start",
538
+ icon: t ? /* @__PURE__ */ a(t, { sx: { fontSize: 18 } }) : void 0,
539
+ label: /* @__PURE__ */ a(_, {
540
+ component: "span",
541
+ sx: { fontWeight: 700 },
542
+ children: e.label
543
+ })
544
+ }, e.id);
545
+ })
546
+ })
547
+ }) : null]
548
+ });
549
+ }
550
+ //#endregion
551
+ //#region src/components/PmGuard.jsx
552
+ function Q({ perm: e, anyOf: t, children: n, title: r = "You don’t have access to this page" }) {
553
+ let i = X(), s = C();
554
+ return z((e) => e.Authenticate?.linearMenuItems) == null ? /* @__PURE__ */ a(l, {
555
+ sx: { p: 3 },
556
+ children: /* @__PURE__ */ a(p, {})
557
+ }) : (t ? i.hasAny(t) : i.has(e)) ? n : /* @__PURE__ */ a(l, {
558
+ sx: { p: 3 },
559
+ children: /* @__PURE__ */ a(c, {
560
+ severity: "warning",
561
+ icon: /* @__PURE__ */ a(B, {}),
562
+ sx: {
563
+ borderRadius: 1.5,
564
+ alignItems: "flex-start"
565
+ },
566
+ children: /* @__PURE__ */ o(m, {
567
+ spacing: 1.25,
568
+ children: [
569
+ /* @__PURE__ */ a(_, {
570
+ sx: { fontWeight: 800 },
571
+ children: r
572
+ }),
573
+ /* @__PURE__ */ a(_, {
574
+ variant: "body2",
575
+ color: "text.secondary",
576
+ children: "Your account doesn’t have the required permission to view this section of Product Management. Ask an admin to grant it via the role / user permission assignment."
577
+ }),
578
+ /* @__PURE__ */ a(l, { children: /* @__PURE__ */ a(u, {
579
+ size: "small",
580
+ variant: "contained",
581
+ onClick: () => s("/ui/medplat/manage/pm"),
582
+ children: "Back to Dashboard"
583
+ }) })
584
+ ]
585
+ })
586
+ })
587
+ });
588
+ }
589
+ //#endregion
590
+ export { q as a, X as i, Z as n, W as o, Y as r, Q as t };
591
+
592
+ //# sourceMappingURL=PmGuard-C90yhpsN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PmGuard-C90yhpsN.js","names":[],"sources":["../src/utils/workspaces.js","../src/components/PmPageShell.jsx","../src/utils/permissions.js","../src/components/PmNav.jsx","../src/components/PmGuard.jsx"],"sourcesContent":["// Information architecture: the module is split into three \"workspaces\" that\n// match real-world roles in a clinic / store.\n//\n// Catalog — master-data setup (configured occasionally by an admin)\n// Operations — daily floor work (stock, sales, vials, payments)\n// Ledger — read-only audit trail (every stock + money movement)\n//\n// Each workspace has its own accent hue so the operator knows which\n// \"section\" of the tool they're in without explicit labels everywhere.\n// Dashboard sits outside any workspace — it's the landing page.\n\nimport SpaceDashboardRoundedIcon from '@mui/icons-material/SpaceDashboardRounded';\nimport SettingsRoundedIcon from '@mui/icons-material/SettingsRounded';\nimport LayersRoundedIcon from '@mui/icons-material/LayersRounded';\nimport CategoryRoundedIcon from '@mui/icons-material/CategoryRounded';\nimport SellRoundedIcon from '@mui/icons-material/SellRounded';\nimport Inventory2RoundedIcon from '@mui/icons-material/Inventory2Rounded';\nimport WarehouseRoundedIcon from '@mui/icons-material/WarehouseRounded';\nimport LocalShippingRoundedIcon from '@mui/icons-material/LocalShippingRounded';\nimport WidgetsRoundedIcon from '@mui/icons-material/WidgetsRounded';\nimport ShoppingCartRoundedIcon from '@mui/icons-material/ShoppingCartRounded';\nimport FactCheckRoundedIcon from '@mui/icons-material/FactCheckRounded';\nimport MoveDownRoundedIcon from '@mui/icons-material/MoveDownRounded';\nimport SwapHorizRoundedIcon from '@mui/icons-material/SwapHorizRounded';\nimport PointOfSaleRoundedIcon from '@mui/icons-material/PointOfSaleRounded';\nimport VaccinesRoundedIcon from '@mui/icons-material/VaccinesRounded';\nimport PaymentsRoundedIcon from '@mui/icons-material/PaymentsRounded';\nimport ReceiptLongRoundedIcon from '@mui/icons-material/ReceiptLongRounded';\n\n// Permission ids match the backend's api_permission rows. Treated as plain\n// strings here — there's no parallel constants table; the featureJson at\n// runtime is the source of truth for what each user has been granted.\nexport const DASHBOARD = {\n id: 'dashboard',\n label: 'Dashboard',\n path: '/ui/medplat/manage/pm',\n icon: SpaceDashboardRoundedIcon,\n accent: '#6366f1', // indigo — the \"home\" accent\n accentDark: '#4338ca',\n permissionId: 'view.manage.productManagement',\n};\n\n// Settings sits outside the three workspaces — administrative, rarely used,\n// available as its own pill on the nav row alongside Dashboard.\nexport const SETTINGS = {\n id: 'settings',\n label: 'Settings',\n path: '/ui/medplat/manage/pm/settings',\n icon: SettingsRoundedIcon,\n accent: '#64748b', // slate — quiet, non-competing\n accentDark: '#334155',\n permissionId: 'view.manage.productManagement.settings',\n};\n\nexport const WORKSPACES = [\n {\n id: 'catalog',\n label: 'Catalog',\n description: 'Define what you sell and where you keep it. Master data — configured once, used everywhere.',\n icon: LayersRoundedIcon,\n accent: '#8b5cf6', // violet\n accentDark: '#6d28d9',\n accentSoft: '#ede9fe',\n items: [\n { id: 'categories', label: 'Categories', path: '/ui/medplat/manage/pm/categories', icon: CategoryRoundedIcon, permissionId: 'view.manage.productManagement.category' },\n { id: 'brands', label: 'Brands', path: '/ui/medplat/manage/pm/brands', icon: SellRoundedIcon, permissionId: 'view.manage.productManagement.brand' },\n { id: 'products', label: 'Products', path: '/ui/medplat/manage/pm/products', icon: Inventory2RoundedIcon, permissionId: 'view.manage.productManagement.product' },\n { id: 'storage', label: 'Storage Units', path: '/ui/medplat/manage/pm/storage-units', icon: WarehouseRoundedIcon, permissionId: 'view.manage.productManagement.storageUnit' },\n ],\n },\n {\n id: 'operations',\n label: 'Operations',\n description: 'Run the day — receive stock, sell to customers, administer vaccines, collect payments.',\n icon: LocalShippingRoundedIcon,\n accent: '#10b981', // emerald\n accentDark: '#047857',\n accentSoft: '#d1fae5',\n items: [\n // Purchase tabs are mutually exclusive based on the deployment-level\n // requirePurchaseConfirmation setting:\n // confirmation ON → \"Purchase Requests\" page with My Requests +\n // Pending tabs (per-tab perm-gated). An approver\n // with only the approve perm sees just Pending.\n // confirmation OFF → \"Purchases\" page with the direct-purchase list.\n // Both surface under either view.purchase or approve.purchase — the\n // approver-only role still gets the nav entry to reach their queue.\n { id: 'purchase-requests', label: 'Purchase Requests', path: '/ui/medplat/manage/pm/purchase-requests', icon: FactCheckRoundedIcon,\n anyOfPermissionIds: ['view.manage.productManagement.purchase', 'approve.manage.productManagement.purchase'],\n purchaseApprovalGroup: true },\n { id: 'purchases', label: 'Purchases', path: '/ui/medplat/manage/pm/purchases', icon: ShoppingCartRoundedIcon,\n permissionId: 'view.manage.productManagement.purchase', hiddenWhenConfirmationOn: true },\n { id: 'inventory', label: 'Inventory', path: '/ui/medplat/manage/pm/inventory', icon: WidgetsRoundedIcon, permissionId: 'view.manage.productManagement.inventory' },\n // Pickups — user checks out facility stock onto personal inventory and\n // hands it back later. Wastage gets recorded at return if there's a gap.\n { id: 'pickups', label: 'Pickups', path: '/ui/medplat/manage/pm/pickups', icon: MoveDownRoundedIcon, permissionId: 'view.manage.productManagement.pickup' },\n // Transfers — two-step facility ↔ facility movement (sender ships,\n // receiver confirms). Permission-gated so deployments that don't use\n // transfers can leave the menu out by withholding the perm.\n { id: 'transfers', label: 'Transfers', path: '/ui/medplat/manage/pm/transfers', icon: SwapHorizRoundedIcon, permissionId: 'view.manage.productManagement.transfer' },\n // Sales + Payments items also AND with settings.manageSales; PmNav and\n // DashboardPage hide them when the deployment isn't running sales.\n { id: 'sales', label: 'Sales', path: '/ui/medplat/manage/pm/sales', icon: PointOfSaleRoundedIcon, permissionId: 'view.manage.productManagement.sale', salesGroup: true },\n { id: 'vials', label: 'Vial', path: '/ui/medplat/manage/pm/vials', icon: VaccinesRoundedIcon, permissionId: 'view.manage.productManagement.vial' },\n { id: 'payments', label: 'Payments', path: '/ui/medplat/manage/pm/payments', icon: PaymentsRoundedIcon, permissionId: 'view.manage.productManagement.payment', salesGroup: true },\n ],\n },\n {\n id: 'ledger',\n label: 'Ledger',\n description: 'Every stock and money movement, append-only, with full lot / volume / monetary detail.',\n icon: ReceiptLongRoundedIcon,\n accent: '#f59e0b', // amber\n accentDark: '#b45309',\n accentSoft: '#fef3c7',\n items: [\n { id: 'transactions', label: 'Transactions', path: '/ui/medplat/manage/pm/transactions', icon: ReceiptLongRoundedIcon, permissionId: 'view.manage.productManagement.ledger' },\n ],\n },\n];\n\n/**\n * Filter the workspace tree against (a) the current operator's PM permission\n * set and (b) the manageSales settings toggle. An item is visible iff its\n * permissionId is granted AND (manageSales is on OR it isn't in the sales\n * group). A workspace tab survives iff at least one of its items survives.\n *\n * Both PmNav and DashboardPage consume this so the two stay in lock-step.\n */\nexport function getVisibleWorkspaces(perms, settings) {\n const manageSales = settings?.manageSales !== false;\n const requirePurchaseConfirmation = settings?.requirePurchaseConfirmation === true;\n return WORKSPACES\n .map((ws) => ({\n ...ws,\n items: ws.items.filter((it) => {\n // Items can declare either a single `permissionId` or\n // `anyOfPermissionIds` for the \"user needs any of these perms\" case\n // (used by the Purchase Requests entry — visible to both viewers\n // and approvers).\n const hasPerm = it.anyOfPermissionIds\n ? !!perms?.hasAny?.(it.anyOfPermissionIds)\n : !!perms?.has?.(it.permissionId);\n return hasPerm\n && (manageSales || !it.salesGroup)\n && (requirePurchaseConfirmation || !it.purchaseApprovalGroup)\n && (!requirePurchaseConfirmation || !it.hiddenWhenConfirmationOn);\n }),\n }))\n .filter((ws) => ws.items.length > 0);\n}\n\n// Locate the workspace that owns a given pathname. The Dashboard route is\n// intentionally not in any workspace; we surface it via a dedicated pill.\nexport function findWorkspaceForPath(pathname) {\n if (!pathname) return null;\n for (const ws of WORKSPACES) {\n if (ws.items.some((it) => pathname.startsWith(it.path))) return ws;\n }\n return null;\n}\n\nexport function findItemForPath(pathname) {\n if (!pathname) return null;\n for (const ws of WORKSPACES) {\n const hit = ws.items.find((it) => pathname.startsWith(it.path));\n if (hit) return { workspace: ws, item: hit };\n }\n return null;\n}\n","import PropTypes from 'prop-types';\nimport { useEffect } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport { alpha, useTheme } from '@mui/material/styles';\nimport { Box, Chip, Fade, Stack, Typography } from '@mui/material';\nimport { DASHBOARD, SETTINGS, findItemForPath } from '@pm/utils/workspaces';\nimport { loadPmSettings } from '@pm/utils/settingsStore';\n\n// Page shell shared by every PM screen. Reads the active workspace from the\n// route and tints the header to match — peripheral cue for \"what section of\n// the tool am I in\". Body content fades in to soften route changes.\nexport default function PmPageShell({ title, subtitle, chips = [], actions, children }) {\n const theme = useTheme();\n const { pathname } = useLocation();\n\n // Kick off the settings preload from the shared shell, so every PM page has\n // the currency cached by the time PmMoney renders. usePmSettings inside the\n // money cell will also trigger this; calling here just shaves one render.\n useEffect(() => { void loadPmSettings().catch(() => {}); }, []);\n\n const onDashboard = pathname.startsWith(DASHBOARD.path);\n const onSettings = pathname.startsWith(SETTINGS.path);\n const hit = findItemForPath(pathname);\n const workspace = hit?.workspace;\n\n const accent = onDashboard\n ? DASHBOARD.accent\n : onSettings\n ? SETTINGS.accent\n : (workspace?.accent ?? theme.palette.primary.main);\n const accentDark = onDashboard\n ? DASHBOARD.accentDark\n : onSettings\n ? SETTINGS.accentDark\n : (workspace?.accentDark ?? theme.palette.primary.dark);\n\n return (\n <Box sx={{ position: 'relative', px: { xs: 1, md: 2 }, py: { xs: 1, md: 2 } }}>\n {/* Soft accent glow tied to the active workspace. */}\n <Box sx={{ position: 'absolute', inset: 0, pointerEvents: 'none', overflow: 'hidden' }}>\n <Box\n sx={{\n position: 'absolute',\n top: -60,\n right: -40,\n width: 260,\n height: 260,\n borderRadius: '50%',\n background: `radial-gradient(circle, ${alpha(accent, 0.18)} 0%, transparent 70%)`,\n filter: 'blur(2px)',\n }}\n />\n <Box\n sx={{\n position: 'absolute',\n top: 40,\n left: -50,\n width: 200,\n height: 200,\n borderRadius: '50%',\n background: `radial-gradient(circle, ${alpha(theme.palette.info.main, 0.08)} 0%, transparent 72%)`,\n filter: 'blur(2px)',\n }}\n />\n </Box>\n\n {/* Header card — workspace badge + title + actions. */}\n <Box\n sx={{\n position: 'relative',\n zIndex: 1,\n mb: 2,\n p: { xs: 2, md: 2.5 },\n borderRadius: 1.5,\n border: `1px solid ${alpha(accent, 0.18)}`,\n background: `linear-gradient(135deg, ${alpha(theme.palette.background.paper, 0.98)} 0%, ${alpha(accent, 0.07)} 100%)`,\n boxShadow: `0 18px 44px ${alpha(theme.palette.common.black, 0.06)}`,\n overflow: 'hidden',\n // Thin colored bar at the left edge — instantly tells you which workspace.\n '&::before': {\n content: '\"\"',\n position: 'absolute',\n left: 0,\n top: 0,\n bottom: 0,\n width: 4,\n background: `linear-gradient(180deg, ${accent} 0%, ${accentDark} 100%)`,\n },\n }}\n >\n <Stack\n direction={{ xs: 'column', md: 'row' }}\n justifyContent=\"space-between\"\n alignItems={{ xs: 'flex-start', md: 'center' }}\n spacing={1.5}\n >\n <Box sx={{ minWidth: 0 }}>\n {workspace || onDashboard || onSettings ? (\n <Stack direction=\"row\" alignItems=\"center\" spacing={0.75} sx={{ mb: 0.75 }}>\n {(() => {\n const Icon = onDashboard\n ? DASHBOARD.icon\n : onSettings\n ? SETTINGS.icon\n : workspace.icon;\n return Icon ? (\n <Icon sx={{ fontSize: 16, color: accentDark }} />\n ) : null;\n })()}\n <Typography\n variant=\"overline\"\n sx={{\n color: accentDark,\n fontWeight: 800,\n letterSpacing: 1.1,\n lineHeight: 1,\n }}\n >\n {onDashboard ? 'Overview' : onSettings ? 'Configuration' : workspace.label}\n </Typography>\n {hit?.item ? (\n <>\n <Box sx={{ width: 4, height: 4, borderRadius: '50%', bgcolor: alpha(accent, 0.4), mx: 0.5 }} />\n <Typography variant=\"overline\" sx={{ color: theme.palette.text.secondary, fontWeight: 700, letterSpacing: 0.8 }}>\n {hit.item.label}\n </Typography>\n </>\n ) : null}\n </Stack>\n ) : null}\n\n <Typography variant=\"h5\" sx={{ fontWeight: 800, color: theme.palette.text.primary, lineHeight: 1.2 }}>\n {title}\n </Typography>\n {subtitle ? (\n <Typography variant=\"body2\" sx={{ mt: 0.75, maxWidth: 900, color: theme.palette.text.secondary }}>\n {subtitle}\n </Typography>\n ) : null}\n {chips?.length ? (\n <Stack direction=\"row\" spacing={1} useFlexGap flexWrap=\"wrap\" sx={{ mt: 1.5 }}>\n {chips.map((chip) => (\n <Chip\n key={chip}\n label={chip}\n size=\"small\"\n sx={{\n borderRadius: 2,\n backgroundColor: alpha(accent, 0.1),\n color: accentDark,\n fontWeight: 700,\n border: `1px solid ${alpha(accent, 0.2)}`,\n }}\n />\n ))}\n </Stack>\n ) : null}\n </Box>\n {actions ? <Box>{actions}</Box> : null}\n </Stack>\n </Box>\n\n {/* Body — fade in to soften route transitions. Keyed on pathname so each\n navigation triggers a fresh animation rather than reusing prior fade. */}\n <Fade in key={pathname} timeout={360}>\n <Box\n sx={{\n position: 'relative',\n zIndex: 1,\n // Form field labels and helper/hint text default to a small, light\n // grey that's hard to read — bump the size and darken the colour\n // consistently across every PM form.\n '& .MuiInputLabel-root': {\n fontSize: '0.95rem',\n color: theme.palette.text.primary,\n },\n '& .MuiInputLabel-root.Mui-focused': {\n color: theme.palette.primary.main,\n },\n '& .MuiFormHelperText-root': {\n fontSize: '0.78rem',\n color: alpha(theme.palette.text.primary, 0.7),\n },\n }}\n >\n {children}\n </Box>\n </Fade>\n </Box>\n );\n}\n\nPmPageShell.propTypes = {\n title: PropTypes.node,\n subtitle: PropTypes.node,\n chips: PropTypes.arrayOf(PropTypes.string),\n actions: PropTypes.node,\n children: PropTypes.node,\n};\n","import { useEffect, useMemo } from 'react';\nimport { useSelector } from 'react-redux';\n\n// PM module's navigation_state in menu_config. The backend attaches a\n// featureJson onto this node whose keys are the permission_ids the current\n// user has been granted under the module — exactly the same featureJson\n// MedplatForm reads off any other menu node. Nothing about which\n// permissions exist is baked into the frontend; the source of truth is\n// whatever the backend serialised onto this node.\nconst PM_MENU_KEY = 'techo.manage.pm';\n\n/**\n * Hook returning the PM permission set for the current user.\n *\n * Reads `linearMenuItems['techo.manage.pm'].featureJson` from the\n * Authenticate slice — Protected.jsx populates that at login via\n * /api/login/menuV2. The featureJson is a JSON-string-or-object whose keys\n * are permission_ids and whose values are true/false.\n *\n * Returns:\n * has(permId) — true iff the user has been granted that permission_id\n * hasAny(ids[]) — true iff any id in the list is granted\n *\n * **Default-deny**: when the PM menu node is missing or its featureJson is\n * empty, both helpers return false. There's no dev escape hatch — devs go\n * through the same grant flow as everyone else.\n *\n * **What's actually in featureJson**: only the top-level api_permission\n * rows for menu_id 543 (those with `parent_permission_id = NULL`). The\n * `.child.get.X` / `.child.post.X` rows govern API-URL access via the\n * backend's GlobalMenuPermissionFilter but they do NOT surface to the\n * frontend. So every UI check in PM uses the parent perm\n * (`view.manage.productManagement.<page>`). The backend still 403s any\n * write the user lacks the `.child.post.X` row for — that's the actual\n * write gate. To gate buttons in the UI separately from page-visibility\n * later, mint flat write perms (e.g. `write.manage.productManagement.X`\n * with `parent_permission_id = NULL`).\n */\n/**\n * `useEffect` that only runs when the current user has the permission.\n *\n * <p>PM pages historically declared their load `useEffect` in the outer\n * component above {@code <PmGuard>}. That meant the fetch fired on mount\n * regardless of the user's perm — the guard only hid the UI after the\n * network call already went out. Wrapping the effect with this hook makes\n * the fetch wait for (or skip entirely without) the perm, matching what\n * `PmGuard` does for the rendered tree.\n *\n * @param {string|string[]} perm Permission id required to fire the effect. Array means any-of.\n * @param {() => (void|(()=>void))} fn The effect body — receives no args, may return a cleanup.\n * @param {ReadonlyArray<*>} [deps] Extra deps; the perm gate is added implicitly.\n */\nexport function usePermissionedEffect(perm, fn, deps) {\n const perms = usePmPermissions();\n const allowed = Array.isArray(perm)\n ? perms.hasAny(perm)\n : (!!perm && perms.has(perm));\n // We list `allowed` first so a perm flip re-fires the effect (e.g. a user\n // who gains the perm mid-session lands on the page fully loaded). Caller\n // deps come after — same semantics they'd get from a plain useEffect.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (!allowed) return undefined;\n return fn();\n }, [allowed, ...(deps ?? [])]);\n}\n\nexport function usePmPermissions() {\n const linearMenuItems = useSelector((state) => state.Authenticate?.linearMenuItems);\n return useMemo(() => {\n const node = linearMenuItems?.[PM_MENU_KEY];\n let grants = node?.featureJson;\n if (typeof grants === 'string') {\n try { grants = JSON.parse(grants); } catch { grants = {}; }\n }\n const grantSet = grants && typeof grants === 'object' ? grants : {};\n const has = (permId) => !!permId && grantSet[permId] === true;\n const hasAny = (perms) => Array.isArray(perms) && perms.some(has);\n return { has, hasAny };\n }, [linearMenuItems]);\n}\n","import { useMemo } from 'react';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport { Box, Stack, Tab, Tabs, Typography } from '@mui/material';\nimport { alpha, useTheme } from '@mui/material/styles';\nimport { DASHBOARD, SETTINGS, findWorkspaceForPath, getVisibleWorkspaces } from '@pm/utils/workspaces';\nimport { usePmSettings } from '@pm/utils/settingsStore';\nimport { usePmPermissions } from '@pm/utils/permissions';\n\n// Two-row navigation:\n// Row 1 — workspace pills: Dashboard · Catalog · Operations · Ledger\n// Row 2 — when inside a workspace, the items in that workspace as tabs,\n// accented with the workspace's hue.\n//\n// The active workspace's accent flows into both rows so the user always\n// has a peripheral cue for \"where am I in the tool\".\n//\n// Visibility is filtered by getVisibleWorkspaces() — items that the user\n// lacks permission for OR that the deployment has turned off (e.g. Sales +\n// Payments when manageSales=false) are dropped, and a workspace tab whose\n// items all got dropped disappears too.\nexport default function PmNav() {\n const navigate = useNavigate();\n const location = useLocation();\n const theme = useTheme();\n const settings = usePmSettings();\n const perms = usePmPermissions();\n\n const visibleWorkspaces = useMemo(\n () => getVisibleWorkspaces(perms, settings),\n [perms, settings],\n );\n\n const showDashboardPill = perms.has(DASHBOARD.permissionId);\n const showSettingsPill = perms.has(SETTINGS.permissionId);\n\n const onDashboard = location.pathname.startsWith(DASHBOARD.path);\n const onSettings = location.pathname.startsWith(SETTINGS.path);\n const activeWorkspace = findWorkspaceForPath(location.pathname);\n // visibleWorkspaces is already filtered; if the user landed on a workspace\n // whose items they no longer have access to (e.g. deep link), it won't be\n // here and the row-2 tab strip stays collapsed.\n const visibleActiveWorkspace = activeWorkspace\n ? visibleWorkspaces.find((ws) => ws.id === activeWorkspace.id) ?? null\n : null;\n const accent = onDashboard\n ? DASHBOARD.accent\n : onSettings\n ? SETTINGS.accent\n : (activeWorkspace?.accent ?? theme.palette.primary.main);\n\n const activeItemIndex = visibleActiveWorkspace\n ? visibleActiveWorkspace.items.findIndex((it) => location.pathname.startsWith(it.path))\n : -1;\n\n function pillSx(active, hue) {\n return {\n px: 2,\n py: 0.9,\n borderRadius: 999,\n cursor: 'pointer',\n display: 'inline-flex',\n alignItems: 'center',\n gap: 1,\n fontWeight: 700,\n fontSize: '0.875rem',\n letterSpacing: 0.2,\n transition: 'all 220ms cubic-bezier(0.4, 0, 0.2, 1)',\n color: active ? '#fff' : theme.palette.text.secondary,\n backgroundColor: active ? hue : 'transparent',\n boxShadow: active ? `0 8px 22px ${alpha(hue, 0.32)}` : 'none',\n '&:hover': {\n color: active ? '#fff' : hue,\n backgroundColor: active ? hue : alpha(hue, 0.08),\n transform: active ? 'none' : 'translateY(-1px)',\n },\n };\n }\n\n function renderPill({ id, label, icon: Icon, active, onClick, hue }) {\n return (\n <Box key={id} role=\"button\" onClick={onClick} sx={pillSx(active, hue)}>\n {Icon ? <Icon sx={{ fontSize: 18 }} /> : null}\n {label}\n </Box>\n );\n }\n\n return (\n <Box sx={{ mb: 2 }}>\n {/* Row 1 — workspace pills */}\n <Box\n sx={{\n position: 'relative',\n borderRadius: 1.5,\n p: 1,\n background: `linear-gradient(135deg, ${alpha(theme.palette.background.paper, 0.96)} 0%, ${alpha(accent, 0.06)} 100%)`,\n border: `1px solid ${alpha(theme.palette.divider, 0.7)}`,\n boxShadow: `0 10px 28px ${alpha(theme.palette.common.black, 0.04)}`,\n }}\n >\n <Stack direction=\"row\" alignItems=\"center\" spacing={0.75} flexWrap=\"wrap\" useFlexGap>\n {showDashboardPill ? renderPill({\n id: DASHBOARD.id,\n label: DASHBOARD.label,\n icon: DASHBOARD.icon,\n active: onDashboard,\n hue: DASHBOARD.accent,\n onClick: () => navigate(DASHBOARD.path),\n }) : null}\n\n {showDashboardPill && visibleWorkspaces.length > 0 ? (\n <Box sx={{ width: 1, height: 22, mx: 0.5, bgcolor: 'divider', opacity: 0.7 }} />\n ) : null}\n\n {visibleWorkspaces.map((ws) => renderPill({\n id: ws.id,\n label: ws.label,\n icon: ws.icon,\n active: activeWorkspace?.id === ws.id,\n hue: ws.accent,\n // Tapping a workspace jumps to its first item — a deterministic\n // landing, no submenu to fight with.\n onClick: () => ws.items[0] && navigate(ws.items[0].path),\n }))}\n\n {/* Settings sits to the right, separated from the workspaces — it's\n configuration, not a workspace, and shouldn't compete visually. */}\n <Box sx={{ flexGrow: 1 }} />\n {showSettingsPill ? renderPill({\n id: SETTINGS.id,\n label: SETTINGS.label,\n icon: SETTINGS.icon,\n active: onSettings,\n hue: SETTINGS.accent,\n onClick: () => navigate(SETTINGS.path),\n }) : null}\n </Stack>\n </Box>\n\n {/* Row 2 — items within the active workspace */}\n {visibleActiveWorkspace && visibleActiveWorkspace.items.length > 0 ? (\n <Box\n sx={{\n mt: 1,\n borderRadius: 1.5,\n px: 1,\n bgcolor: alpha(visibleActiveWorkspace.accent, 0.04),\n border: `1px solid ${alpha(visibleActiveWorkspace.accent, 0.12)}`,\n }}\n >\n <Tabs\n value={activeItemIndex === -1 ? false : activeItemIndex}\n onChange={(_, idx) => navigate(visibleActiveWorkspace.items[idx].path)}\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n slotProps={{\n indicator: { sx: { backgroundColor: visibleActiveWorkspace.accent, height: 3, borderRadius: 2 } },\n }}\n sx={{\n minHeight: 44,\n '& .MuiTab-root': {\n minHeight: 44,\n fontWeight: 700,\n textTransform: 'none',\n fontSize: '0.85rem',\n color: theme.palette.text.secondary,\n transition: 'color 180ms ease',\n '&:hover': { color: visibleActiveWorkspace.accentDark },\n '&.Mui-selected': { color: visibleActiveWorkspace.accentDark },\n },\n }}\n >\n {visibleActiveWorkspace.items.map((it) => {\n const Icon = it.icon;\n return (\n <Tab\n key={it.id}\n iconPosition=\"start\"\n icon={Icon ? <Icon sx={{ fontSize: 18 }} /> : undefined}\n label={<Typography component=\"span\" sx={{ fontWeight: 700 }}>{it.label}</Typography>}\n />\n );\n })}\n </Tabs>\n </Box>\n ) : null}\n </Box>\n );\n}\n","import { useNavigate } from 'react-router-dom';\nimport { useSelector } from 'react-redux';\nimport { Alert, Box, Button, LinearProgress, Stack, Typography } from '@mui/material';\nimport LockOutlinedIcon from '@mui/icons-material/LockOutlined';\nimport { usePmPermissions } from '@pm/utils/permissions';\n\n/**\n * Page-level guard. Wrap a PM page in `<PmGuard perm=\"...\">…</PmGuard>` and\n * the children only render when the current user has the perm; otherwise\n * the page shows a friendly \"no access\" panel with a back-to-dashboard\n * button.\n *\n * Default-deny: when the featureJson is missing the guard blocks. While the\n * menu tree hasn't loaded yet (first paint right after login) we show a\n * thin loader so the \"no access\" alert doesn't flash.\n */\nexport default function PmGuard({ perm, anyOf, children, title = 'You don’t have access to this page' }) {\n const perms = usePmPermissions();\n const navigate = useNavigate();\n const linearMenuItems = useSelector((state) => state.Authenticate?.linearMenuItems);\n const menuReady = linearMenuItems !== null && linearMenuItems !== undefined;\n if (!menuReady) {\n return (\n <Box sx={{ p: 3 }}>\n <LinearProgress />\n </Box>\n );\n }\n const allowed = anyOf ? perms.hasAny(anyOf) : perms.has(perm);\n if (allowed) return children;\n return (\n <Box sx={{ p: 3 }}>\n <Alert\n severity=\"warning\"\n icon={<LockOutlinedIcon />}\n sx={{ borderRadius: 1.5, alignItems: 'flex-start' }}\n >\n <Stack spacing={1.25}>\n <Typography sx={{ fontWeight: 800 }}>{title}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Your account doesn’t have the required permission to view this\n section of Product Management. Ask an admin to grant it via the\n role / user permission assignment.\n </Typography>\n <Box>\n <Button\n size=\"small\"\n variant=\"contained\"\n onClick={() => navigate('/ui/medplat/manage/pm')}\n >\n Back to Dashboard\n </Button>\n </Box>\n </Stack>\n </Alert>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAa,IAAY;CACvB,IAAI;CACJ,OAAO;CACP,MAAM;CACN,MAAM;CACN,QAAQ;CACR,YAAY;CACZ,cAAc;AAChB,GAIa,IAAW;CACtB,IAAI;CACJ,OAAO;CACP,MAAM;CACN,MAAM;CACN,QAAQ;CACR,YAAY;CACZ,cAAc;AAChB,GAEa,IAAa;CACxB;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,YAAY;EACZ,OAAO;GACL;IAAE,IAAI;IAAc,OAAO;IAAiB,MAAM;IAAuC,MAAM;I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