@argusoft/medplat-form-engine 1.0.15 → 1.0.17

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 (132) hide show
  1. package/dist/AccessRights-BMRM1u9S-D1Gc0rKI.js +1228 -0
  2. package/dist/AccessRights-BMRM1u9S-D1Gc0rKI.js.map +1 -0
  3. package/dist/AddEditQueryBuilder-7JRplV5J-DHgS6TYG.js +313 -0
  4. package/dist/AddEditQueryBuilder-7JRplV5J-DHgS6TYG.js.map +1 -0
  5. package/dist/AddEditQueryBuilder-7JRplV5J.css +1 -0
  6. package/dist/AddFeatures-CkTu7sOI-BGplSFp6.js +212 -0
  7. package/dist/AddFeatures-CkTu7sOI-BGplSFp6.js.map +1 -0
  8. package/dist/AddLabelModal-DE3ploGD-OOyaGC02.js +734 -0
  9. package/dist/AddLabelModal-DE3ploGD-OOyaGC02.js.map +1 -0
  10. package/dist/AddMenuConfiguration-QWfpcnuP-TAM2c68S.js +5389 -0
  11. package/dist/AddMenuConfiguration-QWfpcnuP-TAM2c68S.js.map +1 -0
  12. package/dist/AddMenuConfiguration-QWfpcnuP.css +1 -0
  13. package/dist/AddRoleDrawer-ZK1eejxI-BM6rfhh5.js +453 -0
  14. package/dist/AddRoleDrawer-ZK1eejxI-BM6rfhh5.js.map +1 -0
  15. package/dist/AppModal-BgZyfrd--BO3wW4ma.js +428 -0
  16. package/dist/AppModal-BgZyfrd--BO3wW4ma.js.map +1 -0
  17. package/dist/ChangePasswordModalCore-DIe4rzW--Dz71RCI6.js +176 -0
  18. package/dist/ChangePasswordModalCore-DIe4rzW--Dz71RCI6.js.map +1 -0
  19. package/dist/ConditionConfig-GDCXIg3C-DuEy85LD.js +395 -0
  20. package/dist/ConditionConfig-GDCXIg3C-DuEy85LD.js.map +1 -0
  21. package/dist/ConditionConfig-GDCXIg3C.css +1 -0
  22. package/dist/EntityManagement-D-x6Qzal-BE01iKNR.js +50 -0
  23. package/dist/EntityManagement-D-x6Qzal-BE01iKNR.js.map +1 -0
  24. package/dist/EventConfigurations-jGCJ4LqP-CJBCGp6J.js +384 -0
  25. package/dist/EventConfigurations-jGCJ4LqP-CJBCGp6J.js.map +1 -0
  26. package/dist/EventConfigurations-jGCJ4LqP.css +1 -0
  27. package/dist/EventsExceptionModal-BF6E1Np7-DHT7pQsx.js +200 -0
  28. package/dist/EventsExceptionModal-BF6E1Np7-DHT7pQsx.js.map +1 -0
  29. package/dist/EventsSkeleton-BN7_0IGs-BAnd1Vug.js +74 -0
  30. package/dist/EventsSkeleton-BN7_0IGs-BAnd1Vug.js.map +1 -0
  31. package/dist/FeatureMenu-Ds6lFg4w-ShGx4okQ.js +249 -0
  32. package/dist/FeatureMenu-Ds6lFg4w-ShGx4okQ.js.map +1 -0
  33. package/dist/Features-Cshdl06N-CZ02Tt89.js +12 -0
  34. package/dist/Features-Cshdl06N-CZ02Tt89.js.map +1 -0
  35. package/dist/FileSaver.min-CN9EpL2h-N-3OFAd7.js +77 -0
  36. package/dist/FileSaver.min-CN9EpL2h-N-3OFAd7.js.map +1 -0
  37. package/dist/FlywayQuery-Cx2sly6g-DdhUw6bN.js +169 -0
  38. package/dist/FlywayQuery-Cx2sly6g-DdhUw6bN.js.map +1 -0
  39. package/dist/ImmunizationConfigurationBase-DZ8EqXlF-B4x4_1v0.js +5162 -0
  40. package/dist/ImmunizationConfigurationBase-DZ8EqXlF-B4x4_1v0.js.map +1 -0
  41. package/dist/ImmunizationConfigurationBase-DZ8EqXlF.css +1 -0
  42. package/dist/ImmunizationConfigurationsList-CQnxWa09-Bbr0iyGy.js +335 -0
  43. package/dist/ImmunizationConfigurationsList-CQnxWa09-Bbr0iyGy.js.map +1 -0
  44. package/dist/ImmunizationSkeleton-D2tdv5k--B7SY-gnr.js +186 -0
  45. package/dist/ImmunizationSkeleton-D2tdv5k--B7SY-gnr.js.map +1 -0
  46. package/dist/LanguagesModal-rk6IGQwY-B0Jtpivu.js +394 -0
  47. package/dist/LanguagesModal-rk6IGQwY-B0Jtpivu.js.map +1 -0
  48. package/dist/ManageDynamicFeature-C2I7Ho7i-Bbxkpw0S.js +4189 -0
  49. package/dist/ManageDynamicFeature-C2I7Ho7i-Bbxkpw0S.js.map +1 -0
  50. package/dist/ManageEventConfiguration-BJxS2Su0-CRATBMym.js +1017 -0
  51. package/dist/ManageEventConfiguration-BJxS2Su0-CRATBMym.js.map +1 -0
  52. package/dist/ManageEventConfiguration-BJxS2Su0.css +1 -0
  53. package/dist/ManageNotification-DMN2szWy-DQvdrfwC.js +6819 -0
  54. package/dist/ManageNotification-DMN2szWy-DQvdrfwC.js.map +1 -0
  55. package/dist/ManageRole-CuXmWQyp-Cy15Mlax.js +728 -0
  56. package/dist/ManageRole-CuXmWQyp-Cy15Mlax.js.map +1 -0
  57. package/dist/ManageTranslation-BTxvSYKb-CdO4Fk7f.js +616 -0
  58. package/dist/ManageTranslation-BTxvSYKb-CdO4Fk7f.js.map +1 -0
  59. package/dist/ManageTranslation-BTxvSYKb.css +1 -0
  60. package/dist/ManageUser-Dr3ptCYp-CzLX1rCi.js +2179 -0
  61. package/dist/ManageUser-Dr3ptCYp-CzLX1rCi.js.map +1 -0
  62. package/dist/ManageUser-Dr3ptCYp.css +1 -0
  63. package/dist/MedplatFormWrapper-CfKQpZOJ.js +52228 -0
  64. package/dist/MedplatFormWrapper-CfKQpZOJ.js.map +1 -0
  65. package/dist/MedplatFormWrapper.css +1 -0
  66. package/dist/MobileMenuManagement-BmrO-7MN-xFkU87j6.js +111 -0
  67. package/dist/MobileMenuManagement-BmrO-7MN-xFkU87j6.js.map +1 -0
  68. package/dist/MobileTypeEventConfigModal-ChhO_A4f-DfJDqFB9.js +783 -0
  69. package/dist/MobileTypeEventConfigModal-ChhO_A4f-DfJDqFB9.js.map +1 -0
  70. package/dist/NewServerManagement-5YcAtF-g-DHV6PFTR.js +1002 -0
  71. package/dist/NewServerManagement-5YcAtF-g-DHV6PFTR.js.map +1 -0
  72. package/dist/NotificationFlywayQuery-BY8Zzml_-C7G-28dx.js +244 -0
  73. package/dist/NotificationFlywayQuery-BY8Zzml_-C7G-28dx.js.map +1 -0
  74. package/dist/NotificationList-BqibwMaM-D4mMbj4h.js +400 -0
  75. package/dist/NotificationList-BqibwMaM-D4mMbj4h.js.map +1 -0
  76. package/dist/OtherTypeEventConfigModal-ZnCGWm9v-D7x0QObl.js +1953 -0
  77. package/dist/OtherTypeEventConfigModal-ZnCGWm9v-D7x0QObl.js.map +1 -0
  78. package/dist/QueryBuilder-BPfavHH9-M3wgeHB3.js +378 -0
  79. package/dist/QueryBuilder-BPfavHH9-M3wgeHB3.js.map +1 -0
  80. package/dist/QueryBuilder-BPfavHH9.css +1 -0
  81. package/dist/QueryManagement-DXA73N2j-C2RCVmd2.js +671 -0
  82. package/dist/QueryManagement-DXA73N2j-C2RCVmd2.js.map +1 -0
  83. package/dist/QueryManagement-DXA73N2j.css +1 -0
  84. package/dist/RoleManagement-C0feJCuq-DIGwGqOD.js +410 -0
  85. package/dist/RoleManagement-C0feJCuq-DIGwGqOD.js.map +1 -0
  86. package/dist/SecurityAuditLogList-DHTcOtbx-VvwDlRuu.js +746 -0
  87. package/dist/SecurityAuditLogList-DHTcOtbx-VvwDlRuu.js.map +1 -0
  88. package/dist/ServerSyncModal-D_oFpv3C-C6c3_3lx.js +836 -0
  89. package/dist/ServerSyncModal-D_oFpv3C-C6c3_3lx.js.map +1 -0
  90. package/dist/ShowFlywayQuery-BkyA6QaA-2t9pZjcx.js +130 -0
  91. package/dist/ShowFlywayQuery-BkyA6QaA-2t9pZjcx.js.map +1 -0
  92. package/dist/ShowFlywayQuery-DVRCd384-BypXcNWX.js +259 -0
  93. package/dist/ShowFlywayQuery-DVRCd384-BypXcNWX.js.map +1 -0
  94. package/dist/ShowQueryHistory-BDN0tzHg-17BxK88Z.js +190 -0
  95. package/dist/ShowQueryHistory-BDN0tzHg-17BxK88Z.js.map +1 -0
  96. package/dist/SubMenu-DAfZC9Xi-B0BQYLdI.js +188 -0
  97. package/dist/SubMenu-DAfZC9Xi-B0BQYLdI.js.map +1 -0
  98. package/dist/TableDetails-DzREeJkm-B-WEBbQz.js +1508 -0
  99. package/dist/TableDetails-DzREeJkm-B-WEBbQz.js.map +1 -0
  100. package/dist/TableList-B9hr05Hs-BIsMbnIV.js +428 -0
  101. package/dist/TableList-B9hr05Hs-BIsMbnIV.js.map +1 -0
  102. package/dist/TypeConfiguration-C-lk8Szs-DkvHWHhr.js +117 -0
  103. package/dist/TypeConfiguration-C-lk8Szs-DkvHWHhr.js.map +1 -0
  104. package/dist/UserList-S5Q76wO7-Cj5u_K4_.js +1104 -0
  105. package/dist/UserList-S5Q76wO7-Cj5u_K4_.js.map +1 -0
  106. package/dist/UserList-S5Q76wO7.css +1 -0
  107. package/dist/UserListSkeleton-cglK2SaU-B_Tj5gUp.js +184 -0
  108. package/dist/UserListSkeleton-cglK2SaU-B_Tj5gUp.js.map +1 -0
  109. package/dist/WidgetList-BSApErov-Z61Kpq4T.js +188 -0
  110. package/dist/WidgetList-BSApErov-Z61Kpq4T.js.map +1 -0
  111. package/dist/_commonjsHelpers-B4e78b8K-B9tZyK9c.js +29 -0
  112. package/dist/_commonjsHelpers-B4e78b8K-B9tZyK9c.js.map +1 -0
  113. package/dist/default-DlLB_mdl.js +11341 -0
  114. package/dist/default-DlLB_mdl.js.map +1 -0
  115. package/dist/default.css +1 -0
  116. package/dist/i18next-CTOWN_jH-BKKbdDel.js +1389 -0
  117. package/dist/i18next-CTOWN_jH-BKKbdDel.js.map +1 -0
  118. package/dist/index-B4r0wjBD.js +563 -0
  119. package/dist/index-B4r0wjBD.js.map +1 -0
  120. package/dist/index-BFznsakV-CzCTrTvj.js +42638 -0
  121. package/dist/index-BFznsakV-CzCTrTvj.js.map +1 -0
  122. package/dist/index-Dta_LKti.js +744 -0
  123. package/dist/index-Dta_LKti.js.map +1 -0
  124. package/dist/index.css +1 -1
  125. package/dist/index.js +6 -52390
  126. package/dist/index.js.map +1 -1
  127. package/dist/manageImmunization-B4swS745-JldexHrO.js +1204 -0
  128. package/dist/manageImmunization-B4swS745-JldexHrO.js.map +1 -0
  129. package/dist/manageImmunization-B4swS745.css +1 -0
  130. package/dist/xlsx.min-D1LFqt_b-BGwkpd8r.js +11869 -0
  131. package/dist/xlsx.min-D1LFqt_b-BGwkpd8r.js.map +1 -0
  132. package/package.json +1 -4
