@argusoft/medplat-form-engine 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 (134) 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--CSDVIGsb.js +176 -0
  18. package/dist/ChangePasswordModalCore-DIe4rzW--CSDVIGsb.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-B2XcYTYJ.js +5162 -0
  40. package/dist/ImmunizationConfigurationBase-DZ8EqXlF-B2XcYTYJ.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-CJBp0yVr.js +2179 -0
  61. package/dist/ManageUser-Dr3ptCYp-CJBp0yVr.js.map +1 -0
  62. package/dist/ManageUser-Dr3ptCYp.css +1 -0
  63. package/dist/MedplatFormWrapper-SwW0rdxN.js +52363 -0
  64. package/dist/MedplatFormWrapper-SwW0rdxN.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-De9XnBKC.js +671 -0
  82. package/dist/QueryManagement-DXA73N2j-De9XnBKC.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-BSjPID73.js +746 -0
  87. package/dist/SecurityAuditLogList-DHTcOtbx-BSjPID73.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/dayjs.min-BiUMMz0V.js +285 -0
  114. package/dist/dayjs.min-BiUMMz0V.js.map +1 -0
  115. package/dist/default-B6sHblIG.js +11341 -0
  116. package/dist/default-B6sHblIG.js.map +1 -0
  117. package/dist/default.css +1 -0
  118. package/dist/i18next-CTOWN_jH-BKKbdDel.js +1389 -0
  119. package/dist/i18next-CTOWN_jH-BKKbdDel.js.map +1 -0
  120. package/dist/index-B4r0wjBD.js +563 -0
  121. package/dist/index-B4r0wjBD.js.map +1 -0
  122. package/dist/index-BFznsakV-BsOSEQZI.js +42638 -0
  123. package/dist/index-BFznsakV-BsOSEQZI.js.map +1 -0
  124. package/dist/index-DNrIMQFT.js +567 -0
  125. package/dist/index-DNrIMQFT.js.map +1 -0
  126. package/dist/index.css +1 -1
  127. package/dist/index.js +3 -52390
  128. package/dist/index.js.map +1 -1
  129. package/dist/manageImmunization-B4swS745-JldexHrO.js +1204 -0
  130. package/dist/manageImmunization-B4swS745-JldexHrO.js.map +1 -0
  131. package/dist/manageImmunization-B4swS745.css +1 -0
  132. package/dist/xlsx.min-D1LFqt_b-BGwkpd8r.js +11869 -0
  133. package/dist/xlsx.min-D1LFqt_b-BGwkpd8r.js.map +1 -0
  134. package/package.json +1 -4
