@argusoft/medplat-core 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 (113) hide show
  1. package/dist/AccessRights-sgIhYR30.js +1238 -0
  2. package/dist/AccessRights-sgIhYR30.js.map +1 -0
  3. package/dist/AddEditQueryBuilder-BaZxS2Cm.js +289 -0
  4. package/dist/AddEditQueryBuilder-BaZxS2Cm.js.map +1 -0
  5. package/dist/AddEditQueryBuilder.css +1 -0
  6. package/dist/AddFeatures-BxXCC6ex.js +212 -0
  7. package/dist/AddFeatures-BxXCC6ex.js.map +1 -0
  8. package/dist/AddLabelModal-DE3ploGD.js +734 -0
  9. package/dist/AddLabelModal-DE3ploGD.js.map +1 -0
  10. package/dist/AddMenuConfiguration-QWfpcnuP.js +2237 -0
  11. package/dist/AddMenuConfiguration-QWfpcnuP.js.map +1 -0
  12. package/dist/AddMenuConfiguration.css +1 -0
  13. package/dist/AddRoleDrawer-ZK1eejxI.js +453 -0
  14. package/dist/AddRoleDrawer-ZK1eejxI.js.map +1 -0
  15. package/dist/AppModal-BgZyfrd-.js +428 -0
  16. package/dist/AppModal-BgZyfrd-.js.map +1 -0
  17. package/dist/ChangePasswordModal-MV7g8tkA.js +176 -0
  18. package/dist/ChangePasswordModal-MV7g8tkA.js.map +1 -0
  19. package/dist/ConditionConfig-BqWe0NKO.js +395 -0
  20. package/dist/ConditionConfig-BqWe0NKO.js.map +1 -0
  21. package/dist/ConditionConfig.css +1 -0
  22. package/dist/EntityManagement-D-x6Qzal.js +50 -0
  23. package/dist/EntityManagement-D-x6Qzal.js.map +1 -0
  24. package/dist/EventConfigurations-jGCJ4LqP.js +384 -0
  25. package/dist/EventConfigurations-jGCJ4LqP.js.map +1 -0
  26. package/dist/EventConfigurations.css +1 -0
  27. package/dist/EventsExceptionModal-BF6E1Np7.js +200 -0
  28. package/dist/EventsExceptionModal-BF6E1Np7.js.map +1 -0
  29. package/dist/EventsSkeleton-BN7_0IGs.js +74 -0
  30. package/dist/EventsSkeleton-BN7_0IGs.js.map +1 -0
  31. package/dist/FeatureMenu-BYSRoNm0.js +249 -0
  32. package/dist/FeatureMenu-BYSRoNm0.js.map +1 -0
  33. package/dist/Features-CKMmuqcs.js +11 -0
  34. package/dist/Features-CKMmuqcs.js.map +1 -0
  35. package/dist/FlywayQuery-Cx2sly6g.js +169 -0
  36. package/dist/FlywayQuery-Cx2sly6g.js.map +1 -0
  37. package/dist/ImmunizationConfigurationBase-CdCgDaAl.js +5299 -0
  38. package/dist/ImmunizationConfigurationBase-CdCgDaAl.js.map +1 -0
  39. package/dist/ImmunizationConfigurationBase.css +1 -0
  40. package/dist/ImmunizationConfigurationsList-CQnxWa09.js +335 -0
  41. package/dist/ImmunizationConfigurationsList-CQnxWa09.js.map +1 -0
  42. package/dist/ImmunizationSkeleton-D2tdv5k-.js +186 -0
  43. package/dist/ImmunizationSkeleton-D2tdv5k-.js.map +1 -0
  44. package/dist/LanguagesModal-rk6IGQwY.js +394 -0
  45. package/dist/LanguagesModal-rk6IGQwY.js.map +1 -0
  46. package/dist/ManageDynamicFeature-CeeqiS3K.js +4189 -0
  47. package/dist/ManageDynamicFeature-CeeqiS3K.js.map +1 -0
  48. package/dist/ManageEventConfiguration-BRXh51fc.js +1017 -0
  49. package/dist/ManageEventConfiguration-BRXh51fc.js.map +1 -0
  50. package/dist/ManageEventConfiguration.css +1 -0
  51. package/dist/ManageNotification-B4prX-9Z.js +6819 -0
  52. package/dist/ManageNotification-B4prX-9Z.js.map +1 -0
  53. package/dist/ManageRole-ByqBmjuc.js +699 -0
  54. package/dist/ManageRole-ByqBmjuc.js.map +1 -0
  55. package/dist/ManageTranslation-BTxvSYKb.js +616 -0
  56. package/dist/ManageTranslation-BTxvSYKb.js.map +1 -0
  57. package/dist/ManageTranslation.css +1 -0
  58. package/dist/ManageUser-PHiTNyF8.js +2160 -0
  59. package/dist/ManageUser-PHiTNyF8.js.map +1 -0
  60. package/dist/ManageUser.css +1 -0
  61. package/dist/MobileMenuManagement-DmQU5TTo.js +108 -0
  62. package/dist/MobileMenuManagement-DmQU5TTo.js.map +1 -0
  63. package/dist/MobileTypeEventConfigModal-BCp-SF4-.js +783 -0
  64. package/dist/MobileTypeEventConfigModal-BCp-SF4-.js.map +1 -0
  65. package/dist/NewServerManagement-5YcAtF-g.js +1002 -0
  66. package/dist/NewServerManagement-5YcAtF-g.js.map +1 -0
  67. package/dist/NotificationFlywayQuery-BY8Zzml_.js +244 -0
  68. package/dist/NotificationFlywayQuery-BY8Zzml_.js.map +1 -0
  69. package/dist/NotificationList-BkpOrCpM.js +400 -0
  70. package/dist/NotificationList-BkpOrCpM.js.map +1 -0
  71. package/dist/OtherTypeEventConfigModal-DPB8IYzj.js +2001 -0
  72. package/dist/OtherTypeEventConfigModal-DPB8IYzj.js.map +1 -0
  73. package/dist/QueryBuilder-Cus_mRwZ.js +378 -0
  74. package/dist/QueryBuilder-Cus_mRwZ.js.map +1 -0
  75. package/dist/QueryBuilder.css +1 -0
  76. package/dist/QueryManagement-DXA73N2j.js +671 -0
  77. package/dist/QueryManagement-DXA73N2j.js.map +1 -0
  78. package/dist/QueryManagement.css +1 -0
  79. package/dist/RoleManagement-CLaEJ90J.js +410 -0
  80. package/dist/RoleManagement-CLaEJ90J.js.map +1 -0
  81. package/dist/ServerSyncModal-uNjGCQJz.js +869 -0
  82. package/dist/ServerSyncModal-uNjGCQJz.js.map +1 -0
  83. package/dist/ShowFlywayQuery-DMsAbtOW.js +130 -0
  84. package/dist/ShowFlywayQuery-DMsAbtOW.js.map +1 -0
  85. package/dist/ShowFlywayQuery-DVRCd384.js +259 -0
  86. package/dist/ShowFlywayQuery-DVRCd384.js.map +1 -0
  87. package/dist/ShowQueryHistory-BDN0tzHg.js +190 -0
  88. package/dist/ShowQueryHistory-BDN0tzHg.js.map +1 -0
  89. package/dist/SubMenu-BHcSNSUF.js +187 -0
  90. package/dist/SubMenu-BHcSNSUF.js.map +1 -0
  91. package/dist/TableDetails-DzREeJkm.js +1508 -0
  92. package/dist/TableDetails-DzREeJkm.js.map +1 -0
  93. package/dist/TableList-B9hr05Hs.js +428 -0
  94. package/dist/TableList-B9hr05Hs.js.map +1 -0
  95. package/dist/TypeConfiguration-BYM8PjV9.js +117 -0
  96. package/dist/TypeConfiguration-BYM8PjV9.js.map +1 -0
  97. package/dist/UserList-BxB1tCwM.js +13042 -0
  98. package/dist/UserList-BxB1tCwM.js.map +1 -0
  99. package/dist/UserList.css +1 -0
  100. package/dist/UserListSkeleton-cglK2SaU.js +184 -0
  101. package/dist/UserListSkeleton-cglK2SaU.js.map +1 -0
  102. package/dist/WidgetList-BSApErov.js +188 -0
  103. package/dist/WidgetList-BSApErov.js.map +1 -0
  104. package/dist/_commonjsHelpers-BItOPCY9.js +29 -0
  105. package/dist/_commonjsHelpers-BItOPCY9.js.map +1 -0
  106. package/dist/i18next-CTOWN_jH.js +1394 -0
  107. package/dist/i18next-CTOWN_jH.js.map +1 -0
  108. package/dist/index.js +481 -0
  109. package/dist/index.js.map +1 -0
  110. package/dist/manageImmunization-B4swS745.js +1204 -0
  111. package/dist/manageImmunization-B4swS745.js.map +1 -0
  112. package/dist/manageImmunization.css +1 -0
  113. package/package.json +79 -0
