@argusoft/medplat-core 1.0.28 → 1.0.29

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