@argusoft/medplat-core 1.0.0

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