@argusoft/medplat-core 1.0.14 → 1.0.16

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 (119) hide show
  1. package/dist/AccessRights-Bvd5Bm5K.js +1259 -0
  2. package/dist/AccessRights-Bvd5Bm5K.js.map +1 -0
  3. package/dist/{AddEditQueryBuilder-7JRplV5J.js → AddEditQueryBuilder-Bcjl5mXE.js} +2 -2
  4. package/dist/{AddEditQueryBuilder-7JRplV5J.js.map → AddEditQueryBuilder-Bcjl5mXE.js.map} +1 -1
  5. package/dist/{AddFeatures-CkTu7sOI.js → AddFeatures-CE5rBxEG.js} +2 -2
  6. package/dist/{AddFeatures-CkTu7sOI.js.map → AddFeatures-CE5rBxEG.js.map} +1 -1
  7. package/dist/{AddLabelModal-DE3ploGD.js → AddLabelModal-CB8E8cYG.js} +2 -2
  8. package/dist/{AddLabelModal-DE3ploGD.js.map → AddLabelModal-CB8E8cYG.js.map} +1 -1
  9. package/dist/{AddRoleDrawer-ZK1eejxI.js → AddRoleDrawer-SvntLdRu.js} +44 -43
  10. package/dist/AddRoleDrawer-SvntLdRu.js.map +1 -0
  11. package/dist/{AppModal-BgZyfrd-.js → AppModal-BKgIwe1h.js} +2 -2
  12. package/dist/{AppModal-BgZyfrd-.js.map → AppModal-BKgIwe1h.js.map} +1 -1
  13. package/dist/{ChangePasswordModalCore-DIe4rzW-.js → ChangePasswordModalCore-ClND1mel.js} +67 -62
  14. package/dist/ChangePasswordModalCore-ClND1mel.js.map +1 -0
  15. package/dist/{ConditionConfig-GDCXIg3C.js → ConditionConfig-DB0FqwgG.js} +2 -2
  16. package/dist/{ConditionConfig-GDCXIg3C.js.map → ConditionConfig-DB0FqwgG.js.map} +1 -1
  17. package/dist/{EntityManagement-D-x6Qzal.js → EntityManagement-DQKXnEzz.js} +2 -2
  18. package/dist/{EntityManagement-D-x6Qzal.js.map → EntityManagement-DQKXnEzz.js.map} +1 -1
  19. package/dist/EventConfigurations-DZvSJ5EZ.js +395 -0
  20. package/dist/EventConfigurations-DZvSJ5EZ.js.map +1 -0
  21. package/dist/{EventsExceptionModal-BF6E1Np7.js → EventsExceptionModal-DsvngLi8.js} +2 -2
  22. package/dist/{EventsExceptionModal-BF6E1Np7.js.map → EventsExceptionModal-DsvngLi8.js.map} +1 -1
  23. package/dist/EventsSkeleton-DCXwwPbb.js +76 -0
  24. package/dist/EventsSkeleton-DCXwwPbb.js.map +1 -0
  25. package/dist/FeatureMenu-CLX8VNZ-.js +265 -0
  26. package/dist/FeatureMenu-CLX8VNZ-.js.map +1 -0
  27. package/dist/Features-Cpf1PDx0.js +13 -0
  28. package/dist/Features-Cpf1PDx0.js.map +1 -0
  29. package/dist/FileSaver.min-CN9EpL2h.js.map +1 -1
  30. package/dist/{ImmunizationConfigurationBase-DZ8EqXlF.js → ImmunizationConfigurationBase-VqVvVR57.js} +2095 -1872
  31. package/dist/ImmunizationConfigurationBase-VqVvVR57.js.map +1 -0
  32. package/dist/ImmunizationConfigurationsList-K2ddBpPJ.js +345 -0
  33. package/dist/ImmunizationConfigurationsList-K2ddBpPJ.js.map +1 -0
  34. package/dist/ImmunizationSkeleton-D2tdv5k-.js.map +1 -1
  35. package/dist/{LanguagesModal-rk6IGQwY.js → LanguagesModal-CX3oS8rk.js} +2 -2
  36. package/dist/{LanguagesModal-rk6IGQwY.js.map → LanguagesModal-CX3oS8rk.js.map} +1 -1
  37. package/dist/{ManageDynamicFeature-C2I7Ho7i.js → ManageDynamicFeature-CsIett5x.js} +2 -2
  38. package/dist/{ManageDynamicFeature-C2I7Ho7i.js.map → ManageDynamicFeature-CsIett5x.js.map} +1 -1
  39. package/dist/{ManageEventConfiguration-BJxS2Su0.js → ManageEventConfiguration-0YBDaxOI.js} +60 -60
  40. package/dist/ManageEventConfiguration-0YBDaxOI.js.map +1 -0
  41. package/dist/{ManageNotification-DMN2szWy.js → ManageNotification-BUAvg5Ge.js} +1797 -1705
  42. package/dist/ManageNotification-BUAvg5Ge.js.map +1 -0
  43. package/dist/{ManageRole-CuXmWQyp.js → ManageRole-Cbs9dUhc.js} +244 -191
  44. package/dist/ManageRole-Cbs9dUhc.js.map +1 -0
  45. package/dist/ManageTranslation-D9IScGhk.js +625 -0
  46. package/dist/ManageTranslation-D9IScGhk.js.map +1 -0
  47. package/dist/{ManageUser-Dr3ptCYp.js → ManageUser-eBS0yC5k.js} +754 -748
  48. package/dist/ManageUser-eBS0yC5k.js.map +1 -0
  49. package/dist/{MobileTypeEventConfigModal-ChhO_A4f.js → MobileTypeEventConfigModal-Ltm529jG.js} +2 -2
  50. package/dist/{MobileTypeEventConfigModal-ChhO_A4f.js.map → MobileTypeEventConfigModal-Ltm529jG.js.map} +1 -1
  51. package/dist/NotificationList-CUZSWp2J.js +402 -0
  52. package/dist/NotificationList-CUZSWp2J.js.map +1 -0
  53. package/dist/{OtherTypeEventConfigModal-ZnCGWm9v.js → OtherTypeEventConfigModal-dXt2qDg_.js} +2 -2
  54. package/dist/OtherTypeEventConfigModal-dXt2qDg_.js.map +1 -0
  55. package/dist/{QueryBuilder-BPfavHH9.js → QueryBuilder-DXexUIe8.js} +154 -148
  56. package/dist/QueryBuilder-DXexUIe8.js.map +1 -0
  57. package/dist/QueryManagement-B2y23kus.js +935 -0
  58. package/dist/QueryManagement-B2y23kus.js.map +1 -0
  59. package/dist/RoleManagement-BThAL5LO.js +422 -0
  60. package/dist/RoleManagement-BThAL5LO.js.map +1 -0
  61. package/dist/SubMenu-BGznOP2a.js +191 -0
  62. package/dist/SubMenu-BGznOP2a.js.map +1 -0
  63. package/dist/TableDetails-DztbjsIA.js +2069 -0
  64. package/dist/TableDetails-DztbjsIA.js.map +1 -0
  65. package/dist/TableList-DYwotUDO.js +1425 -0
  66. package/dist/TableList-DYwotUDO.js.map +1 -0
  67. package/dist/{TypeConfiguration-C-lk8Szs.js → TypeConfiguration-DYbBG_hZ.js} +2 -2
  68. package/dist/{TypeConfiguration-C-lk8Szs.js.map → TypeConfiguration-DYbBG_hZ.js.map} +1 -1
  69. package/dist/{UserList-S5Q76wO7.js → UserList-BAeAFeXZ.js} +410 -400
  70. package/dist/UserList-BAeAFeXZ.js.map +1 -0
  71. package/dist/{UserListSkeleton-cglK2SaU.js → UserListSkeleton-DhIJ5X3y.js} +10 -7
  72. package/dist/UserListSkeleton-DhIJ5X3y.js.map +1 -0
  73. package/dist/WidgetList-D-fIf3N2.js +200 -0
  74. package/dist/WidgetList-D-fIf3N2.js.map +1 -0
  75. package/dist/i18next-CTOWN_jH.js.map +1 -1
  76. package/dist/index.css +1 -1
  77. package/dist/index.js +64 -63
  78. package/dist/index.js.map +1 -1
  79. package/dist/xlsx.min-D1LFqt_b.js.map +1 -1
  80. package/package.json +1 -1
  81. package/dist/AccessRights-BMRM1u9S.js +0 -1228
  82. package/dist/AccessRights-BMRM1u9S.js.map +0 -1
  83. package/dist/AddRoleDrawer-ZK1eejxI.js.map +0 -1
  84. package/dist/ChangePasswordModalCore-DIe4rzW-.js.map +0 -1
  85. package/dist/EventConfigurations-jGCJ4LqP.js +0 -384
  86. package/dist/EventConfigurations-jGCJ4LqP.js.map +0 -1
  87. package/dist/EventsSkeleton-BN7_0IGs.js +0 -74
  88. package/dist/EventsSkeleton-BN7_0IGs.js.map +0 -1
  89. package/dist/FeatureMenu-Ds6lFg4w.js +0 -249
  90. package/dist/FeatureMenu-Ds6lFg4w.js.map +0 -1
  91. package/dist/Features-Cshdl06N.js +0 -12
  92. package/dist/Features-Cshdl06N.js.map +0 -1
  93. package/dist/ImmunizationConfigurationBase-DZ8EqXlF.js.map +0 -1
  94. package/dist/ImmunizationConfigurationsList-CQnxWa09.js +0 -335
  95. package/dist/ImmunizationConfigurationsList-CQnxWa09.js.map +0 -1
  96. package/dist/ManageEventConfiguration-BJxS2Su0.js.map +0 -1
  97. package/dist/ManageNotification-DMN2szWy.js.map +0 -1
  98. package/dist/ManageRole-CuXmWQyp.js.map +0 -1
  99. package/dist/ManageTranslation-BTxvSYKb.js +0 -616
  100. package/dist/ManageTranslation-BTxvSYKb.js.map +0 -1
  101. package/dist/ManageUser-Dr3ptCYp.js.map +0 -1
  102. package/dist/NotificationList-BqibwMaM.js +0 -400
  103. package/dist/NotificationList-BqibwMaM.js.map +0 -1
  104. package/dist/OtherTypeEventConfigModal-ZnCGWm9v.js.map +0 -1
  105. package/dist/QueryBuilder-BPfavHH9.js.map +0 -1
  106. package/dist/QueryManagement-DXA73N2j.js +0 -671
  107. package/dist/QueryManagement-DXA73N2j.js.map +0 -1
  108. package/dist/RoleManagement-C0feJCuq.js +0 -410
  109. package/dist/RoleManagement-C0feJCuq.js.map +0 -1
  110. package/dist/SubMenu-DAfZC9Xi.js +0 -188
  111. package/dist/SubMenu-DAfZC9Xi.js.map +0 -1
  112. package/dist/TableDetails-DzREeJkm.js +0 -1508
  113. package/dist/TableDetails-DzREeJkm.js.map +0 -1
  114. package/dist/TableList-B9hr05Hs.js +0 -428
  115. package/dist/TableList-B9hr05Hs.js.map +0 -1
  116. package/dist/UserList-S5Q76wO7.js.map +0 -1
  117. package/dist/UserListSkeleton-cglK2SaU.js.map +0 -1
  118. package/dist/WidgetList-BSApErov.js +0 -188
  119. package/dist/WidgetList-BSApErov.js.map +0 -1
