@argusoft/medplat-form-engine 1.0.15 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/AccessRights-BMRM1u9S-D1Gc0rKI.js +1228 -0
  2. package/dist/AccessRights-BMRM1u9S-D1Gc0rKI.js.map +1 -0
  3. package/dist/AddEditQueryBuilder-7JRplV5J-DHgS6TYG.js +313 -0
  4. package/dist/AddEditQueryBuilder-7JRplV5J-DHgS6TYG.js.map +1 -0
  5. package/dist/AddEditQueryBuilder-7JRplV5J.css +1 -0
  6. package/dist/AddFeatures-CkTu7sOI-BGplSFp6.js +212 -0
  7. package/dist/AddFeatures-CkTu7sOI-BGplSFp6.js.map +1 -0
  8. package/dist/AddLabelModal-DE3ploGD-OOyaGC02.js +734 -0
  9. package/dist/AddLabelModal-DE3ploGD-OOyaGC02.js.map +1 -0
  10. package/dist/AddMenuConfiguration-QWfpcnuP-TAM2c68S.js +5389 -0
  11. package/dist/AddMenuConfiguration-QWfpcnuP-TAM2c68S.js.map +1 -0
  12. package/dist/AddMenuConfiguration-QWfpcnuP.css +1 -0
  13. package/dist/AddRoleDrawer-ZK1eejxI-BM6rfhh5.js +453 -0
  14. package/dist/AddRoleDrawer-ZK1eejxI-BM6rfhh5.js.map +1 -0
  15. package/dist/AppModal-BgZyfrd--BO3wW4ma.js +428 -0
  16. package/dist/AppModal-BgZyfrd--BO3wW4ma.js.map +1 -0
  17. package/dist/ChangePasswordModalCore-DIe4rzW--CSDVIGsb.js +176 -0
  18. package/dist/ChangePasswordModalCore-DIe4rzW--CSDVIGsb.js.map +1 -0
  19. package/dist/ConditionConfig-GDCXIg3C-DuEy85LD.js +395 -0
  20. package/dist/ConditionConfig-GDCXIg3C-DuEy85LD.js.map +1 -0
  21. package/dist/ConditionConfig-GDCXIg3C.css +1 -0
  22. package/dist/EntityManagement-D-x6Qzal-BE01iKNR.js +50 -0
  23. package/dist/EntityManagement-D-x6Qzal-BE01iKNR.js.map +1 -0
  24. package/dist/EventConfigurations-jGCJ4LqP-CJBCGp6J.js +384 -0
  25. package/dist/EventConfigurations-jGCJ4LqP-CJBCGp6J.js.map +1 -0
  26. package/dist/EventConfigurations-jGCJ4LqP.css +1 -0
  27. package/dist/EventsExceptionModal-BF6E1Np7-DHT7pQsx.js +200 -0
  28. package/dist/EventsExceptionModal-BF6E1Np7-DHT7pQsx.js.map +1 -0
  29. package/dist/EventsSkeleton-BN7_0IGs-BAnd1Vug.js +74 -0
  30. package/dist/EventsSkeleton-BN7_0IGs-BAnd1Vug.js.map +1 -0
  31. package/dist/FeatureMenu-Ds6lFg4w-ShGx4okQ.js +249 -0
  32. package/dist/FeatureMenu-Ds6lFg4w-ShGx4okQ.js.map +1 -0
  33. package/dist/Features-Cshdl06N-CZ02Tt89.js +12 -0
  34. package/dist/Features-Cshdl06N-CZ02Tt89.js.map +1 -0
  35. package/dist/FileSaver.min-CN9EpL2h-N-3OFAd7.js +77 -0
  36. package/dist/FileSaver.min-CN9EpL2h-N-3OFAd7.js.map +1 -0
  37. package/dist/FlywayQuery-Cx2sly6g-DdhUw6bN.js +169 -0
  38. package/dist/FlywayQuery-Cx2sly6g-DdhUw6bN.js.map +1 -0
  39. package/dist/ImmunizationConfigurationBase-DZ8EqXlF-B2XcYTYJ.js +5162 -0
  40. package/dist/ImmunizationConfigurationBase-DZ8EqXlF-B2XcYTYJ.js.map +1 -0
  41. package/dist/ImmunizationConfigurationBase-DZ8EqXlF.css +1 -0
  42. package/dist/ImmunizationConfigurationsList-CQnxWa09-Bbr0iyGy.js +335 -0
  43. package/dist/ImmunizationConfigurationsList-CQnxWa09-Bbr0iyGy.js.map +1 -0
  44. package/dist/ImmunizationSkeleton-D2tdv5k--B7SY-gnr.js +186 -0
  45. package/dist/ImmunizationSkeleton-D2tdv5k--B7SY-gnr.js.map +1 -0
  46. package/dist/LanguagesModal-rk6IGQwY-B0Jtpivu.js +394 -0
  47. package/dist/LanguagesModal-rk6IGQwY-B0Jtpivu.js.map +1 -0
  48. package/dist/ManageDynamicFeature-C2I7Ho7i-Bbxkpw0S.js +4189 -0
  49. package/dist/ManageDynamicFeature-C2I7Ho7i-Bbxkpw0S.js.map +1 -0
  50. package/dist/ManageEventConfiguration-BJxS2Su0-CRATBMym.js +1017 -0
  51. package/dist/ManageEventConfiguration-BJxS2Su0-CRATBMym.js.map +1 -0
  52. package/dist/ManageEventConfiguration-BJxS2Su0.css +1 -0
  53. package/dist/ManageNotification-DMN2szWy-DQvdrfwC.js +6819 -0
  54. package/dist/ManageNotification-DMN2szWy-DQvdrfwC.js.map +1 -0
  55. package/dist/ManageRole-CuXmWQyp-Cy15Mlax.js +728 -0
  56. package/dist/ManageRole-CuXmWQyp-Cy15Mlax.js.map +1 -0
  57. package/dist/ManageTranslation-BTxvSYKb-CdO4Fk7f.js +616 -0
  58. package/dist/ManageTranslation-BTxvSYKb-CdO4Fk7f.js.map +1 -0
  59. package/dist/ManageTranslation-BTxvSYKb.css +1 -0
  60. package/dist/ManageUser-Dr3ptCYp-CJBp0yVr.js +2179 -0
  61. package/dist/ManageUser-Dr3ptCYp-CJBp0yVr.js.map +1 -0
  62. package/dist/ManageUser-Dr3ptCYp.css +1 -0
  63. package/dist/MedplatFormWrapper-SwW0rdxN.js +52363 -0
  64. package/dist/MedplatFormWrapper-SwW0rdxN.js.map +1 -0
  65. package/dist/MedplatFormWrapper.css +1 -0
  66. package/dist/MobileMenuManagement-BmrO-7MN-xFkU87j6.js +111 -0
  67. package/dist/MobileMenuManagement-BmrO-7MN-xFkU87j6.js.map +1 -0
  68. package/dist/MobileTypeEventConfigModal-ChhO_A4f-DfJDqFB9.js +783 -0
  69. package/dist/MobileTypeEventConfigModal-ChhO_A4f-DfJDqFB9.js.map +1 -0
  70. package/dist/NewServerManagement-5YcAtF-g-DHV6PFTR.js +1002 -0
  71. package/dist/NewServerManagement-5YcAtF-g-DHV6PFTR.js.map +1 -0
  72. package/dist/NotificationFlywayQuery-BY8Zzml_-C7G-28dx.js +244 -0
  73. package/dist/NotificationFlywayQuery-BY8Zzml_-C7G-28dx.js.map +1 -0
  74. package/dist/NotificationList-BqibwMaM-D4mMbj4h.js +400 -0
  75. package/dist/NotificationList-BqibwMaM-D4mMbj4h.js.map +1 -0
  76. package/dist/OtherTypeEventConfigModal-ZnCGWm9v-D7x0QObl.js +1953 -0
  77. package/dist/OtherTypeEventConfigModal-ZnCGWm9v-D7x0QObl.js.map +1 -0
  78. package/dist/QueryBuilder-BPfavHH9-M3wgeHB3.js +378 -0
  79. package/dist/QueryBuilder-BPfavHH9-M3wgeHB3.js.map +1 -0
  80. package/dist/QueryBuilder-BPfavHH9.css +1 -0
  81. package/dist/QueryManagement-DXA73N2j-De9XnBKC.js +671 -0
  82. package/dist/QueryManagement-DXA73N2j-De9XnBKC.js.map +1 -0
  83. package/dist/QueryManagement-DXA73N2j.css +1 -0
  84. package/dist/RoleManagement-C0feJCuq-DIGwGqOD.js +410 -0
  85. package/dist/RoleManagement-C0feJCuq-DIGwGqOD.js.map +1 -0
  86. package/dist/SecurityAuditLogList-DHTcOtbx-BSjPID73.js +746 -0
  87. package/dist/SecurityAuditLogList-DHTcOtbx-BSjPID73.js.map +1 -0
  88. package/dist/ServerSyncModal-D_oFpv3C-C6c3_3lx.js +836 -0
  89. package/dist/ServerSyncModal-D_oFpv3C-C6c3_3lx.js.map +1 -0
  90. package/dist/ShowFlywayQuery-BkyA6QaA-2t9pZjcx.js +130 -0
  91. package/dist/ShowFlywayQuery-BkyA6QaA-2t9pZjcx.js.map +1 -0
  92. package/dist/ShowFlywayQuery-DVRCd384-BypXcNWX.js +259 -0
  93. package/dist/ShowFlywayQuery-DVRCd384-BypXcNWX.js.map +1 -0
  94. package/dist/ShowQueryHistory-BDN0tzHg-17BxK88Z.js +190 -0
  95. package/dist/ShowQueryHistory-BDN0tzHg-17BxK88Z.js.map +1 -0
  96. package/dist/SubMenu-DAfZC9Xi-B0BQYLdI.js +188 -0
  97. package/dist/SubMenu-DAfZC9Xi-B0BQYLdI.js.map +1 -0
  98. package/dist/TableDetails-DzREeJkm-B-WEBbQz.js +1508 -0
  99. package/dist/TableDetails-DzREeJkm-B-WEBbQz.js.map +1 -0
  100. package/dist/TableList-B9hr05Hs-BIsMbnIV.js +428 -0
  101. package/dist/TableList-B9hr05Hs-BIsMbnIV.js.map +1 -0
  102. package/dist/TypeConfiguration-C-lk8Szs-DkvHWHhr.js +117 -0
  103. package/dist/TypeConfiguration-C-lk8Szs-DkvHWHhr.js.map +1 -0
  104. package/dist/UserList-S5Q76wO7-Cj5u_K4_.js +1104 -0
  105. package/dist/UserList-S5Q76wO7-Cj5u_K4_.js.map +1 -0
  106. package/dist/UserList-S5Q76wO7.css +1 -0
  107. package/dist/UserListSkeleton-cglK2SaU-B_Tj5gUp.js +184 -0
  108. package/dist/UserListSkeleton-cglK2SaU-B_Tj5gUp.js.map +1 -0
  109. package/dist/WidgetList-BSApErov-Z61Kpq4T.js +188 -0
  110. package/dist/WidgetList-BSApErov-Z61Kpq4T.js.map +1 -0
  111. package/dist/_commonjsHelpers-B4e78b8K-B9tZyK9c.js +29 -0
  112. package/dist/_commonjsHelpers-B4e78b8K-B9tZyK9c.js.map +1 -0
  113. package/dist/dayjs.min-BiUMMz0V.js +285 -0
  114. package/dist/dayjs.min-BiUMMz0V.js.map +1 -0
  115. package/dist/default-B6sHblIG.js +11341 -0
  116. package/dist/default-B6sHblIG.js.map +1 -0
  117. package/dist/default.css +1 -0
  118. package/dist/i18next-CTOWN_jH-BKKbdDel.js +1389 -0
  119. package/dist/i18next-CTOWN_jH-BKKbdDel.js.map +1 -0
  120. package/dist/index-B4r0wjBD.js +563 -0
  121. package/dist/index-B4r0wjBD.js.map +1 -0
  122. package/dist/index-BFznsakV-BsOSEQZI.js +42638 -0
  123. package/dist/index-BFznsakV-BsOSEQZI.js.map +1 -0
  124. package/dist/index-DNrIMQFT.js +567 -0
  125. package/dist/index-DNrIMQFT.js.map +1 -0
  126. package/dist/index.css +1 -1
  127. package/dist/index.js +3 -52390
  128. package/dist/index.js.map +1 -1
  129. package/dist/manageImmunization-B4swS745-JldexHrO.js +1204 -0
  130. package/dist/manageImmunization-B4swS745-JldexHrO.js.map +1 -0
  131. package/dist/manageImmunization-B4swS745.css +1 -0
  132. package/dist/xlsx.min-D1LFqt_b-BGwkpd8r.js +11869 -0
  133. package/dist/xlsx.min-D1LFqt_b-BGwkpd8r.js.map +1 -0
  134. package/package.json +1 -4
