@argusoft/medplat-form-engine 1.0.13 → 1.0.14

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