@@ -0,0 +1,1002 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import { addServer as ce, addServerMappingList as de, updateServer as ue, updateServerMappingList as pe, getAllServer as he, getAllServerDetails as me } from "@/common/services/SyncWithServer";
3
+ import { FontAwesomeIcon as v } from "@fortawesome/react-fontawesome";
4
+ import { faPen as V, faPlus as H, faServer as Q, faCircleCheck as X, faMagnifyingGlass as fe, faCircleXmark as ge } from "@fortawesome/free-solid-svg-icons";
5
+ import { useTheme as te } from "@mui/material/styles";
6
+ import { Dialog as ve, DialogTitle as be, Box as F, Typography as c, DialogContent as ye, Divider as G, Autocomplete as B, TextField as I, FormHelperText as Z, FormControl as Se, RadioGroup as xe, FormControlLabel as _, Radio as ee, Chip as b, DialogActions as Ce, Button as Y, Paper as re, InputAdornment as Pe, TableContainer as Ae, Table as ze, TableHead as we, TableRow as J, TableCell as h, TableBody as Te, Tooltip as oe, IconButton as ke } from "@mui/material";
7
+ import f from "@mui/material/Grid2";
8
+ import { Box as z } from "@mui/system";
9
+ import { useState as P, useEffect as le, createElement as ne, useMemo as Re } from "react";
10
+ import { showToast as C } from "@/common/toaster/toaster";
11
+ import { useDebounceFn as We } from "@/hooks/useDebounceFn";
12
+ import U from "@/views/custom-components/CustomTextField";
13
+ import { yupResolver as Ne } from "@hookform/resolvers/yup";
14
+ import y from "prop-types";
15
+ import { useForm as Fe, Controller as q } from "react-hook-form";
16
+ import * as R from "yup";
17
+ import { useTranslateProvider as qe } from "@/common/languageTranslator/TranslationContext";
18
+ function ae({
19
+ openAddServer: O,
20
+ openAddServerFunc: W,
21
+ allServerList: x,
22
+ reloadPageFunc: w,
23
+ editServer: g,
24
+ editServerFunc: N,
25
+ serverData: d = {}
26
+ }) {
27
+ var k;
28
+ const { translate: u } = qe(), [S, E] = P(""), M = ["STAGING", "PRODUCTION"], D = te(), A = (l) => D.palette.mode === "light" ? l : `${l}-dark`, $ = R.object().shape({
29
+ name: R.string().required("Name is required"),
30
+ code: R.string().required("Code is required"),
31
+ type: R.string().required("Type is required"),
32
+ url: R.string().required("URL is required").matches(
33
+ /^https?:\/\/(localhost|\d{1,3}(?:\.\d{1,3}){3}|[a-zA-Z0-9.-]+)(:\d+)?(\/.*)?$/,
34
+ "Invalid URL"
35
+ ),
36
+ isActive: R.boolean().required("This field is required.")
37
+ }), s = Fe({
38
+ defaultValues: {
39
+ name: "",
40
+ code: "",
41
+ type: "",
42
+ url: "",
43
+ isActive: null,
44
+ canPullServer: [],
45
+ canPushServer: []
46
+ },
47
+ resolver: Ne($),
48
+ mode: "onChange"
49
+ });
50
+ le(() => {
51
+ g && s.reset({
52
+ name: d.name,
53
+ code: d.code,
54
+ type: d.type,
55
+ url: d.url,
56
+ isActive: d.isActive,
57
+ canPullServer: d.canPullServers ? d.canPullServers : [],
58
+ canPushServer: d.canPushServers ? d.canPushServers : []
59
+ });
60
+ }, []);
61
+ const T = () => {
62
+ W(!1), N(!1);
63
+ }, L = We(async (l) => {
64
+ x != null && x.find((o) => o.code === l) ? s.setError("code", {
65
+ type: "manual",
66
+ message: "Code already exists"
67
+ }) : E(`${l} is available`);
68
+ }, 500), j = async (l) => {
69
+ var n, i;
70
+ let o = /* @__PURE__ */ new Map();
71
+ (n = l.canPullServer) == null || n.forEach((t) => {
72
+ let p = {
73
+ canPull: !0,
74
+ canPush: !1
75
+ };
76
+ o.set(t.code, p);
77
+ }), (i = l.canPushServer) == null || i.forEach((t) => {
78
+ if (o.has(t.code))
79
+ o.get(t.code).canPush = !0;
80
+ else {
81
+ let p = {
82
+ canPull: !1,
83
+ canPush: !0
84
+ };
85
+ o.set(t.code, p);
86
+ }
87
+ });
88
+ const r = [];
89
+ if (o.forEach((t, p) => {
90
+ r.push({
91
+ sourceServerCode: l.code,
92
+ destinationServerCode: p,
93
+ canPull: t.canPull,
94
+ canPush: t.canPush
95
+ }), r.push({
96
+ sourceServerCode: p,
97
+ destinationServerCode: l.code,
98
+ canPull: t.canPush,
99
+ canPush: t.canPull
100
+ });
101
+ }), g)
102
+ try {
103
+ if (o.size === 0 && r.push({
104
+ sourceServerCode: l.code,
105
+ destinationServerCode: null,
106
+ canPull: null,
107
+ canPush: null
108
+ }), l.uuid = d.uuid, await ue(l), C({
109
+ type: "success",
110
+ message: "Server updated successfully"
111
+ }), r.length > 0)
112
+ try {
113
+ await pe(r), C({
114
+ type: "success",
115
+ message: "Server mapping updated successfully"
116
+ });
117
+ } catch (t) {
118
+ C({
119
+ type: "error",
120
+ message: "Failed to update server mapping"
121
+ }), console.error("Error updating server mapping:", t);
122
+ }
123
+ w((t) => !t), T();
124
+ } catch (t) {
125
+ C({
126
+ type: "error",
127
+ message: "Failed to update server"
128
+ }), console.error("Error updating server:", t);
129
+ }
130
+ else
131
+ try {
132
+ const t = {
133
+ name: l.name,
134
+ code: l.code,
135
+ type: l.type,
136
+ url: l.url,
137
+ isActive: l.isActive
138
+ };
139
+ if (await ce(t), C({
140
+ type: "success",
141
+ message: "Server added successfully"
142
+ }), r.length > 0)
143
+ try {
144
+ await de(r), C({
145
+ type: "success",
146
+ message: "Server mapping added successfully"
147
+ });
148
+ } catch (p) {
149
+ C({
150
+ type: "error",
151
+ message: "Failed to add server mapping"
152
+ }), console.error("Error adding server mapping:", p);
153
+ }
154
+ w((p) => !p), W(!1);
155
+ } catch (t) {
156
+ C({
157
+ type: "error",
158
+ message: "Failed to add server"
159
+ }), console.error("Error adding server:", t);
160
+ }
161
+ }, m = ({ label: l, required: o, children: r }) => /* @__PURE__ */ a(F, { sx: { display: "flex", flexDirection: "column", gap: 0.75 }, children: [
162
+ /* @__PURE__ */ a(
163
+ c,
164
+ {
165
+ variant: "body2",
166
+ sx: { fontWeight: 600, color: "text.primary" },
167
+ children: [
168
+ l,
169
+ o && /* @__PURE__ */ e(c, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
170
+ ]
171
+ }
172
+ ),
173
+ r
174
+ ] });
175
+ return m.propTypes = {
176
+ label: y.string.isRequired,
177
+ required: y.bool,
178
+ children: y.node.isRequired
179
+ }, /* @__PURE__ */ a(
180
+ ve,
181
+ {
182
+ open: O,
183
+ fullWidth: !0,
184
+ maxWidth: "sm",
185
+ onClose: T,
186
+ className: A("add-server-dialog"),
187
+ PaperProps: {
188
+ sx: {
189
+ borderRadius: 3,
190
+ scrollbarWidth: "none",
191
+ msOverflowStyle: "none",
192
+ "&::-webkit-scrollbar": { display: "none" },
193
+ "& .MuiDialogContent-root": {
194
+ scrollbarWidth: "none",
195
+ msOverflowStyle: "none",
196
+ "&::-webkit-scrollbar": { display: "none" }
197
+ }
198
+ }
199
+ },
200
+ children: [
201
+ /* @__PURE__ */ e(
202
+ be,
203
+ {
204
+ sx: {
205
+ px: 3,
206
+ pt: 2.5,
207
+ pb: 2,
208
+ borderBottom: "1px solid",
209
+ borderColor: "divider",
210
+ backgroundColor: "background.paper"
211
+ },
212
+ children: /* @__PURE__ */ a(F, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
213
+ /* @__PURE__ */ e(
214
+ F,
215
+ {
216
+ sx: {
217
+ width: 36,
218
+ height: 36,
219
+ borderRadius: 2,
220
+ display: "flex",
221
+ alignItems: "center",
222
+ justifyContent: "center",
223
+ backgroundColor: "primary.main",
224
+ color: "primary.contrastText",
225
+ flexShrink: 0
226
+ },
227
+ children: /* @__PURE__ */ e(
228
+ v,
229
+ {
230
+ icon: g ? V : H,
231
+ style: { fontSize: "0.85rem" }
232
+ }
233
+ )
234
+ }
235
+ ),
236
+ /* @__PURE__ */ a(F, { children: [
237
+ /* @__PURE__ */ e(c, { variant: "h6", sx: { fontWeight: 700, lineHeight: 1.3 }, children: u(g ? "Update Server" : "Add Server") }),
238
+ /* @__PURE__ */ e(c, { variant: "caption", color: "text.secondary", children: g ? "Modify server configuration and sync permissions." : "Configure a new server connection." })
239
+ ] })
240
+ ] })
241
+ }
242
+ ),
243
+ /* @__PURE__ */ a("form", { noValidate: !0, onSubmit: s.handleSubmit(j), children: [
244
+ /* @__PURE__ */ e(
245
+ ye,
246
+ {
247
+ sx: {
248
+ px: 3,
249
+ py: 3,
250
+ scrollbarWidth: "none",
251
+ "&::-webkit-scrollbar": { display: "none" }
252
+ },
253
+ children: /* @__PURE__ */ a(f, { container: !0, spacing: 2.5, children: [
254
+ /* @__PURE__ */ a(f, { size: 12, children: [
255
+ /* @__PURE__ */ e(
256
+ c,
257
+ {
258
+ variant: "subtitle2",
259
+ sx: {
260
+ fontWeight: 700,
261
+ color: "text.primary",
262
+ mb: 0.5,
263
+ textTransform: "uppercase",
264
+ fontSize: "0.7rem",
265
+ letterSpacing: "0.05em"
266
+ },
267
+ children: "Server Details"
268
+ }
269
+ ),
270
+ /* @__PURE__ */ e(G, {})
271
+ ] }),
272
+ /* @__PURE__ */ e(f, { size: 6, children: /* @__PURE__ */ e(m, { label: u("Name"), required: !0, children: /* @__PURE__ */ e(
273
+ U,
274
+ {
275
+ control: s.control,
276
+ name: "name",
277
+ id: "name",
278
+ errors: s.formState.errors,
279
+ placeholder: "Enter server name"
280
+ }
281
+ ) }) }),
282
+ /* @__PURE__ */ e(f, { size: 6, children: /* @__PURE__ */ e(m, { label: u("Code"), required: !0, children: /* @__PURE__ */ e(
283
+ U,
284
+ {
285
+ control: s.control,
286
+ name: "code",
287
+ id: "code",
288
+ disabled: g,
289
+ errors: s.formState.errors,
290
+ placeholder: "Enter server code",
291
+ successMessage: S,
292
+ onChange: (l) => L(l.target.value)
293
+ }
294
+ ) }) }),
295
+ /* @__PURE__ */ e(f, { size: 6, children: /* @__PURE__ */ a(m, { label: u("Type"), required: !0, children: [
296
+ /* @__PURE__ */ e(
297
+ q,
298
+ {
299
+ name: "type",
300
+ control: s.control,
301
+ render: ({ field: { onChange: l, value: o } }) => /* @__PURE__ */ e(
302
+ B,
303
+ {
304
+ size: "small",
305
+ options: M || [],
306
+ getOptionLabel: (r) => r,
307
+ defaultValue: o,
308
+ onChange: (r, n) => {
309
+ l(n);
310
+ },
311
+ renderInput: (r) => {
312
+ var n;
313
+ return /* @__PURE__ */ e(
314
+ I,
315
+ {
316
+ ...r,
317
+ placeholder: "Select type",
318
+ variant: "outlined",
319
+ error: !!((n = s.formState.errors) != null && n.type)
320
+ }
321
+ );
322
+ }
323
+ }
324
+ )
325
+ }
326
+ ),
327
+ s.formState.errors.type && /* @__PURE__ */ e(Z, { error: !0, children: (k = s.formState.errors.type) == null ? void 0 : k.message })
328
+ ] }) }),
329
+ /* @__PURE__ */ e(f, { size: 6, children: /* @__PURE__ */ e(m, { label: u("URL"), required: !0, children: /* @__PURE__ */ e(
330
+ U,
331
+ {
332
+ control: s.control,
333
+ name: "url",
334
+ id: "url",
335
+ errors: s.formState.errors,
336
+ placeholder: "https://example.com"
337
+ }
338
+ ) }) }),
339
+ /* @__PURE__ */ e(f, { size: 12, children: /* @__PURE__ */ e(m, { label: u("Active"), required: !0, children: /* @__PURE__ */ e(
340
+ q,
341
+ {
342
+ name: "isActive",
343
+ control: s.control,
344
+ rules: { required: "This field is required." },
345
+ render: ({
346
+ field: { onChange: l, value: o },
347
+ fieldState: { error: r }
348
+ }) => {
349
+ var n;
350
+ return /* @__PURE__ */ a(Se, { component: "fieldset", error: !!r, children: [
351
+ /* @__PURE__ */ a(xe, { row: !0, value: o, onChange: l, children: [
352
+ /* @__PURE__ */ e(
353
+ _,
354
+ {
355
+ value: !0,
356
+ control: /* @__PURE__ */ e(ee, { size: "small" }),
357
+ label: /* @__PURE__ */ e(c, { variant: "body2", children: "Yes" })
358
+ }
359
+ ),
360
+ /* @__PURE__ */ e(
361
+ _,
362
+ {
363
+ value: !1,
364
+ control: /* @__PURE__ */ e(ee, { size: "small" }),
365
+ label: /* @__PURE__ */ e(c, { variant: "body2", children: "No" })
366
+ }
367
+ )
368
+ ] }),
369
+ r && /* @__PURE__ */ e(Z, { children: (n = s.formState.errors.isActive) == null ? void 0 : n.message })
370
+ ] });
371
+ }
372
+ }
373
+ ) }) }),
374
+ /* @__PURE__ */ a(f, { size: 12, sx: { mt: 0.5 }, children: [
375
+ /* @__PURE__ */ e(
376
+ c,
377
+ {
378
+ variant: "subtitle2",
379
+ sx: {
380
+ fontWeight: 700,
381
+ color: "text.primary",
382
+ mb: 0.5,
383
+ textTransform: "uppercase",
384
+ fontSize: "0.7rem",
385
+ letterSpacing: "0.05em"
386
+ },
387
+ children: "Sync Permissions"
388
+ }
389
+ ),
390
+ /* @__PURE__ */ e(G, {})
391
+ ] }),
392
+ /* @__PURE__ */ e(f, { size: 12, children: /* @__PURE__ */ e(m, { label: u("Can Pull From"), children: /* @__PURE__ */ e(
393
+ q,
394
+ {
395
+ name: "canPullServer",
396
+ control: s.control,
397
+ render: ({ field: { onChange: l, value: o } }) => /* @__PURE__ */ e(
398
+ B,
399
+ {
400
+ size: "small",
401
+ multiple: !0,
402
+ options: x || [],
403
+ getOptionLabel: (r) => r.name || "",
404
+ getOptionKey: (r) => r.code || "",
405
+ getOptionDisabled: (r) => r.code === s.getValues("code") || s.getValues("canPullServer").some((n) => n.code === r.code),
406
+ value: o,
407
+ onChange: (r, n) => {
408
+ l(n);
409
+ },
410
+ renderTags: (r, n) => r.map((i, t) => /* @__PURE__ */ ne(
411
+ b,
412
+ {
413
+ ...n({ index: t }),
414
+ key: i.code,
415
+ label: i.name,
416
+ size: "small",
417
+ color: "primary",
418
+ variant: "outlined",
419
+ sx: { borderRadius: 2, fontWeight: 500 }
420
+ }
421
+ )),
422
+ renderInput: (r) => /* @__PURE__ */ e(
423
+ I,
424
+ {
425
+ ...r,
426
+ placeholder: (o == null ? void 0 : o.length) > 0 ? "" : "Select servers to pull from...",
427
+ variant: "outlined"
428
+ }
429
+ )
430
+ }
431
+ )
432
+ }
433
+ ) }) }),
434
+ /* @__PURE__ */ e(f, { size: 12, children: /* @__PURE__ */ e(m, { label: u("Can Push To"), children: /* @__PURE__ */ e(
435
+ q,
436
+ {
437
+ name: "canPushServer",
438
+ control: s.control,
439
+ render: ({ field: { onChange: l, value: o } }) => /* @__PURE__ */ e(
440
+ B,
441
+ {
442
+ size: "small",
443
+ multiple: !0,
444
+ options: x || [],
445
+ getOptionLabel: (r) => r.name || "",
446
+ getOptionKey: (r) => r.code || "",
447
+ getOptionDisabled: (r) => r.code === s.getValues("code") || s.getValues("canPushServer").some((n) => n.code === r.code),
448
+ value: o,
449
+ onChange: (r, n) => {
450
+ l(n);
451
+ },
452
+ renderTags: (r, n) => r.map((i, t) => /* @__PURE__ */ ne(
453
+ b,
454
+ {
455
+ ...n({ index: t }),
456
+ key: i.code,
457
+ label: i.name,
458
+ size: "small",
459
+ color: "primary",
460
+ variant: "outlined",
461
+ sx: { borderRadius: 2, fontWeight: 500 }
462
+ }
463
+ )),
464
+ renderInput: (r) => /* @__PURE__ */ e(
465
+ I,
466
+ {
467
+ ...r,
468
+ placeholder: (o == null ? void 0 : o.length) > 0 ? "" : "Select servers to push to...",
469
+ variant: "outlined"
470
+ }
471
+ )
472
+ }
473
+ )
474
+ }
475
+ ) }) })
476
+ ] })
477
+ }
478
+ ),
479
+ /* @__PURE__ */ a(
480
+ Ce,
481
+ {
482
+ sx: {
483
+ px: 3,
484
+ py: 2,
485
+ borderTop: "1px solid",
486
+ borderColor: "divider",
487
+ gap: 1
488
+ },
489
+ children: [
490
+ /* @__PURE__ */ e(
491
+ Y,
492
+ {
493
+ onClick: T,
494
+ size: "small",
495
+ variant: "outlined",
496
+ sx: {
497
+ borderRadius: 2,
498
+ textTransform: "none",
499
+ fontWeight: 600,
500
+ px: 2.5,
501
+ borderColor: "divider",
502
+ color: "text.secondary",
503
+ "&:hover": {
504
+ backgroundColor: "action.hover",
505
+ borderColor: "text.disabled"
506
+ }
507
+ },
508
+ children: u("Cancel")
509
+ }
510
+ ),
511
+ /* @__PURE__ */ e(
512
+ Y,
513
+ {
514
+ type: "submit",
515
+ size: "small",
516
+ variant: "contained",
517
+ sx: {
518
+ borderRadius: 2,
519
+ textTransform: "none",
520
+ fontWeight: 600,
521
+ px: 2.5,
522
+ boxShadow: "none"
523
+ },
524
+ startIcon: /* @__PURE__ */ e(
525
+ v,
526
+ {
527
+ icon: g ? V : H,
528
+ style: { fontSize: "0.75rem" }
529
+ }
530
+ ),
531
+ children: g ? "Update Server" : "Add Server"
532
+ }
533
+ )
534
+ ]
535
+ }
536
+ )
537
+ ] })
538
+ ]
539
+ }
540
+ );
541
+ }
542
+ ae.propTypes = {
543
+ openAddServer: y.bool,
544
+ openAddServerFunc: y.func,
545
+ allServerList: y.array,
546
+ reloadPageFunc: y.func,
547
+ editServer: y.bool,
548
+ editServerFunc: y.func,
549
+ serverData: y.object
550
+ };
551
+ function Qe() {
552
+ const [O, W] = P([]), [x, w] = P(!1), [g, N] = P(!1), [d, u] = P({}), [S, E] = P([]), [M, D] = P(!1), [A, $] = P(""), s = te();
553
+ le(() => {
554
+ (async () => (await K(), await L()))();
555
+ }, [M]);
556
+ const T = (o) => s.palette.mode === "light" ? o : `${o}-dark`, K = async () => {
557
+ try {
558
+ const o = (await he()).data;
559
+ o && W(
560
+ o.map((r) => ({ code: r.code, name: r.name }))
561
+ );
562
+ } catch (o) {
563
+ console.error("Error fetching servers:", o);
564
+ }
565
+ }, L = async () => {
566
+ try {
567
+ const o = (await me()).data;
568
+ o && (o.forEach((r) => {
569
+ let n = r.canPullServers ? JSON.parse(r.canPullServers) : [], i = r.canPushServers ? JSON.parse(r.canPushServers) : [];
570
+ r.canPullServers = JSON.parse(r.canPullServers), r.canPushServers = JSON.parse(r.canPushServers), r.pullServersName = n.length > 0 ? n.map((t) => t.name) : [], r.pushServersName = i.length > 0 ? i.map((t) => t.name) : [];
571
+ }), E(o));
572
+ } catch (o) {
573
+ console.error("Error fetching servers:", o);
574
+ }
575
+ }, j = (o) => {
576
+ N(!0), u(o), w(!0);
577
+ }, m = Re(() => {
578
+ if (!A.trim()) return S;
579
+ const o = A.toLowerCase();
580
+ return S.filter(
581
+ (r) => {
582
+ var n, i, t;
583
+ return ((n = r.name) == null ? void 0 : n.toLowerCase().includes(o)) || ((i = r.code) == null ? void 0 : i.toLowerCase().includes(o)) || ((t = r.url) == null ? void 0 : t.toLowerCase().includes(o));
584
+ }
585
+ );
586
+ }, [S, A]), k = S.filter((o) => o.isActive).length, l = (o) => {
587
+ if (!o) return "-";
588
+ const r = new Date(o), n = String(r.getDate()).padStart(2, "0"), t = [
589
+ "Jan",
590
+ "Feb",
591
+ "Mar",
592
+ "Apr",
593
+ "May",
594
+ "Jun",
595
+ "Jul",
596
+ "Aug",
597
+ "Sep",
598
+ "Oct",
599
+ "Nov",
600
+ "Dec"
601
+ ][r.getMonth()], p = r.getFullYear(), se = String(r.getHours()).padStart(2, "0"), ie = String(r.getMinutes()).padStart(2, "0");
602
+ return `${n} ${t} ${p}, ${se}:${ie}`;
603
+ };
604
+ return /* @__PURE__ */ a(f, { pt: 2, sx: { height: "calc(100vh)", zoom: "0.9" }, children: [
605
+ /* @__PURE__ */ e(z, { sx: { p: 3 }, className: T("server-management-wrapper"), children: /* @__PURE__ */ a(
606
+ re,
607
+ {
608
+ elevation: 0,
609
+ sx: {
610
+ p: { xs: 2.5, md: 3 },
611
+ border: "1px solid",
612
+ borderColor: "divider",
613
+ borderRadius: 3,
614
+ backgroundColor: "background.paper"
615
+ },
616
+ children: [
617
+ /* @__PURE__ */ a(z, { sx: { display: "flex", flexDirection: "column", gap: 3 }, children: [
618
+ /* @__PURE__ */ a(
619
+ z,
620
+ {
621
+ sx: {
622
+ display: "flex",
623
+ justifyContent: "space-between",
624
+ alignItems: "flex-start",
625
+ flexWrap: "wrap",
626
+ gap: 2
627
+ },
628
+ children: [
629
+ /* @__PURE__ */ a(z, { sx: { minWidth: { xs: "100%", lg: "40%" } }, children: [
630
+ /* @__PURE__ */ e(
631
+ c,
632
+ {
633
+ variant: "h5",
634
+ sx: { fontWeight: 800, color: "text.primary", mb: 0.5 },
635
+ children: "Server Management"
636
+ }
637
+ ),
638
+ /* @__PURE__ */ e(c, { variant: "body2", color: "text.secondary", children: "Configure and manage server connections, sync permissions, and server details." })
639
+ ] }),
640
+ /* @__PURE__ */ e(
641
+ z,
642
+ {
643
+ sx: {
644
+ display: "flex",
645
+ alignItems: "center",
646
+ gap: 1.5,
647
+ flexWrap: "wrap"
648
+ },
649
+ children: /* @__PURE__ */ e(
650
+ Y,
651
+ {
652
+ size: "small",
653
+ variant: "contained",
654
+ sx: {
655
+ borderRadius: 2,
656
+ fontWeight: 600,
657
+ px: 2,
658
+ boxShadow: "none",
659
+ textTransform: "none"
660
+ },
661
+ startIcon: /* @__PURE__ */ e(v, { icon: H }),
662
+ onClick: () => {
663
+ w(!0);
664
+ },
665
+ children: "Add Server"
666
+ }
667
+ )
668
+ }
669
+ )
670
+ ]
671
+ }
672
+ ),
673
+ /* @__PURE__ */ a(
674
+ z,
675
+ {
676
+ sx: {
677
+ display: "flex",
678
+ justifyContent: "space-between",
679
+ alignItems: "center",
680
+ flexWrap: "wrap",
681
+ gap: 2,
682
+ backgroundColor: "action.hover",
683
+ p: 1.5,
684
+ borderRadius: 2.5,
685
+ border: "1px solid",
686
+ borderColor: "divider"
687
+ },
688
+ children: [
689
+ /* @__PURE__ */ a(z, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
690
+ /* @__PURE__ */ e(
691
+ b,
692
+ {
693
+ icon: /* @__PURE__ */ e(
694
+ v,
695
+ {
696
+ icon: Q,
697
+ style: { fontSize: "0.7rem" }
698
+ }
699
+ ),
700
+ label: `${S.length} Total`,
701
+ size: "small",
702
+ variant: "outlined",
703
+ sx: {
704
+ fontWeight: 600,
705
+ borderRadius: 2,
706
+ px: 0.5,
707
+ borderColor: "divider"
708
+ }
709
+ }
710
+ ),
711
+ /* @__PURE__ */ e(
712
+ b,
713
+ {
714
+ icon: /* @__PURE__ */ e(
715
+ v,
716
+ {
717
+ icon: X,
718
+ style: { fontSize: "0.7rem" }
719
+ }
720
+ ),
721
+ label: `${k} Active`,
722
+ size: "small",
723
+ color: "success",
724
+ variant: "filled",
725
+ sx: { fontWeight: 700, borderRadius: 2, px: 0.5 }
726
+ }
727
+ ),
728
+ S.length - k > 0 && /* @__PURE__ */ e(
729
+ b,
730
+ {
731
+ label: `${S.length - k} Inactive`,
732
+ size: "small",
733
+ color: "default",
734
+ variant: "outlined",
735
+ sx: {
736
+ fontWeight: 600,
737
+ borderRadius: 2,
738
+ px: 0.5,
739
+ borderColor: "divider"
740
+ }
741
+ }
742
+ )
743
+ ] }),
744
+ /* @__PURE__ */ e(
745
+ I,
746
+ {
747
+ value: A,
748
+ size: "small",
749
+ placeholder: "Search servers...",
750
+ onChange: (o) => $(o.target.value),
751
+ InputProps: {
752
+ startAdornment: /* @__PURE__ */ e(Pe, { position: "start", children: /* @__PURE__ */ e(
753
+ v,
754
+ {
755
+ icon: fe,
756
+ style: { fontSize: "0.85rem", color: "#999" }
757
+ }
758
+ ) }),
759
+ sx: {
760
+ backgroundColor: "background.paper",
761
+ borderRadius: 2,
762
+ minWidth: 260
763
+ }
764
+ }
765
+ }
766
+ )
767
+ ]
768
+ }
769
+ )
770
+ ] }),
771
+ /* @__PURE__ */ e(G, { sx: { my: 3 } }),
772
+ /* @__PURE__ */ e(
773
+ Ae,
774
+ {
775
+ className: T("server-table"),
776
+ component: re,
777
+ elevation: 0,
778
+ sx: {
779
+ borderRadius: 2.5,
780
+ border: "1px solid",
781
+ borderColor: "divider",
782
+ overflowY: "auto",
783
+ maxHeight: "calc(100vh - 340px)"
784
+ },
785
+ children: /* @__PURE__ */ a(ze, { stickyHeader: !0, children: [
786
+ /* @__PURE__ */ e(we, { children: /* @__PURE__ */ e(J, { children: [
787
+ "Sr. No.",
788
+ "Name",
789
+ "Code",
790
+ "Type",
791
+ "URL",
792
+ "Status",
793
+ "Can Pull From",
794
+ "Can Push To",
795
+ "Modified On",
796
+ "Actions"
797
+ ].map((o, r) => /* @__PURE__ */ e(
798
+ h,
799
+ {
800
+ align: o === "Actions" ? "center" : "left",
801
+ sx: {
802
+ fontWeight: 700,
803
+ fontSize: "0.78rem",
804
+ textTransform: "uppercase",
805
+ letterSpacing: "0.04em",
806
+ color: "text.secondary",
807
+ backgroundColor: "background.default",
808
+ borderBottom: "2px solid",
809
+ borderColor: "divider",
810
+ py: 1.5
811
+ },
812
+ children: o
813
+ },
814
+ r
815
+ )) }) }),
816
+ /* @__PURE__ */ a(Te, { children: [
817
+ m.map((o, r) => /* @__PURE__ */ a(
818
+ J,
819
+ {
820
+ sx: {
821
+ transition: "background-color 0.15s ease",
822
+ "&:hover": { backgroundColor: "action.hover" },
823
+ "&:last-child td": { borderBottom: 0 }
824
+ },
825
+ children: [
826
+ /* @__PURE__ */ e(
827
+ h,
828
+ {
829
+ sx: { color: "text.secondary", fontWeight: 500 },
830
+ children: r + 1
831
+ }
832
+ ),
833
+ /* @__PURE__ */ e(h, { sx: { fontWeight: 600 }, children: o.name }),
834
+ /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(
835
+ b,
836
+ {
837
+ label: o.code,
838
+ size: "small",
839
+ variant: "outlined",
840
+ sx: {
841
+ fontFamily: "monospace",
842
+ fontSize: "0.75rem",
843
+ borderRadius: 1.5,
844
+ borderColor: "divider"
845
+ }
846
+ }
847
+ ) }),
848
+ /* @__PURE__ */ e(h, { children: o.type }),
849
+ /* @__PURE__ */ e(
850
+ h,
851
+ {
852
+ sx: {
853
+ maxWidth: 200,
854
+ overflow: "hidden",
855
+ textOverflow: "ellipsis",
856
+ whiteSpace: "nowrap"
857
+ },
858
+ children: /* @__PURE__ */ e(oe, { title: o.url || "", arrow: !0, placement: "top", children: /* @__PURE__ */ e("span", { children: o.url }) })
859
+ }
860
+ ),
861
+ /* @__PURE__ */ e(h, { children: o.isActive ? /* @__PURE__ */ e(
862
+ b,
863
+ {
864
+ icon: /* @__PURE__ */ e(
865
+ v,
866
+ {
867
+ icon: X,
868
+ style: { fontSize: "0.7rem" }
869
+ }
870
+ ),
871
+ label: "Active",
872
+ size: "small",
873
+ color: "success",
874
+ variant: "filled",
875
+ sx: { fontWeight: 600, borderRadius: 2 }
876
+ }
877
+ ) : /* @__PURE__ */ e(
878
+ b,
879
+ {
880
+ icon: /* @__PURE__ */ e(
881
+ v,
882
+ {
883
+ icon: ge,
884
+ style: { fontSize: "0.7rem" }
885
+ }
886
+ ),
887
+ label: "Inactive",
888
+ size: "small",
889
+ color: "default",
890
+ variant: "outlined",
891
+ sx: {
892
+ fontWeight: 600,
893
+ borderRadius: 2,
894
+ borderColor: "divider"
895
+ }
896
+ }
897
+ ) }),
898
+ /* @__PURE__ */ e(h, { children: Array.isArray(o.pullServersName) && o.pullServersName.length > 0 ? o.pullServersName.map((n, i) => /* @__PURE__ */ e(
899
+ b,
900
+ {
901
+ label: n || "-",
902
+ color: "primary",
903
+ size: "small",
904
+ variant: "outlined",
905
+ sx: {
906
+ mr: 0.5,
907
+ mb: 0.5,
908
+ borderRadius: 2,
909
+ fontWeight: 500
910
+ }
911
+ },
912
+ i
913
+ )) : /* @__PURE__ */ e(c, { variant: "caption", color: "text.disabled", children: "—" }) }),
914
+ /* @__PURE__ */ e(h, { children: Array.isArray(o.pushServersName) && o.pushServersName.length > 0 ? o.pushServersName.map((n, i) => /* @__PURE__ */ e(
915
+ b,
916
+ {
917
+ label: n || "-",
918
+ color: "primary",
919
+ size: "small",
920
+ variant: "outlined",
921
+ sx: {
922
+ mr: 0.5,
923
+ mb: 0.5,
924
+ borderRadius: 2,
925
+ fontWeight: 500
926
+ }
927
+ },
928
+ i
929
+ )) : /* @__PURE__ */ e(c, { variant: "caption", color: "text.disabled", children: "—" }) }),
930
+ /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(
931
+ c,
932
+ {
933
+ variant: "caption",
934
+ sx: { color: "text.secondary" },
935
+ children: l(o.modifiedOn)
936
+ }
937
+ ) }),
938
+ /* @__PURE__ */ e(h, { align: "center", children: /* @__PURE__ */ e(oe, { title: "Edit server", arrow: !0, placement: "top", children: /* @__PURE__ */ e(
939
+ ke,
940
+ {
941
+ size: "small",
942
+ onClick: () => {
943
+ j(o);
944
+ },
945
+ sx: {
946
+ color: "primary.main",
947
+ "&:hover": { backgroundColor: "primary.50" }
948
+ },
949
+ children: /* @__PURE__ */ e(
950
+ v,
951
+ {
952
+ icon: V,
953
+ style: { fontSize: "0.8rem" }
954
+ }
955
+ )
956
+ }
957
+ ) }) })
958
+ ]
959
+ },
960
+ r
961
+ )),
962
+ m.length === 0 && /* @__PURE__ */ e(J, { children: /* @__PURE__ */ a(h, { colSpan: 10, align: "center", sx: { py: 6 }, children: [
963
+ /* @__PURE__ */ e(
964
+ v,
965
+ {
966
+ icon: Q,
967
+ style: {
968
+ fontSize: "2rem",
969
+ color: "#ccc",
970
+ marginBottom: 8,
971
+ display: "block",
972
+ margin: "0 auto 8px"
973
+ }
974
+ }
975
+ ),
976
+ /* @__PURE__ */ e(c, { variant: "body2", color: "text.secondary", children: A ? "No servers match your search." : 'No servers found. Click "Add Server" to get started.' })
977
+ ] }) })
978
+ ] })
979
+ ] })
980
+ }
981
+ )
982
+ ]
983
+ }
984
+ ) }),
985
+ x && /* @__PURE__ */ e(
986
+ ae,
987
+ {
988
+ openAddServer: x,
989
+ openAddServerFunc: w,
990
+ allServerList: O,
991
+ reloadPageFunc: D,
992
+ editServer: g,
993
+ editServerFunc: N,
994
+ serverData: d
995
+ }
996
+ )
997
+ ] });
998
+ }
999
+ export {
1000
+ Qe as default
1001
+ };
1002
+ //# sourceMappingURL=NewServerManagement-5YcAtF-g.js.map