@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,1228 @@
1
+ import { jsx as n, Fragment as Oe, jsxs as f } from "react/jsx-runtime";
2
+ import { debounce as mt, Typography as U, Box as le, TextField as Pe, ListItem as ke, FormControlLabel as De, Checkbox as Ce, Tooltip as Je, Modal as Ae, Card as Le, IconButton as ve, Button as he, Autocomplete as ft, Menu as pt, MenuItem as ht } from "@mui/material";
3
+ import b from "@mui/material/Grid2";
4
+ import i from "prop-types";
5
+ import vt from "@/views/custom-components/CustomConfirmationModal";
6
+ import { useRef as _e, useState as p, useEffect as te, useCallback as gt, createElement as je } from "react";
7
+ import { useTheme as yt } from "@mui/material/styles";
8
+ import { o as K, u as fe, a as xt, i as wt, g as Nt } from "./Features-Cshdl06N-CZ02Tt89.js";
9
+ import { getRoleList as bt, execute as Z } from "@/common/services/GlobalApis.js";
10
+ import "@/assets/scss/scrollBar.scss";
11
+ import { useForm as ge, Controller as It } from "react-hook-form";
12
+ import { showToast as C } from "@/common/toaster/toaster";
13
+ import St from "@/hooks/useTrackEvent";
14
+ import { useTranslateProvider as ze } from "@/common/languageTranslator/TranslationContext";
15
+ import { FontAwesomeIcon as z } from "@fortawesome/react-fontawesome";
16
+ import { faTrash as Ot, faPen as kt, faAngleDown as Dt, faEyeSlash as Te, faEye as Ee, faXmark as Be, faCheck as Ct, faArrowRight as Jt } from "@fortawesome/free-solid-svg-icons";
17
+ import { yupResolver as _t } from "@hookform/resolvers/yup";
18
+ import * as X from "yup";
19
+ import pe from "@/views/custom-components/CustomCheckBox";
20
+ import Me from "@/views/custom-components/CustomDatePicker";
21
+ import { execute as jt } from "@/common/services/GlobalApis";
22
+ import Tt from "@/views/custom-components/CustomAutoComplete";
23
+ import Et from "@mui/material/Accordion";
24
+ import Mt from "@mui/material/AccordionDetails";
25
+ import Pt from "@mui/material/AccordionSummary";
26
+ import { useSelector as At } from "react-redux";
27
+ import { getUseSkeleton as Lt } from "@/store/reducers/SkeletonReducer";
28
+ const zt = X.object().shape({
29
+ noStartDate: X.boolean().default(!0),
30
+ noEndDate: X.boolean().default(!0),
31
+ startDate: X.date().nullable().when("noStartDate", {
32
+ is: !1,
33
+ then: (s) => s.required("Start date is required")
34
+ }),
35
+ endDate: X.date().nullable().when("noEndDate", {
36
+ is: !1,
37
+ then: (s) => s.required("End date is required")
38
+ }).test(
39
+ "endAfterStart",
40
+ "End date must be after start date",
41
+ function(s) {
42
+ const { startDate: J, noEndDate: g } = this.parent;
43
+ return !s || g || !J ? !0 : new Date(s) >= new Date(J);
44
+ }
45
+ ),
46
+ isBackendOnly: X.boolean().default(!1)
47
+ });
48
+ function Fe({
49
+ isOpen: s,
50
+ onClose: J,
51
+ pendingGrant: g,
52
+ subMenuId: S,
53
+ newApiData: _
54
+ }) {
55
+ const { translate: j } = ze(), {
56
+ handleSubmit: E,
57
+ control: O,
58
+ reset: I,
59
+ watch: d,
60
+ formState: { errors: h },
61
+ trigger: A
62
+ } = ge({
63
+ resolver: _t(zt),
64
+ defaultValues: {
65
+ noStartDate: !0,
66
+ noEndDate: !0,
67
+ startDate: null,
68
+ endDate: null,
69
+ isBackendOnly: !1
70
+ },
71
+ mode: "onChange"
72
+ }), k = d("noStartDate"), B = d("noEndDate"), L = d("startDate"), y = d("endDate"), D = async (x) => {
73
+ var c, N;
74
+ if (g) {
75
+ try {
76
+ await Z({
77
+ code: "grant_permission",
78
+ parameters: {
79
+ featureName: g.id,
80
+ roleIds: g != null && g.designationId ? String(g == null ? void 0 : g.designationId) : null,
81
+ userIds: g != null && g.userId ? String(g.userId) : null,
82
+ startDate: x.noStartDate ? null : x.startDate,
83
+ endDate: x.noEndDate ? null : x.endDate,
84
+ isBackendOnly: x.isBackendOnly
85
+ }
86
+ }), C({
87
+ type: "success",
88
+ message: "Permission Granted Successfully"
89
+ });
90
+ const { data: T } = await K(S);
91
+ _(T);
92
+ } catch (T) {
93
+ C({
94
+ type: "error",
95
+ message: `Error granting permission: ${(N = (c = T == null ? void 0 : T.response) == null ? void 0 : c.data) == null ? void 0 : N.message}`
96
+ });
97
+ }
98
+ I(), J();
99
+ }
100
+ }, M = () => {
101
+ I(), J();
102
+ };
103
+ return /* @__PURE__ */ n(Ae, { open: s, onClose: M, children: /* @__PURE__ */ n(le, { className: "fixed inset-0 flex items-start justify-center z-50 overflow-y-auto bg-opacity-10", children: /* @__PURE__ */ n(
104
+ Le,
105
+ {
106
+ className: `
107
+ relative mt-10 p-4 shadow-lg flex flex-col rounded-xl
108
+ w-[95vw] max-w-md
109
+ sm:w-[80vw] sm:max-w-lg
110
+ md:w-[60vw] md:max-w-xl
111
+ lg:w-[40vw] lg:max-w-2xl
112
+ xl:w-[30vw] xl:max-w-3xl
113
+ `,
114
+ children: /* @__PURE__ */ f("form", { onSubmit: E(D), children: [
115
+ /* @__PURE__ */ f(b, { className: "flex justify-between items-center mb-4", children: [
116
+ /* @__PURE__ */ n(
117
+ U,
118
+ {
119
+ variant: "h6",
120
+ className: "text-base sm:text-lg text-customBlue",
121
+ children: j("Set Access Window")
122
+ }
123
+ ),
124
+ /* @__PURE__ */ n(ve, { onClick: M, children: /* @__PURE__ */ n(z, { icon: Be }) })
125
+ ] }),
126
+ /* @__PURE__ */ f(b, { className: "flex flex-col sm:flex-row gap-4 mb-4", children: [
127
+ /* @__PURE__ */ f(b, { className: "flex-1", children: [
128
+ /* @__PURE__ */ n(
129
+ pe,
130
+ {
131
+ defaultChecked: !0,
132
+ label: "No Start Date",
133
+ control: O,
134
+ errors: h,
135
+ name: "noStartDate",
136
+ onChange: () => A("startDate")
137
+ }
138
+ ),
139
+ /* @__PURE__ */ n(
140
+ Me,
141
+ {
142
+ control: O,
143
+ name: "startDate",
144
+ errors: h,
145
+ disabled: k,
146
+ format: "DD/MM/YYYY",
147
+ maxDate: y || void 0
148
+ }
149
+ )
150
+ ] }),
151
+ /* @__PURE__ */ f(b, { className: "flex-1", children: [
152
+ /* @__PURE__ */ n(
153
+ pe,
154
+ {
155
+ label: "No End Date",
156
+ control: O,
157
+ name: "noEndDate",
158
+ errors: h,
159
+ onChange: () => A("endDate")
160
+ }
161
+ ),
162
+ /* @__PURE__ */ n(
163
+ Me,
164
+ {
165
+ control: O,
166
+ name: "endDate",
167
+ errors: h,
168
+ disabled: B,
169
+ format: "DD/MM/YYYY",
170
+ minDate: L || void 0
171
+ }
172
+ )
173
+ ] })
174
+ ] }),
175
+ /* @__PURE__ */ n(
176
+ pe,
177
+ {
178
+ label: "Is Backend Only?",
179
+ control: O,
180
+ name: "isBackendOnly",
181
+ className: ""
182
+ }
183
+ ),
184
+ /* @__PURE__ */ f(b, { className: "flex justify-end gap-3 mt-2", children: [
185
+ /* @__PURE__ */ n(
186
+ he,
187
+ {
188
+ variant: "contained",
189
+ color: "secondary",
190
+ size: "small",
191
+ onClick: M,
192
+ type: "button",
193
+ className: "mt-2",
194
+ children: j("Close")
195
+ }
196
+ ),
197
+ /* @__PURE__ */ n(
198
+ he,
199
+ {
200
+ variant: "contained",
201
+ color: "primary",
202
+ size: "small",
203
+ type: "submit",
204
+ className: "mt-2",
205
+ children: j("Submit")
206
+ }
207
+ )
208
+ ] })
209
+ ] })
210
+ }
211
+ ) }) });
212
+ }
213
+ Fe.propTypes = {
214
+ isOpen: i.bool,
215
+ onClose: i.func,
216
+ pendingGrant: i.object,
217
+ execute: i.func,
218
+ getFeatureDataV2: i.func,
219
+ subMenuId: i.string,
220
+ newApiData: i.func,
221
+ showToast: i.func
222
+ };
223
+ function Re({
224
+ translate: s,
225
+ onSubmit: J,
226
+ roleList: g,
227
+ featureData: S
228
+ }) {
229
+ const [_, j] = p(""), [E, O] = p(""), [I, d] = p([]), { control: h, handleSubmit: A, reset: k } = ge({}), B = g.filter(
230
+ (y) => !(S != null && S.some((D) => (D == null ? void 0 : D.designationId) === (y == null ? void 0 : y.id)))
231
+ );
232
+ te(() => {
233
+ const y = setTimeout(() => {
234
+ O(_);
235
+ }, 300);
236
+ return () => clearTimeout(y);
237
+ }, [_]), te(() => {
238
+ E !== "" && L(E);
239
+ }, [E]), te(() => {
240
+ L("");
241
+ }, []);
242
+ const L = async (y, D = S) => {
243
+ try {
244
+ const { data: M } = await jt({
245
+ code: "user_search_for_selectize",
246
+ parameters: {
247
+ searchString: y
248
+ }
249
+ }), x = ((M == null ? void 0 : M.result) || []).filter((c) => c == null ? void 0 : c.id).filter(
250
+ (c) => !(D != null && D.some((N) => (N == null ? void 0 : N.userId) === (c == null ? void 0 : c.id)))
251
+ ).map((c) => ({
252
+ ...c,
253
+ displayName: `${c.firstName || ""} ${c.lastName || ""} (${c.userName || ""})`.trim()
254
+ }));
255
+ d(x);
256
+ } catch (M) {
257
+ console.error(M);
258
+ }
259
+ };
260
+ return /* @__PURE__ */ f(b, { className: "flex flex-col md:flex-row gap-3 md:pl-5 justify-start w-full", children: [
261
+ /* @__PURE__ */ f(
262
+ b,
263
+ {
264
+ className: "flex flex-col md:flex-row md:space-x-5 justify-center items-center w-full",
265
+ children: [
266
+ /* @__PURE__ */ f(b, { className: "flex flex-row flex-2 md:space-x-3 items-center w-full", children: [
267
+ /* @__PURE__ */ n(U, { className: "flex-1", children: s("User") }),
268
+ /* @__PURE__ */ n(b, { className: "flex-3", children: /* @__PURE__ */ n(
269
+ It,
270
+ {
271
+ name: "roles",
272
+ id: "roles",
273
+ users: !0,
274
+ control: h,
275
+ defaultValue: null,
276
+ render: ({ field: { onChange: y, value: D, ref: M } }) => /* @__PURE__ */ n(
277
+ ft,
278
+ {
279
+ options: I,
280
+ getOptionLabel: (x) => x.displayName || "",
281
+ isOptionEqualToValue: (x, c) => x.id === (c == null ? void 0 : c.id),
282
+ value: D || null,
283
+ onChange: (x, c, N) => {
284
+ N === "clear" && L(""), y(c);
285
+ },
286
+ onInputChange: (x, c, N) => {
287
+ N === "input" && j(c);
288
+ },
289
+ renderOption: (x, c) => {
290
+ const N = c.displayName || "", T = _.trim(), Y = N.toLowerCase().indexOf(T.toLowerCase());
291
+ if (Y === -1)
292
+ return /* @__PURE__ */ je(
293
+ "li",
294
+ {
295
+ ...x,
296
+ key: c.id,
297
+ style: { lineHeight: 1.5, fontSize: "14px" }
298
+ },
299
+ N
300
+ );
301
+ const ae = N.substring(0, Y), V = N.substring(
302
+ Y,
303
+ Y + T.length
304
+ ), re = N.substring(
305
+ Y + T.length
306
+ );
307
+ return /* @__PURE__ */ je("li", { ...x, key: c.id }, /* @__PURE__ */ f("span", { className: "inline", children: [
308
+ ae,
309
+ /* @__PURE__ */ n("span", { className: "bg-yellow-300", children: V }),
310
+ re
311
+ ] }));
312
+ },
313
+ renderInput: (x) => /* @__PURE__ */ n(
314
+ Pe,
315
+ {
316
+ ...x,
317
+ label: "User",
318
+ variant: "outlined",
319
+ size: "small",
320
+ inputRef: M
321
+ }
322
+ )
323
+ }
324
+ )
325
+ }
326
+ ) })
327
+ ] }),
328
+ /* @__PURE__ */ f(b, { className: "flex flex-row flex-2 md:space-x-3 items-center w-full", children: [
329
+ /* @__PURE__ */ n(U, { className: "flex-1", children: s("Role") }),
330
+ /* @__PURE__ */ n(b, { className: "flex-3", children: /* @__PURE__ */ n(
331
+ Tt,
332
+ {
333
+ id: "selectedRoles",
334
+ name: "selectedRoles",
335
+ options: B,
336
+ control: h,
337
+ getOptionLabel: (y) => y == null ? void 0 : y.name,
338
+ dataTestId: "accessrights-select-role"
339
+ }
340
+ ) })
341
+ ] })
342
+ ]
343
+ },
344
+ "specific-section"
345
+ ),
346
+ /* @__PURE__ */ n(b, { className: "flex items-center md:pr-5 justify-end", children: /* @__PURE__ */ n(
347
+ he,
348
+ {
349
+ variant: "contained",
350
+ size: "small",
351
+ onClick: A((y) => {
352
+ var D;
353
+ J(y), L("", [...S, { userId: (D = y.roles) == null ? void 0 : D.id }]), k();
354
+ }),
355
+ children: s("add")
356
+ }
357
+ ) })
358
+ ] });
359
+ }
360
+ Re.propTypes = {
361
+ translate: i.any,
362
+ permissionDetailsList: i.any,
363
+ getPermissionDetails: i.any,
364
+ onSubmit: i.any,
365
+ permissionTypes: i.any,
366
+ roleList: i.any,
367
+ featureData: i.any
368
+ };
369
+ function Ue({
370
+ isOpen: s,
371
+ onClose: J,
372
+ permissions: g,
373
+ featureState: S,
374
+ featureName: _
375
+ }) {
376
+ const j = () => {
377
+ J();
378
+ }, E = S[_] || !1, O = (I, d = 0) => {
379
+ if (!I) return null;
380
+ const h = I.child || [], A = I.display_name || I.name || I.id;
381
+ return /* @__PURE__ */ f("div", { className: "py-2 ", children: [
382
+ /* @__PURE__ */ f("div", { className: "flex items-center ", children: [
383
+ E ? /* @__PURE__ */ n(z, { icon: Ct }) : /* @__PURE__ */ n(z, { icon: Jt }),
384
+ /* @__PURE__ */ n("div", { className: "top-6.5 w-4 border-t border-gray-300" }),
385
+ /* @__PURE__ */ n(
386
+ "div",
387
+ {
388
+ className: `
389
+ inline-flex items-center
390
+ text-[0.8rem]
391
+ px-2 py-1
392
+ rounded-full
393
+ bg-gray-100
394
+ text-gray-800
395
+ border border-gray-300
396
+ hover:bg-gray-200
397
+ transition-all duration-200 cursor-pointer
398
+
399
+ `,
400
+ children: A
401
+ }
402
+ )
403
+ ] }),
404
+ (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ n("div", { className: "pl-2 ", children: h.map((k, B) => {
405
+ const L = B === h.length - 1;
406
+ return /* @__PURE__ */ f("div", { className: "relative pl-3", children: [
407
+ /* @__PURE__ */ n(
408
+ "div",
409
+ {
410
+ className: `
411
+ absolute left-0 w-px bg-gray-300
412
+ ${L ? "top-0 h-6.5" : "top-[-11px] bottom-0"}
413
+ `
414
+ }
415
+ ),
416
+ /* @__PURE__ */ n("div", { className: "absolute left-0 top-6.5 w-3 border-t border-gray-300" }),
417
+ O(k, d + 1)
418
+ ] }, B);
419
+ }) })
420
+ ] });
421
+ };
422
+ return /* @__PURE__ */ n(Ae, { open: s, onClose: j, children: /* @__PURE__ */ n(le, { className: "fixed inset-0 flex items-start justify-center z-50 bg-opacity-10", children: /* @__PURE__ */ f(
423
+ Le,
424
+ {
425
+ className: `
426
+ relative mt-10 shadow-lg flex flex-col rounded-xl
427
+ w-[95vw] max-w-md
428
+ sm:w-[80vw] sm:max-w-lg
429
+ md:w-[60vw] md:max-w-xl
430
+ lg:w-[60vw] lg:max-w-2xl
431
+ xl:w-[30vw] xl:max-w-3xl
432
+
433
+ `,
434
+ children: [
435
+ /* @__PURE__ */ f(b, { className: "flex justify-between items-center p-[5px_10px] border-b border-black", children: [
436
+ /* @__PURE__ */ n(U, { variant: "body1", className: "font-bold text-customBlue", children: "Permissions" }),
437
+ /* @__PURE__ */ n(
438
+ ve,
439
+ {
440
+ size: "small",
441
+ onClick: j,
442
+ "data-testid": "flywayquery-close-button",
443
+ children: /* @__PURE__ */ n(z, { icon: Be })
444
+ }
445
+ )
446
+ ] }),
447
+ /* @__PURE__ */ n("div", { className: " max-h-[75vh] overflow-y-auto", children: g && /* @__PURE__ */ n("div", { className: "w-max pl-6 m-3 rounded px-2 py-1 h-fit ", children: O(g) }) })
448
+ ]
449
+ }
450
+ ) }) });
451
+ }
452
+ Ue.propTypes = {
453
+ isOpen: i.bool,
454
+ onClose: i.func,
455
+ permissions: i.any,
456
+ featureName: i.any,
457
+ featureState: i.any
458
+ };
459
+ function qe({ config: s, row: J }) {
460
+ var g;
461
+ const [S, _] = p(null), j = !!S, E = (d) => {
462
+ d.stopPropagation(), _(d.currentTarget), typeof s.menuClick == "function" && s.menuClick(J);
463
+ }, O = (d) => {
464
+ d && d.stopPropagation(), _(null);
465
+ }, I = (d) => (h) => {
466
+ h.stopPropagation(), typeof d.onClick == "function" && d.onClick(J), _(null);
467
+ };
468
+ return /* @__PURE__ */ f(le, { children: [
469
+ /* @__PURE__ */ n(
470
+ ve,
471
+ {
472
+ size: "small",
473
+ disableRipple: !0,
474
+ sx: {
475
+ "&:hover": {
476
+ backgroundColor: "transparent"
477
+ }
478
+ },
479
+ onClick: E,
480
+ "data-testid": s.dataTestId,
481
+ children: s.icon
482
+ }
483
+ ),
484
+ /* @__PURE__ */ n(
485
+ pt,
486
+ {
487
+ anchorEl: S,
488
+ open: j,
489
+ onClose: O,
490
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
491
+ transformOrigin: { vertical: "top", horizontal: "right" },
492
+ children: (g = s.menuItems) == null ? void 0 : g.map((d, h) => /* @__PURE__ */ n(ht, { onClick: I(d), children: d.label }, h))
493
+ }
494
+ )
495
+ ] });
496
+ }
497
+ qe.propTypes = {
498
+ config: i.any,
499
+ row: i.any
500
+ };
501
+ function Bt({
502
+ subMenuId: s,
503
+ // subMenuGroupName,
504
+ subMenuFeatureVal: J,
505
+ // selectedTab,
506
+ parentLoading: g,
507
+ onNewAPIChange: S
508
+ }) {
509
+ const _ = At(Lt), j = yt(), E = _e(null), O = _e(!1), I = St(), [d, h] = p([]), [A, k] = p([]), [B, L] = p([]), [y, D] = p([]), [M, x] = p([]), [c, N] = p(""), [T, Y] = p({}), [ae, V] = p(!1), [re, se] = p(!1), [ye, Ye] = p(""), [q, Ve] = p(null), [We, Ge] = p({}), [He, W] = p(!1), [ee, xe] = p(!1), [$e, we] = p(null), [G, Qe] = p([]), [Xe, oe] = p(0), [Ke, Ne] = p(""), { translate: be } = ze(), [Ze, ie] = p(""), [et, de] = p([]), [F, H] = p(null);
510
+ te(() => {
511
+ let e = E.current;
512
+ return () => {
513
+ I("conversion_event", {
514
+ form: e,
515
+ form_name: "Access Rights",
516
+ submit: O.current
517
+ });
518
+ };
519
+ }, []);
520
+ const ce = (e) => {
521
+ var l;
522
+ let r;
523
+ return r = (l = e.userMenuItemDtos) == null ? void 0 : l.toSorted((t, a) => t.designationId !== void 0 && a.designationId !== void 0 ? t.designationId - a.designationId : t.designationId !== void 0 && a.designationId === void 0 ? -1 : t.designationId === void 0 && a.designationId !== void 0 ? 1 : t.userId !== void 0 && a.userId !== void 0 ? t.userId - a.userId : t.userId !== void 0 && a.userId === void 0 ? -1 : t.userId === void 0 && a.userId !== void 0 ? 1 : 0), r;
524
+ };
525
+ i.any;
526
+ const ue = (e) => (e == null || e.userMenuItemDtos.forEach((l) => {
527
+ l.featureJson = ot(
528
+ JSON.parse(e.featureJson || "{}"),
529
+ JSON.parse(l.featureJson || "{}")
530
+ ), l.designationId ? (l.code = "Role", l.displayName = l.roleName) : (l.code = "User", l.displayName = l.fullName);
531
+ }), e), tt = async () => {
532
+ var e, l;
533
+ try {
534
+ if (W((r) => !r), ee) {
535
+ const r = [];
536
+ Object.entries(JSON.parse(q == null ? void 0 : q.featureJson)).forEach(
537
+ ([t, a]) => {
538
+ a === !0 && r.push(t);
539
+ }
540
+ );
541
+ try {
542
+ await Z({
543
+ code: "delete_permissions",
544
+ parameters: {
545
+ permissionList: r,
546
+ roleId: parseInt(q == null ? void 0 : q.designationId),
547
+ userId: parseInt(q == null ? void 0 : q.userId)
548
+ }
549
+ }), C({
550
+ type: "success",
551
+ message: "Permission Deleted Successfully"
552
+ });
553
+ const { data: t } = await K(s);
554
+ $(t);
555
+ } catch {
556
+ C({
557
+ type: "error",
558
+ message: "error occurred"
559
+ });
560
+ }
561
+ } else {
562
+ await xt(ye);
563
+ let { data: r } = await fe(s);
564
+ (r == null ? void 0 : r.userMenuItemDtos.length) > 0 && (r = ue(r)), k(r.userMenuItemDtos);
565
+ }
566
+ V(!1), W((r) => !r);
567
+ } catch (r) {
568
+ C({
569
+ type: "error",
570
+ message: `Error Deleting data: ${(l = (e = r == null ? void 0 : r.response) == null ? void 0 : e.data) == null ? void 0 : l.message}`
571
+ }), W((t) => !t), V(!1);
572
+ }
573
+ }, nt = (e, l) => {
574
+ const r = new Set(e.map((a) => a.id)), t = [];
575
+ return Object.entries(l).forEach(([a, m]) => {
576
+ m === !0 && !r.has(a) && t.push({ id: a, action: "grant" });
577
+ }), e.forEach((a) => {
578
+ l[a.id] || t.push({ id: a.id, action: "revoke" });
579
+ }), t;
580
+ }, { handleSubmit: lt } = ge({}), me = async (e) => {
581
+ var l, r, t, a, m, v;
582
+ try {
583
+ if (ee) {
584
+ e = { ...e, featureJson: JSON.parse(e == null ? void 0 : e.featureJson) };
585
+ const o = nt(
586
+ e.permissions,
587
+ e == null ? void 0 : e.featureJson
588
+ );
589
+ if (((l = o[0]) == null ? void 0 : l.action) === "grant")
590
+ we({
591
+ ...e,
592
+ id: (r = o[0]) == null ? void 0 : r.id
593
+ }), oe(1);
594
+ else if (((t = o[0]) == null ? void 0 : t.action) === "revoke")
595
+ try {
596
+ await Z({
597
+ code: "revoke_permission",
598
+ parameters: {
599
+ featureName: (a = o[0]) == null ? void 0 : a.id,
600
+ roleId: parseInt(e == null ? void 0 : e.designationId),
601
+ userId: parseInt(e == null ? void 0 : e.userId)
602
+ }
603
+ }), C({
604
+ type: "success",
605
+ message: "Permission Revoked Successfully"
606
+ });
607
+ } catch {
608
+ C({
609
+ type: "error",
610
+ message: "Error in revoking permission"
611
+ });
612
+ }
613
+ const { data: w } = await K(s);
614
+ $(w);
615
+ } else
616
+ await Nt(e);
617
+ } catch (o) {
618
+ C({
619
+ type: "error",
620
+ message: `Error Updating data: ${(v = (m = o == null ? void 0 : o.response) == null ? void 0 : m.data) == null ? void 0 : v.message}`
621
+ });
622
+ }
623
+ }, at = async (e) => {
624
+ try {
625
+ if (e = {
626
+ ...e,
627
+ featureJson: JSON.parse(e == null ? void 0 : e.featureJson)
628
+ }, e != null && e.checkAll) {
629
+ const r = Object.keys(e == null ? void 0 : e.featureJson).filter((t) => (e == null ? void 0 : e.featureJson[t]) === !1).join(",");
630
+ await Z({
631
+ code: "grant_permission_bulk",
632
+ parameters: {
633
+ permission_id_list: r,
634
+ role_id: parseInt(e == null ? void 0 : e.designationId),
635
+ user_id: parseInt(e == null ? void 0 : e.userId)
636
+ }
637
+ }), C({
638
+ type: "success",
639
+ message: "Permission granted Successfully"
640
+ });
641
+ }
642
+ const { data: l } = await K(s);
643
+ $(l);
644
+ } catch (l) {
645
+ console.error(l);
646
+ }
647
+ }, Ie = async (e) => {
648
+ var l, r, t;
649
+ if (!(e != null && e.roles || e != null && e.selectedRoles)) {
650
+ C({
651
+ message: "Please select either user or role !!",
652
+ type: "info"
653
+ });
654
+ return;
655
+ }
656
+ if (ee && d.length < 1) {
657
+ C({
658
+ message: "Please add permissions first for this feature !!",
659
+ type: "info"
660
+ });
661
+ return;
662
+ }
663
+ try {
664
+ const a = ((l = e == null ? void 0 : e.selectedRoles) == null ? void 0 : l.map((o) => o == null ? void 0 : o.id)) || [], m = T != null && T.id ? A.some((o) => (o == null ? void 0 : o.userId) === (T == null ? void 0 : T.id)) : !1, v = (a == null ? void 0 : a.length) > 0 ? A.some(
665
+ (o) => a.includes(o == null ? void 0 : o.designationId)
666
+ ) : !1;
667
+ if (m || v)
668
+ C({
669
+ message: "Selected User Already found please select another id",
670
+ type: "warning"
671
+ });
672
+ else {
673
+ const o = a == null ? void 0 : a.join(","), w = {
674
+ userId: (r = e == null ? void 0 : e.roles) == null ? void 0 : r.id,
675
+ designationId: o || null
676
+ }, P = G.filter(
677
+ (u) => {
678
+ var R;
679
+ return (R = u == null ? void 0 : u.id) == null ? void 0 : R.startsWith("view");
680
+ }
681
+ );
682
+ if (ee) {
683
+ we({
684
+ ...w,
685
+ id: (P == null ? void 0 : P.filter((R) => R.id.split(".").length === 3).map((R) => R.id)[0]) || ((t = G[0]) == null ? void 0 : t.id)
686
+ }), oe(1);
687
+ const { data: u } = await K(s);
688
+ $(u);
689
+ } else {
690
+ await wt(s, w);
691
+ let { data: u } = await fe(s);
692
+ (u == null ? void 0 : u.userMenuItemDtos.length) > 0 && (u == null ? void 0 : u.userMenuItemDtos.length) > 0 && (u = ue(u)), N(u == null ? void 0 : u.featureJson);
693
+ const R = ce(u);
694
+ k(R);
695
+ const Q = u.featureJson ? Object.keys(JSON.parse(u.featureJson)) : [];
696
+ if (Q.length > 0) {
697
+ const { data: ut } = await Z({
698
+ code: "retrieve_display_name_for_feature",
699
+ parameters: {
700
+ menu_id: s,
701
+ feature_name_list: Q
702
+ }
703
+ });
704
+ h(ut.result);
705
+ } else
706
+ h([]);
707
+ C({
708
+ message: "menu item added successfully",
709
+ type: "success"
710
+ });
711
+ }
712
+ O.current = !0, Y({});
713
+ }
714
+ } catch (a) {
715
+ console.error(a), C({
716
+ message: "cannot add menu item",
717
+ type: "error"
718
+ });
719
+ }
720
+ }, rt = gt(
721
+ mt((e) => {
722
+ if (!e)
723
+ k(B);
724
+ else {
725
+ const l = B == null ? void 0 : B.filter(
726
+ (r) => {
727
+ var t, a;
728
+ return r != null && r.designationId ? (t = r.roleName) == null ? void 0 : t.toLowerCase().includes(e) : (a = r.fullName) == null ? void 0 : a.toLowerCase().includes(e);
729
+ }
730
+ );
731
+ I("search_tracking", {
732
+ searchTerm: e,
733
+ results_count: l.length,
734
+ search_type: "Page Search"
735
+ }), k(l);
736
+ }
737
+ }, 500),
738
+ [d, I]
739
+ ), st = (e) => {
740
+ const l = e.target.value.toLowerCase();
741
+ Ne(l), rt(l);
742
+ }, ot = (e, l = {}) => {
743
+ const r = {};
744
+ return Object.keys(e).forEach((t) => {
745
+ Object.prototype.hasOwnProperty.call(l, t) ? r[t] = l[t] : r[t] = e[t];
746
+ }), JSON.stringify(r);
747
+ }, it = (e, l) => {
748
+ const r = new Set(l.map((a) => a.id)), t = {};
749
+ return e.forEach((a) => {
750
+ t[a.id] = r.has(a.id);
751
+ }), JSON.stringify(t);
752
+ }, $ = (e) => {
753
+ e == null || e.userMenuItemDtos.forEach((t) => {
754
+ t.id = (t == null ? void 0 : t.designationId) || (t == null ? void 0 : t.userId), t.featureJson = it(
755
+ e == null ? void 0 : e.permissions,
756
+ t == null ? void 0 : t.permissions
757
+ ), t.designationId ? (t.code = "Role", t.displayName = t.roleName) : (t.code = "User", t.displayName = t.fullName);
758
+ });
759
+ const l = [
760
+ ...new Set(e.permissions.map((t) => t.id))
761
+ ];
762
+ h(l), Qe(e == null ? void 0 : e.permissions);
763
+ const r = ce(e);
764
+ k(r), L(r);
765
+ };
766
+ te(() => {
767
+ (async () => {
768
+ var e, l, r;
769
+ try {
770
+ if (s) {
771
+ H(null), Se(!1), W((o) => !o), Ne("");
772
+ let t, a;
773
+ if (J ? (t = (await K(s)).data, a = !0, xe(!0), S({ id: s, val: !0 })) : (t = (await fe(s)).data, a = !1, xe(!1), S({ id: s, val: !1 })), a)
774
+ $(t);
775
+ else {
776
+ (t == null ? void 0 : t.userMenuItemDtos.length) > 0 && (t = ue(t)), N(t == null ? void 0 : t.featureJson);
777
+ const o = ce(t);
778
+ k(o), L(o);
779
+ }
780
+ let m = M;
781
+ if (!y || y.length === 0) {
782
+ const { data: o } = await bt();
783
+ x(o), m = o;
784
+ }
785
+ let v;
786
+ if (a)
787
+ v = t.permissions.map((o) => o.id), h(v);
788
+ else if (v = t.featureJson ? Object.keys(JSON.parse(t.featureJson)) : [], v.length > 0) {
789
+ const [o] = await Promise.all([
790
+ await Z({
791
+ code: "retrieve_display_name_for_feature",
792
+ parameters: {
793
+ menu_id: s,
794
+ feature_name_list: v
795
+ }
796
+ })
797
+ ]);
798
+ h((e = o.data) == null ? void 0 : e.result);
799
+ } else
800
+ h([]);
801
+ if (m && m.length > 0)
802
+ if (t.isDynamicFeature) {
803
+ const o = JSON.parse(JSON.stringify(m)).filter((w) => {
804
+ const P = w.roleType;
805
+ return P === null || t != null && t.isMobileFeature && t != null && t.isWebFeature ? !0 : t.isMobileFeature ? P === "MOBILE" || P === "BOTH" : t.isWebFeature ? P === "WEB" || P === "BOTH" : !1;
806
+ });
807
+ D(o);
808
+ } else
809
+ D(m);
810
+ W((o) => !o);
811
+ }
812
+ } catch (t) {
813
+ C({
814
+ type: "error",
815
+ message: `Error loading initial data: ${(r = (l = t == null ? void 0 : t.response) == null ? void 0 : l.data) == null ? void 0 : r.message}`
816
+ }), W((a) => !a);
817
+ }
818
+ })();
819
+ }, [s, S]);
820
+ function ne(e, l) {
821
+ for (const r of e)
822
+ if (String(r.id) === String(l))
823
+ return r;
824
+ return null;
825
+ }
826
+ const [dt, Se] = p(!1), ct = (e) => (l, r) => {
827
+ Se(r ? e : !1);
828
+ };
829
+ return /* @__PURE__ */ n(Oe, { children: (He || g) && _ ? /* @__PURE__ */ n("div", { className: "w-full flex flex-wrap", children: /* @__PURE__ */ f("div", { className: "w-full flex flex-col px-2", children: [
830
+ /* @__PURE__ */ n("div", { className: "bg-gray-300 animate-pulse rounded-sm h-[70px] mb-2" }),
831
+ /* @__PURE__ */ n("div", { className: "bg-gray-300 animate-pulse rounded-sm h-[280px] mb-2" })
832
+ ] }) }) : /* @__PURE__ */ f(b, { container: !0, sx: { borderTop: `1px solid ${j.palette.divider}` }, children: [
833
+ /* @__PURE__ */ n(
834
+ vt,
835
+ {
836
+ description: "Are you sure , Do you want to delete this ?",
837
+ title: "CONFIRM ACTION",
838
+ open: ae && ye === (q == null ? void 0 : q.id),
839
+ handleClick: tt,
840
+ handleClose: () => V((e) => !e),
841
+ dataTestId: "accessrights-delete-modal"
842
+ }
843
+ ),
844
+ /* @__PURE__ */ n(
845
+ Ue,
846
+ {
847
+ isOpen: re && F,
848
+ onClose: () => {
849
+ se((e) => !e), H(null), ie(""), de([]);
850
+ },
851
+ featureState: et,
852
+ featureName: Ze,
853
+ permissions: F
854
+ }
855
+ ),
856
+ /* @__PURE__ */ n(
857
+ Fe,
858
+ {
859
+ isOpen: Xe === 1,
860
+ onClose: () => oe(0),
861
+ pendingGrant: $e,
862
+ subMenuId: s,
863
+ newApiData: $
864
+ }
865
+ ),
866
+ /* @__PURE__ */ n(
867
+ "form",
868
+ {
869
+ ref: E,
870
+ onSubmit: lt(Ie),
871
+ className: "w-full",
872
+ children: /* @__PURE__ */ f(
873
+ b,
874
+ {
875
+ container: !0,
876
+ className: "flex flex-col md:flex-row items-center justify-between p-2 w-full",
877
+ spacing: 1,
878
+ children: [
879
+ /* @__PURE__ */ f(b, { className: "flex-1 flex space-x-10 items-center justify-between", children: [
880
+ /* @__PURE__ */ n(U, { variant: "body2", children: be("Search") }),
881
+ /* @__PURE__ */ n(le, { children: /* @__PURE__ */ n(
882
+ Pe,
883
+ {
884
+ id: "searchQuery",
885
+ placeholder: "Search Text",
886
+ size: "small",
887
+ onChange: st,
888
+ value: Ke,
889
+ "data-testid": "access-rights-textfield-search",
890
+ sx: {
891
+ "& .MuiInputBase-root": {
892
+ height: "2.6em"
893
+ }
894
+ }
895
+ }
896
+ ) })
897
+ ] }),
898
+ /* @__PURE__ */ n(b, { className: "flex-3 flex space-x-10 items-center justify-between w-full", children: /* @__PURE__ */ n(
899
+ Re,
900
+ {
901
+ translate: be,
902
+ onSubmit: Ie,
903
+ roleList: y,
904
+ featureData: A
905
+ }
906
+ ) })
907
+ ]
908
+ }
909
+ )
910
+ }
911
+ ),
912
+ /* @__PURE__ */ n("div", { style: { width: "100%" }, children: A.map((e) => /* @__PURE__ */ n(Oe, { children: /* @__PURE__ */ f(
913
+ Et,
914
+ {
915
+ expanded: dt === `panel${e == null ? void 0 : e.id}`,
916
+ onChange: ct(`panel${e == null ? void 0 : e.id}`),
917
+ children: [
918
+ /* @__PURE__ */ f(
919
+ Pt,
920
+ {
921
+ expandIcon: /* @__PURE__ */ n(z, { icon: Dt }),
922
+ "aria-controls": "panel1bh-content",
923
+ id: "panel1bh-header",
924
+ children: [
925
+ /* @__PURE__ */ n(
926
+ U,
927
+ {
928
+ component: "span",
929
+ sx: { width: "33%", flexShrink: 0 },
930
+ children: e.code
931
+ }
932
+ ),
933
+ /* @__PURE__ */ n(
934
+ U,
935
+ {
936
+ component: "span",
937
+ sx: { color: "text.secondary" },
938
+ children: e.displayName
939
+ }
940
+ ),
941
+ /* @__PURE__ */ f("div", { className: "ml-auto mr-4 flex items-center space-x-3", children: [
942
+ /* @__PURE__ */ n(
943
+ z,
944
+ {
945
+ icon: Ot,
946
+ style: {
947
+ cursor: "pointer",
948
+ color: j.palette.error.main,
949
+ fontSize: "16px",
950
+ marginTop: "0.5rem"
951
+ },
952
+ onClick: (l) => {
953
+ l.stopPropagation(), l.preventDefault(), V(!0), Ye(e.id), Ve(e);
954
+ }
955
+ }
956
+ ),
957
+ /* @__PURE__ */ n(
958
+ qe,
959
+ {
960
+ config: {
961
+ label: "",
962
+ icon: /* @__PURE__ */ n(
963
+ z,
964
+ {
965
+ style: {
966
+ cursor: "pointer",
967
+ // color: theme.palette.error.main,
968
+ fontSize: "16px",
969
+ marginTop: "0.5rem"
970
+ },
971
+ icon: kt
972
+ }
973
+ ),
974
+ dataTestId: "accessrights-edit-icon",
975
+ menuClick: (l) => {
976
+ Ge(() => ({
977
+ ...l,
978
+ code: l.designationId ? "Role" : "User",
979
+ menuConfigId: s,
980
+ displayName: l.designationId ? l.roleName : l.fullName
981
+ }));
982
+ },
983
+ menuItems: [
984
+ {
985
+ label: "Check All",
986
+ onClick: (l) => {
987
+ if (ee)
988
+ at({
989
+ ...l,
990
+ checkAll: !0
991
+ });
992
+ else {
993
+ let r = JSON.parse(c);
994
+ const t = (d == null ? void 0 : d.length) > 0 ? d.reduce(
995
+ (a, { feature_name: m }) => (a[m] = !0, a),
996
+ {}
997
+ ) : Object.keys(r).reduce(
998
+ (a, m) => (a[m] = !0, a),
999
+ {}
1000
+ );
1001
+ k(
1002
+ (a) => a.map(
1003
+ (m) => m.id === l.id ? {
1004
+ ...m,
1005
+ featureJson: JSON.stringify(t)
1006
+ } : m
1007
+ )
1008
+ ), me({
1009
+ ...We,
1010
+ featureJson: JSON.stringify(t)
1011
+ });
1012
+ }
1013
+ }
1014
+ }
1015
+ ]
1016
+ },
1017
+ row: e
1018
+ }
1019
+ )
1020
+ ] })
1021
+ ]
1022
+ }
1023
+ ),
1024
+ /* @__PURE__ */ n(Mt, { children: /* @__PURE__ */ n("div", { className: "overflow-x-auto", children: /* @__PURE__ */ n("div", { className: "flex gap-6 w-max", children: /* @__PURE__ */ f("div", { className: "grid grid-cols-3 w-max p-0 m-0", children: [
1025
+ d.length <= 0 && Object.keys(JSON.parse(c || "{}")).length <= 0 && /* @__PURE__ */ n("div", { className: "text-gray-500 px-4 italic", children: "No Data to Display" }),
1026
+ (d == null ? void 0 : d.length) > 0 ? Object.keys(
1027
+ JSON.parse(e.featureJson || "{}")
1028
+ ).map((l, r) => {
1029
+ var t, a;
1030
+ const m = JSON.parse(
1031
+ e.featureJson || "{}"
1032
+ ), v = ((t = d.find(
1033
+ (u) => u.feature_name === l
1034
+ )) == null ? void 0 : t.display_name) || l, o = m[l] || !1, w = ne(
1035
+ G,
1036
+ v
1037
+ ), P = (((a = w == null ? void 0 : w.child) == null ? void 0 : a.length) || 0) > 0;
1038
+ return /* @__PURE__ */ f(
1039
+ ke,
1040
+ {
1041
+ className: "p-0 flex ",
1042
+ children: [
1043
+ /* @__PURE__ */ n(
1044
+ De,
1045
+ {
1046
+ control: /* @__PURE__ */ n(
1047
+ Ce,
1048
+ {
1049
+ checked: o,
1050
+ name: l,
1051
+ onClick: () => {
1052
+ const u = {
1053
+ ...m,
1054
+ [l]: !o
1055
+ };
1056
+ k(
1057
+ (R) => R.map(
1058
+ (Q) => Q.id === e.id ? {
1059
+ ...Q,
1060
+ featureJson: JSON.stringify(
1061
+ u
1062
+ )
1063
+ } : Q
1064
+ )
1065
+ ), me({
1066
+ ...e,
1067
+ featureJson: JSON.stringify(
1068
+ u
1069
+ ),
1070
+ code: e.designationId ? "Role" : "User",
1071
+ menuConfigId: s,
1072
+ displayName: e.designationId ? e.roleName : e.fullName
1073
+ });
1074
+ }
1075
+ }
1076
+ ),
1077
+ label: /* @__PURE__ */ n(U, { variant: "body2", children: (() => {
1078
+ const u = ne(
1079
+ G,
1080
+ v
1081
+ );
1082
+ return u ? u.name : v;
1083
+ })() })
1084
+ }
1085
+ ),
1086
+ P && /* @__PURE__ */ n(
1087
+ "div",
1088
+ {
1089
+ onClick: () => {
1090
+ if ((F == null ? void 0 : F.id) === (w == null ? void 0 : w.id)) {
1091
+ H(null), se(!1), ie(""), de([]);
1092
+ return;
1093
+ }
1094
+ ie(l), de(
1095
+ m
1096
+ ), se(!0), H(w);
1097
+ },
1098
+ className: "cursor-pointer text-gray-600 transition-transform duration-200 hover:scale-[1.2] py-1 pr-3",
1099
+ children: (F == null ? void 0 : F.id) === (w == null ? void 0 : w.id) ? /* @__PURE__ */ n(Je, { title: "Close Permissions", children: /* @__PURE__ */ n(
1100
+ z,
1101
+ {
1102
+ color: "primary",
1103
+ icon: Te
1104
+ }
1105
+ ) }) : /* @__PURE__ */ n(Je, { title: "View Permissions", children: /* @__PURE__ */ n(
1106
+ z,
1107
+ {
1108
+ className: " text-[var(--color-primary)] ",
1109
+ color: "primary",
1110
+ icon: Ee
1111
+ }
1112
+ ) })
1113
+ }
1114
+ )
1115
+ ]
1116
+ },
1117
+ `featureName-${r}`
1118
+ );
1119
+ }) : Object.keys(JSON.parse(c || "{}")).map(
1120
+ (l, r) => {
1121
+ var t;
1122
+ const a = JSON.parse(
1123
+ e.featureJson || "{}"
1124
+ ), m = a[l] || !1, v = ne(
1125
+ G,
1126
+ l
1127
+ ), o = (((t = v == null ? void 0 : v.child) == null ? void 0 : t.length) || 0) > 0;
1128
+ return /* @__PURE__ */ f(
1129
+ ke,
1130
+ {
1131
+ className: "p-0",
1132
+ children: [
1133
+ /* @__PURE__ */ n(
1134
+ De,
1135
+ {
1136
+ control: /* @__PURE__ */ n(
1137
+ Ce,
1138
+ {
1139
+ checked: m,
1140
+ name: l,
1141
+ onClick: () => {
1142
+ const w = {
1143
+ ...a,
1144
+ [l]: !m
1145
+ };
1146
+ k(
1147
+ (P) => P.map(
1148
+ (u) => u.id === e.id ? {
1149
+ ...u,
1150
+ featureJson: JSON.stringify(
1151
+ w
1152
+ )
1153
+ } : u
1154
+ )
1155
+ ), me({
1156
+ ...e,
1157
+ featureJson: JSON.stringify(
1158
+ w
1159
+ ),
1160
+ code: e.designationId ? "Role" : "User",
1161
+ menuConfigId: s,
1162
+ displayName: e.designationId ? e.roleName : e.fullName
1163
+ });
1164
+ }
1165
+ }
1166
+ ),
1167
+ label: /* @__PURE__ */ n(U, { variant: "body2", children: (() => {
1168
+ const w = ne(
1169
+ G,
1170
+ l
1171
+ );
1172
+ return w ? w.name : l;
1173
+ })() })
1174
+ }
1175
+ ),
1176
+ o && /* @__PURE__ */ n(
1177
+ "div",
1178
+ {
1179
+ onClick: () => {
1180
+ if ((F == null ? void 0 : F.id) === (v == null ? void 0 : v.id)) {
1181
+ H(null);
1182
+ return;
1183
+ }
1184
+ H(v);
1185
+ },
1186
+ className: "cursor-pointer text-slate-500 dark:text-slate-400 transition-transform duration-200 hover:scale-[1.2] py-1 pr-3",
1187
+ children: (F == null ? void 0 : F.id) === (v == null ? void 0 : v.id) ? /* @__PURE__ */ n(
1188
+ z,
1189
+ {
1190
+ color: "primary",
1191
+ icon: Te
1192
+ }
1193
+ ) : /* @__PURE__ */ n(
1194
+ z,
1195
+ {
1196
+ className: " text-[var(--color-primary)] ",
1197
+ color: "primary",
1198
+ icon: Ee
1199
+ }
1200
+ )
1201
+ }
1202
+ )
1203
+ ]
1204
+ },
1205
+ `featureName-${r}`
1206
+ );
1207
+ }
1208
+ )
1209
+ ] }) }) }) })
1210
+ ]
1211
+ }
1212
+ ) })) })
1213
+ ] }) });
1214
+ }
1215
+ Bt.propTypes = {
1216
+ subMenuId: i.any,
1217
+ subMenuGroupName: i.any,
1218
+ selectedTab: i.any,
1219
+ parentLoading: i.any,
1220
+ isNewApi: i.any,
1221
+ setIsNewApi: i.any,
1222
+ onNewAPIChange: i.any,
1223
+ subMenuFeatureVal: i.any
1224
+ };
1225
+ export {
1226
+ Bt as default
1227
+ };
1228
+ //# sourceMappingURL=AccessRights-BMRM1u9S-D1Gc0rKI.js.map