@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,663 @@
1
+ import { D as e, F as t, R as n, V as r, et as i, n as a, t as o, w as s } from "./settingsStore-KW217unV.js";
2
+ import { r as c } from "./PmTable-BkK65bJQ.js";
3
+ import { a as l, i as u, n as d, r as f, t as p } from "./PmGuard-C90yhpsN.js";
4
+ import { useEffect as m, useMemo as h, useState as g } from "react";
5
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
6
+ import { Alert as y, Autocomplete as b, Box as x, Button as S, Card as C, CardContent as w, Grid as T, Stack as E, TextField as D, Typography as O } from "@mui/material";
7
+ import { showToast as k } from "@/common/toaster/toaster";
8
+ import { alpha as A } from "@mui/material/styles";
9
+ import { findCountry as j } from "@/common/constants/countries";
10
+ import M from "@mui/icons-material/RefreshRounded";
11
+ import N from "@/views/custom-components/CustomSwitch";
12
+ import P from "@mui/icons-material/PaymentsRounded";
13
+ import F from "@mui/icons-material/SaveRounded";
14
+ import I from "@/views/custom-components/CountrySelect";
15
+ import L from "@mui/icons-material/PhoneIphoneRounded";
16
+ //#region src/views/SettingsPage.jsx
17
+ function R() {
18
+ return {
19
+ memberTableName: "",
20
+ memberIdColumn: "",
21
+ memberIdentifierColumn: "",
22
+ memberFamilyIdColumn: "",
23
+ memberNameColumn: "",
24
+ memberDobColumn: "",
25
+ countryCode: "IN",
26
+ managePurchaseAmounts: !0,
27
+ manageSales: !0,
28
+ allowPersonalPurchase: !0,
29
+ requirePurchaseConfirmation: !1
30
+ };
31
+ }
32
+ function z(e) {
33
+ return {
34
+ memberTableName: e?.memberTableName ?? "",
35
+ memberIdColumn: e?.memberIdColumn ?? "",
36
+ memberIdentifierColumn: e?.memberIdentifierColumn ?? "",
37
+ memberFamilyIdColumn: e?.memberFamilyIdColumn ?? "",
38
+ memberNameColumn: e?.memberNameColumn ?? "",
39
+ memberDobColumn: e?.memberDobColumn ?? "",
40
+ countryCode: e?.countryCode ?? "IN",
41
+ managePurchaseAmounts: e?.managePurchaseAmounts !== !1,
42
+ manageSales: e?.manageSales !== !1,
43
+ allowPersonalPurchase: e?.allowPersonalPurchase !== !1,
44
+ requirePurchaseConfirmation: e?.requirePurchaseConfirmation === !0
45
+ };
46
+ }
47
+ function B() {
48
+ let h = u().has("update.manage.productManagement.settings"), [b, D] = g(R()), [O, A] = g(!0), [N, B] = g(!1), [W, G] = g(""), [ee, te] = g([]), [K, ne] = g({}), [q, re] = g({}), [J, ie] = g({});
49
+ async function Y() {
50
+ A(!0), G("");
51
+ try {
52
+ let [e, n] = await Promise.all([s(), t().catch(() => [])]);
53
+ D(z(e)), te(n);
54
+ } catch (e) {
55
+ G(e?.response?.data?.message ?? e?.message ?? "Failed to load settings");
56
+ } finally {
57
+ A(!1);
58
+ }
59
+ }
60
+ f("view.manage.productManagement.settings", () => {
61
+ Y();
62
+ }, []), m(() => {
63
+ let e = [b.memberTableName].filter(Boolean).filter((e) => K[e] === void 0);
64
+ if (e.length === 0) return;
65
+ let t = !1;
66
+ return (async () => {
67
+ let n = {};
68
+ await Promise.all(e.map(async (e) => {
69
+ try {
70
+ n[e] = await r(e);
71
+ } catch {
72
+ n[e] = [];
73
+ }
74
+ })), t || ne((e) => ({
75
+ ...e,
76
+ ...n
77
+ }));
78
+ })(), () => {
79
+ t = !0;
80
+ };
81
+ }, [b.memberTableName, K]), m(() => {
82
+ let e = [b.memberTableName].filter(Boolean).filter((e) => q[e] === void 0);
83
+ if (e.length === 0) return;
84
+ let t = !1;
85
+ return (async () => {
86
+ let r = {};
87
+ await Promise.all(e.map(async (e) => {
88
+ try {
89
+ r[e] = await n(e);
90
+ } catch {
91
+ r[e] = [];
92
+ }
93
+ })), t || re((e) => ({
94
+ ...e,
95
+ ...r
96
+ }));
97
+ })(), () => {
98
+ t = !0;
99
+ };
100
+ }, [b.memberTableName, q]), m(() => {
101
+ let t = [b.memberTableName].filter(Boolean).filter((e) => J[e] === void 0);
102
+ if (t.length === 0) return;
103
+ let n = !1;
104
+ return (async () => {
105
+ let r = {};
106
+ await Promise.all(t.map(async (t) => {
107
+ try {
108
+ r[t] = await e(t);
109
+ } catch {
110
+ r[t] = [];
111
+ }
112
+ })), n || ie((e) => ({
113
+ ...e,
114
+ ...r
115
+ }));
116
+ })(), () => {
117
+ n = !0;
118
+ };
119
+ }, [b.memberTableName, J]);
120
+ function X(e, t) {
121
+ D((n) => ({
122
+ ...n,
123
+ [e]: t
124
+ }));
125
+ }
126
+ function ae(e, t, n) {
127
+ let r = Array.isArray(t) ? t : [t];
128
+ D((t) => {
129
+ let i = r.reduce((e, t) => ({
130
+ ...e,
131
+ [t]: ""
132
+ }), {});
133
+ return {
134
+ ...t,
135
+ [e]: n,
136
+ ...i
137
+ };
138
+ });
139
+ }
140
+ let Z = b.countryCode ? "" : "Country is required.", Q = !Z, $ = j(b.countryCode);
141
+ async function oe() {
142
+ if (Q) {
143
+ B(!0), G("");
144
+ try {
145
+ let e = await i({
146
+ memberTableName: b.memberTableName || null,
147
+ memberIdColumn: b.memberIdColumn || null,
148
+ memberIdentifierColumn: b.memberIdentifierColumn || null,
149
+ memberFamilyIdColumn: b.memberFamilyIdColumn || null,
150
+ memberNameColumn: b.memberNameColumn || null,
151
+ memberDobColumn: b.memberDobColumn || null,
152
+ countryCode: b.countryCode,
153
+ managePurchaseAmounts: b.manageSales ? !0 : !!b.managePurchaseAmounts,
154
+ manageSales: !!b.manageSales,
155
+ allowPersonalPurchase: !!b.allowPersonalPurchase,
156
+ requirePurchaseConfirmation: !!b.requirePurchaseConfirmation
157
+ });
158
+ D(z(e)), a(e), o(!0).catch(() => {}), k({
159
+ message: "Settings saved.",
160
+ type: "success"
161
+ });
162
+ } catch (e) {
163
+ let t = e?.response?.data?.message ?? e?.message ?? "Failed to save settings";
164
+ G(t), k({
165
+ message: t,
166
+ type: "error"
167
+ });
168
+ } finally {
169
+ B(!1);
170
+ }
171
+ }
172
+ }
173
+ return /* @__PURE__ */ v(x, { children: [/* @__PURE__ */ _(d, {}), /* @__PURE__ */ _(p, {
174
+ perm: "view.manage.productManagement.settings",
175
+ children: /* @__PURE__ */ v(l, {
176
+ title: "Settings",
177
+ subtitle: "Set up the module for your deployment. Choose your country, link to your database, and enable the features you need.",
178
+ chips: ["Configuration"],
179
+ actions: /* @__PURE__ */ v(E, {
180
+ direction: "row",
181
+ spacing: 1,
182
+ children: [/* @__PURE__ */ _(S, {
183
+ variant: "outlined",
184
+ startIcon: /* @__PURE__ */ _(M, {}),
185
+ onClick: () => void Y(),
186
+ children: "Refresh"
187
+ }), /* @__PURE__ */ _(S, {
188
+ variant: "contained",
189
+ startIcon: /* @__PURE__ */ _(F, {}),
190
+ disabled: !Q || N || O || !h,
191
+ onClick: () => void oe(),
192
+ children: N ? "Saving…" : "Save"
193
+ })]
194
+ }),
195
+ children: [
196
+ W ? /* @__PURE__ */ _(y, {
197
+ severity: "error",
198
+ sx: { mb: 2 },
199
+ children: W
200
+ }) : null,
201
+ /* @__PURE__ */ _(C, {
202
+ sx: {
203
+ borderRadius: 1.5,
204
+ mb: 2,
205
+ border: "1px solid",
206
+ borderColor: "divider",
207
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
208
+ },
209
+ children: /* @__PURE__ */ v(w, {
210
+ sx: { p: 2.5 },
211
+ children: [/* @__PURE__ */ _(c, {
212
+ eyebrow: "Locale",
213
+ title: "Implementation country",
214
+ hint: "The country controls currency display and phone number formats.",
215
+ sx: { mb: 2 }
216
+ }), /* @__PURE__ */ v(T, {
217
+ container: !0,
218
+ spacing: 2,
219
+ children: [/* @__PURE__ */ _(T, {
220
+ item: !0,
221
+ xs: 12,
222
+ md: 6,
223
+ children: /* @__PURE__ */ _(I, {
224
+ required: !0,
225
+ disableClearable: !0,
226
+ value: b.countryCode,
227
+ onChange: (e) => X("countryCode", e),
228
+ error: !!Z,
229
+ helperText: Z || "Type to search by name, code, currency, or dial code."
230
+ })
231
+ }), /* @__PURE__ */ _(T, {
232
+ item: !0,
233
+ xs: 12,
234
+ md: 6,
235
+ children: /* @__PURE__ */ v(E, {
236
+ direction: "row",
237
+ spacing: 1.5,
238
+ sx: { height: "100%" },
239
+ children: [/* @__PURE__ */ _(H, {
240
+ icon: /* @__PURE__ */ _(P, { fontSize: "small" }),
241
+ label: "Currency",
242
+ primary: `${$?.currencySymbol ?? "—"} 1,234.50`,
243
+ secondary: $?.currencyCode ?? "—"
244
+ }), /* @__PURE__ */ _(H, {
245
+ icon: /* @__PURE__ */ _(L, { fontSize: "small" }),
246
+ label: "Phone",
247
+ primary: $?.phoneCode ?? "—",
248
+ secondary: $ ? `${$.phoneMin}${$.phoneMin === $.phoneMax ? "" : `–${$.phoneMax}`} digits` : "—"
249
+ })]
250
+ })
251
+ })]
252
+ })]
253
+ })
254
+ }),
255
+ /* @__PURE__ */ _(C, {
256
+ sx: {
257
+ borderRadius: 1.5,
258
+ mb: 2,
259
+ border: "1px solid",
260
+ borderColor: "divider",
261
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
262
+ },
263
+ children: /* @__PURE__ */ v(w, {
264
+ sx: { p: 2.5 },
265
+ children: [/* @__PURE__ */ _(c, {
266
+ eyebrow: "Scope",
267
+ title: "Features",
268
+ hint: "Turn on only the features you need.",
269
+ sx: { mb: 2 }
270
+ }), /* @__PURE__ */ v(E, {
271
+ spacing: 1.5,
272
+ children: [
273
+ /* @__PURE__ */ _(V, {
274
+ label: "Manage sales and payments",
275
+ hint: "Turn off to hide sales and payment features.",
276
+ value: b.manageSales,
277
+ onChange: (e) => X("manageSales", e)
278
+ }),
279
+ /* @__PURE__ */ _(V, {
280
+ label: "Manage purchase amounts",
281
+ hint: "Turn off if you only track stock, not money.",
282
+ value: b.manageSales ? !0 : b.managePurchaseAmounts,
283
+ onChange: (e) => X("managePurchaseAmounts", e),
284
+ disabled: b.manageSales,
285
+ lockNote: "Required while sales and payments are on — sales need purchase costs to compute margins."
286
+ }),
287
+ /* @__PURE__ */ _(V, {
288
+ label: "Allow personal purchases",
289
+ hint: "Turn off to hide the personal purchase option.",
290
+ value: b.allowPersonalPurchase,
291
+ onChange: (e) => X("allowPersonalPurchase", e)
292
+ }),
293
+ /* @__PURE__ */ _(V, {
294
+ label: "Require purchase confirmation",
295
+ hint: "Turn on to require a manager to approve purchases before stock is added.",
296
+ value: b.requirePurchaseConfirmation,
297
+ onChange: (e) => X("requirePurchaseConfirmation", e)
298
+ })
299
+ ]
300
+ })]
301
+ })
302
+ }),
303
+ /* @__PURE__ */ _(C, {
304
+ sx: {
305
+ borderRadius: 1.5,
306
+ border: "1px solid",
307
+ borderColor: "divider",
308
+ boxShadow: "0 12px 32px rgba(15, 23, 42, 0.045)"
309
+ },
310
+ children: /* @__PURE__ */ v(w, {
311
+ sx: { p: 2.5 },
312
+ children: [/* @__PURE__ */ _(c, {
313
+ eyebrow: "Identity mappings",
314
+ title: "Subjects",
315
+ hint: "Connect customer, user, and facility data from your system. This links real people to the app.",
316
+ sx: { mb: 2 }
317
+ }), /* @__PURE__ */ _(E, {
318
+ spacing: 3,
319
+ children: /* @__PURE__ */ _(U, {
320
+ tables: ee,
321
+ tableValue: b.memberTableName,
322
+ onTableChange: (e) => ae("memberTableName", [
323
+ "memberIdColumn",
324
+ "memberIdentifierColumn",
325
+ "memberFamilyIdColumn",
326
+ "memberNameColumn",
327
+ "memberDobColumn"
328
+ ], e),
329
+ uuidColumns: K[b.memberTableName],
330
+ textColumns: q[b.memberTableName],
331
+ dateColumns: J[b.memberTableName],
332
+ idColumnValue: b.memberIdColumn,
333
+ onIdColumnChange: (e) => X("memberIdColumn", e),
334
+ identifierColumnValue: b.memberIdentifierColumn,
335
+ onIdentifierColumnChange: (e) => X("memberIdentifierColumn", e),
336
+ familyIdColumnValue: b.memberFamilyIdColumn,
337
+ onFamilyIdColumnChange: (e) => X("memberFamilyIdColumn", e),
338
+ nameColumnValue: b.memberNameColumn,
339
+ onNameColumnChange: (e) => X("memberNameColumn", e),
340
+ dobColumnValue: b.memberDobColumn,
341
+ onDobColumnChange: (e) => X("memberDobColumn", e)
342
+ })
343
+ })]
344
+ })
345
+ })
346
+ ]
347
+ })
348
+ })] });
349
+ }
350
+ function V({ label: e, hint: t, value: n, onChange: r, disabled: i = !1, lockNote: a = "" }) {
351
+ let o = !!n, s = !i;
352
+ return /* @__PURE__ */ v(x, {
353
+ role: "button",
354
+ tabIndex: s ? 0 : -1,
355
+ "aria-disabled": i || void 0,
356
+ onClick: s ? () => r(!o) : void 0,
357
+ onKeyDown: s ? (e) => {
358
+ (e.key === " " || e.key === "Enter") && (e.preventDefault(), r(!o));
359
+ } : void 0,
360
+ sx: (e) => ({
361
+ display: "flex",
362
+ alignItems: "center",
363
+ gap: 2,
364
+ p: 2,
365
+ borderRadius: 1.5,
366
+ cursor: s ? "pointer" : "not-allowed",
367
+ opacity: s ? 1 : .75,
368
+ border: "1px solid",
369
+ borderColor: o ? A(e.palette.primary.main, .35) : "divider",
370
+ bgcolor: o ? A(e.palette.primary.main, .04) : "transparent",
371
+ transition: "all 180ms ease",
372
+ "&:hover": s ? {
373
+ borderColor: o ? e.palette.primary.main : A(e.palette.primary.main, .35),
374
+ bgcolor: o ? A(e.palette.primary.main, .06) : A(e.palette.primary.main, .02)
375
+ } : void 0
376
+ }),
377
+ children: [/* @__PURE__ */ v(x, {
378
+ sx: {
379
+ flexGrow: 1,
380
+ minWidth: 0
381
+ },
382
+ children: [/* @__PURE__ */ v(E, {
383
+ direction: "row",
384
+ alignItems: "center",
385
+ spacing: 1,
386
+ children: [
387
+ /* @__PURE__ */ _(O, {
388
+ variant: "subtitle1",
389
+ sx: {
390
+ fontWeight: 800,
391
+ lineHeight: 1.2
392
+ },
393
+ children: e
394
+ }),
395
+ /* @__PURE__ */ _(x, {
396
+ sx: (e) => ({
397
+ px: .9,
398
+ py: .15,
399
+ borderRadius: 999,
400
+ fontSize: "0.65rem",
401
+ fontWeight: 800,
402
+ letterSpacing: .6,
403
+ textTransform: "uppercase",
404
+ color: o ? e.palette.success.dark : e.palette.text.disabled,
405
+ bgcolor: o ? A(e.palette.success.main, .12) : A(e.palette.text.disabled, .1)
406
+ }),
407
+ children: o ? "Enabled" : "Disabled"
408
+ }),
409
+ i && a ? /* @__PURE__ */ _(x, {
410
+ sx: (e) => ({
411
+ px: .9,
412
+ py: .15,
413
+ borderRadius: 999,
414
+ fontSize: "0.65rem",
415
+ fontWeight: 800,
416
+ letterSpacing: .6,
417
+ textTransform: "uppercase",
418
+ color: e.palette.warning.dark,
419
+ bgcolor: A(e.palette.warning.main, .14)
420
+ }),
421
+ children: "Locked"
422
+ }) : null
423
+ ]
424
+ }), /* @__PURE__ */ _(O, {
425
+ variant: "caption",
426
+ color: "text.secondary",
427
+ sx: {
428
+ display: "block",
429
+ mt: .5
430
+ },
431
+ children: i && a ? a : t
432
+ })]
433
+ }), /* @__PURE__ */ _(N, {
434
+ checked: o,
435
+ disabled: i,
436
+ onClick: (e) => e.stopPropagation(),
437
+ onChange: (e) => r(e.target.checked)
438
+ })]
439
+ });
440
+ }
441
+ function H({ icon: e, label: t, primary: n, secondary: r }) {
442
+ return /* @__PURE__ */ v(x, {
443
+ sx: (e) => ({
444
+ flex: 1,
445
+ minWidth: 0,
446
+ p: 1.25,
447
+ borderRadius: 1.5,
448
+ border: "1px solid",
449
+ borderColor: "divider",
450
+ bgcolor: A(e.palette.primary.main, .03),
451
+ display: "flex",
452
+ flexDirection: "column",
453
+ justifyContent: "center"
454
+ }),
455
+ children: [
456
+ /* @__PURE__ */ v(E, {
457
+ direction: "row",
458
+ alignItems: "center",
459
+ spacing: .75,
460
+ sx: {
461
+ color: "text.secondary",
462
+ mb: .25
463
+ },
464
+ children: [e, /* @__PURE__ */ _(O, {
465
+ variant: "caption",
466
+ sx: {
467
+ fontWeight: 800,
468
+ letterSpacing: .6,
469
+ textTransform: "uppercase"
470
+ },
471
+ children: t
472
+ })]
473
+ }),
474
+ /* @__PURE__ */ _(O, {
475
+ sx: {
476
+ fontWeight: 800,
477
+ fontSize: "1.1rem",
478
+ fontVariantNumeric: "tabular-nums",
479
+ lineHeight: 1.2
480
+ },
481
+ noWrap: !0,
482
+ children: n
483
+ }),
484
+ /* @__PURE__ */ _(O, {
485
+ variant: "caption",
486
+ color: "text.secondary",
487
+ noWrap: !0,
488
+ children: r
489
+ })
490
+ ]
491
+ });
492
+ }
493
+ function U({ tables: e, tableValue: t, onTableChange: n, uuidColumns: r, textColumns: i, dateColumns: a, idColumnValue: o, onIdColumnChange: s, identifierColumnValue: c, onIdentifierColumnChange: l, familyIdColumnValue: u, onFamilyIdColumnChange: d, nameColumnValue: f, onNameColumnChange: p, dobColumnValue: m, onDobColumnChange: g }) {
494
+ let y = Array.isArray(r), S = Array.isArray(i), C = Array.isArray(a), w = y && r.length === 0, E = S && i.length === 0, k = C && a.length === 0, A = h(() => {
495
+ let n = e ?? [];
496
+ return !t || n.includes(t) ? n : [t, ...n];
497
+ }, [t, e]);
498
+ function j(e, t) {
499
+ let n = e ?? [];
500
+ return !t || n.includes(t) ? n : [t, ...n];
501
+ }
502
+ let M = h(() => j(y ? r : [], o), [
503
+ r,
504
+ y,
505
+ o
506
+ ]), N = h(() => j(S ? i : [], c), [
507
+ i,
508
+ S,
509
+ c
510
+ ]), P = h(() => j(S ? i : [], u), [
511
+ i,
512
+ S,
513
+ u
514
+ ]), F = h(() => j(S ? i : [], f), [
515
+ i,
516
+ S,
517
+ f
518
+ ]), I = h(() => j(C ? a : [], m), [
519
+ a,
520
+ C,
521
+ m
522
+ ]), L = t ? y ? w ? "No UUID columns found in this table." : "Column that holds the member’s primary key." : "Loading columns…" : "Pick a table first.";
523
+ function R(e) {
524
+ return t ? S ? E ? "No text columns found in this table." : e : "Loading columns…" : "Pick a table first.";
525
+ }
526
+ let z = t ? C ? k ? "No date/timestamp columns found in this table." : "Age is derived from this column in the UI." : "Loading columns…" : "Pick a table first.";
527
+ return /* @__PURE__ */ v(x, { children: [
528
+ /* @__PURE__ */ _(O, {
529
+ variant: "subtitle1",
530
+ sx: {
531
+ fontWeight: 800,
532
+ lineHeight: 1.2
533
+ },
534
+ children: "Members"
535
+ }),
536
+ /* @__PURE__ */ _(O, {
537
+ variant: "caption",
538
+ color: "text.secondary",
539
+ sx: {
540
+ display: "block",
541
+ mb: 1.5
542
+ },
543
+ children: "Patients / customers who can be sold to, charged dues, and administered vaccines. These columns build the member profile card on Sales and Payments."
544
+ }),
545
+ /* @__PURE__ */ v(T, {
546
+ container: !0,
547
+ spacing: 2,
548
+ children: [
549
+ /* @__PURE__ */ _(T, {
550
+ item: !0,
551
+ xs: 12,
552
+ md: 6,
553
+ children: /* @__PURE__ */ _(b, {
554
+ size: "small",
555
+ options: A,
556
+ value: t || null,
557
+ onChange: (e, t) => n(t ?? ""),
558
+ renderInput: (e) => /* @__PURE__ */ _(D, {
559
+ ...e,
560
+ label: "Table name",
561
+ placeholder: "Type to search…",
562
+ helperText: "Public-schema table that holds members."
563
+ })
564
+ })
565
+ }),
566
+ /* @__PURE__ */ _(T, {
567
+ item: !0,
568
+ xs: 12,
569
+ md: 6,
570
+ children: /* @__PURE__ */ _(b, {
571
+ size: "small",
572
+ disabled: !t || !y || w,
573
+ options: M,
574
+ value: o || null,
575
+ onChange: (e, t) => s(t ?? ""),
576
+ renderInput: (e) => /* @__PURE__ */ _(D, {
577
+ ...e,
578
+ label: "UUID column",
579
+ placeholder: "Type to search…",
580
+ helperText: L
581
+ })
582
+ })
583
+ }),
584
+ /* @__PURE__ */ _(T, {
585
+ item: !0,
586
+ xs: 12,
587
+ md: 6,
588
+ children: /* @__PURE__ */ _(b, {
589
+ size: "small",
590
+ disabled: !t || !S || E,
591
+ options: N,
592
+ value: c || null,
593
+ onChange: (e, t) => l(t ?? ""),
594
+ renderInput: (e) => /* @__PURE__ */ _(D, {
595
+ ...e,
596
+ label: "Identifier column",
597
+ placeholder: "Type to search…",
598
+ helperText: R("Unique identifier shown on the profile card (e.g. national id).")
599
+ })
600
+ })
601
+ }),
602
+ /* @__PURE__ */ _(T, {
603
+ item: !0,
604
+ xs: 12,
605
+ md: 6,
606
+ children: /* @__PURE__ */ _(b, {
607
+ size: "small",
608
+ disabled: !t || !S || E,
609
+ options: P,
610
+ value: u || null,
611
+ onChange: (e, t) => d(t ?? ""),
612
+ renderInput: (e) => /* @__PURE__ */ _(D, {
613
+ ...e,
614
+ label: "Family ID column",
615
+ placeholder: "Type to search…",
616
+ helperText: R("Groups members by household.")
617
+ })
618
+ })
619
+ }),
620
+ /* @__PURE__ */ _(T, {
621
+ item: !0,
622
+ xs: 12,
623
+ md: 6,
624
+ children: /* @__PURE__ */ _(b, {
625
+ size: "small",
626
+ disabled: !t || !S || E,
627
+ options: F,
628
+ value: f || null,
629
+ onChange: (e, t) => p(t ?? ""),
630
+ renderInput: (e) => /* @__PURE__ */ _(D, {
631
+ ...e,
632
+ label: "Name column",
633
+ placeholder: "Type to search…",
634
+ helperText: R("Display name. Also used by the recent-payments / sales tables.")
635
+ })
636
+ })
637
+ }),
638
+ /* @__PURE__ */ _(T, {
639
+ item: !0,
640
+ xs: 12,
641
+ md: 6,
642
+ children: /* @__PURE__ */ _(b, {
643
+ size: "small",
644
+ disabled: !t || !C || k,
645
+ options: I,
646
+ value: m || null,
647
+ onChange: (e, t) => g(t ?? ""),
648
+ renderInput: (e) => /* @__PURE__ */ _(D, {
649
+ ...e,
650
+ label: "Date of birth column",
651
+ placeholder: "Type to search…",
652
+ helperText: z
653
+ })
654
+ })
655
+ })
656
+ ]
657
+ })
658
+ ] });
659
+ }
660
+ //#endregion
661
+ export { B as default };
662
+
663
+ //# sourceMappingURL=SettingsPage-CiwVmzM3.js.map