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