@@ -0,0 +1,1002 @@
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import { getAllServer as se, getAllServerDetails as de, updateServer as ce, updateServerMappingList as ue, addServer as pe, addServerMappingList as me } from "@/common/services/SyncWithServer";
3
+ import { FontAwesomeIcon as f } from "@fortawesome/react-fontawesome";
4
+ import { faPlus as V, faServer as Y, faCircleCheck as Q, faMagnifyingGlass as he, faCircleXmark as ve, faPen as H } from "@fortawesome/free-solid-svg-icons";
5
+ import { useTheme as ae } from "@mui/material/styles";
6
+ import { Paper as X, Typography as u, Button as G, Chip as b, TextField as D, InputAdornment as ge, Divider as K, TableContainer as fe, Table as be, TableHead as Se, TableRow as j, TableCell as m, TableBody as ye, Tooltip as Z, IconButton as xe, Dialog as Ce, DialogTitle as Pe, Box as N, DialogContent as ze, Autocomplete as J, FormHelperText as _, FormControl as Ae, RadioGroup as we, FormControlLabel as ee, Radio as re, DialogActions as Te } from "@mui/material";
7
+ import v from "@mui/material/Grid2";
8
+ import { Box as z } from "@mui/system";
9
+ import { useState as x, useEffect as ne, useMemo as ke, createElement as oe } from "react";
10
+ import { showToast as y } from "@/common/toaster/toaster";
11
+ import { useDebounceFn as We } from "@/hooks/useDebounceFn";
12
+ import U from "@/views/custom-components/CustomTextField";
13
+ import { yupResolver as Re } from "@hookform/resolvers/yup";
14
+ import S from "prop-types";
15
+ import { useForm as Ne, Controller as F } from "react-hook-form";
16
+ import * as w from "yup";
17
+ import { useTranslateProvider as Fe } from "@/common/languageTranslator/TranslationContext";
18
+ function te({
19
+ openAddServer: q,
20
+ openAddServerFunc: k,
21
+ allServerList: C,
22
+ reloadPageFunc: A,
23
+ editServer: g,
24
+ editServerFunc: W,
25
+ serverData: p = {}
26
+ }) {
27
+ var R;
28
+ const { translate: c } = Fe(), [I, O] = x(""), L = ["STAGING", "PRODUCTION"], P = ae(), E = (n) => P.palette.mode === "light" ? n : `${n}-dark`, M = w.object().shape({
29
+ name: w.string().required("Name is required"),
30
+ code: w.string().required("Code is required"),
31
+ type: w.string().required("Type is required"),
32
+ url: w.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: w.boolean().required("This field is required.")
37
+ }), l = Ne({
38
+ defaultValues: {
39
+ name: "",
40
+ code: "",
41
+ type: "",
42
+ url: "",
43
+ isActive: null,
44
+ canPullServer: [],
45
+ canPushServer: []
46
+ },
47
+ resolver: Re(M),
48
+ mode: "onChange"
49
+ });
50
+ ne(() => {
51
+ g && l.reset({
52
+ name: p.name,
53
+ code: p.code,
54
+ type: p.type,
55
+ url: p.url,
56
+ isActive: p.isActive,
57
+ canPullServer: p.canPullServers ? p.canPullServers : [],
58
+ canPushServer: p.canPushServers ? p.canPushServers : []
59
+ });
60
+ }, []);
61
+ const T = () => {
62
+ k(!1), W(!1);
63
+ }, $ = We(async (n) => {
64
+ C != null && C.find((s) => s.code === n) ? l.setError("code", {
65
+ type: "manual",
66
+ message: "Code already exists"
67
+ }) : O(`${n} is available`);
68
+ }, 500), B = async (n) => {
69
+ var s, r;
70
+ let o = /* @__PURE__ */ new Map();
71
+ (s = n.canPullServer) == null || s.forEach((a) => {
72
+ let d = {
73
+ canPull: !0,
74
+ canPush: !1
75
+ };
76
+ o.set(a.code, d);
77
+ }), (r = n.canPushServer) == null || r.forEach((a) => {
78
+ if (o.has(a.code))
79
+ o.get(a.code).canPush = !0;
80
+ else {
81
+ let d = {
82
+ canPull: !1,
83
+ canPush: !0
84
+ };
85
+ o.set(a.code, d);
86
+ }
87
+ });
88
+ const t = [];
89
+ if (o.forEach((a, d) => {
90
+ t.push({
91
+ sourceServerCode: n.code,
92
+ destinationServerCode: d,
93
+ canPull: a.canPull,
94
+ canPush: a.canPush
95
+ }), t.push({
96
+ sourceServerCode: d,
97
+ destinationServerCode: n.code,
98
+ canPull: a.canPush,
99
+ canPush: a.canPull
100
+ });
101
+ }), g)
102
+ try {
103
+ if (o.size === 0 && t.push({
104
+ sourceServerCode: n.code,
105
+ destinationServerCode: null,
106
+ canPull: null,
107
+ canPush: null
108
+ }), n.uuid = p.uuid, await ce(n), y({
109
+ type: "success",
110
+ message: "Server updated successfully"
111
+ }), t.length > 0)
112
+ try {
113
+ await ue(t), y({
114
+ type: "success",
115
+ message: "Server mapping updated successfully"
116
+ });
117
+ } catch (a) {
118
+ y({
119
+ type: "error",
120
+ message: "Failed to update server mapping"
121
+ }), console.error("Error updating server mapping:", a);
122
+ }
123
+ A((a) => !a), T();
124
+ } catch (a) {
125
+ y({
126
+ type: "error",
127
+ message: "Failed to update server"
128
+ }), console.error("Error updating server:", a);
129
+ }
130
+ else
131
+ try {
132
+ const a = {
133
+ name: n.name,
134
+ code: n.code,
135
+ type: n.type,
136
+ url: n.url,
137
+ isActive: n.isActive
138
+ };
139
+ if (await pe(a), y({
140
+ type: "success",
141
+ message: "Server added successfully"
142
+ }), t.length > 0)
143
+ try {
144
+ await me(t), y({
145
+ type: "success",
146
+ message: "Server mapping added successfully"
147
+ });
148
+ } catch (d) {
149
+ y({
150
+ type: "error",
151
+ message: "Failed to add server mapping"
152
+ }), console.error("Error adding server mapping:", d);
153
+ }
154
+ A((d) => !d), k(!1);
155
+ } catch (a) {
156
+ y({
157
+ type: "error",
158
+ message: "Failed to add server"
159
+ }), console.error("Error adding server:", a);
160
+ }
161
+ }, h = ({ label: n, required: s, children: r }) => /* @__PURE__ */ i(N, { sx: { display: "flex", flexDirection: "column", gap: 0.75 }, children: [
162
+ /* @__PURE__ */ i(
163
+ u,
164
+ {
165
+ variant: "body2",
166
+ sx: { fontWeight: 600, color: "text.primary" },
167
+ children: [
168
+ n,
169
+ s && /* @__PURE__ */ e(u, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
170
+ ]
171
+ }
172
+ ),
173
+ r
174
+ ] });
175
+ return h.propTypes = {
176
+ label: S.string.isRequired,
177
+ required: S.bool,
178
+ children: S.node.isRequired
179
+ }, /* @__PURE__ */ i(
180
+ Ce,
181
+ {
182
+ open: q,
183
+ fullWidth: !0,
184
+ maxWidth: "sm",
185
+ onClose: T,
186
+ className: E("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
+ Pe,
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__ */ i(N, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
213
+ /* @__PURE__ */ e(
214
+ N,
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
+ f,
229
+ {
230
+ icon: g ? H : V,
231
+ style: { fontSize: "0.85rem" }
232
+ }
233
+ )
234
+ }
235
+ ),
236
+ /* @__PURE__ */ i(N, { children: [
237
+ /* @__PURE__ */ e(u, { variant: "h6", sx: { fontWeight: 700, lineHeight: 1.3 }, children: c(g ? "Update Server" : "Add Server") }),
238
+ /* @__PURE__ */ e(u, { variant: "caption", color: "text.secondary", children: g ? "Modify server configuration and sync permissions." : "Configure a new server connection." })
239
+ ] })
240
+ ] })
241
+ }
242
+ ),
243
+ /* @__PURE__ */ i("form", { noValidate: !0, onSubmit: l.handleSubmit(B), children: [
244
+ /* @__PURE__ */ e(
245
+ ze,
246
+ {
247
+ sx: {
248
+ px: 3,
249
+ py: 3,
250
+ scrollbarWidth: "none",
251
+ "&::-webkit-scrollbar": { display: "none" }
252
+ },
253
+ children: /* @__PURE__ */ i(v, { container: !0, spacing: 2.5, children: [
254
+ /* @__PURE__ */ i(v, { size: 12, children: [
255
+ /* @__PURE__ */ e(
256
+ u,
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(K, {})
271
+ ] }),
272
+ /* @__PURE__ */ e(v, { size: 6, children: /* @__PURE__ */ e(h, { label: c("Name"), required: !0, children: /* @__PURE__ */ e(
273
+ U,
274
+ {
275
+ control: l.control,
276
+ name: "name",
277
+ id: "name",
278
+ errors: l.formState.errors,
279
+ placeholder: "Enter server name"
280
+ }
281
+ ) }) }),
282
+ /* @__PURE__ */ e(v, { size: 6, children: /* @__PURE__ */ e(h, { label: c("Code"), required: !0, children: /* @__PURE__ */ e(
283
+ U,
284
+ {
285
+ control: l.control,
286
+ name: "code",
287
+ id: "code",
288
+ disabled: g,
289
+ errors: l.formState.errors,
290
+ placeholder: "Enter server code",
291
+ successMessage: I,
292
+ onChange: (n) => $(n.target.value)
293
+ }
294
+ ) }) }),
295
+ /* @__PURE__ */ e(v, { size: 6, children: /* @__PURE__ */ i(h, { label: c("Type"), required: !0, children: [
296
+ /* @__PURE__ */ e(
297
+ F,
298
+ {
299
+ name: "type",
300
+ control: l.control,
301
+ render: ({ field: { onChange: n, value: s } }) => /* @__PURE__ */ e(
302
+ J,
303
+ {
304
+ size: "small",
305
+ options: L || [],
306
+ getOptionLabel: (r) => r,
307
+ defaultValue: s,
308
+ onChange: (r, o) => {
309
+ n(o);
310
+ },
311
+ renderInput: (r) => {
312
+ var o;
313
+ return /* @__PURE__ */ e(
314
+ D,
315
+ {
316
+ ...r,
317
+ placeholder: "Select type",
318
+ variant: "outlined",
319
+ error: !!((o = l.formState.errors) != null && o.type)
320
+ }
321
+ );
322
+ }
323
+ }
324
+ )
325
+ }
326
+ ),
327
+ l.formState.errors.type && /* @__PURE__ */ e(_, { error: !0, children: (R = l.formState.errors.type) == null ? void 0 : R.message })
328
+ ] }) }),
329
+ /* @__PURE__ */ e(v, { size: 6, children: /* @__PURE__ */ e(h, { label: c("URL"), required: !0, children: /* @__PURE__ */ e(
330
+ U,
331
+ {
332
+ control: l.control,
333
+ name: "url",
334
+ id: "url",
335
+ errors: l.formState.errors,
336
+ placeholder: "https://example.com"
337
+ }
338
+ ) }) }),
339
+ /* @__PURE__ */ e(v, { size: 12, children: /* @__PURE__ */ e(h, { label: c("Active"), required: !0, children: /* @__PURE__ */ e(
340
+ F,
341
+ {
342
+ name: "isActive",
343
+ control: l.control,
344
+ rules: { required: "This field is required." },
345
+ render: ({
346
+ field: { onChange: n, value: s },
347
+ fieldState: { error: r }
348
+ }) => {
349
+ var o;
350
+ return /* @__PURE__ */ i(Ae, { component: "fieldset", error: !!r, children: [
351
+ /* @__PURE__ */ i(we, { row: !0, value: s, onChange: n, children: [
352
+ /* @__PURE__ */ e(
353
+ ee,
354
+ {
355
+ value: !0,
356
+ control: /* @__PURE__ */ e(re, { size: "small" }),
357
+ label: /* @__PURE__ */ e(u, { variant: "body2", children: "Yes" })
358
+ }
359
+ ),
360
+ /* @__PURE__ */ e(
361
+ ee,
362
+ {
363
+ value: !1,
364
+ control: /* @__PURE__ */ e(re, { size: "small" }),
365
+ label: /* @__PURE__ */ e(u, { variant: "body2", children: "No" })
366
+ }
367
+ )
368
+ ] }),
369
+ r && /* @__PURE__ */ e(_, { children: (o = l.formState.errors.isActive) == null ? void 0 : o.message })
370
+ ] });
371
+ }
372
+ }
373
+ ) }) }),
374
+ /* @__PURE__ */ i(v, { size: 12, sx: { mt: 0.5 }, children: [
375
+ /* @__PURE__ */ e(
376
+ u,
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(K, {})
391
+ ] }),
392
+ /* @__PURE__ */ e(v, { size: 12, children: /* @__PURE__ */ e(h, { label: c("Can Pull From"), children: /* @__PURE__ */ e(
393
+ F,
394
+ {
395
+ name: "canPullServer",
396
+ control: l.control,
397
+ render: ({ field: { onChange: n, value: s } }) => /* @__PURE__ */ e(
398
+ J,
399
+ {
400
+ size: "small",
401
+ multiple: !0,
402
+ options: C || [],
403
+ getOptionLabel: (r) => r.name || "",
404
+ getOptionKey: (r) => r.code || "",
405
+ getOptionDisabled: (r) => r.code === l.getValues("code") || l.getValues("canPullServer").some((o) => o.code === r.code),
406
+ value: s,
407
+ onChange: (r, o) => {
408
+ n(o);
409
+ },
410
+ renderTags: (r, o) => r.map((t, a) => /* @__PURE__ */ oe(
411
+ b,
412
+ {
413
+ ...o({ index: a }),
414
+ key: t.code,
415
+ label: t.name,
416
+ size: "small",
417
+ color: "primary",
418
+ variant: "outlined",
419
+ sx: { borderRadius: 2, fontWeight: 500 }
420
+ }
421
+ )),
422
+ renderInput: (r) => /* @__PURE__ */ e(
423
+ D,
424
+ {
425
+ ...r,
426
+ placeholder: (s == null ? void 0 : s.length) > 0 ? "" : "Select servers to pull from...",
427
+ variant: "outlined"
428
+ }
429
+ )
430
+ }
431
+ )
432
+ }
433
+ ) }) }),
434
+ /* @__PURE__ */ e(v, { size: 12, children: /* @__PURE__ */ e(h, { label: c("Can Push To"), children: /* @__PURE__ */ e(
435
+ F,
436
+ {
437
+ name: "canPushServer",
438
+ control: l.control,
439
+ render: ({ field: { onChange: n, value: s } }) => /* @__PURE__ */ e(
440
+ J,
441
+ {
442
+ size: "small",
443
+ multiple: !0,
444
+ options: C || [],
445
+ getOptionLabel: (r) => r.name || "",
446
+ getOptionKey: (r) => r.code || "",
447
+ getOptionDisabled: (r) => r.code === l.getValues("code") || l.getValues("canPushServer").some((o) => o.code === r.code),
448
+ value: s,
449
+ onChange: (r, o) => {
450
+ n(o);
451
+ },
452
+ renderTags: (r, o) => r.map((t, a) => /* @__PURE__ */ oe(
453
+ b,
454
+ {
455
+ ...o({ index: a }),
456
+ key: t.code,
457
+ label: t.name,
458
+ size: "small",
459
+ color: "primary",
460
+ variant: "outlined",
461
+ sx: { borderRadius: 2, fontWeight: 500 }
462
+ }
463
+ )),
464
+ renderInput: (r) => /* @__PURE__ */ e(
465
+ D,
466
+ {
467
+ ...r,
468
+ placeholder: (s == null ? void 0 : s.length) > 0 ? "" : "Select servers to push to...",
469
+ variant: "outlined"
470
+ }
471
+ )
472
+ }
473
+ )
474
+ }
475
+ ) }) })
476
+ ] })
477
+ }
478
+ ),
479
+ /* @__PURE__ */ i(
480
+ Te,
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
+ G,
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: c("Cancel")
509
+ }
510
+ ),
511
+ /* @__PURE__ */ e(
512
+ G,
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
+ f,
526
+ {
527
+ icon: g ? H : V,
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
+ te.propTypes = {
543
+ openAddServer: S.bool,
544
+ openAddServerFunc: S.func,
545
+ allServerList: S.array,
546
+ reloadPageFunc: S.func,
547
+ editServer: S.bool,
548
+ editServerFunc: S.func,
549
+ serverData: S.object
550
+ };
551
+ function Ye() {
552
+ const [q, k] = x([]), [C, A] = x(!1), [g, W] = x(!1), [p, R] = x({}), [c, I] = x([]), [O, L] = x(!1), [P, E] = x(""), M = ae();
553
+ ne(() => {
554
+ (async () => (await T(), await $()))();
555
+ }, [O]);
556
+ const l = (r) => M.palette.mode === "light" ? r : `${r}-dark`, T = async () => {
557
+ try {
558
+ const r = (await se()).data;
559
+ r && k(
560
+ r.map((o) => ({ code: o.code, name: o.name }))
561
+ );
562
+ } catch (r) {
563
+ console.error("Error fetching servers:", r);
564
+ }
565
+ }, $ = async () => {
566
+ try {
567
+ const r = (await de()).data;
568
+ r && (r.forEach((o) => {
569
+ let t = o.canPullServers ? JSON.parse(o.canPullServers) : [], a = o.canPushServers ? JSON.parse(o.canPushServers) : [];
570
+ o.canPullServers = JSON.parse(o.canPullServers), o.canPushServers = JSON.parse(o.canPushServers), o.pullServersName = t.length > 0 ? t.map((d) => d.name) : [], o.pushServersName = a.length > 0 ? a.map((d) => d.name) : [];
571
+ }), I(r));
572
+ } catch (r) {
573
+ console.error("Error fetching servers:", r);
574
+ }
575
+ }, B = (r) => {
576
+ W(!0), R(r), A(!0);
577
+ }, h = ke(() => {
578
+ if (!P.trim()) return c;
579
+ const r = P.toLowerCase();
580
+ return c.filter(
581
+ (o) => {
582
+ var t, a, d;
583
+ return ((t = o.name) == null ? void 0 : t.toLowerCase().includes(r)) || ((a = o.code) == null ? void 0 : a.toLowerCase().includes(r)) || ((d = o.url) == null ? void 0 : d.toLowerCase().includes(r));
584
+ }
585
+ );
586
+ }, [c, P]), n = c.filter((r) => r.isActive).length, s = (r) => {
587
+ if (!r) return "-";
588
+ const o = new Date(r), t = String(o.getDate()).padStart(2, "0"), a = [
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
+ ][o.getMonth()], d = o.getFullYear(), le = String(o.getHours()).padStart(2, "0"), ie = String(o.getMinutes()).padStart(2, "0");
602
+ return `${t} ${a} ${d}, ${le}:${ie}`;
603
+ };
604
+ return /* @__PURE__ */ i(v, { pt: 2, sx: { height: "calc(100vh)", zoom: "0.9" }, children: [
605
+ /* @__PURE__ */ e(z, { sx: { p: 3 }, className: l("server-management-wrapper"), children: /* @__PURE__ */ i(
606
+ X,
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__ */ i(z, { sx: { display: "flex", flexDirection: "column", gap: 3 }, children: [
618
+ /* @__PURE__ */ i(
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__ */ i(z, { sx: { minWidth: { xs: "100%", lg: "40%" } }, children: [
630
+ /* @__PURE__ */ e(
631
+ u,
632
+ {
633
+ variant: "h5",
634
+ sx: { fontWeight: 800, color: "text.primary", mb: 0.5 },
635
+ children: "Server Management"
636
+ }
637
+ ),
638
+ /* @__PURE__ */ e(u, { 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
+ G,
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(f, { icon: V }),
662
+ onClick: () => {
663
+ A(!0);
664
+ },
665
+ children: "Add Server"
666
+ }
667
+ )
668
+ }
669
+ )
670
+ ]
671
+ }
672
+ ),
673
+ /* @__PURE__ */ i(
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__ */ i(z, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
690
+ /* @__PURE__ */ e(
691
+ b,
692
+ {
693
+ icon: /* @__PURE__ */ e(
694
+ f,
695
+ {
696
+ icon: Y,
697
+ style: { fontSize: "0.7rem" }
698
+ }
699
+ ),
700
+ label: `${c.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
+ f,
716
+ {
717
+ icon: Q,
718
+ style: { fontSize: "0.7rem" }
719
+ }
720
+ ),
721
+ label: `${n} Active`,
722
+ size: "small",
723
+ color: "success",
724
+ variant: "filled",
725
+ sx: { fontWeight: 700, borderRadius: 2, px: 0.5 }
726
+ }
727
+ ),
728
+ c.length - n > 0 && /* @__PURE__ */ e(
729
+ b,
730
+ {
731
+ label: `${c.length - n} 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
+ D,
746
+ {
747
+ value: P,
748
+ size: "small",
749
+ placeholder: "Search servers...",
750
+ onChange: (r) => E(r.target.value),
751
+ InputProps: {
752
+ startAdornment: /* @__PURE__ */ e(ge, { position: "start", children: /* @__PURE__ */ e(
753
+ f,
754
+ {
755
+ icon: he,
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(K, { sx: { my: 3 } }),
772
+ /* @__PURE__ */ e(
773
+ fe,
774
+ {
775
+ className: l("server-table"),
776
+ component: X,
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__ */ i(be, { stickyHeader: !0, children: [
786
+ /* @__PURE__ */ e(Se, { 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((r, o) => /* @__PURE__ */ e(
798
+ m,
799
+ {
800
+ align: r === "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: r
813
+ },
814
+ o
815
+ )) }) }),
816
+ /* @__PURE__ */ i(ye, { children: [
817
+ h.map((r, o) => /* @__PURE__ */ i(
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
+ m,
828
+ {
829
+ sx: { color: "text.secondary", fontWeight: 500 },
830
+ children: o + 1
831
+ }
832
+ ),
833
+ /* @__PURE__ */ e(m, { sx: { fontWeight: 600 }, children: r.name }),
834
+ /* @__PURE__ */ e(m, { children: /* @__PURE__ */ e(
835
+ b,
836
+ {
837
+ label: r.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(m, { children: r.type }),
849
+ /* @__PURE__ */ e(
850
+ m,
851
+ {
852
+ sx: {
853
+ maxWidth: 200,
854
+ overflow: "hidden",
855
+ textOverflow: "ellipsis",
856
+ whiteSpace: "nowrap"
857
+ },
858
+ children: /* @__PURE__ */ e(Z, { title: r.url || "", arrow: !0, placement: "top", children: /* @__PURE__ */ e("span", { children: r.url }) })
859
+ }
860
+ ),
861
+ /* @__PURE__ */ e(m, { children: r.isActive ? /* @__PURE__ */ e(
862
+ b,
863
+ {
864
+ icon: /* @__PURE__ */ e(
865
+ f,
866
+ {
867
+ icon: Q,
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
+ f,
882
+ {
883
+ icon: ve,
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(m, { children: Array.isArray(r.pullServersName) && r.pullServersName.length > 0 ? r.pullServersName.map((t, a) => /* @__PURE__ */ e(
899
+ b,
900
+ {
901
+ label: t || "-",
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
+ a
913
+ )) : /* @__PURE__ */ e(u, { variant: "caption", color: "text.disabled", children: "—" }) }),
914
+ /* @__PURE__ */ e(m, { children: Array.isArray(r.pushServersName) && r.pushServersName.length > 0 ? r.pushServersName.map((t, a) => /* @__PURE__ */ e(
915
+ b,
916
+ {
917
+ label: t || "-",
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
+ a
929
+ )) : /* @__PURE__ */ e(u, { variant: "caption", color: "text.disabled", children: "—" }) }),
930
+ /* @__PURE__ */ e(m, { children: /* @__PURE__ */ e(
931
+ u,
932
+ {
933
+ variant: "caption",
934
+ sx: { color: "text.secondary" },
935
+ children: s(r.modifiedOn)
936
+ }
937
+ ) }),
938
+ /* @__PURE__ */ e(m, { align: "center", children: /* @__PURE__ */ e(Z, { title: "Edit server", arrow: !0, placement: "top", children: /* @__PURE__ */ e(
939
+ xe,
940
+ {
941
+ size: "small",
942
+ onClick: () => {
943
+ B(r);
944
+ },
945
+ sx: {
946
+ color: "primary.main",
947
+ "&:hover": { backgroundColor: "primary.50" }
948
+ },
949
+ children: /* @__PURE__ */ e(
950
+ f,
951
+ {
952
+ icon: H,
953
+ style: { fontSize: "0.8rem" }
954
+ }
955
+ )
956
+ }
957
+ ) }) })
958
+ ]
959
+ },
960
+ o
961
+ )),
962
+ h.length === 0 && /* @__PURE__ */ e(j, { children: /* @__PURE__ */ i(m, { colSpan: 10, align: "center", sx: { py: 6 }, children: [
963
+ /* @__PURE__ */ e(
964
+ f,
965
+ {
966
+ icon: Y,
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(u, { variant: "body2", color: "text.secondary", children: P ? "No servers match your search." : 'No servers found. Click "Add Server" to get started.' })
977
+ ] }) })
978
+ ] })
979
+ ] })
980
+ }
981
+ )
982
+ ]
983
+ }
984
+ ) }),
985
+ C && /* @__PURE__ */ e(
986
+ te,
987
+ {
988
+ openAddServer: C,
989
+ openAddServerFunc: A,
990
+ allServerList: q,
991
+ reloadPageFunc: L,
992
+ editServer: g,
993
+ editServerFunc: W,
994
+ serverData: p
995
+ }
996
+ )
997
+ ] });
998
+ }
999
+ export {
1000
+ Ye as default
1001
+ };
1002
+ //# sourceMappingURL=NewServerManagement-5YcAtF-g-DHV6PFTR.js.map