@@ -0,0 +1,728 @@
1
+ import { jsx as a, jsxs as t, Fragment as D } from "react/jsx-runtime";
2
+ import { useRef as G, useState as V, useEffect as se } from "react";
3
+ import { Modal as de, Box as P, IconButton as ce, FormControl as b, FormGroup as me, Button as K } from "@mui/material";
4
+ import ue from "@/hooks/useTrackEvent";
5
+ import { g as pe, a as he } from "./RoleManagement-C0feJCuq-DIGwGqOD.js";
6
+ import { getRoleList as ge, getLocationTypes as ye, execute as F } from "@/common/services/GlobalApis";
7
+ import { showToast as H } from "@/common/toaster/toaster";
8
+ import { useForm as fe } from "react-hook-form";
9
+ import { yupResolver as ve } from "@hookform/resolvers/yup";
10
+ import "@/assets/scss/scrollBar.scss";
11
+ import { FormItem as d } from "@/views/custom-components/FormItem.jsx";
12
+ import * as N from "yup";
13
+ import O from "@/views/custom-components/CustomTextField";
14
+ import be from "@/views/custom-components/CustomDropdown";
15
+ import j from "@/views/custom-components/CustomCheckBox";
16
+ import T from "@/views/custom-components/CustomAutoComplete";
17
+ import { useTranslateProvider as Ne } from "@/common/languageTranslator/TranslationContext";
18
+ import { FontAwesomeIcon as Ie } from "@fortawesome/react-fontawesome";
19
+ import { faXmark as Te } from "@fortawesome/free-solid-svg-icons";
20
+ import g from "@/common/services/util/GeneralUtil";
21
+ import y from "prop-types";
22
+ import Y from "@/views/custom-components/CustomToggleSwitch";
23
+ import { useSelector as xe } from "react-redux";
24
+ import { getUseSkeleton as we } from "@/store/reducers/SkeletonReducer";
25
+ const J = ({ children: x, isLoading: f }) => !xe(we) || !f ? x : /* @__PURE__ */ t("div", { className: "pt-6 h-[88vh]", children: [
26
+ /* @__PURE__ */ t("div", { className: "px-8 pt-2 pb-4 flex items-center justify-between", children: [
27
+ /* @__PURE__ */ a("div", { className: "bg-gray-300 animate-pulse rounded-md w-32 h-8" }),
28
+ /* @__PURE__ */ a("div", { className: "bg-gray-300 animate-pulse rounded-full w-10 h-10" })
29
+ ] }),
30
+ /* @__PURE__ */ t("div", { className: "px-8 pb-8 space-y-6 overflow-y-auto max-h-[80vh]", children: [
31
+ /* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: [1, 2, 3].map((c) => /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
32
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 mb-2 animate-pulse" }),
33
+ /* @__PURE__ */ a("div", { className: "h-10 bg-gray-300 rounded animate-pulse w-full" })
34
+ ] }, c)) }),
35
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-6 w-full", children: /* @__PURE__ */ t("div", { className: "w-full", children: [
36
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/4 mb-2 animate-pulse" }),
37
+ /* @__PURE__ */ a("div", { className: "h-8 bg-gray-300 rounded-full w-16 animate-pulse" })
38
+ ] }) }),
39
+ /* @__PURE__ */ t("div", { className: "space-y-4", children: [
40
+ [1, 2].map((c) => /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
41
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/4 mb-2 animate-pulse" }),
42
+ /* @__PURE__ */ a("div", { className: "h-10 bg-gray-300 rounded animate-pulse w-full" })
43
+ ] }, c)),
44
+ /* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [1, 2].map((c) => /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
45
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 mb-2 animate-pulse" }),
46
+ /* @__PURE__ */ a("div", { className: "h-10 bg-gray-300 rounded animate-pulse w-full" })
47
+ ] }, c)) }),
48
+ [1, 2].map((c) => /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
49
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 mb-2 animate-pulse" }),
50
+ /* @__PURE__ */ a("div", { className: "h-10 bg-gray-300 rounded animate-pulse w-full" })
51
+ ] }, c))
52
+ ] }),
53
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-6", children: [
54
+ /* @__PURE__ */ t("div", { className: "w-[60%]", children: [
55
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 mb-2 animate-pulse" }),
56
+ /* @__PURE__ */ a("div", { className: "h-8 bg-gray-300 rounded-full w-16 animate-pulse" })
57
+ ] }),
58
+ /* @__PURE__ */ t("div", { className: "w-[40%] flex items-center gap-2", children: [
59
+ /* @__PURE__ */ a("div", { className: "h-5 w-5 bg-gray-300 rounded animate-pulse" }),
60
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 animate-pulse" })
61
+ ] })
62
+ ] }),
63
+ /* @__PURE__ */ t("div", { className: "space-y-2", children: [
64
+ /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/4 mb-2 animate-pulse" }),
65
+ /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-4", children: [1, 2, 3, 4].map((c) => /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
66
+ /* @__PURE__ */ a("div", { className: "h-5 w-5 bg-gray-300 rounded animate-pulse" }),
67
+ /* @__PURE__ */ a("div", { className: "h-4 w-16 bg-gray-300 rounded animate-pulse" })
68
+ ] }, c)) })
69
+ ] })
70
+ ] }),
71
+ /* @__PURE__ */ t("div", { className: "flex items-center justify-end gap-3 pt-6 px-8 pb-4 border-t border-slate-100", children: [
72
+ /* @__PURE__ */ a("div", { className: "h-9 w-20 bg-gray-300 rounded animate-pulse" }),
73
+ /* @__PURE__ */ a("div", { className: "h-9 w-24 bg-gray-300 rounded animate-pulse" })
74
+ ] })
75
+ ] });
76
+ J.propTypes = {
77
+ children: y.any,
78
+ isLoading: y.any
79
+ };
80
+ const Me = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Re = ({
81
+ selectedId: x,
82
+ isUpdate: f,
83
+ open: c,
84
+ setOpen: Q,
85
+ isRoleListModified: X
86
+ }) => {
87
+ const E = G(null), W = G(!1), q = ue(), [m, U] = V({}), [Z, k] = V(!1), ee = N.object().shape({
88
+ name: N.string().required("Enter Role Name"),
89
+ locationTypes: N.array().when("isLocationRequired", {
90
+ is: !0,
91
+ then: (e) => e.min(1, "Select Location Type").required("Select Location Type"),
92
+ otherwise: (e) => e.notRequired()
93
+ }),
94
+ roleType: N.string().required("Select Role Type"),
95
+ isBankDetailsRequired: g.isTecho ? N.boolean().notRequired() : N.boolean().nullable().defined("Please Select a Value"),
96
+ healthInfrastructureIds: N.array().when("isHealthInfraMandatory", {
97
+ is: !0,
98
+ then: (e) => e.min(1, "Select Health Infrastructure Type").required("Select Health Infrastructure Type"),
99
+ otherwise: (e) => e.notRequired()
100
+ })
101
+ }), {
102
+ control: i,
103
+ handleSubmit: ae,
104
+ formState: { errors: u, isSubmitting: le },
105
+ setValue: p,
106
+ // getValues,
107
+ watch: L,
108
+ reset: te
109
+ } = fe({
110
+ defaultValues: {
111
+ name: "",
112
+ locationTypes: [],
113
+ maxPosition: "",
114
+ maxHealthInfra: "",
115
+ roleType: "",
116
+ isLastNameMandatory: !1,
117
+ isAadharNumMandatory: !1,
118
+ isEmailMandatory: !1,
119
+ isContactNumMandatory: !1,
120
+ isConvoxIdMandatory: !1,
121
+ isHealthInfraMandatory: !1,
122
+ isGeolocationMandatory: !1,
123
+ roleIds: [],
124
+ canManageRoleIds: [],
125
+ manageByTeamTypeIds: [],
126
+ canSelfManage: !1,
127
+ healthInfrastructureIds: [],
128
+ categoryIds: [],
129
+ isBankDetailsRequired: !1,
130
+ isBankDetailsMandatory: !1,
131
+ id: "",
132
+ code: "",
133
+ description: "",
134
+ createdBy: "",
135
+ state: "",
136
+ createdOn: "",
137
+ assignedFeatureList: "",
138
+ assignedFeatures: "",
139
+ isSmagTrainedMandatory: "",
140
+ isLocationRequired: !0,
141
+ isNodalMandatory: !1
142
+ },
143
+ resolver: ve(ee),
144
+ mode: "onChange",
145
+ shouldUnregister: !1
146
+ }), re = L("isBankDetailsRequired"), $ = L("locationTypes"), { translate: _ } = Ne(), oe = L("isLocationRequired"), ie = L("isHealthInfraMandatory"), z = [
147
+ { label: "Email", value: "isEmailMandatory" },
148
+ ...(m == null ? void 0 : m.env) !== "chip" ? [{ label: "Aadhar Number", value: "isAadharNumMandatory" }] : [],
149
+ { label: "Contact Number", value: "isContactNumMandatory" },
150
+ ...(m == null ? void 0 : m.env) !== "chip" ? [{ label: "Convox Id", value: "isConvoxIdMandatory" }] : [],
151
+ { label: "Last Name", value: "isLastNameMandatory" },
152
+ { label: "Health Infrastructure", value: "isHealthInfraMandatory" },
153
+ { label: "GeoLocation", value: "isGeolocationMandatory" },
154
+ ...(m == null ? void 0 : m.env) !== "chip" ? [{ label: "Smag Trained", value: "isSmagTrainedMandatory" }] : [],
155
+ { label: "Nodal", value: "isNodalMandatory" }
156
+ ].filter((e) => g.isTecho ? ![
157
+ "isGeolocationMandatory",
158
+ "isHealthInfraMandatory",
159
+ "isLastNameMandatory",
160
+ "isSmagTrainedMandatory"
161
+ ].includes(e.value) : g.isSewaRural || g.isPhmp || g.isImomcare ? e.value !== "isNodalMandatory" : g.isEkavach ? ![
162
+ "isGeolocationMandatory",
163
+ "isHealthInfraMandatory",
164
+ "isLastNameMandatory",
165
+ "isNodalMandatory",
166
+ "isSmagTrainedMandatory"
167
+ ].includes(e.value) : !0), B = () => {
168
+ Q(0), te(), q("conversion_event", {
169
+ form: E.current,
170
+ form_name: "Manage Role",
171
+ submit: W.current
172
+ }), q("button_click", {
173
+ button_name: "add role close button",
174
+ button_type: "cancel",
175
+ button_id: "managerole-close-button"
176
+ });
177
+ }, I = (e, l, v) => {
178
+ p(v, l);
179
+ }, ne = async (e) => {
180
+ var l, v;
181
+ try {
182
+ q("button_click", {
183
+ button_name: f ? "update role button" : "add role button",
184
+ button_type: "submit",
185
+ button_id: "managerole-add-button"
186
+ }), delete e.bankDetailsRequired, delete e.bankDetailsMandatory, f || (delete e.id, delete e.state, delete e.createdOn, delete e.createdBy, delete e.code, delete e.description, delete e.assignedFeatures, delete e.assignedFeatureList), e.roleIds = e.roleIds.map((r) => r == null ? void 0 : r.id), e.canManageRoleIds = e.canManageRoleIds.map(
187
+ (r) => r == null ? void 0 : r.id
188
+ ), e.manageByTeamTypeIds = e.manageByTeamTypeIds.map(
189
+ (r) => r == null ? void 0 : r.id
190
+ ), e.healthInfrastructureIds = e.healthInfrastructureIds.map(
191
+ (r) => r == null ? void 0 : r.id
192
+ ), e.categoryIds = e.categoryIds.map((r) => r == null ? void 0 : r.id), e.locationTypes = e.isLocationRequired === !0 ? e.locationTypes : [], delete e.isLocationRequired, e.manageByRoleIds = e.roleIds, await he(e), H({
193
+ type: "success",
194
+ message: `Role ${f ? "Updated" : "Added"} Successfully`
195
+ }), W.current = !0, B(), X();
196
+ } catch (r) {
197
+ H({
198
+ type: "error",
199
+ message: `Role Cannot be added: ${(v = (l = r == null ? void 0 : r.response) == null ? void 0 : l.data) == null ? void 0 : v.message}`
200
+ });
201
+ }
202
+ };
203
+ return se(() => {
204
+ (async () => {
205
+ try {
206
+ k((l) => !l);
207
+ const e = g.getEnv();
208
+ if (c !== 0) {
209
+ const [l, v, r, S, C] = await Promise.all([
210
+ ge(),
211
+ ye(),
212
+ F({
213
+ code: "team_all_types_for_roles",
214
+ parameters: {}
215
+ }),
216
+ F({
217
+ code: "retrieve_field_values_for_form_field",
218
+ parameters: {
219
+ form: "WEB",
220
+ fieldKey: "role_catg"
221
+ }
222
+ }),
223
+ F({
224
+ code: "retrieve_field_values_for_form_field",
225
+ parameters: {
226
+ form: "WEB",
227
+ fieldKey: "infra_type"
228
+ }
229
+ })
230
+ ]);
231
+ if (U((h) => {
232
+ var w, M, R;
233
+ return {
234
+ ...h,
235
+ roles: l.data,
236
+ locationData: v.data,
237
+ manageTeam: (w = r == null ? void 0 : r.data) == null ? void 0 : w.result,
238
+ category: (M = S == null ? void 0 : S.data) == null ? void 0 : M.result,
239
+ healthInfraType: (R = C == null ? void 0 : C.data) == null ? void 0 : R.result
240
+ };
241
+ }), x) {
242
+ const { data: h } = await pe(x);
243
+ U((o) => ({ ...o, roleData: h, env: e })), Object.keys(h).map((o) => p(o, h[o])), p("isBankDetailsRequired", h.isBankDetailsRequired), p("isBankDetailsMandatory", h.isBankDetailsMandatory);
244
+ const {
245
+ manageByTeamTypeIds: w,
246
+ healthInfrastructureIds: M,
247
+ roleIds: R,
248
+ categoryIds: A
249
+ } = h;
250
+ p(
251
+ "manageByTeamTypeIds",
252
+ w ? w.map(
253
+ (o) => {
254
+ var n;
255
+ return (n = r.data.result) == null ? void 0 : n.find((s) => (s == null ? void 0 : s.id) === o);
256
+ }
257
+ ) : []
258
+ ), p(
259
+ "healthInfrastructureIds",
260
+ M ? M.map(
261
+ (o) => {
262
+ var n;
263
+ return (n = C.data.result) == null ? void 0 : n.find(
264
+ (s) => (s == null ? void 0 : s.id) === o
265
+ );
266
+ }
267
+ ).filter((o) => o !== void 0) : []
268
+ ), p(
269
+ "categoryIds",
270
+ A ? A.map(
271
+ (o) => {
272
+ var n;
273
+ return (n = S.data.result) == null ? void 0 : n.find((s) => (s == null ? void 0 : s.id) === o);
274
+ }
275
+ ) : []
276
+ ), p(
277
+ "roleIds",
278
+ R ? R.map((o) => {
279
+ var n;
280
+ return (n = l.data) == null ? void 0 : n.find((s) => (s == null ? void 0 : s.id) === o);
281
+ }).filter((o) => o !== void 0) : []
282
+ ), p(
283
+ "canManageRoleIds",
284
+ h.canManageRoleIds ? h.canManageRoleIds.map((o) => {
285
+ var n;
286
+ return (n = l.data) == null ? void 0 : n.find((s) => (s == null ? void 0 : s.id) === o);
287
+ }).filter((o) => o !== void 0) : []
288
+ ), h.locationTypes.length > 0 ? p("isLocationRequired", !0) : p("isLocationRequired", !1);
289
+ }
290
+ }
291
+ k((l) => !l);
292
+ } catch (e) {
293
+ H({
294
+ message: `Error in manage role :${e == null ? void 0 : e.message}`,
295
+ type: "error"
296
+ }), k((l) => !l);
297
+ }
298
+ })();
299
+ }, [x, c]), /* @__PURE__ */ a(
300
+ de,
301
+ {
302
+ open: c !== 0,
303
+ onClose: B,
304
+ "data-testid": "managerole-modal",
305
+ children: /* @__PURE__ */ a("div", { className: "mt-10 fixed inset-0 z-[100] flex items-center justify-center p-4 animate-in fade-in duration-200", children: /* @__PURE__ */ a(
306
+ P,
307
+ {
308
+ className: "w-full max-w-2xl rounded-[2.5rem] shadow-2xl shadow-blue-900/10 overflow-hidden flex flex-col animate-in zoom-in-95 duration-300",
309
+ sx: { bgcolor: (e) => e.palette.custom.customBackground },
310
+ children: /* @__PURE__ */ t(J, { isLoading: Z, children: [
311
+ /* @__PURE__ */ t("div", { className: "px-8 pt-8 pb-4 flex items-center justify-between", children: [
312
+ /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
313
+ P,
314
+ {
315
+ component: "h2",
316
+ className: "text-2xl font-bold text-customBlue",
317
+ sx: { color: "text.primary" },
318
+ children: f ? "Update Role" : "Add New Role"
319
+ }
320
+ ) }),
321
+ /* @__PURE__ */ a(
322
+ ce,
323
+ {
324
+ size: "small",
325
+ onClick: B,
326
+ className: "w-10 h-10 rounded-full bg-slate-100 flex items-center justify-center text-slate-400 hover:bg-slate-200 hover:text-slate-600 transition-all",
327
+ "data-testid": "managerole-close-icon",
328
+ children: /* @__PURE__ */ a(Ie, { icon: Te, size: "lg" })
329
+ }
330
+ )
331
+ ] }),
332
+ /* @__PURE__ */ t(
333
+ "form",
334
+ {
335
+ onSubmit: ae(ne),
336
+ ref: E,
337
+ className: "px-8 pb-8 space-y-6 overflow-y-auto max-h-[80vh]",
338
+ children: [
339
+ /* @__PURE__ */ t("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: [
340
+ /* @__PURE__ */ a(b, { variant: "outlined", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(d, { label: "Role Name", children: /* @__PURE__ */ a(
341
+ O,
342
+ {
343
+ placeholder: "Role Name",
344
+ name: "name",
345
+ id: "name",
346
+ errors: u,
347
+ control: i,
348
+ dataTestId: "managerole-role-name-field"
349
+ }
350
+ ) }) }) }),
351
+ /* @__PURE__ */ a(b, { variant: "outlined", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
352
+ d,
353
+ {
354
+ label: "Max Position",
355
+ tooltip: "This is the maximum no of users that can be created at one location of this role type",
356
+ children: /* @__PURE__ */ a(
357
+ O,
358
+ {
359
+ name: "maxPosition",
360
+ id: "maxPosition",
361
+ errors: u,
362
+ control: i,
363
+ rules: {
364
+ maxLength: 3,
365
+ pattern: /^\d{1,3}$/
366
+ },
367
+ inputProps: {
368
+ maxLength: 3,
369
+ inputMode: "numeric",
370
+ pattern: "[0-9]*",
371
+ onInput: (e) => {
372
+ e.target.value = e.target.value.replace(/\D/g, "");
373
+ }
374
+ },
375
+ dataTestId: "managerole-max-position-field"
376
+ }
377
+ )
378
+ }
379
+ ) }) }),
380
+ !g.isTecho && /* @__PURE__ */ a(b, { variant: "outlined", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(d, { label: "Max Health Infrastructure", children: /* @__PURE__ */ a(
381
+ O,
382
+ {
383
+ name: "maxHealthInfra",
384
+ id: "maxHealthInfra",
385
+ control: i,
386
+ errors: u,
387
+ rules: {
388
+ maxLength: 3,
389
+ pattern: /^\d{1,3}$/
390
+ },
391
+ inputProps: {
392
+ maxLength: 3,
393
+ inputMode: "numeric",
394
+ pattern: "[0-9]*",
395
+ onInput: (e) => {
396
+ e.target.value = e.target.value.replace(
397
+ /\D/g,
398
+ ""
399
+ );
400
+ }
401
+ },
402
+ dataTestId: "managerole-max-health-infra-field"
403
+ }
404
+ ) }) }) })
405
+ ] }),
406
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-6 w-full", children: /* @__PURE__ */ a(
407
+ b,
408
+ {
409
+ variant: "outlined",
410
+ className: "flex flex-row items-center w-full ",
411
+ children: /* @__PURE__ */ a(
412
+ d,
413
+ {
414
+ label: "Location Required",
415
+ required: !0,
416
+ direction: "row",
417
+ children: /* @__PURE__ */ a(
418
+ Y,
419
+ {
420
+ control: i,
421
+ name: "isLocationRequired",
422
+ options: [
423
+ { label: "Yes", value: !0 },
424
+ { label: "No", value: !1 }
425
+ ],
426
+ errors: u
427
+ }
428
+ )
429
+ }
430
+ )
431
+ }
432
+ ) }),
433
+ /* @__PURE__ */ t("div", { className: "space-y-4", children: [
434
+ (oe === !0 || le) && /* @__PURE__ */ a(D, { children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
435
+ d,
436
+ {
437
+ label: "Location",
438
+ required: !0,
439
+ tooltip: "The OU level where users of this role perform their job function",
440
+ children: /* @__PURE__ */ a(
441
+ T,
442
+ {
443
+ id: "locationTypes",
444
+ control: i,
445
+ name: "locationTypes",
446
+ options: m.locationData,
447
+ value: $ == null ? void 0 : $.map(
448
+ (e) => {
449
+ var l;
450
+ return (l = m.locationData) == null ? void 0 : l.find(
451
+ (v) => v.type === (e == null ? void 0 : e.type)
452
+ );
453
+ }
454
+ ),
455
+ errors: u,
456
+ getOptionLabel: (e) => e == null ? void 0 : e.name,
457
+ dataTestId: "managerole-location-type-select",
458
+ checkEquality: "type",
459
+ onChange: (e, l) => I(e, l, "locationTypes")
460
+ }
461
+ )
462
+ }
463
+ ) }) }),
464
+ /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
465
+ d,
466
+ {
467
+ label: "Can Manage Role",
468
+ tooltip: "Please select the roles that shall be managed by this role",
469
+ children: /* @__PURE__ */ a(
470
+ T,
471
+ {
472
+ name: "roleIds",
473
+ id: "roleIds",
474
+ errors: u,
475
+ control: i,
476
+ dataTestId: "managerole-manage-role-select",
477
+ options: m.roles,
478
+ onChange: (e, l) => I(e, l, "roleIds"),
479
+ getOptionLabel: (e) => e == null ? void 0 : e.name
480
+ }
481
+ )
482
+ }
483
+ ) }),
484
+ /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
485
+ d,
486
+ {
487
+ label: "Managed From",
488
+ tooltip: "Please select the roles that can manage this role",
489
+ children: /* @__PURE__ */ a(
490
+ T,
491
+ {
492
+ name: "canManageRoleIds",
493
+ id: "canManageRoleIds",
494
+ errors: u,
495
+ control: i,
496
+ dataTestId: "managerole-managed-by-role-select",
497
+ options: m.roles,
498
+ onChange: (e, l) => I(e, l, "canManageRoleIds"),
499
+ getOptionLabel: (e) => e == null ? void 0 : e.name
500
+ }
501
+ )
502
+ }
503
+ ) }),
504
+ /* @__PURE__ */ t("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
505
+ /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
506
+ d,
507
+ {
508
+ label: "Role Type",
509
+ tooltip: "Please select Role Type",
510
+ required: !0,
511
+ children: /* @__PURE__ */ a(
512
+ be,
513
+ {
514
+ control: i,
515
+ id: "roleType",
516
+ name: "roleType",
517
+ options: Me,
518
+ displayName: "name",
519
+ optionValue: "name",
520
+ errors: u,
521
+ dataTestId: "managerole-role-type-dropdown"
522
+ }
523
+ )
524
+ }
525
+ ) }),
526
+ /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
527
+ d,
528
+ {
529
+ label: "Can Manage Team",
530
+ tooltip: "Please select the teams that shall be managed by this role",
531
+ children: /* @__PURE__ */ a(
532
+ T,
533
+ {
534
+ control: i,
535
+ name: "manageByTeamTypeIds",
536
+ id: "manageByTeamTypeIds",
537
+ errors: u,
538
+ options: m.manageTeam,
539
+ dataTestId: "managerole-manage-team-select",
540
+ onChange: (e, l) => I(e, l, "manageByTeamTypeIds"),
541
+ getOptionLabel: (e) => e == null ? void 0 : e.type
542
+ }
543
+ )
544
+ }
545
+ ) })
546
+ ] }),
547
+ /* @__PURE__ */ a("div", { className: "space-y-4", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
548
+ d,
549
+ {
550
+ label: "Select Health Infrastructure type",
551
+ tooltip: "Please select the institute to be associated with the role",
552
+ required: ie,
553
+ children: /* @__PURE__ */ a(
554
+ T,
555
+ {
556
+ options: m.healthInfraType,
557
+ errors: u,
558
+ name: "healthInfrastructureIds",
559
+ id: "healthInfrastructureIds",
560
+ dataTestId: "managerole-health-infrastructure-select",
561
+ control: i,
562
+ onChange: (e, l) => I(e, l, "healthInfrastructureIds"),
563
+ getOptionLabel: (e) => e == null ? void 0 : e.value
564
+ }
565
+ )
566
+ }
567
+ ) }) }),
568
+ !g.isBahaar && /* @__PURE__ */ a(D, { children: /* @__PURE__ */ a("div", { className: "space-y-4", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
569
+ d,
570
+ {
571
+ label: "Category",
572
+ tooltip: "Please select the category to be associated with the role",
573
+ children: /* @__PURE__ */ a(
574
+ T,
575
+ {
576
+ id: "categoryIds",
577
+ name: "categoryIds",
578
+ errors: u,
579
+ options: m.category,
580
+ dataTestId: "managerole-role-category-select",
581
+ control: i,
582
+ onChange: (e, l) => I(e, l, "categoryIds"),
583
+ getOptionLabel: (e) => e == null ? void 0 : e.value
584
+ }
585
+ )
586
+ }
587
+ ) }) }) })
588
+ ] }),
589
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-6", children: [
590
+ /* @__PURE__ */ a(
591
+ b,
592
+ {
593
+ variant: "outlined",
594
+ className: "flex flex-row items-center w-[60%] ",
595
+ children: /* @__PURE__ */ a(
596
+ d,
597
+ {
598
+ label: "Bank Details Required",
599
+ tooltip: "Select if bank details are required for this role",
600
+ required: !0,
601
+ labelWidth: "50%",
602
+ childrenWidth: "50%",
603
+ direction: "row",
604
+ children: /* @__PURE__ */ a(
605
+ Y,
606
+ {
607
+ control: i,
608
+ name: "isBankDetailsRequired",
609
+ options: [
610
+ { label: "Yes", value: !0 },
611
+ { label: "No", value: !1 }
612
+ ],
613
+ errors: u
614
+ }
615
+ )
616
+ }
617
+ )
618
+ }
619
+ ),
620
+ !f && /* @__PURE__ */ a(D, { children: /* @__PURE__ */ a(b, { variant: "outlined ", className: "w-[40%]", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ a(
621
+ d,
622
+ {
623
+ label: "Self Manage",
624
+ labelWidth: "60%",
625
+ childrenWidth: "40%",
626
+ direction: "row",
627
+ children: /* @__PURE__ */ a(
628
+ j,
629
+ {
630
+ name: "canSelfManage",
631
+ control: i,
632
+ isFullWidth: !1,
633
+ "data-testid": "managerole-self-manage-checkbox"
634
+ }
635
+ )
636
+ }
637
+ ) }) }) })
638
+ ] }),
639
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-6", children: /* @__PURE__ */ a(
640
+ b,
641
+ {
642
+ variant: "outlined",
643
+ className: "flex flex-col items-start justify-between",
644
+ children: /* @__PURE__ */ a(
645
+ d,
646
+ {
647
+ label: "Mandatory Fields",
648
+ tooltip: "These fields are Mandatory when creating users of this role type",
649
+ children: /* @__PURE__ */ t(me, { row: !0, children: [
650
+ z == null ? void 0 : z.map((e) => /* @__PURE__ */ a(
651
+ j,
652
+ {
653
+ control: i,
654
+ name: e.value,
655
+ label: e.label,
656
+ isFullWidth: !1,
657
+ "data-testid": `managerole-mandatory-field-${e.value}`
658
+ },
659
+ e.value
660
+ )),
661
+ re === !0 && /* @__PURE__ */ a(
662
+ j,
663
+ {
664
+ name: "isBankDetailsMandatory",
665
+ control: i,
666
+ label: "Bank Details",
667
+ isFullWidth: !1,
668
+ "data-testid": "managerole-bank-details-mandatory-checkbox"
669
+ }
670
+ )
671
+ ] })
672
+ }
673
+ )
674
+ }
675
+ ) }),
676
+ /* @__PURE__ */ t(
677
+ P,
678
+ {
679
+ className: "flex items-center justify-end gap-3 pt-6 border-t",
680
+ sx: { borderColor: "divider" },
681
+ children: [
682
+ /* @__PURE__ */ a(
683
+ K,
684
+ {
685
+ variant: "contained",
686
+ color: "secondary",
687
+ size: "small",
688
+ onClick: B,
689
+ "data-testid": "managerole-close-button",
690
+ children: _("Close")
691
+ }
692
+ ),
693
+ /* @__PURE__ */ a(
694
+ K,
695
+ {
696
+ variant: "contained",
697
+ color: "primary",
698
+ size: "small",
699
+ type: "submit",
700
+ "data-testid": "managerole-submit-button",
701
+ children: f ? `${_("Update Role")}` : `${_("Add Role")}`
702
+ }
703
+ )
704
+ ]
705
+ }
706
+ )
707
+ ]
708
+ }
709
+ )
710
+ ] })
711
+ }
712
+ ) })
713
+ }
714
+ );
715
+ };
716
+ Re.propTypes = {
717
+ isUpdate: y.bool,
718
+ role: y.object,
719
+ onClose: y.func,
720
+ open: y.bool,
721
+ setOpen: y.func,
722
+ selectedId: y.string,
723
+ isRoleListModified: y.bool
724
+ };
725
+ export {
726
+ Re as default
727
+ };
728
+ //# sourceMappingURL=ManageRole-CuXmWQyp-Cy15Mlax.js.map