@@ -0,0 +1,734 @@
1
+ import { jsx as n, jsxs as s, Fragment as J } from "react/jsx-runtime";
2
+ import { useRef as oe, useState as S, useCallback as Ve, useMemo as Te, useEffect as de } from "react";
3
+ import v from "prop-types";
4
+ import { useForm as qe } from "react-hook-form";
5
+ import { yupResolver as Fe } from "@hookform/resolvers/yup";
6
+ import h from "@mui/material/Grid2";
7
+ import * as y from "yup";
8
+ import { Modal as ze, Typography as Oe, IconButton as Ie, FormControl as V, Box as k, Button as ue } from "@mui/material";
9
+ import P from "@/views/custom-components/CustomTextField";
10
+ import { showToast as N } from "@/common/toaster/toaster";
11
+ import { t as Be, e as Re, f as Y, h as Ke, i as Xe } from "./ManageTranslation-BTxvSYKb-CdO4Fk7f.js";
12
+ import { executeQuery as ce, execute as W } from "@/common/services/GlobalApis";
13
+ import Ge from "@/views/custom-components/CustomAutoComplete";
14
+ import Me from "@/hooks/useTrackEvent";
15
+ import { useTranslateProvider as Pe } from "@/common/languageTranslator/TranslationContext";
16
+ import We from "@mui/material/Tabs";
17
+ import De from "@mui/material/Tab";
18
+ import { faXmark as Qe } from "@fortawesome/free-solid-svg-icons";
19
+ import { FontAwesomeIcon as Ue } from "@fortawesome/react-fontawesome";
20
+ import He from "@/views/custom-components/CustomDropdown";
21
+ function pe($) {
22
+ const { children: D, value: O, index: w, selectedTab: f, ...m } = $;
23
+ return /* @__PURE__ */ n(
24
+ "div",
25
+ {
26
+ role: "tabpanel",
27
+ hidden: O !== f,
28
+ id: `simple-tabpanel-${w}`,
29
+ "aria-labelledby": `simple-tab-${w}`,
30
+ ...m,
31
+ children: O === f && /* @__PURE__ */ n(k, { className: "p-3", children: D })
32
+ }
33
+ );
34
+ }
35
+ pe.propTypes = {
36
+ selectedTab: v.any,
37
+ children: v.node,
38
+ index: v.number.isRequired,
39
+ value: v.number.isRequired
40
+ };
41
+ function Je($) {
42
+ return {
43
+ id: `simple-tab-${$}`,
44
+ "aria-controls": `simple-tabpanel-${$}`
45
+ };
46
+ }
47
+ const Ye = ({
48
+ open: $,
49
+ handleClose: D,
50
+ apps: O,
51
+ languageList: w = [],
52
+ addAppFlag: f = !1,
53
+ fieldsData: m,
54
+ refetch: I,
55
+ addNameSpaceFlag: _ = !1,
56
+ editLabelFlag: x = !1,
57
+ labelKey: Z = null,
58
+ isLoading: me = !1
59
+ }) => {
60
+ var ee;
61
+ const B = (ee = w == null ? void 0 : w.find(
62
+ (e) => e.languageValue === "English"
63
+ )) == null ? void 0 : ee.id, ae = oe(null), T = oe(!1), Q = Me(), [q, le] = S([]), [A, ne] = S([]), [ve, ge] = S([]), [R, he] = S([]), [U, te] = S(null), [fe, be] = S([]), { translate: E } = Pe(), ye = (e, l) => {
64
+ te(l);
65
+ };
66
+ let F;
67
+ if (f) {
68
+ const e = m == null ? void 0 : m.reduce((l, a) => (l[`${a.languagevalue}`] = y.string().required(
69
+ `Enter value for ${a.languagevalue}`
70
+ ), l), {});
71
+ F = y.object().shape({
72
+ apps: y.array().min(1, "Select at least one App").required("Select App"),
73
+ ...e
74
+ // Spread the dynamically created validations
75
+ });
76
+ } else if (_)
77
+ F = y.object().shape({
78
+ namespace: y.array().min(1, "Select at least one Namespace").required("Select Namespace")
79
+ });
80
+ else if (x) {
81
+ let e = R.reduce((l, a) => ((a == null ? void 0 : a.languagevalue) !== "English" && (a == null ? void 0 : a.appvalue) === U && (l[`${a.app}_${a.languagevalue}`] = y.string().required(`Enter value for ${a.languagevalue}`).test(
82
+ "placeholders-match",
83
+ "Placeholders do not match the original English text.",
84
+ function(i) {
85
+ const { path: t, createError: o, parent: d } = this, u = (d == null ? void 0 : d[`${a.app}_English`]) || "", r = X(u), p = X(i);
86
+ return Object.keys(r).length === Object.keys(p).length && Object.keys(r).every(
87
+ (b) => p[b] === r[b]
88
+ ) || o({
89
+ path: t,
90
+ message: "Placeholders do not match the original English text."
91
+ });
92
+ }
93
+ )), l), {});
94
+ F = y.object().shape({
95
+ ...e
96
+ });
97
+ } else {
98
+ const e = w.reduce((l, a) => ((a == null ? void 0 : a.language_value) !== "English" && (l[a.language_value] = y.string().required(`Enter value for ${a.language_value}`).test(
99
+ "placeholders-match",
100
+ "Placeholders do not match the original English text.",
101
+ function(i) {
102
+ const { path: t, createError: o, parent: d } = this, u = (d == null ? void 0 : d.englishValue) || "", r = X(u), p = X(i);
103
+ return Object.keys(r).length === Object.keys(p).length && Object.keys(r).every(
104
+ (b) => p[b] === r[b]
105
+ ) || o({
106
+ path: t,
107
+ message: "Placeholders do not match the original English text."
108
+ });
109
+ }
110
+ )), l), {});
111
+ F = y.object().shape({
112
+ apps: y.array().min(1, "Select at least one App").required("Select App"),
113
+ namespace: y.array().min(1, "Select at least one Namespace").required("Select Namespace"),
114
+ englishValue: y.string().required("Enter Value for English"),
115
+ ...e
116
+ // Spread the dynamically created validations
117
+ });
118
+ }
119
+ const ie = Ve(async (e) => {
120
+ try {
121
+ await Le(e);
122
+ } catch (l) {
123
+ console.error(l);
124
+ }
125
+ }, []), xe = (e, l) => {
126
+ let a;
127
+ return (...i) => {
128
+ a && clearTimeout(a), a = setTimeout(() => {
129
+ e(...i);
130
+ }, l);
131
+ };
132
+ }, Ne = Te(
133
+ () => xe(ie, 300),
134
+ [ie]
135
+ ), {
136
+ control: j,
137
+ handleSubmit: ke,
138
+ reset: we,
139
+ setValue: K,
140
+ getValues: re,
141
+ formState: { errors: L }
142
+ } = qe({
143
+ defaultValues: {},
144
+ resolver: Fe(F),
145
+ mode: "onChange"
146
+ }), X = (e) => {
147
+ if (!e) return {};
148
+ const l = [...e.matchAll(/{(.*?)}/g)], a = {};
149
+ return l.forEach((i) => {
150
+ const t = i[1];
151
+ a[t] = (a[t] || 0) + 1;
152
+ }), a;
153
+ };
154
+ de(() => {
155
+ if (Ae(), m && f) {
156
+ let e = [];
157
+ m == null || m.forEach((l) => {
158
+ K(l == null ? void 0 : l.languagevalue, l == null ? void 0 : l.value), e.push({ id: l == null ? void 0 : l.language, value: l == null ? void 0 : l.value });
159
+ }), ne(e), Ce();
160
+ }
161
+ m && _ && _e(m.key);
162
+ }, [m]), de(() => {
163
+ x && Ee();
164
+ }, [x]);
165
+ const Ee = async () => {
166
+ var e, l, a, i;
167
+ try {
168
+ const t = await ce({
169
+ code: "labels_selected_apps_for_editing",
170
+ parameters: { key: Z }
171
+ });
172
+ he((e = t == null ? void 0 : t.data) == null ? void 0 : e.result);
173
+ let o = (a = (l = t == null ? void 0 : t.data) == null ? void 0 : l.result) == null ? void 0 : a.map((d) => d.appvalue).filter((d, u, r) => u === r.findIndex((p) => p === d));
174
+ (i = t == null ? void 0 : t.data) == null || i.result.forEach((d) => {
175
+ const u = `${d.app}_${d.languagevalue}`;
176
+ K(u, d.value || "");
177
+ }), le(o), te(o[0]);
178
+ } catch (t) {
179
+ console.error(t), N({ message: "Error in editing label", type: "error" });
180
+ }
181
+ }, H = (e, l, a = null) => {
182
+ let i = [...A], t = !1;
183
+ i == null || i.forEach((o) => {
184
+ (o == null ? void 0 : o.id) === e && (o.value = l, t = !0);
185
+ }), t || (a ? i.push({ id: e, value: l, labelid: a }) : i.push({ id: e, value: l })), ne(i);
186
+ }, _e = async (e) => {
187
+ var l, a;
188
+ try {
189
+ const i = await W({
190
+ code: "get_namespaces_from_key",
191
+ parameters: { key: e }
192
+ });
193
+ let t = (a = (l = i == null ? void 0 : i.data) == null ? void 0 : l.result) == null ? void 0 : a.map((o) => o.value);
194
+ K("namespace", t || []);
195
+ } catch (i) {
196
+ console.error(i);
197
+ }
198
+ }, Ae = async () => {
199
+ var e;
200
+ try {
201
+ const l = await W({
202
+ code: "get_distinct_namespce",
203
+ parameters: {}
204
+ });
205
+ be((e = l == null ? void 0 : l.data) == null ? void 0 : e.result);
206
+ } catch (l) {
207
+ console.error(l);
208
+ }
209
+ }, Ce = async () => {
210
+ var e, l, a;
211
+ try {
212
+ let i = {
213
+ code: "labels_selected_apps_for_editing",
214
+ parameters: { key: (e = m[0]) == null ? void 0 : e.key.replace(/'/g, "''") }
215
+ };
216
+ const t = await ce(i);
217
+ let o = (a = (l = t == null ? void 0 : t.data) == null ? void 0 : l.result) == null ? void 0 : a.map((d) => d.appvalue).filter((d, u, r) => u === r.findIndex((p) => p === d)).join(", ");
218
+ le(o);
219
+ } catch (i) {
220
+ console.error(i), N({ message: "Error in Adding App", type: "error" });
221
+ }
222
+ }, $e = (e, l) => {
223
+ ge(l), K("apps", l);
224
+ }, je = (e) => (e == null ? void 0 : e.appValue) || "", C = () => {
225
+ Q("conversion_event", {
226
+ form: ae.current,
227
+ form_name: "Add Label Configuration",
228
+ submit: T.current
229
+ }), D();
230
+ }, Le = async (e) => {
231
+ var l;
232
+ try {
233
+ let a;
234
+ if ((e == null ? void 0 : e.id) === B) {
235
+ let i;
236
+ f ? (a = A.filter((t) => t.id !== B).map((t) => t.id).join(","), A == null || A.forEach((t) => {
237
+ (t == null ? void 0 : t.id) === B && (i = t == null ? void 0 : t.value);
238
+ })) : (a = w.filter((t) => t.languageKey !== "en").map((t) => t.id).join(","), i = (l = re()) == null ? void 0 : l.englishValue), i ? await Be(a, i) : N({ message: "Enter english text", type: "info" });
239
+ }
240
+ } catch (a) {
241
+ console.error(a), N({ message: "Error in Translation", type: "error" });
242
+ }
243
+ }, Se = async (e) => {
244
+ var l, a, i, t, o, d;
245
+ try {
246
+ Q("button_click", {
247
+ button_name: "add-label-add-button",
248
+ button_type: "submit",
249
+ button_id: "add-label-submit-button"
250
+ });
251
+ let u = [];
252
+ if (f)
253
+ (l = e == null ? void 0 : e.apps) == null || l.forEach((r) => {
254
+ A == null || A.forEach((p) => {
255
+ u.push({
256
+ language: p == null ? void 0 : p.id,
257
+ value: p == null ? void 0 : p.value,
258
+ app: r == null ? void 0 : r.id,
259
+ isActive: !0,
260
+ key: m[0].key
261
+ });
262
+ });
263
+ }), await Y(u), T.current = !0, I(), N({ message: "App Added Successfully", type: "success" }), C();
264
+ else if (_) {
265
+ let r = (e == null ? void 0 : e.namespace) || [];
266
+ await Ke({
267
+ key: m.key,
268
+ namespace: r
269
+ }), T.current = !0, I(), N({
270
+ message: "NameSpace Updated Successfully",
271
+ type: "success"
272
+ }), C();
273
+ } else if (x) {
274
+ const r = re(), p = Object.entries(r).reduce(
275
+ (b, [G, c]) => {
276
+ const [g, z] = G.split("_");
277
+ if (c === "") return b;
278
+ const M = R.find(
279
+ (se) => se.app === parseInt(g) && se.languagevalue === z
280
+ );
281
+ return M && M.value !== c && b.push({
282
+ id: M.id || null,
283
+ language: M.language || z,
284
+ value: c,
285
+ app: parseInt(g),
286
+ isActive: !0,
287
+ key: Z
288
+ }), b;
289
+ },
290
+ []
291
+ );
292
+ await Y(p), T.current = !0, I(), N({ message: "Label Updated Successfully", type: "success" }), C();
293
+ } else {
294
+ const r = e.englishValue.replace(/ /g, "");
295
+ (a = e == null ? void 0 : e.apps) == null || a.forEach((c) => {
296
+ u.push({
297
+ language: B,
298
+ value: e == null ? void 0 : e.englishValue,
299
+ app: c == null ? void 0 : c.id,
300
+ isActive: !0,
301
+ key: r
302
+ }), A == null || A.forEach((g) => {
303
+ u.push({
304
+ language: g == null ? void 0 : g.id,
305
+ value: g == null ? void 0 : g.value,
306
+ app: c == null ? void 0 : c.id,
307
+ isActive: !0,
308
+ key: r
309
+ });
310
+ });
311
+ });
312
+ let p = (e == null ? void 0 : e.namespace) || [], b = [];
313
+ for (const c of p)
314
+ try {
315
+ const g = await W({
316
+ code: "check_key_namespace_exist",
317
+ parameters: {
318
+ key: r,
319
+ namespace: c
320
+ }
321
+ });
322
+ ((t = (i = g == null ? void 0 : g.data) == null ? void 0 : i.result) == null ? void 0 : t.length) === 0 && b.push(c);
323
+ } catch (g) {
324
+ console.error("Error while checking namespace:", c, g);
325
+ }
326
+ await Xe({
327
+ key: r,
328
+ namespace: b
329
+ });
330
+ let G = !1;
331
+ for (const c of u) {
332
+ let g = {
333
+ code: "translation_label_app_language_key_check",
334
+ parameters: {
335
+ key: c == null ? void 0 : c.key,
336
+ language: c == null ? void 0 : c.language,
337
+ app: c == null ? void 0 : c.app
338
+ }
339
+ };
340
+ const z = await W(g);
341
+ if (((d = (o = z == null ? void 0 : z.data) == null ? void 0 : o.result) == null ? void 0 : d.length) > 0) {
342
+ N({
343
+ message: "The Label containing Same App, Language and Key Already Exists.",
344
+ type: "error"
345
+ }), G = !0;
346
+ break;
347
+ }
348
+ }
349
+ !G && u.length > 0 && (await Y(u), T.current = !0, I(), N({
350
+ message: "Label Added Successfully",
351
+ type: "success"
352
+ }), C());
353
+ }
354
+ } catch (u) {
355
+ console.error(u), N({ message: "Error in Adding Label", type: "error" });
356
+ }
357
+ };
358
+ return /* @__PURE__ */ n(
359
+ ze,
360
+ {
361
+ "data-testid": "add-label-modal",
362
+ open: $,
363
+ onClose: () => {
364
+ C(), we();
365
+ },
366
+ className: "translation-modal",
367
+ children: /* @__PURE__ */ n(Re, { isLoading: me, children: /* @__PURE__ */ s(
368
+ h,
369
+ {
370
+ container: !0,
371
+ sx: {
372
+ display: "flex",
373
+ flexDirection: "column",
374
+ position: "absolute",
375
+ top: 40,
376
+ left: "50%",
377
+ transform: "translateX(-50%)",
378
+ width: "95%",
379
+ maxWidth: { sm: 600, md: 700, lg: 800 },
380
+ bgcolor: "background.paper",
381
+ boxShadow: 24,
382
+ border: 1,
383
+ borderColor: "divider",
384
+ borderRadius: 0.5
385
+ },
386
+ children: [
387
+ /* @__PURE__ */ s(
388
+ h,
389
+ {
390
+ sx: {
391
+ p: 1.25,
392
+ px: 3,
393
+ display: "flex",
394
+ justifyContent: "space-between",
395
+ borderBottom: 1,
396
+ borderColor: "divider"
397
+ },
398
+ "data-testid": "add-label-header",
399
+ children: [
400
+ /* @__PURE__ */ s(
401
+ Oe,
402
+ {
403
+ variant: "body1",
404
+ className: "text-customBlue",
405
+ sx: { fontWeight: "medium", fontSize: "1.125rem" },
406
+ children: [
407
+ !f && !_ && !x && E("Add Label"),
408
+ _ && E("Add NameSpace"),
409
+ f && E("Add App"),
410
+ x && E("Edit Label")
411
+ ]
412
+ }
413
+ ),
414
+ /* @__PURE__ */ n(
415
+ Ie,
416
+ {
417
+ size: "small",
418
+ onClick: () => {
419
+ C();
420
+ },
421
+ "data-testid": "add-label-close-button",
422
+ children: /* @__PURE__ */ n(Ue, { icon: Qe })
423
+ }
424
+ )
425
+ ]
426
+ }
427
+ ),
428
+ /* @__PURE__ */ n(h, { item: "true", className: "overflow-y-auto max-h-[60vh]", children: /* @__PURE__ */ s(
429
+ h,
430
+ {
431
+ container: !0,
432
+ justifyContent: "flex-start",
433
+ className: "p-3 pl-5 pr-7",
434
+ children: [
435
+ _ && /* @__PURE__ */ s("div", { children: [
436
+ "Add Namespace for ",
437
+ m == null ? void 0 : m.key
438
+ ] }),
439
+ f && /* @__PURE__ */ s("div", { children: [
440
+ "Label already exists in ",
441
+ q
442
+ ] }),
443
+ /* @__PURE__ */ s(
444
+ "form",
445
+ {
446
+ onSubmit: ke(Se),
447
+ className: "w-full",
448
+ ref: ae,
449
+ children: [
450
+ !_ && !x && /* @__PURE__ */ n(h, { item: "true", className: "pb-[5px]", children: /* @__PURE__ */ n(
451
+ V,
452
+ {
453
+ variant: "outlined",
454
+ className: "w-full",
455
+ "data-testid": "add-label-base-date-field",
456
+ children: /* @__PURE__ */ s(k, { className: "custom-flex-container", children: [
457
+ /* @__PURE__ */ s("div", { className: "w-[30%]", children: [
458
+ E("App"),
459
+ /* @__PURE__ */ n("span", { className: "text-red-500 ml-1", children: "*" })
460
+ ] }),
461
+ /* @__PURE__ */ n(
462
+ Ge,
463
+ {
464
+ control: j,
465
+ name: "apps",
466
+ size: "small",
467
+ options: O || [],
468
+ errors: L,
469
+ value: ve,
470
+ onChange: $e,
471
+ getOptionLabel: je
472
+ }
473
+ )
474
+ ] })
475
+ }
476
+ ) }),
477
+ !f && !x && /* @__PURE__ */ n(h, { item: "true", className: "pb-[5px]", children: /* @__PURE__ */ n(
478
+ V,
479
+ {
480
+ variant: "outlined",
481
+ className: "w-full",
482
+ "data-testid": "add-label-base-date-field",
483
+ children: /* @__PURE__ */ s(k, { className: "custom-flex-container", children: [
484
+ /* @__PURE__ */ s("div", { className: "w-[30%]", children: [
485
+ E("Namespace"),
486
+ /* @__PURE__ */ n("span", { className: "text-red-500 ml-1", children: "*" }),
487
+ /* @__PURE__ */ n("br", {}),
488
+ /* @__PURE__ */ n("div", { className: "text-sm text-gray-600 pr-3", children: "(Note: Add to General if no specific namespace)" })
489
+ ] }),
490
+ /* @__PURE__ */ n(
491
+ He,
492
+ {
493
+ control: j,
494
+ name: "namespace",
495
+ options: fe || [],
496
+ errors: L,
497
+ displayName: "label",
498
+ optionValue: "value",
499
+ multiple: !0
500
+ }
501
+ )
502
+ ] })
503
+ }
504
+ ) }),
505
+ !f && !_ && !x && /* @__PURE__ */ s(J, { children: [
506
+ /* @__PURE__ */ n(h, { item: "true", className: "pb-[5px]", children: /* @__PURE__ */ n(
507
+ V,
508
+ {
509
+ variant: "outlined",
510
+ className: "w-full",
511
+ "data-testid": "add-label-field",
512
+ children: /* @__PURE__ */ s(
513
+ k,
514
+ {
515
+ className: "custom-flex-container",
516
+ display: "flex",
517
+ children: [
518
+ /* @__PURE__ */ s("div", { className: "w-[30%]", children: [
519
+ E("English"),
520
+ /* @__PURE__ */ n("span", { className: "text-red-500 ml-1", children: "*" })
521
+ ] }),
522
+ /* @__PURE__ */ n(
523
+ P,
524
+ {
525
+ control: j,
526
+ id: "englishValue",
527
+ name: "englishValue",
528
+ errors: L,
529
+ label: "",
530
+ size: "small",
531
+ className: "w-full",
532
+ "data-testid": "add-label-language-english"
533
+ }
534
+ )
535
+ ]
536
+ }
537
+ )
538
+ }
539
+ ) }),
540
+ w == null ? void 0 : w.map((e, l) => {
541
+ if ((e == null ? void 0 : e.language_value) !== "English")
542
+ return /* @__PURE__ */ n(h, { item: "true", className: "pb-[5px]", children: /* @__PURE__ */ n(
543
+ V,
544
+ {
545
+ variant: "outlined",
546
+ className: "w-full",
547
+ "data-testid": "add-label-base-date-field",
548
+ children: /* @__PURE__ */ s(k, { className: "custom-flex-container", children: [
549
+ /* @__PURE__ */ s("div", { className: "w-[30%]", children: [
550
+ e == null ? void 0 : e.language_value,
551
+ /* @__PURE__ */ n("span", { className: "text-red-500 ml-1", children: "*" })
552
+ ] }),
553
+ /* @__PURE__ */ n(
554
+ P,
555
+ {
556
+ control: j,
557
+ id: e == null ? void 0 : e.language_value,
558
+ name: e == null ? void 0 : e.language_value,
559
+ errors: L,
560
+ onChange: (a) => {
561
+ var i;
562
+ H(
563
+ e == null ? void 0 : e.id,
564
+ (i = a == null ? void 0 : a.target) == null ? void 0 : i.value
565
+ );
566
+ },
567
+ label: "",
568
+ size: "small",
569
+ className: "w-full",
570
+ "data-testid": "add-label-language"
571
+ }
572
+ )
573
+ ] })
574
+ }
575
+ ) }, l + 1);
576
+ })
577
+ ] }),
578
+ f && /* @__PURE__ */ n(J, { children: m == null ? void 0 : m.map((e, l) => /* @__PURE__ */ n(h, { item: "true", className: "pb-[5px]", children: /* @__PURE__ */ n(
579
+ V,
580
+ {
581
+ variant: "outlined",
582
+ className: "w-full",
583
+ "data-testid": "add-label-base-date-field",
584
+ children: /* @__PURE__ */ s(k, { className: "custom-flex-container", children: [
585
+ /* @__PURE__ */ s("div", { className: "w-[30%]", children: [
586
+ e == null ? void 0 : e.languagevalue,
587
+ /* @__PURE__ */ n("span", { className: "text-red-500 ml-1", children: "*" })
588
+ ] }),
589
+ /* @__PURE__ */ n(
590
+ P,
591
+ {
592
+ control: j,
593
+ id: e == null ? void 0 : e.languagevalue,
594
+ name: e == null ? void 0 : e.languagevalue,
595
+ errors: L,
596
+ onChange: (a) => {
597
+ var i;
598
+ H(
599
+ e == null ? void 0 : e.language,
600
+ (i = a == null ? void 0 : a.target) == null ? void 0 : i.value
601
+ ), Ne({ id: e == null ? void 0 : e.language });
602
+ },
603
+ label: "",
604
+ size: "small",
605
+ className: "w-full",
606
+ "data-testid": "add-label-language"
607
+ }
608
+ )
609
+ ] })
610
+ }
611
+ ) }, l + 1)) }),
612
+ x && /* @__PURE__ */ s(J, { children: [
613
+ " ",
614
+ /* @__PURE__ */ n(h, { item: !0, className: "pb-[5px]", children: /* @__PURE__ */ n(k, { className: "w-full", children: /* @__PURE__ */ n(k, { className: "label-edit-tabs", children: /* @__PURE__ */ n(
615
+ We,
616
+ {
617
+ value: U,
618
+ onChange: ye,
619
+ "aria-label": "basic tabs example",
620
+ children: q == null ? void 0 : q.map((e, l) => /* @__PURE__ */ n(
621
+ De,
622
+ {
623
+ label: e,
624
+ value: e,
625
+ ...Je(l)
626
+ },
627
+ l + 1
628
+ ))
629
+ }
630
+ ) }) }) }),
631
+ q == null ? void 0 : q.map((e, l) => /* @__PURE__ */ n(h, { item: !0, children: /* @__PURE__ */ n(h, { children: /* @__PURE__ */ n(
632
+ pe,
633
+ {
634
+ value: e,
635
+ selectedTab: U,
636
+ index: l,
637
+ children: R == null ? void 0 : R.map((a, i) => {
638
+ if ((a == null ? void 0 : a.appvalue) === e)
639
+ return /* @__PURE__ */ n(h, { item: !0, className: "pb-[5px]", children: /* @__PURE__ */ n(
640
+ V,
641
+ {
642
+ variant: "outlined",
643
+ className: "w-full",
644
+ "data-testid": "label-edit-field",
645
+ children: /* @__PURE__ */ s(k, { className: "custom-flex-container", children: [
646
+ /* @__PURE__ */ n("div", { className: "w-[30%]", children: a == null ? void 0 : a.languagevalue }),
647
+ /* @__PURE__ */ n(
648
+ P,
649
+ {
650
+ control: j,
651
+ id: `${a == null ? void 0 : a.app}-${a.languagevalue}`,
652
+ name: `${a == null ? void 0 : a.app}_${a.languagevalue}`,
653
+ errors: L,
654
+ onChange: (t) => {
655
+ var o;
656
+ return H(
657
+ a == null ? void 0 : a.language,
658
+ (o = t == null ? void 0 : t.target) == null ? void 0 : o.value,
659
+ a == null ? void 0 : a.id
660
+ );
661
+ },
662
+ label: "",
663
+ size: "small",
664
+ className: "w-full",
665
+ "data-testid": "label-edit-input"
666
+ }
667
+ )
668
+ ] })
669
+ }
670
+ ) }, i + 1);
671
+ })
672
+ },
673
+ l + 1
674
+ ) }) }, l + 1))
675
+ ] }),
676
+ /* @__PURE__ */ n(h, { item: "true", className: "pb-[5px] flex justify-end", children: /* @__PURE__ */ s(k, { className: "custom-flex-button", children: [
677
+ /* @__PURE__ */ n(
678
+ ue,
679
+ {
680
+ size: "small",
681
+ variant: "contained",
682
+ "data-testid": "add-label-back-button",
683
+ color: "secondary",
684
+ onClick: () => {
685
+ C(), Q("button_click", {
686
+ button_name: "add-label-back-button",
687
+ button_type: "cancel",
688
+ button_id: "add-label-back-button"
689
+ });
690
+ },
691
+ children: E("Cancel")
692
+ }
693
+ ),
694
+ /* @__PURE__ */ n(
695
+ ue,
696
+ {
697
+ type: "submit",
698
+ size: "small",
699
+ variant: "contained",
700
+ "data-testid": "add-label-save-button",
701
+ color: "primary",
702
+ children: E("Save")
703
+ }
704
+ )
705
+ ] }) })
706
+ ]
707
+ }
708
+ )
709
+ ]
710
+ }
711
+ ) })
712
+ ]
713
+ }
714
+ ) })
715
+ }
716
+ );
717
+ };
718
+ Ye.propTypes = {
719
+ open: v.any,
720
+ handleClose: v.any,
721
+ languageList: v.any,
722
+ apps: v.any,
723
+ addAppFlag: v.any,
724
+ fieldsData: v.any,
725
+ refetch: v.any,
726
+ addNameSpaceFlag: v.any,
727
+ editLabelFlag: v.any,
728
+ labelKey: v.any,
729
+ isLoading: v.any
730
+ };
731
+ export {
732
+ Ye as default
733
+ };
734
+ //# sourceMappingURL=AddLabelModal-DE3ploGD-OOyaGC02.js.map