@argusoft/medplat-form-engine 1.0.13 → 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 (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,728 +0,0 @@
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-v5Nyp1vr-BsTLfcMm.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-BjIIXAlK-DY39p0FD.js.map