@argusoft/medplat-core 1.0.14 → 1.0.15

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