@argusoft/medplat-product-management 1.0.0

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