@@ -0,0 +1,1425 @@
1
+ import { jsxs as r, jsx as e, Fragment as ln } from "react/jsx-runtime";
2
+ import { useTranslateProvider as sn } from "@/common/languageTranslator/TranslationContext";
3
+ import { execute as xe, executeAll as dn } from "@/common/services/QueryBuilder";
4
+ import { showToast as F } from "@/common/toaster/toaster";
5
+ import cn from "@monaco-editor/react";
6
+ import { Dialog as Ae, DialogTitle as Re, Typography as C, Divider as te, DialogContent as Ne, TableContainer as ke, Table as Oe, TableHead as $e, TableRow as K, TableCell as y, TableBody as Me, Chip as A, Box as x, Accordion as pn, AccordionSummary as mn, AccordionDetails as hn, DialogActions as ze, Button as M, Alert as Ce, Paper as be, Tooltip as U, TextField as Se, InputAdornment as un, Checkbox as ve, List as fn, ListItem as gn, ListItemButton as yn, ListItemText as xn, IconButton as Te, Autocomplete as Cn } from "@mui/material";
7
+ import b from "prop-types";
8
+ import bn, { useState as g, useRef as Sn, useEffect as Ie, Suspense as vn, lazy as Tn } from "react";
9
+ import I from "@/common/fontAwesomeIcons/FontAwesomeIcons";
10
+ import we from "@mui/material/Grid2";
11
+ import { useForm as In } from "react-hook-form";
12
+ import { useSelector as wn } from "react-redux";
13
+ const Ee = {
14
+ NEW_TABLE: { label: "New Table", color: "success" },
15
+ MODIFIED: { label: "Modified", color: "warning" },
16
+ SYNC_REQUIRED: { label: "Sync Required", color: "info" },
17
+ NO_CHANGES: { label: "No Changes", color: "default" }
18
+ };
19
+ function De({ changes: d, status: z }) {
20
+ var m, w, v, R, O;
21
+ const f = [];
22
+ return z === "NEW_TABLE" ? f.push(
23
+ /* @__PURE__ */ e(
24
+ A,
25
+ {
26
+ size: "small",
27
+ label: `${((m = d.addedColumns) == null ? void 0 : m.length) || 0} columns`,
28
+ color: "success",
29
+ variant: "outlined"
30
+ },
31
+ "new"
32
+ )
33
+ ) : ((w = d.addedColumns) != null && w.length && f.push(
34
+ /* @__PURE__ */ e(
35
+ A,
36
+ {
37
+ size: "small",
38
+ label: `+${d.addedColumns.length} cols`,
39
+ color: "success",
40
+ variant: "outlined"
41
+ },
42
+ "add"
43
+ )
44
+ ), (v = d.removedColumns) != null && v.length && f.push(
45
+ /* @__PURE__ */ e(
46
+ A,
47
+ {
48
+ size: "small",
49
+ label: `-${d.removedColumns.length} cols`,
50
+ color: "error",
51
+ variant: "outlined"
52
+ },
53
+ "rem"
54
+ )
55
+ ), (R = d.typeChangedColumns) != null && R.length && f.push(
56
+ /* @__PURE__ */ e(
57
+ A,
58
+ {
59
+ size: "small",
60
+ label: `${d.typeChangedColumns.length} types`,
61
+ color: "warning",
62
+ variant: "outlined"
63
+ },
64
+ "type"
65
+ )
66
+ ), d.primaryKeyChange && f.push(
67
+ /* @__PURE__ */ e(
68
+ A,
69
+ {
70
+ size: "small",
71
+ label: "PK changed",
72
+ color: "warning",
73
+ variant: "outlined"
74
+ },
75
+ "pk"
76
+ )
77
+ ), (O = d.settingsChanges) != null && O.length && f.push(
78
+ /* @__PURE__ */ e(
79
+ A,
80
+ {
81
+ size: "small",
82
+ label: `${d.settingsChanges.length} settings`,
83
+ color: "info",
84
+ variant: "outlined"
85
+ },
86
+ "set"
87
+ )
88
+ ), f.length || f.push(
89
+ /* @__PURE__ */ e(C, { variant: "caption", color: "text.secondary", children: "—" }, "none")
90
+ )), /* @__PURE__ */ e(x, { sx: { display: "flex", gap: 0.5, flexWrap: "wrap" }, children: f });
91
+ }
92
+ function We({ item: d }) {
93
+ var w, v, R, O, D, W, T;
94
+ const { tableName: z, status: f, changes: m } = d;
95
+ return /* @__PURE__ */ r(x, { sx: { p: 1.5 }, children: [
96
+ f === "NEW_TABLE" && /* @__PURE__ */ r(Ce, { severity: "success", sx: { mb: 1.5, py: 0.5 }, children: [
97
+ "This table does not exist in the database. A",
98
+ " ",
99
+ /* @__PURE__ */ e("strong", { children: "CREATE TABLE" }),
100
+ " migration script will be generated."
101
+ ] }),
102
+ (((w = m.addedColumns) == null ? void 0 : w.length) > 0 || ((v = m.removedColumns) == null ? void 0 : v.length) > 0 || ((R = m.typeChangedColumns) == null ? void 0 : R.length) > 0 || m.primaryKeyChange) && f !== "NEW_TABLE" && /* @__PURE__ */ r(Ce, { severity: "warning", sx: { mb: 1.5, py: 0.5 }, children: [
103
+ "SQLite does not support all ALTER TABLE operations. A",
104
+ " ",
105
+ /* @__PURE__ */ e("strong", { children: "rebuild migration" }),
106
+ " (dummy table copy) will be generated."
107
+ ] }),
108
+ (((O = m.addedColumns) == null ? void 0 : O.length) > 0 || ((D = m.removedColumns) == null ? void 0 : D.length) > 0 || ((W = m.typeChangedColumns) == null ? void 0 : W.length) > 0) && /* @__PURE__ */ e(
109
+ ke,
110
+ {
111
+ sx: {
112
+ mb: 1.5,
113
+ border: "1px solid",
114
+ borderColor: "divider",
115
+ borderRadius: 1
116
+ },
117
+ children: /* @__PURE__ */ r(Oe, { size: "small", children: [
118
+ /* @__PURE__ */ e($e, { children: /* @__PURE__ */ r(K, { sx: { backgroundColor: "action.hover" }, children: [
119
+ /* @__PURE__ */ e(y, { sx: { fontWeight: 700, fontSize: "0.75rem" }, children: "Column" }),
120
+ /* @__PURE__ */ e(y, { sx: { fontWeight: 700, fontSize: "0.75rem" }, children: "Type" }),
121
+ /* @__PURE__ */ e(y, { sx: { fontWeight: 700, fontSize: "0.75rem" }, children: "Change" })
122
+ ] }) }),
123
+ /* @__PURE__ */ r(Me, { children: [
124
+ (m.addedColumns || []).map((l) => /* @__PURE__ */ r(
125
+ K,
126
+ {
127
+ sx: { backgroundColor: "rgba(76,175,80,0.08)" },
128
+ children: [
129
+ /* @__PURE__ */ e(
130
+ y,
131
+ {
132
+ sx: { fontSize: "0.75rem", fontFamily: "monospace" },
133
+ children: l.name
134
+ }
135
+ ),
136
+ /* @__PURE__ */ e(y, { sx: { fontSize: "0.75rem" }, children: l.type }),
137
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(A, { size: "small", label: "Added", color: "success" }) })
138
+ ]
139
+ },
140
+ `add-${l.name}`
141
+ )),
142
+ (m.removedColumns || []).map((l) => /* @__PURE__ */ r(
143
+ K,
144
+ {
145
+ sx: { backgroundColor: "rgba(244,67,54,0.08)" },
146
+ children: [
147
+ /* @__PURE__ */ e(
148
+ y,
149
+ {
150
+ sx: {
151
+ fontSize: "0.75rem",
152
+ fontFamily: "monospace",
153
+ textDecoration: "line-through",
154
+ color: "error.main"
155
+ },
156
+ children: l.name
157
+ }
158
+ ),
159
+ /* @__PURE__ */ e(
160
+ y,
161
+ {
162
+ sx: {
163
+ fontSize: "0.75rem",
164
+ textDecoration: "line-through",
165
+ color: "error.main"
166
+ },
167
+ children: l.type
168
+ }
169
+ ),
170
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(A, { size: "small", label: "Removed", color: "error" }) })
171
+ ]
172
+ },
173
+ `rem-${l.name}`
174
+ )),
175
+ (m.typeChangedColumns || []).map((l) => /* @__PURE__ */ r(
176
+ K,
177
+ {
178
+ sx: { backgroundColor: "rgba(255,152,0,0.08)" },
179
+ children: [
180
+ /* @__PURE__ */ e(
181
+ y,
182
+ {
183
+ sx: { fontSize: "0.75rem", fontFamily: "monospace" },
184
+ children: l.name
185
+ }
186
+ ),
187
+ /* @__PURE__ */ r(y, { sx: { fontSize: "0.75rem" }, children: [
188
+ /* @__PURE__ */ e(
189
+ "span",
190
+ {
191
+ style: {
192
+ textDecoration: "line-through",
193
+ color: "var(--mui-palette-error-main)",
194
+ marginRight: "8px"
195
+ },
196
+ children: l.oldType
197
+ }
198
+ ),
199
+ /* @__PURE__ */ e("span", { children: l.newType })
200
+ ] }),
201
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(A, { size: "small", label: "Type Changed", color: "warning" }) })
202
+ ]
203
+ },
204
+ `type-${l.name}`
205
+ ))
206
+ ] })
207
+ ] })
208
+ }
209
+ ),
210
+ m.primaryKeyChange && /* @__PURE__ */ r(
211
+ x,
212
+ {
213
+ sx: {
214
+ mb: 1.5,
215
+ p: 1,
216
+ backgroundColor: "warning.50",
217
+ borderRadius: 1,
218
+ border: "1px solid",
219
+ borderColor: "warning.200"
220
+ },
221
+ children: [
222
+ /* @__PURE__ */ e(
223
+ C,
224
+ {
225
+ variant: "caption",
226
+ sx: { fontWeight: 700, color: "warning.dark" },
227
+ children: "Primary Key Change:"
228
+ }
229
+ ),
230
+ /* @__PURE__ */ r(C, { variant: "caption", sx: { ml: 1 }, children: [
231
+ /* @__PURE__ */ e("code", { children: m.primaryKeyChange.from }),
232
+ " → ",
233
+ /* @__PURE__ */ e("code", { children: m.primaryKeyChange.to })
234
+ ] })
235
+ ]
236
+ }
237
+ ),
238
+ ((T = m.settingsChanges) == null ? void 0 : T.length) > 0 && /* @__PURE__ */ r(x, { sx: { mb: 1.5 }, children: [
239
+ /* @__PURE__ */ e(
240
+ C,
241
+ {
242
+ variant: "caption",
243
+ sx: { fontWeight: 700, display: "block", mb: 0.5 },
244
+ children: "Settings Changes:"
245
+ }
246
+ ),
247
+ m.settingsChanges.map((l, _) => /* @__PURE__ */ r(
248
+ x,
249
+ {
250
+ sx: { display: "flex", alignItems: "center", gap: 1, mb: 0.25 },
251
+ children: [
252
+ /* @__PURE__ */ r(
253
+ C,
254
+ {
255
+ variant: "caption",
256
+ sx: { color: "text.secondary", minWidth: 120 },
257
+ children: [
258
+ l.field,
259
+ ":"
260
+ ]
261
+ }
262
+ ),
263
+ /* @__PURE__ */ r(C, { variant: "caption", children: [
264
+ /* @__PURE__ */ e("code", { children: String(l.from) }),
265
+ " → ",
266
+ /* @__PURE__ */ e("code", { children: String(l.to) })
267
+ ] })
268
+ ]
269
+ },
270
+ _
271
+ ))
272
+ ] })
273
+ ] });
274
+ }
275
+ function _e({
276
+ open: d,
277
+ onClose: z,
278
+ summaryData: f,
279
+ onApply: m,
280
+ applying: w,
281
+ migrationVersions: v,
282
+ unifiedMigrationScript: R,
283
+ onUnifiedScriptChange: O
284
+ }) {
285
+ const [D, W] = g(!0), T = f.filter(
286
+ (l) => l.status !== "NO_CHANGES"
287
+ ).length;
288
+ return /* @__PURE__ */ r(
289
+ Ae,
290
+ {
291
+ open: d,
292
+ onClose: z,
293
+ maxWidth: "md",
294
+ fullWidth: !0,
295
+ PaperProps: { sx: { borderRadius: 3 } },
296
+ children: [
297
+ /* @__PURE__ */ r(Re, { sx: { pb: 1, fontWeight: 700 }, children: [
298
+ "Import Summary",
299
+ /* @__PURE__ */ r(C, { variant: "body2", color: "text.secondary", children: [
300
+ T,
301
+ " table(s) will be affected · ",
302
+ f.length,
303
+ " total in file"
304
+ ] })
305
+ ] }),
306
+ /* @__PURE__ */ e(te, {}),
307
+ /* @__PURE__ */ r(Ne, { sx: { p: 0 }, children: [
308
+ /* @__PURE__ */ e(ke, { children: /* @__PURE__ */ r(Oe, { children: [
309
+ /* @__PURE__ */ e($e, { children: /* @__PURE__ */ r(K, { sx: { backgroundColor: "action.hover" }, children: [
310
+ /* @__PURE__ */ e(y, { sx: { fontWeight: 700, pl: 3 }, children: "Table Name" }),
311
+ /* @__PURE__ */ e(y, { sx: { fontWeight: 700 }, children: "Status" }),
312
+ /* @__PURE__ */ e(y, { sx: { fontWeight: 700 }, children: "Changes" })
313
+ ] }) }),
314
+ /* @__PURE__ */ e(Me, { children: f.map((l) => {
315
+ const _ = Ee[l.status] || Ee.NO_CHANGES;
316
+ return /* @__PURE__ */ r(bn.Fragment, { children: [
317
+ /* @__PURE__ */ r(
318
+ K,
319
+ {
320
+ sx: {
321
+ "& > *": {
322
+ borderBottom: l.status !== "NO_CHANGES" ? "none" : void 0
323
+ }
324
+ },
325
+ children: [
326
+ /* @__PURE__ */ e(
327
+ y,
328
+ {
329
+ sx: {
330
+ fontFamily: "monospace",
331
+ fontSize: "0.82rem",
332
+ pl: 3
333
+ },
334
+ children: l.tableName
335
+ }
336
+ ),
337
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
338
+ A,
339
+ {
340
+ label: _.label,
341
+ color: _.color,
342
+ size: "small",
343
+ sx: { fontWeight: 600 }
344
+ }
345
+ ) }),
346
+ /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
347
+ De,
348
+ {
349
+ changes: l.changes,
350
+ status: l.status
351
+ }
352
+ ) })
353
+ ]
354
+ }
355
+ ),
356
+ l.status !== "NO_CHANGES" && /* @__PURE__ */ e(K, { children: /* @__PURE__ */ e(
357
+ y,
358
+ {
359
+ colSpan: 3,
360
+ sx: {
361
+ pt: 0,
362
+ pb: 0.5,
363
+ px: 2,
364
+ backgroundColor: "action.hover"
365
+ },
366
+ children: /* @__PURE__ */ e(
367
+ We,
368
+ {
369
+ item: l
370
+ }
371
+ )
372
+ }
373
+ ) })
374
+ ] }, l.tableName);
375
+ }) })
376
+ ] }) }),
377
+ R && /* @__PURE__ */ e(x, { sx: { p: 3, borderTop: "1px solid", borderColor: "divider" }, children: /* @__PURE__ */ r(
378
+ pn,
379
+ {
380
+ expanded: D,
381
+ onChange: () => W((l) => !l),
382
+ sx: {
383
+ boxShadow: "none",
384
+ border: "1px solid",
385
+ borderColor: "divider",
386
+ borderRadius: "4px !important"
387
+ },
388
+ children: [
389
+ /* @__PURE__ */ e(
390
+ mn,
391
+ {
392
+ expandIcon: /* @__PURE__ */ e(
393
+ I,
394
+ {
395
+ iconName: "faChevronDown",
396
+ className: "text-[0.75rem]"
397
+ }
398
+ ),
399
+ children: /* @__PURE__ */ r(
400
+ x,
401
+ {
402
+ sx: {
403
+ display: "flex",
404
+ justifyContent: "space-between",
405
+ alignItems: "center",
406
+ width: "100%",
407
+ pr: 2
408
+ },
409
+ children: [
410
+ /* @__PURE__ */ r(C, { variant: "caption", sx: { fontWeight: 700 }, children: [
411
+ /* @__PURE__ */ e(
412
+ I,
413
+ {
414
+ iconName: "faCode",
415
+ className: "mr-2 text-[0.7rem]"
416
+ }
417
+ ),
418
+ "Preview Unified Migration Script"
419
+ ] }),
420
+ v && v.from_version !== void 0 && /* @__PURE__ */ r(
421
+ C,
422
+ {
423
+ variant: "caption",
424
+ sx: { color: "text.secondary", fontWeight: 600 },
425
+ children: [
426
+ "From : ",
427
+ /* @__PURE__ */ r("strong", { children: [
428
+ "v",
429
+ v.from_version + 1
430
+ ] }),
431
+ /* @__PURE__ */ e(
432
+ I,
433
+ {
434
+ iconName: "faArrowRight",
435
+ className: "mx-2 text-[0.6rem]"
436
+ }
437
+ ),
438
+ "To : ",
439
+ /* @__PURE__ */ r("strong", { children: [
440
+ "v",
441
+ v.to_version + 1
442
+ ] })
443
+ ]
444
+ }
445
+ )
446
+ ]
447
+ }
448
+ )
449
+ }
450
+ ),
451
+ /* @__PURE__ */ e(hn, { sx: { p: 0 }, children: /* @__PURE__ */ e(
452
+ cn,
453
+ {
454
+ height: "300px",
455
+ defaultLanguage: "sql",
456
+ theme: "vs-dark",
457
+ options: {
458
+ fontSize: 12,
459
+ minimap: { enabled: !1 },
460
+ readOnly: !1,
461
+ scrollBeyondLastLine: !1,
462
+ wordWrap: "on"
463
+ },
464
+ value: R,
465
+ onChange: O
466
+ }
467
+ ) })
468
+ ]
469
+ }
470
+ ) })
471
+ ] }),
472
+ /* @__PURE__ */ e(te, {}),
473
+ /* @__PURE__ */ r(ze, { sx: { px: 3, py: 2, gap: 1 }, children: [
474
+ /* @__PURE__ */ e(
475
+ M,
476
+ {
477
+ onClick: z,
478
+ variant: "outlined",
479
+ size: "small",
480
+ sx: { borderRadius: 2, textTransform: "none" },
481
+ disabled: w,
482
+ children: "Cancel"
483
+ }
484
+ ),
485
+ /* @__PURE__ */ e(
486
+ M,
487
+ {
488
+ variant: "contained",
489
+ size: "small",
490
+ disabled: T === 0 || w,
491
+ onClick: m,
492
+ sx: { borderRadius: 2, textTransform: "none", boxShadow: "none" },
493
+ startIcon: w ? null : /* @__PURE__ */ e(I, { iconName: "faCheck" }),
494
+ children: w ? "Applying…" : `Apply Import (${T})`
495
+ }
496
+ )
497
+ ] })
498
+ ]
499
+ }
500
+ );
501
+ }
502
+ _e.propTypes = {
503
+ open: b.bool.isRequired,
504
+ onClose: b.func.isRequired,
505
+ summaryData: b.array.isRequired,
506
+ onApply: b.func.isRequired,
507
+ applying: b.bool,
508
+ migrationVersions: b.object,
509
+ unifiedMigrationScript: b.string,
510
+ onUnifiedScriptChange: b.func.isRequired
511
+ };
512
+ We.propTypes = {
513
+ item: b.object
514
+ };
515
+ De.propTypes = {
516
+ changes: b.object,
517
+ status: b.string
518
+ };
519
+ const En = Tn(() => import("./TableDetails-DztbjsIA.js"));
520
+ function An({
521
+ tableList: d,
522
+ tablesInfo: z,
523
+ allTableList: f,
524
+ allTablesInfo: m,
525
+ formSubmitted: w,
526
+ reloadComponents: v
527
+ }) {
528
+ const [R, O] = g(""), [D, W] = g(""), [T, l] = g({}), [_, Y] = g({}), [P, Be] = g({}), [Fe, V] = g({}), N = d ? d.filter(
529
+ (n) => n.toLowerCase().includes(R.toLowerCase())
530
+ ) : [], [Ke, L] = g(!1), [je, X] = g(!1), [j, Z] = g(), [ae, Q] = g(!1), [Pe, ie] = g(!1), [Le, le] = g(!1), { translate: se } = sn(), de = wn((n) => n.Authenticate.user.id), [h, ce] = g(!1), [E, G] = g(/* @__PURE__ */ new Set()), pe = Sn(null), [Qe, ee] = g(!1), [me, Ge] = g([]), [Ue, H] = g(!1), [He, he] = g({}), [ne, ue] = g("");
531
+ In({
532
+ defaultValues: {
533
+ field1: "",
534
+ field2: "",
535
+ field3: ""
536
+ }
537
+ }), Ie(() => {
538
+ let n = {}, t = {};
539
+ W(d[0]), n = fe(z), l((i) => ({ ...i, ...n })), t = fe(m), Be((i) => ({ ...i, ...t }));
540
+ }, [z, m]), Ie(() => {
541
+ Y(() => T[d[0]]), V(() => P[d[0]]);
542
+ }, [T, P]);
543
+ const Je = (n) => {
544
+ const t = n.toLowerCase();
545
+ return t.includes("int") || t.includes("timestamp") || t === "boolean" || t.includes("serial") || t.includes("date") ? "INTEGER" : (t.includes("char") || t.includes("text") || t.includes("varchar"), "TEXT");
546
+ }, fe = (n) => {
547
+ const t = {};
548
+ return n.forEach((i) => {
549
+ const o = JSON.parse(i.columnInfo), p = Object.keys(o).map((s) => ({
550
+ name: s,
551
+ type: Je(o[s])
552
+ })), a = i.mediaConfiguration ? JSON.parse(i.mediaConfiguration) : null;
553
+ t[i.tableName] = {
554
+ columnInfo: p,
555
+ modifiedOnQuery: i.modifiedOnQuery ? i.modifiedOnQuery : null,
556
+ primaryKey: i.primaryKey ? i.primaryKey : null,
557
+ selectQuery: i.selectQuery ? i.selectQuery : null,
558
+ userData: i.userData !== void 0 ? i.userData : null,
559
+ hasMedia: i.hasMedia !== void 0 ? i.hasMedia : null,
560
+ mediaConfiguration: a,
561
+ syncByDefault: i.syncByDefault ? i.syncByDefault : !1
562
+ };
563
+ }), t;
564
+ }, qe = () => {
565
+ Q(!1), X(!0), Z();
566
+ }, Ye = () => {
567
+ L(!1), Q(!0);
568
+ }, ge = () => {
569
+ X(!1);
570
+ }, Ve = () => {
571
+ if (j) {
572
+ const n = { ...P[j] };
573
+ n && (n.columnInfo = []), W(j), Y(() => n), V(() => P[j]), ie(!0), Q(!1), L(!0);
574
+ }
575
+ X(!1), Z(() => "");
576
+ }, oe = (n) => {
577
+ W(n), Y(() => T[n]), V(() => P[n]), L(!1), Q(!1), ie(!1);
578
+ }, Xe = () => {
579
+ if (E.size === 0) return;
580
+ const n = {};
581
+ E.forEach((a) => {
582
+ T[a] && (n[a] = T[a]);
583
+ });
584
+ const t = JSON.stringify(
585
+ { exportedAt: (/* @__PURE__ */ new Date()).toISOString(), tables: n },
586
+ null,
587
+ 2
588
+ ), i = new Blob([t], { type: "application/json" }), o = URL.createObjectURL(i), p = document.createElement("a");
589
+ p.href = o, p.download = `db_export_${Date.now()}.json`, p.click(), URL.revokeObjectURL(o), ce(!1), G(/* @__PURE__ */ new Set()), F({
590
+ message: `Exported ${E.size} table(s) successfully.`,
591
+ type: "success"
592
+ });
593
+ }, Ze = (n, t) => {
594
+ const i = t.columnInfo || [];
595
+ let o = `CREATE TABLE ${n} (
596
+ `;
597
+ return o += i.map((p) => ` ${p.name} ${p.type}`).join(`,
598
+ `), t.primaryKey && (o += `,
599
+ CONSTRAINT ${n}_pkey PRIMARY KEY (${t.primaryKey})`), o += `
600
+ );`, o;
601
+ }, ye = (n, t, i) => {
602
+ const o = i.columnInfo || [], p = t.columnInfo || [], a = new Set(o.map((k) => k.name)), c = p.filter((k) => a.has(k.name)).map((k) => k.name).join(", "), S = i.primaryKey, B = o.map((k) => ` ${k.name} ${k.type}`).join(`,
603
+ `), $ = S ? `,
604
+ CONSTRAINT ${n}_dummy_pkey PRIMARY KEY (${S})` : "", re = S ? `,
605
+ CONSTRAINT ${n}_pkey PRIMARY KEY (${S})` : "";
606
+ return [
607
+ "-- Step 1: Create dummy table with new schema",
608
+ `CREATE TABLE ${n}_dummy (
609
+ ${B}${$}
610
+ );`,
611
+ "-- Step 2: Copy common columns from original",
612
+ c ? `INSERT INTO ${n}_dummy (${c})
613
+ SELECT ${c} FROM ${n};` : "-- (no common columns to copy)",
614
+ "-- Step 3: Drop original table",
615
+ `DROP TABLE ${n};`,
616
+ "-- Step 4: Recreate original table with new schema",
617
+ `CREATE TABLE ${n} (
618
+ ${B}${re}
619
+ );`,
620
+ "-- Step 5: Restore data from dummy",
621
+ c ? `INSERT INTO ${n} (${c})
622
+ SELECT ${c} FROM ${n}_dummy;` : "-- (no data to restore)",
623
+ "-- Step 6: Drop dummy table",
624
+ `DROP TABLE ${n}_dummy;`
625
+ ].join(`
626
+
627
+ `);
628
+ }, J = (n) => (n || "").replace(/\s+/g, " ").trim(), en = (n) => {
629
+ const t = n.tables || {};
630
+ return Object.entries(t).map(([i, o]) => {
631
+ const p = T[i], a = p, s = {
632
+ addedColumns: [],
633
+ removedColumns: [],
634
+ typeChangedColumns: [],
635
+ primaryKeyChange: null,
636
+ settingsChanges: []
637
+ };
638
+ let c = "NO_CHANGES";
639
+ if (!p)
640
+ c = "NEW_TABLE", s.addedColumns = o.columnInfo || [];
641
+ else {
642
+ const B = new Map(
643
+ (o.columnInfo || []).map((u) => [u.name, u.type])
644
+ ), $ = new Map(
645
+ (a.columnInfo || []).map((u) => [u.name, u.type])
646
+ );
647
+ if (s.addedColumns = (o.columnInfo || []).filter(
648
+ (u) => !$.has(u.name)
649
+ ), s.removedColumns = (a.columnInfo || []).filter(
650
+ (u) => !B.has(u.name)
651
+ ), s.typeChangedColumns = (o.columnInfo || []).filter((u) => $.has(u.name) && $.get(u.name) !== u.type).map((u) => ({
652
+ name: u.name,
653
+ oldType: $.get(u.name),
654
+ newType: u.type
655
+ })), s.primaryKeyChange = o.primaryKey !== a.primaryKey ? {
656
+ from: a.primaryKey || "(none)",
657
+ to: o.primaryKey || "(none)"
658
+ } : null, p) {
659
+ const u = [];
660
+ [
661
+ ["syncByDefault", "Sync by Default"],
662
+ ["userData", "User Data"],
663
+ ["hasMedia", "Has Media"]
664
+ ].forEach(([q, an]) => {
665
+ String(o[q]) !== String(p[q]) && u.push({
666
+ field: an,
667
+ from: p[q],
668
+ to: o[q]
669
+ });
670
+ }), J(o.modifiedOnQuery) !== J(p.modifiedOnQuery) && u.push({
671
+ field: "Modified On Query",
672
+ from: "(changed)",
673
+ to: "(changed)"
674
+ }), J(o.selectQuery) !== J(p.selectQuery) && u.push({
675
+ field: "Data Fetch Query",
676
+ from: "(changed)",
677
+ to: "(changed)"
678
+ }), s.settingsChanges = u;
679
+ }
680
+ const re = s.addedColumns.length > 0 || s.removedColumns.length > 0 || s.typeChangedColumns.length > 0 || s.primaryKeyChange, k = s.settingsChanges.length > 0;
681
+ c = re || k ? "MODIFIED" : "NO_CHANGES";
682
+ }
683
+ let S = "";
684
+ return c === "NEW_TABLE" ? S = Ze(i, o) : c !== "NO_CHANGES" && (s.addedColumns.length > 0 || s.removedColumns.length > 0 || s.typeChangedColumns.length > 0 || s.primaryKeyChange) && (S = ye(
685
+ i,
686
+ a,
687
+ o
688
+ )), {
689
+ tableName: i,
690
+ status: c,
691
+ changes: s,
692
+ importedTable: o,
693
+ existingTable: a,
694
+ migrationScript: S
695
+ };
696
+ });
697
+ }, nn = (n) => {
698
+ let t = "";
699
+ return n.filter((o) => o.status !== "NO_CHANGES").forEach((o) => {
700
+ var p, a, s;
701
+ o.migrationScript && (t += `-- ==================================================
702
+ `, t += `-- Table: ${o.tableName}
703
+ `, o.status === "NEW_TABLE" ? t += `-- Changes: New Table
704
+ ` : (t += `-- Changes:
705
+ `, (p = o.changes.addedColumns) != null && p.length && (t += `-- Added: ${o.changes.addedColumns.map((c) => c.name).join(", ")}
706
+ `), (a = o.changes.removedColumns) != null && a.length && (t += `-- Removed: ${o.changes.removedColumns.map((c) => c.name).join(", ")}
707
+ `), (s = o.changes.typeChangedColumns) != null && s.length && (t += `-- Modified types: ${o.changes.typeChangedColumns.map((c) => `${c.name} (${c.oldType} -> ${c.newType})`).join(", ")}
708
+ `), o.changes.primaryKeyChange && (t += `-- Primary Key Changed
709
+ `)), t += `-- ==================================================
710
+
711
+ `, t += o.migrationScript.trim() + `
712
+
713
+ `);
714
+ }), t;
715
+ }, on = (n) => {
716
+ var o;
717
+ const t = (o = n.target.files) == null ? void 0 : o[0];
718
+ if (!t) return;
719
+ const i = new FileReader();
720
+ i.onload = (p) => {
721
+ try {
722
+ const a = JSON.parse(p.target.result);
723
+ if (!a.tables)
724
+ throw new Error("Invalid format: missing 'tables' key.");
725
+ const s = en(a);
726
+ Ge(s);
727
+ const c = nn(s);
728
+ ue(c), xe({ code: "MFA_MIGRATION_MASTER_GET_LATEST_VERSIONS" }).then((S) => {
729
+ var B, $;
730
+ he((($ = (B = S == null ? void 0 : S.data) == null ? void 0 : B.result) == null ? void 0 : $[0]) || {});
731
+ }).catch(() => he({})), ee(!0);
732
+ } catch (a) {
733
+ F({ message: `Import failed: ${a.message}`, type: "error" });
734
+ }
735
+ }, i.readAsText(t), n.target.value = "";
736
+ }, rn = (n) => {
737
+ ue(n);
738
+ }, tn = async () => {
739
+ var i;
740
+ const n = me.filter(
741
+ (o) => o.status !== "NO_CHANGES"
742
+ );
743
+ if (!n.length) {
744
+ F({ message: "Nothing to apply.", type: "info" });
745
+ return;
746
+ }
747
+ H(!0);
748
+ const t = n.map((o, p) => {
749
+ const a = o.importedTable, s = {};
750
+ return (a.columnInfo || []).forEach((c) => {
751
+ s[c.name] = c.type;
752
+ }), {
753
+ code: "update_mobile_entity",
754
+ parameters: {
755
+ tableName: o.tableName || "",
756
+ syncByDefault: !!a.syncByDefault,
757
+ columnInfo: JSON.stringify(s) || "",
758
+ primaryKey: a.primaryKey || "",
759
+ modifiedOnQuery: a.modifiedOnQuery || "",
760
+ selectQuery: a.selectQuery || "",
761
+ userData: !!a.userData,
762
+ hasMedia: !!a.hasMedia,
763
+ mediaConfiguration: a.hasMedia ? JSON.stringify(a.mediaConfiguration || {}) : null,
764
+ modifiedBy: de || "",
765
+ isUpdate: !0
766
+ },
767
+ sequence: p
768
+ };
769
+ });
770
+ try {
771
+ const o = (await dn(t)).data;
772
+ if (o == null ? void 0 : o.some((a) => a.status === 0)) {
773
+ const a = o.findIndex((S) => S.status === 0), s = n[a], c = ((i = o[a]) == null ? void 0 : i.message) || "Unknown error";
774
+ F({
775
+ message: `Failed to save ${s.tableName}: ${c}`,
776
+ type: "error"
777
+ }), H(!1);
778
+ return;
779
+ }
780
+ if (ne.trim()) {
781
+ const a = (await xe({
782
+ code: "INSERT_MOBILE_MIGRATION",
783
+ parameters: {
784
+ migrationScript: ne,
785
+ modifiedBy: de || "",
786
+ generateMigration: !0
787
+ }
788
+ })).data;
789
+ (a == null ? void 0 : a.status) === 0 && F({
790
+ message: `Failed to insert migration script: ${a == null ? void 0 : a.message}`,
791
+ type: "error"
792
+ });
793
+ }
794
+ H(!1), ee(!1), v((a) => !a), F({ message: "Import applied successfully!", type: "success" });
795
+ } catch (o) {
796
+ F({
797
+ message: `Failed to apply import: ${o}`,
798
+ type: "error"
799
+ }), H(!1);
800
+ }
801
+ };
802
+ return /* @__PURE__ */ r(ln, { children: [
803
+ /* @__PURE__ */ r(
804
+ be,
805
+ {
806
+ elevation: 0,
807
+ sx: {
808
+ p: { xs: 2.5, md: 3 },
809
+ mt: 2,
810
+ mb: 3,
811
+ border: "1px solid",
812
+ borderColor: "divider",
813
+ borderRadius: 3,
814
+ backgroundColor: "background.paper"
815
+ },
816
+ children: [
817
+ /* @__PURE__ */ r(x, { sx: { display: "flex", flexDirection: "column", gap: 3 }, children: [
818
+ /* @__PURE__ */ r(
819
+ x,
820
+ {
821
+ sx: {
822
+ display: "flex",
823
+ justifyContent: "space-between",
824
+ alignItems: "flex-start",
825
+ flexWrap: "wrap",
826
+ gap: 2
827
+ },
828
+ children: [
829
+ /* @__PURE__ */ r(x, { sx: { minWidth: { xs: "100%", lg: "40%" } }, children: [
830
+ /* @__PURE__ */ e(
831
+ C,
832
+ {
833
+ variant: "h5",
834
+ sx: { fontWeight: 800, color: "text.primary", mb: 0.5 },
835
+ children: se("Database Management")
836
+ }
837
+ ),
838
+ /* @__PURE__ */ e(C, { variant: "body2", color: "text.secondary", children: "Manage synced tables, create new entities, and configure mobile database schemas." })
839
+ ] }),
840
+ /* @__PURE__ */ r(
841
+ x,
842
+ {
843
+ sx: {
844
+ display: "flex",
845
+ alignItems: "center",
846
+ gap: 1.5,
847
+ flexWrap: "wrap"
848
+ },
849
+ children: [
850
+ /* @__PURE__ */ e(
851
+ "input",
852
+ {
853
+ type: "file",
854
+ accept: ".json",
855
+ ref: pe,
856
+ style: { display: "none" },
857
+ onChange: on
858
+ }
859
+ ),
860
+ /* @__PURE__ */ e(
861
+ U,
862
+ {
863
+ title: h ? "Cancel export mode" : "Export selected tables as JSON",
864
+ arrow: !0,
865
+ children: /* @__PURE__ */ e(
866
+ M,
867
+ {
868
+ variant: h ? "contained" : "outlined",
869
+ size: "small",
870
+ color: h ? "warning" : "inherit",
871
+ sx: {
872
+ borderRadius: 2,
873
+ fontWeight: 600,
874
+ px: 2,
875
+ textTransform: "none",
876
+ borderColor: "divider",
877
+ color: h ? "white" : "text.primary",
878
+ "&:hover": {
879
+ backgroundColor: h ? "warning.dark" : "action.hover",
880
+ borderColor: "text.disabled"
881
+ }
882
+ },
883
+ startIcon: /* @__PURE__ */ e(
884
+ I,
885
+ {
886
+ iconName: h ? "faXmark" : "faFileExport"
887
+ }
888
+ ),
889
+ onClick: () => {
890
+ ce((n) => !n), G(/* @__PURE__ */ new Set());
891
+ },
892
+ children: h ? "Cancel Export" : "Export"
893
+ }
894
+ )
895
+ }
896
+ ),
897
+ /* @__PURE__ */ e(U, { title: "Import table configuration from JSON", arrow: !0, children: /* @__PURE__ */ e(
898
+ M,
899
+ {
900
+ variant: "outlined",
901
+ size: "small",
902
+ sx: {
903
+ borderRadius: 2,
904
+ fontWeight: 600,
905
+ px: 2,
906
+ textTransform: "none",
907
+ borderColor: "divider",
908
+ color: "text.primary",
909
+ "&:hover": {
910
+ backgroundColor: "action.hover",
911
+ borderColor: "text.disabled"
912
+ }
913
+ },
914
+ startIcon: /* @__PURE__ */ e(I, { iconName: "faFileImport" }),
915
+ onClick: () => {
916
+ var n;
917
+ return (n = pe.current) == null ? void 0 : n.click();
918
+ },
919
+ children: "Import"
920
+ }
921
+ ) }),
922
+ /* @__PURE__ */ e(
923
+ M,
924
+ {
925
+ variant: "outlined",
926
+ size: "small",
927
+ sx: {
928
+ borderRadius: 2,
929
+ fontWeight: 600,
930
+ px: 2,
931
+ textTransform: "none",
932
+ borderColor: "divider",
933
+ color: "text.primary",
934
+ "&:hover": {
935
+ backgroundColor: "action.hover",
936
+ borderColor: "text.disabled"
937
+ }
938
+ },
939
+ startIcon: /* @__PURE__ */ e(I, { iconName: "faRotate" }),
940
+ onClick: () => qe(),
941
+ children: "Sync Table"
942
+ }
943
+ ),
944
+ /* @__PURE__ */ e(
945
+ M,
946
+ {
947
+ size: "small",
948
+ variant: "contained",
949
+ sx: {
950
+ borderRadius: 2,
951
+ fontWeight: 600,
952
+ px: 2,
953
+ boxShadow: "none",
954
+ textTransform: "none"
955
+ },
956
+ startIcon: /* @__PURE__ */ e(I, { iconName: "faPlus" }),
957
+ onClick: () => Ye(),
958
+ children: "Create Table"
959
+ }
960
+ )
961
+ ]
962
+ }
963
+ )
964
+ ]
965
+ }
966
+ ),
967
+ /* @__PURE__ */ r(
968
+ x,
969
+ {
970
+ sx: {
971
+ display: "flex",
972
+ justifyContent: "space-between",
973
+ alignItems: "center",
974
+ flexWrap: "wrap",
975
+ gap: 2,
976
+ backgroundColor: "action.hover",
977
+ p: 1.5,
978
+ borderRadius: 2.5,
979
+ border: "1px solid",
980
+ borderColor: "divider"
981
+ },
982
+ children: [
983
+ /* @__PURE__ */ r(x, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
984
+ /* @__PURE__ */ e(
985
+ A,
986
+ {
987
+ label: `${(d == null ? void 0 : d.length) || 0} Synced`,
988
+ size: "small",
989
+ color: "primary",
990
+ variant: "filled",
991
+ sx: { fontWeight: 700, borderRadius: 2, px: 0.5 }
992
+ }
993
+ ),
994
+ /* @__PURE__ */ e(
995
+ A,
996
+ {
997
+ label: `${(f == null ? void 0 : f.length) || 0} Total`,
998
+ size: "small",
999
+ variant: "outlined",
1000
+ sx: {
1001
+ fontWeight: 600,
1002
+ borderRadius: 2,
1003
+ px: 0.5,
1004
+ borderColor: "divider"
1005
+ }
1006
+ }
1007
+ )
1008
+ ] }),
1009
+ /* @__PURE__ */ e(
1010
+ Se,
1011
+ {
1012
+ value: R,
1013
+ size: "small",
1014
+ placeholder: "Search synced tables...",
1015
+ onChange: (n) => O(n.target.value),
1016
+ InputProps: {
1017
+ startAdornment: /* @__PURE__ */ e(un, { position: "start", children: /* @__PURE__ */ e(I, { iconName: "faMagnifyingGlass" }) }),
1018
+ sx: {
1019
+ backgroundColor: "background.paper",
1020
+ borderRadius: 2,
1021
+ minWidth: 260
1022
+ }
1023
+ }
1024
+ }
1025
+ )
1026
+ ]
1027
+ }
1028
+ )
1029
+ ] }),
1030
+ /* @__PURE__ */ e(te, { sx: { my: 3 } }),
1031
+ /* @__PURE__ */ r(we, { container: !0, spacing: 2.5, children: [
1032
+ /* @__PURE__ */ e(we, { size: 3, children: /* @__PURE__ */ r(
1033
+ be,
1034
+ {
1035
+ variant: "outlined",
1036
+ sx: {
1037
+ borderRadius: 2.5,
1038
+ overflow: "hidden",
1039
+ maxHeight: "72vh",
1040
+ display: "flex",
1041
+ flexDirection: "column"
1042
+ },
1043
+ children: [
1044
+ /* @__PURE__ */ r(
1045
+ x,
1046
+ {
1047
+ sx: {
1048
+ px: 2,
1049
+ py: 1.5,
1050
+ backgroundColor: h ? "warning.50" : "action.hover",
1051
+ borderBottom: "1px solid",
1052
+ borderColor: h ? "warning.300" : "divider",
1053
+ transition: "background-color 0.2s"
1054
+ },
1055
+ children: [
1056
+ /* @__PURE__ */ r(
1057
+ x,
1058
+ {
1059
+ sx: {
1060
+ display: "flex",
1061
+ alignItems: "center",
1062
+ justifyContent: "space-between"
1063
+ },
1064
+ children: [
1065
+ /* @__PURE__ */ e(
1066
+ C,
1067
+ {
1068
+ variant: "subtitle2",
1069
+ sx: {
1070
+ fontWeight: 700,
1071
+ color: h ? "warning.dark" : "text.primary"
1072
+ },
1073
+ children: h ? "Select Tables to Export" : se("Synced Tables")
1074
+ }
1075
+ ),
1076
+ h && /* @__PURE__ */ e(
1077
+ U,
1078
+ {
1079
+ title: E.size === N.length ? "Deselect all" : "Select all",
1080
+ arrow: !0,
1081
+ children: /* @__PURE__ */ e(
1082
+ ve,
1083
+ {
1084
+ size: "small",
1085
+ checked: N.length > 0 && E.size === N.length,
1086
+ indeterminate: E.size > 0 && E.size < N.length,
1087
+ onChange: (n) => {
1088
+ n.target.checked ? G(new Set(N)) : G(/* @__PURE__ */ new Set());
1089
+ },
1090
+ sx: { p: 0.25 }
1091
+ }
1092
+ )
1093
+ }
1094
+ )
1095
+ ]
1096
+ }
1097
+ ),
1098
+ /* @__PURE__ */ e(
1099
+ C,
1100
+ {
1101
+ variant: "caption",
1102
+ color: h ? "warning.dark" : "text.secondary",
1103
+ children: h ? `${E.size} of ${N.length} selected` : `${N.length} of ${(d == null ? void 0 : d.length) || 0} tables`
1104
+ }
1105
+ )
1106
+ ]
1107
+ }
1108
+ ),
1109
+ /* @__PURE__ */ e(x, { sx: { overflowY: "auto", flex: 1 }, children: N.length ? /* @__PURE__ */ e(fn, { disablePadding: !0, children: N.map((n, t) => {
1110
+ const i = D === n;
1111
+ return /* @__PURE__ */ e(
1112
+ gn,
1113
+ {
1114
+ disablePadding: !0,
1115
+ secondaryAction: !h && /* @__PURE__ */ r(
1116
+ x,
1117
+ {
1118
+ sx: {
1119
+ display: "flex",
1120
+ gap: 0.25,
1121
+ opacity: i ? 1 : 0,
1122
+ transition: "opacity 0.2s"
1123
+ },
1124
+ children: [
1125
+ /* @__PURE__ */ e(
1126
+ U,
1127
+ {
1128
+ title: "Edit table",
1129
+ arrow: !0,
1130
+ placement: "top",
1131
+ children: /* @__PURE__ */ e(
1132
+ Te,
1133
+ {
1134
+ size: "small",
1135
+ onClick: (o) => {
1136
+ o.stopPropagation(), oe(n), L(!0);
1137
+ },
1138
+ sx: {
1139
+ color: "primary.main",
1140
+ "&:hover": {
1141
+ backgroundColor: "primary.50"
1142
+ }
1143
+ },
1144
+ children: /* @__PURE__ */ e(
1145
+ I,
1146
+ {
1147
+ iconName: "faPen",
1148
+ className: "text-[0.75rem]"
1149
+ }
1150
+ )
1151
+ }
1152
+ )
1153
+ }
1154
+ ),
1155
+ /* @__PURE__ */ e(
1156
+ U,
1157
+ {
1158
+ title: "Delete table",
1159
+ arrow: !0,
1160
+ placement: "top",
1161
+ children: /* @__PURE__ */ e(
1162
+ Te,
1163
+ {
1164
+ size: "small",
1165
+ onClick: (o) => {
1166
+ o.stopPropagation(), oe(n), le(!0);
1167
+ },
1168
+ sx: {
1169
+ color: "error.main",
1170
+ "&:hover": {
1171
+ backgroundColor: "error.50"
1172
+ }
1173
+ },
1174
+ children: /* @__PURE__ */ e(
1175
+ I,
1176
+ {
1177
+ iconName: "faTrash",
1178
+ className: "text-[0.75rem]"
1179
+ }
1180
+ )
1181
+ }
1182
+ )
1183
+ }
1184
+ )
1185
+ ]
1186
+ }
1187
+ ),
1188
+ sx: {
1189
+ borderBottom: t === N.length - 1 ? "none" : "1px solid",
1190
+ borderColor: "divider",
1191
+ "&:hover .MuiBox-root": { opacity: "1 !important" }
1192
+ },
1193
+ children: /* @__PURE__ */ r(
1194
+ yn,
1195
+ {
1196
+ selected: i && !h,
1197
+ onClick: () => {
1198
+ if (h) {
1199
+ const o = new Set(E);
1200
+ o.has(n) ? o.delete(n) : o.add(n), G(o);
1201
+ } else
1202
+ oe(n);
1203
+ },
1204
+ sx: {
1205
+ py: 1,
1206
+ px: 2,
1207
+ transition: "all 0.15s ease",
1208
+ ...h ? {} : {
1209
+ "&.Mui-selected": {
1210
+ backgroundColor: "primary.50",
1211
+ borderLeft: "3px solid",
1212
+ borderLeftColor: "primary.main",
1213
+ "&:hover": {
1214
+ backgroundColor: "primary.100"
1215
+ }
1216
+ },
1217
+ "&:hover": {
1218
+ backgroundColor: "action.hover"
1219
+ }
1220
+ }
1221
+ },
1222
+ children: [
1223
+ h && /* @__PURE__ */ e(
1224
+ ve,
1225
+ {
1226
+ size: "small",
1227
+ checked: E.has(n),
1228
+ disableRipple: !0,
1229
+ sx: { p: 0, mr: 1.5 }
1230
+ }
1231
+ ),
1232
+ /* @__PURE__ */ e(
1233
+ xn,
1234
+ {
1235
+ primary: /* @__PURE__ */ e(
1236
+ C,
1237
+ {
1238
+ variant: "body2",
1239
+ sx: {
1240
+ fontWeight: i && !h ? 600 : 400,
1241
+ color: i && !h ? "primary.dark" : "text.primary",
1242
+ fontSize: "0.82rem",
1243
+ overflow: "hidden",
1244
+ textOverflow: "ellipsis",
1245
+ whiteSpace: "nowrap",
1246
+ maxWidth: "160px"
1247
+ },
1248
+ children: n
1249
+ }
1250
+ )
1251
+ }
1252
+ )
1253
+ ]
1254
+ }
1255
+ )
1256
+ },
1257
+ t + 1
1258
+ );
1259
+ }) }) : /* @__PURE__ */ r(x, { sx: { p: 3, textAlign: "center" }, children: [
1260
+ /* @__PURE__ */ e(
1261
+ I,
1262
+ {
1263
+ iconName: "faInbox",
1264
+ className: "text-[2rem] text-gray-300"
1265
+ }
1266
+ ),
1267
+ /* @__PURE__ */ e(
1268
+ C,
1269
+ {
1270
+ variant: "body2",
1271
+ color: "text.secondary",
1272
+ sx: { mt: 1 },
1273
+ children: d.length < 1 ? "No tables synced" : "No tables match your search."
1274
+ }
1275
+ )
1276
+ ] }) }),
1277
+ h && /* @__PURE__ */ r(
1278
+ x,
1279
+ {
1280
+ sx: {
1281
+ p: 2,
1282
+ borderTop: "1px solid",
1283
+ borderColor: "divider",
1284
+ backgroundColor: "background.paper",
1285
+ display: "flex",
1286
+ justifyContent: "space-between",
1287
+ alignItems: "center"
1288
+ },
1289
+ children: [
1290
+ /* @__PURE__ */ r(C, { variant: "body2", sx: { fontWeight: 600 }, children: [
1291
+ E.size,
1292
+ " selected"
1293
+ ] }),
1294
+ /* @__PURE__ */ e(
1295
+ M,
1296
+ {
1297
+ variant: "contained",
1298
+ size: "small",
1299
+ color: "primary",
1300
+ disabled: E.size === 0,
1301
+ onClick: Xe,
1302
+ startIcon: /* @__PURE__ */ e(I, { iconName: "faDownload" }),
1303
+ sx: {
1304
+ textTransform: "none",
1305
+ borderRadius: 2,
1306
+ boxShadow: "none"
1307
+ },
1308
+ children: "Download JSON"
1309
+ }
1310
+ )
1311
+ ]
1312
+ }
1313
+ )
1314
+ ]
1315
+ }
1316
+ ) }),
1317
+ /* @__PURE__ */ e(vn, { children: (!!D && !!_ || ae) && /* @__PURE__ */ e(
1318
+ En,
1319
+ {
1320
+ tableInfo: _,
1321
+ table: D,
1322
+ isEditMode: Ke,
1323
+ updateEditMode: L,
1324
+ tableCompleteInfo: Fe,
1325
+ formSubmitted: w,
1326
+ reloadComponents: v,
1327
+ isCreateTableMode: ae,
1328
+ isSyncTableMode: Pe,
1329
+ updateCreateTableMode: Q,
1330
+ openDeleteModal: Le,
1331
+ setOpenDeleteModal: le,
1332
+ generateRebuildScript: ye
1333
+ }
1334
+ ) })
1335
+ ] })
1336
+ ]
1337
+ }
1338
+ ),
1339
+ /* @__PURE__ */ r(
1340
+ Ae,
1341
+ {
1342
+ open: je,
1343
+ onClose: ge,
1344
+ maxWidth: "sm",
1345
+ fullWidth: !0,
1346
+ PaperProps: {
1347
+ sx: { borderRadius: 3, p: 1 }
1348
+ },
1349
+ children: [
1350
+ /* @__PURE__ */ r(Re, { sx: { fontWeight: 700, pb: 1 }, children: [
1351
+ "Sync a Table",
1352
+ /* @__PURE__ */ e(C, { variant: "body2", color: "text.secondary", children: "Select an existing database table to sync with the mobile app." })
1353
+ ] }),
1354
+ /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(
1355
+ Cn,
1356
+ {
1357
+ options: f.filter((n) => !d.includes(n)),
1358
+ getOptionLabel: (n) => n,
1359
+ value: j,
1360
+ onChange: (n, t) => Z(t),
1361
+ renderInput: (n) => /* @__PURE__ */ e(
1362
+ Se,
1363
+ {
1364
+ ...n,
1365
+ label: "Table",
1366
+ placeholder: "Search and select a table...",
1367
+ size: "small",
1368
+ sx: { mt: 1 }
1369
+ }
1370
+ )
1371
+ }
1372
+ ) }),
1373
+ /* @__PURE__ */ r(ze, { sx: { px: 3, pb: 2 }, children: [
1374
+ /* @__PURE__ */ e(
1375
+ M,
1376
+ {
1377
+ onClick: ge,
1378
+ variant: "outlined",
1379
+ size: "small",
1380
+ sx: { borderRadius: 2, textTransform: "none" },
1381
+ children: "Cancel"
1382
+ }
1383
+ ),
1384
+ /* @__PURE__ */ e(
1385
+ M,
1386
+ {
1387
+ variant: "contained",
1388
+ size: "small",
1389
+ onClick: () => Ve(),
1390
+ disabled: !j,
1391
+ sx: { borderRadius: 2, textTransform: "none", boxShadow: "none" },
1392
+ children: "Sync Table"
1393
+ }
1394
+ )
1395
+ ] })
1396
+ ]
1397
+ }
1398
+ ),
1399
+ /* @__PURE__ */ e(
1400
+ _e,
1401
+ {
1402
+ open: Qe,
1403
+ onClose: () => ee(!1),
1404
+ summaryData: me,
1405
+ onApply: tn,
1406
+ applying: Ue,
1407
+ migrationVersions: He,
1408
+ unifiedMigrationScript: ne,
1409
+ onUnifiedScriptChange: rn
1410
+ }
1411
+ )
1412
+ ] });
1413
+ }
1414
+ An.propTypes = {
1415
+ tableList: b.any,
1416
+ tablesInfo: b.any,
1417
+ allTableList: b.any,
1418
+ allTablesInfo: b.any,
1419
+ formSubmitted: b.bool,
1420
+ reloadComponents: b.any
1421
+ };
1422
+ export {
1423
+ An as default
1424
+ };
1425
+ //# sourceMappingURL=TableList-DYwotUDO.js.map