@argusoft/medplat-core 1.0.0

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