@argusoft/medplat-form-engine 1.0.8 → 1.0.10

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