@argusoft/medplat-core 1.0.2 → 1.0.4

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.
@@ -1,19 +1,19 @@
1
- import { jsxs as t, jsx as a, Fragment as E } from "react/jsx-runtime";
1
+ import { jsxs as s, jsx as a, Fragment as E } from "react/jsx-runtime";
2
2
  import { useRef as K, useState as Y, useEffect as de } from "react";
3
3
  import { Modal as ce, Box as j, IconButton as me, FormControl as v, FormGroup as ue, Button as X } from "@mui/material";
4
4
  import he from "@/hooks/useTrackEvent";
5
- import { g as pe, a as ge } from "./RoleManagement-CLaEJ90J.js";
5
+ import { g as ge, a as pe } from "./RoleManagement-C0feJCuq.js";
6
6
  import { getRoleList as fe, getLocationTypes as ye, execute as O } from "@/common/services/GlobalApis";
7
7
  import { showToast as W } from "@/common/toaster/toaster";
8
8
  import { useForm as be } from "react-hook-form";
9
9
  import { yupResolver as ve } from "@hookform/resolvers/yup";
10
10
  import "@/assets/scss/scrollBar.scss";
11
- import { FormItem as c } from "@/views/custom-components/FormItem.jsx";
11
+ import { FormItem as m } from "@/views/custom-components/FormItem.jsx";
12
12
  import * as N from "yup";
13
13
  import A from "@/views/custom-components/CustomTextField";
14
14
  import Ne from "@/views/custom-components/CustomDropdown";
15
15
  import $ from "@/views/custom-components/CustomCheckBox";
16
- import R from "@/views/custom-components/CustomAutoComplete";
16
+ import w from "@/views/custom-components/CustomAutoComplete";
17
17
  import { useTranslateProvider as Ie } from "@/common/languageTranslator/TranslationContext";
18
18
  import { FontAwesomeIcon as xe } from "@fortawesome/react-fontawesome";
19
19
  import { faXmark as we } from "@fortawesome/free-solid-svg-icons";
@@ -22,53 +22,53 @@ import y from "prop-types";
22
22
  import J from "@/views/custom-components/CustomToggleSwitch";
23
23
  import { useSelector as Te } from "react-redux";
24
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: [
25
+ const Q = ({ children: I, isLoading: b }) => !Te(Me) || !b ? I : /* @__PURE__ */ s("div", { className: "pt-6 h-[88vh]", children: [
26
+ /* @__PURE__ */ s("div", { className: "px-8 pt-2 pb-4 flex items-center justify-between", children: [
27
27
  /* @__PURE__ */ a("div", { className: "bg-gray-300 animate-pulse rounded-md w-32 h-8" }),
28
28
  /* @__PURE__ */ a("div", { className: "bg-gray-300 animate-pulse rounded-full w-10 h-10" })
29
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: [
30
+ /* @__PURE__ */ s("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((h) => /* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
32
32
  /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 mb-2 animate-pulse" }),
33
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: [
34
+ ] }, h)) }),
35
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-6 w-full", children: /* @__PURE__ */ s("div", { className: "w-full", children: [
36
36
  /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/4 mb-2 animate-pulse" }),
37
37
  /* @__PURE__ */ a("div", { className: "h-8 bg-gray-300 rounded-full w-16 animate-pulse" })
38
38
  ] }) }),
39
- /* @__PURE__ */ t("div", { className: "space-y-4", children: [
40
- [1, 2].map((m) => /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
39
+ /* @__PURE__ */ s("div", { className: "space-y-4", children: [
40
+ [1, 2].map((h) => /* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
41
41
  /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/4 mb-2 animate-pulse" }),
42
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: [
43
+ ] }, h)),
44
+ /* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [1, 2].map((h) => /* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
45
45
  /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 mb-2 animate-pulse" }),
46
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: [
47
+ ] }, h)) }),
48
+ [1, 2].map((h) => /* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
49
49
  /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 mb-2 animate-pulse" }),
50
50
  /* @__PURE__ */ a("div", { className: "h-10 bg-gray-300 rounded animate-pulse w-full" })
51
- ] }, m))
51
+ ] }, h))
52
52
  ] }),
53
- /* @__PURE__ */ t("div", { className: "flex items-center gap-6", children: [
54
- /* @__PURE__ */ t("div", { className: "w-[60%]", children: [
53
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-6", children: [
54
+ /* @__PURE__ */ s("div", { className: "w-[60%]", children: [
55
55
  /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 mb-2 animate-pulse" }),
56
56
  /* @__PURE__ */ a("div", { className: "h-8 bg-gray-300 rounded-full w-16 animate-pulse" })
57
57
  ] }),
58
- /* @__PURE__ */ t("div", { className: "w-[40%] flex items-center gap-2", children: [
58
+ /* @__PURE__ */ s("div", { className: "w-[40%] flex items-center gap-2", children: [
59
59
  /* @__PURE__ */ a("div", { className: "h-5 w-5 bg-gray-300 rounded animate-pulse" }),
60
60
  /* @__PURE__ */ a("div", { className: "h-4 bg-gray-300 rounded w-1/3 animate-pulse" })
61
61
  ] })
62
62
  ] }),
63
- /* @__PURE__ */ t("div", { className: "space-y-2", children: [
63
+ /* @__PURE__ */ s("div", { className: "space-y-2", children: [
64
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: [
65
+ /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-4", children: [1, 2, 3, 4].map((h) => /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
66
66
  /* @__PURE__ */ a("div", { className: "h-5 w-5 bg-gray-300 rounded animate-pulse" }),
67
67
  /* @__PURE__ */ a("div", { className: "h-4 w-16 bg-gray-300 rounded animate-pulse" })
68
- ] }, m)) })
68
+ ] }, h)) })
69
69
  ] })
70
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: [
71
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-3 pt-6 px-8 pb-4 border-t border-slate-100", children: [
72
72
  /* @__PURE__ */ a("div", { className: "h-9 w-20 bg-gray-300 rounded animate-pulse" }),
73
73
  /* @__PURE__ */ a("div", { className: "h-9 w-24 bg-gray-300 rounded animate-pulse" })
74
74
  ] })
@@ -77,14 +77,14 @@ Q.propTypes = {
77
77
  children: y.any,
78
78
  isLoading: y.any
79
79
  };
80
- const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
80
+ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Le = ({
81
81
  selectedId: I,
82
82
  isUpdate: b,
83
- open: B,
84
- setOpen: m,
83
+ open: L,
84
+ setOpen: h,
85
85
  isRoleListModified: Z
86
86
  }) => {
87
- const G = K(null), z = K(!1), _ = he(), [n, V] = Y({}), [ee, D] = Y(!1), ae = N.object().shape({
87
+ const G = K(null), z = K(!1), _ = he(), [i, V] = Y({}), [ee, D] = Y(!1), ae = N.object().shape({
88
88
  name: N.string().required("Enter Role Name"),
89
89
  locationTypes: N.array().when("isLocationRequired", {
90
90
  is: !0,
@@ -102,9 +102,9 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
102
102
  control: d,
103
103
  handleSubmit: te,
104
104
  formState: { errors: u, isSubmitting: le },
105
- setValue: p,
105
+ setValue: g,
106
106
  // getValues,
107
- watch: L,
107
+ watch: B,
108
108
  reset: se
109
109
  } = be({
110
110
  defaultValues: {
@@ -121,6 +121,7 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
121
121
  isHealthInfraMandatory: !1,
122
122
  isGeolocationMandatory: !1,
123
123
  roleIds: [],
124
+ canManageRoleIds: [],
124
125
  manageByTeamTypeIds: [],
125
126
  canSelfManage: !1,
126
127
  healthInfrastructureIds: [],
@@ -142,15 +143,15 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
142
143
  resolver: ve(ae),
143
144
  mode: "onChange",
144
145
  shouldUnregister: !1
145
- }), re = L("isBankDetailsRequired"), F = L("locationTypes"), { translate: H } = Ie(), ne = L("isLocationRequired"), ie = L("isHealthInfraMandatory"), P = [
146
+ }), ne = B("isBankDetailsRequired"), F = B("locationTypes"), { translate: P } = Ie(), re = B("isLocationRequired"), ie = B("isHealthInfraMandatory"), H = [
146
147
  { label: "Email", value: "isEmailMandatory" },
147
- ...(n == null ? void 0 : n.env) !== "chip" ? [{ label: "Aadhar Number", value: "isAadharNumMandatory" }] : [],
148
+ ...(i == null ? void 0 : i.env) !== "chip" ? [{ label: "Aadhar Number", value: "isAadharNumMandatory" }] : [],
148
149
  { label: "Contact Number", value: "isContactNumMandatory" },
149
- ...(n == null ? void 0 : n.env) !== "chip" ? [{ label: "Convox Id", value: "isConvoxIdMandatory" }] : [],
150
+ ...(i == null ? void 0 : i.env) !== "chip" ? [{ label: "Convox Id", value: "isConvoxIdMandatory" }] : [],
150
151
  { label: "Last Name", value: "isLastNameMandatory" },
151
152
  { label: "Health Infrastructure", value: "isHealthInfraMandatory" },
152
153
  { label: "GeoLocation", value: "isGeolocationMandatory" },
153
- ...(n == null ? void 0 : n.env) !== "chip" ? [{ label: "Smag Trained", value: "isSmagTrainedMandatory" }] : [],
154
+ ...(i == null ? void 0 : i.env) !== "chip" ? [{ label: "Smag Trained", value: "isSmagTrainedMandatory" }] : [],
154
155
  { label: "Nodal", value: "isNodalMandatory" }
155
156
  ].filter((e) => f.isTecho ? ![
156
157
  "isGeolocationMandatory",
@@ -164,7 +165,7 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
164
165
  "isNodalMandatory",
165
166
  "isSmagTrainedMandatory"
166
167
  ].includes(e.value) : !0), k = () => {
167
- m(0), se(), _("conversion_event", {
168
+ h(0), se(), _("conversion_event", {
168
169
  form: G.current,
169
170
  form_name: "Manage Role",
170
171
  submit: z.current
@@ -173,37 +174,39 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
173
174
  button_type: "cancel",
174
175
  button_id: "managerole-close-button"
175
176
  });
176
- }, x = (e, l, i) => {
177
- p(i, l);
177
+ }, x = (e, t, o) => {
178
+ g(o, t);
178
179
  }, oe = async (e) => {
179
- var l, i;
180
+ var t, o;
180
181
  try {
181
182
  _("button_click", {
182
183
  button_name: b ? "update role button" : "add role button",
183
184
  button_type: "submit",
184
185
  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
186
+ }), 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((l) => l == null ? void 0 : l.id), e.canManageRoleIds = e.canManageRoleIds.map(
187
+ (l) => l == null ? void 0 : l.id
188
+ ), e.manageByTeamTypeIds = e.manageByTeamTypeIds.map(
189
+ (l) => l == null ? void 0 : l.id
187
190
  ), 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({
191
+ (l) => l == null ? void 0 : l.id
192
+ ), e.categoryIds = e.categoryIds.map((l) => l == null ? void 0 : l.id), e.locationTypes = e.isLocationRequired === !0 ? e.locationTypes : [], delete e.isLocationRequired, e.manageByRoleIds = e.roleIds, await pe(e), W({
190
193
  type: "success",
191
194
  message: `Role ${b ? "Updated" : "Added"} Successfully`
192
195
  }), z.current = !0, k(), Z();
193
- } catch (s) {
196
+ } catch (l) {
194
197
  W({
195
198
  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}`
199
+ message: `Role Cannot be added: ${(o = (t = l == null ? void 0 : l.response) == null ? void 0 : t.data) == null ? void 0 : o.message}`
197
200
  });
198
201
  }
199
202
  };
200
203
  return de(() => {
201
204
  (async () => {
202
205
  try {
203
- D((i) => !i);
204
- const l = f.getEnv();
205
- if (B !== 0) {
206
- const [i, s, q, S, C] = await Promise.all([
206
+ D((o) => !o);
207
+ const t = f.getEnv();
208
+ if (L !== 0) {
209
+ const [o, l, q, C, S] = await Promise.all([
207
210
  fe(),
208
211
  ye(),
209
212
  O({
@@ -225,72 +228,78 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
225
228
  }
226
229
  })
227
230
  ]);
228
- if (V((g) => {
229
- var w, T, M;
231
+ if (V((p) => {
232
+ var T, M, R;
230
233
  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
234
+ ...p,
235
+ roles: o.data,
236
+ locationData: l.data,
237
+ manageTeam: (T = q == null ? void 0 : q.data) == null ? void 0 : T.result,
238
+ category: (M = C == null ? void 0 : C.data) == null ? void 0 : M.result,
239
+ healthInfraType: (R = S == null ? void 0 : S.data) == null ? void 0 : R.result
237
240
  };
238
241
  }), 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);
242
+ const { data: p } = await ge(I);
243
+ V((n) => ({ ...n, roleData: p, env: t })), Object.keys(p).map((n) => g(n, p[n])), g("isBankDetailsRequired", p.isBankDetailsRequired), g("isBankDetailsMandatory", p.isBankDetailsMandatory);
241
244
  const {
242
- manageByTeamTypeIds: w,
243
- healthInfrastructureIds: T,
244
- roleIds: M,
245
+ manageByTeamTypeIds: T,
246
+ healthInfrastructureIds: M,
247
+ roleIds: R,
245
248
  categoryIds: U
246
- } = g;
247
- p(
249
+ } = p;
250
+ g(
248
251
  "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);
252
+ T ? T.map(
253
+ (n) => {
254
+ var c;
255
+ return (c = q.data.result) == null ? void 0 : c.find((r) => (r == null ? void 0 : r.id) === n);
253
256
  }
254
257
  ) : []
255
- ), p(
258
+ ), g(
256
259
  "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
260
+ M ? M.map(
261
+ (n) => {
262
+ var c;
263
+ return (c = S.data.result) == null ? void 0 : c.find(
264
+ (r) => (r == null ? void 0 : r.id) === n
262
265
  );
263
266
  }
264
- ).filter((r) => r !== void 0) : []
265
- ), p(
267
+ ).filter((n) => n !== void 0) : []
268
+ ), g(
266
269
  "categoryIds",
267
270
  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
+ (n) => {
272
+ var c;
273
+ return (c = C.data.result) == null ? void 0 : c.find((r) => (r == null ? void 0 : r.id) === n);
271
274
  }
272
275
  ) : []
273
- ), p(
276
+ ), g(
274
277
  "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);
278
+ R ? R.map((n) => {
279
+ var c;
280
+ return (c = o.data) == null ? void 0 : c.find((r) => (r == null ? void 0 : r.id) === n);
281
+ }).filter((n) => n !== void 0) : []
282
+ ), g(
283
+ "canManageRoleIds",
284
+ p.canManageRoleIds ? p.canManageRoleIds.map((n) => {
285
+ var c;
286
+ return (c = o.data) == null ? void 0 : c.find((r) => (r == null ? void 0 : r.id) === n);
287
+ }).filter((n) => n !== void 0) : []
288
+ ), p.locationTypes.length > 0 ? g("isLocationRequired", !0) : g("isLocationRequired", !1);
280
289
  }
281
290
  }
282
- D((i) => !i);
283
- } catch (l) {
291
+ D((o) => !o);
292
+ } catch (t) {
284
293
  W({
285
- message: `Error in manage role :${l == null ? void 0 : l.message}`,
294
+ message: `Error in manage role :${t == null ? void 0 : t.message}`,
286
295
  type: "error"
287
- }), D((i) => !i);
296
+ }), D((o) => !o);
288
297
  }
289
298
  })();
290
- }, [I, B]), /* @__PURE__ */ a(
299
+ }, [I, L]), /* @__PURE__ */ a(
291
300
  ce,
292
301
  {
293
- open: B !== 0,
302
+ open: L !== 0,
294
303
  onClose: k,
295
304
  "data-testid": "managerole-modal",
296
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(
@@ -298,8 +307,8 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
298
307
  {
299
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",
300
309
  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: [
310
+ children: /* @__PURE__ */ s(Q, { isLoading: ee, children: [
311
+ /* @__PURE__ */ s("div", { className: "px-8 pt-8 pb-4 flex items-center justify-between", children: [
303
312
  /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
304
313
  j,
305
314
  {
@@ -320,15 +329,15 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
320
329
  }
321
330
  )
322
331
  ] }),
323
- /* @__PURE__ */ t(
332
+ /* @__PURE__ */ s(
324
333
  "form",
325
334
  {
326
335
  onSubmit: te(oe),
327
336
  ref: G,
328
337
  className: "px-8 pb-8 space-y-6 overflow-y-auto max-h-[80vh]",
329
338
  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(
339
+ /* @__PURE__ */ s("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: [
340
+ /* @__PURE__ */ a(v, { variant: "outlined", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(m, { label: "Role Name", children: /* @__PURE__ */ a(
332
341
  A,
333
342
  {
334
343
  placeholder: "Role Name",
@@ -340,7 +349,7 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
340
349
  }
341
350
  ) }) }) }),
342
351
  /* @__PURE__ */ a(v, { variant: "outlined", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
343
- c,
352
+ m,
344
353
  {
345
354
  label: "Max Position",
346
355
  tooltip: "This is the maximum no of users that can be created at one location of this role type",
@@ -368,7 +377,7 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
368
377
  )
369
378
  }
370
379
  ) }) }),
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(
380
+ !f.isTecho && /* @__PURE__ */ a(v, { variant: "outlined", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(m, { label: "Max Health Infrastructure", children: /* @__PURE__ */ a(
372
381
  A,
373
382
  {
374
383
  name: "maxHealthInfra",
@@ -400,7 +409,7 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
400
409
  variant: "outlined",
401
410
  className: "flex flex-row items-center w-full ",
402
411
  children: /* @__PURE__ */ a(
403
- c,
412
+ m,
404
413
  {
405
414
  label: "Location Required",
406
415
  required: !0,
@@ -421,25 +430,25 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
421
430
  )
422
431
  }
423
432
  ) }),
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,
433
+ /* @__PURE__ */ s("div", { className: "space-y-4", children: [
434
+ (re === !0 || le) && /* @__PURE__ */ a(E, { children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
435
+ m,
427
436
  {
428
437
  label: "Location",
429
438
  required: !0,
430
439
  tooltip: "The OU level where users of this role perform their job function",
431
440
  children: /* @__PURE__ */ a(
432
- R,
441
+ w,
433
442
  {
434
443
  id: "locationTypes",
435
444
  control: d,
436
445
  name: "locationTypes",
437
- options: n.locationData,
446
+ options: i.locationData,
438
447
  value: F == null ? void 0 : F.map(
439
448
  (e) => {
440
- var l;
441
- return (l = n.locationData) == null ? void 0 : l.find(
442
- (i) => i.type === (e == null ? void 0 : e.type)
449
+ var t;
450
+ return (t = i.locationData) == null ? void 0 : t.find(
451
+ (o) => o.type === (e == null ? void 0 : e.type)
443
452
  );
444
453
  }
445
454
  ),
@@ -447,34 +456,54 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
447
456
  getOptionLabel: (e) => e == null ? void 0 : e.name,
448
457
  dataTestId: "managerole-location-type-select",
449
458
  checkEquality: "type",
450
- onChange: (e, l) => x(e, l, "locationTypes")
459
+ onChange: (e, t) => x(e, t, "locationTypes")
451
460
  }
452
461
  )
453
462
  }
454
463
  ) }) }),
455
464
  /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
456
- c,
465
+ m,
457
466
  {
458
467
  label: "Can Manage Role",
459
468
  tooltip: "Please select the roles that shall be managed by this role",
460
469
  children: /* @__PURE__ */ a(
461
- R,
470
+ w,
462
471
  {
463
472
  name: "roleIds",
464
473
  id: "roleIds",
465
474
  errors: u,
466
475
  control: d,
467
476
  dataTestId: "managerole-manage-role-select",
468
- options: n.roles,
469
- onChange: (e, l) => x(e, l, "roleIds"),
477
+ options: i.roles,
478
+ onChange: (e, t) => x(e, t, "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
+ m,
486
+ {
487
+ label: "Managed From",
488
+ tooltip: "Please select the roles that can manage this role",
489
+ children: /* @__PURE__ */ a(
490
+ w,
491
+ {
492
+ name: "canManageRoleIds",
493
+ id: "canManageRoleIds",
494
+ errors: u,
495
+ control: d,
496
+ dataTestId: "managerole-managed-by-role-select",
497
+ options: i.roles,
498
+ onChange: (e, t) => x(e, t, "canManageRoleIds"),
470
499
  getOptionLabel: (e) => e == null ? void 0 : e.name
471
500
  }
472
501
  )
473
502
  }
474
503
  ) }),
475
- /* @__PURE__ */ t("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
504
+ /* @__PURE__ */ s("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
476
505
  /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
477
- c,
506
+ m,
478
507
  {
479
508
  label: "Role Type",
480
509
  tooltip: "Please select Role Type",
@@ -495,20 +524,20 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
495
524
  }
496
525
  ) }),
497
526
  /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
498
- c,
527
+ m,
499
528
  {
500
529
  label: "Can Manage Team",
501
530
  tooltip: "Please select the teams that shall be managed by this role",
502
531
  children: /* @__PURE__ */ a(
503
- R,
532
+ w,
504
533
  {
505
534
  control: d,
506
535
  name: "manageByTeamTypeIds",
507
536
  id: "manageByTeamTypeIds",
508
537
  errors: u,
509
- options: n.manageTeam,
538
+ options: i.manageTeam,
510
539
  dataTestId: "managerole-manage-team-select",
511
- onChange: (e, l) => x(e, l, "manageByTeamTypeIds"),
540
+ onChange: (e, t) => x(e, t, "manageByTeamTypeIds"),
512
541
  getOptionLabel: (e) => e == null ? void 0 : e.type
513
542
  }
514
543
  )
@@ -516,55 +545,55 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
516
545
  ) })
517
546
  ] }),
518
547
  /* @__PURE__ */ a("div", { className: "space-y-4", children: /* @__PURE__ */ a("div", { className: "space-y-1.5", children: /* @__PURE__ */ a(
519
- c,
548
+ m,
520
549
  {
521
550
  label: "Select Health Infrastructure type",
522
551
  tooltip: "Please select the institute to be associated with the role",
523
552
  required: ie,
524
553
  children: /* @__PURE__ */ a(
525
- R,
554
+ w,
526
555
  {
527
- options: n.healthInfraType,
556
+ options: i.healthInfraType,
528
557
  errors: u,
529
558
  name: "healthInfrastructureIds",
530
559
  id: "healthInfrastructureIds",
531
560
  dataTestId: "managerole-health-infrastructure-select",
532
561
  control: d,
533
- onChange: (e, l) => x(e, l, "healthInfrastructureIds"),
562
+ onChange: (e, t) => x(e, t, "healthInfrastructureIds"),
534
563
  getOptionLabel: (e) => e == null ? void 0 : e.value
535
564
  }
536
565
  )
537
566
  }
538
567
  ) }) }),
539
568
  !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,
569
+ m,
541
570
  {
542
571
  label: "Category",
543
572
  tooltip: "Please select the category to be associated with the role",
544
573
  children: /* @__PURE__ */ a(
545
- R,
574
+ w,
546
575
  {
547
576
  id: "categoryIds",
548
577
  name: "categoryIds",
549
578
  errors: u,
550
- options: n.category,
579
+ options: i.category,
551
580
  dataTestId: "managerole-role-category-select",
552
581
  control: d,
553
- onChange: (e, l) => x(e, l, "categoryIds"),
582
+ onChange: (e, t) => x(e, t, "categoryIds"),
554
583
  getOptionLabel: (e) => e == null ? void 0 : e.value
555
584
  }
556
585
  )
557
586
  }
558
587
  ) }) }) })
559
588
  ] }),
560
- /* @__PURE__ */ t("div", { className: "flex items-center gap-6", children: [
589
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-6", children: [
561
590
  /* @__PURE__ */ a(
562
591
  v,
563
592
  {
564
593
  variant: "outlined",
565
594
  className: "flex flex-row items-center w-[60%] ",
566
595
  children: /* @__PURE__ */ a(
567
- c,
596
+ m,
568
597
  {
569
598
  label: "Bank Details Required",
570
599
  tooltip: "Select if bank details are required for this role",
@@ -589,7 +618,7 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
589
618
  }
590
619
  ),
591
620
  !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,
621
+ m,
593
622
  {
594
623
  label: "Self Manage",
595
624
  labelWidth: "60%",
@@ -613,12 +642,12 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
613
642
  variant: "outlined",
614
643
  className: "flex flex-col items-start justify-between",
615
644
  children: /* @__PURE__ */ a(
616
- c,
645
+ m,
617
646
  {
618
647
  label: "Mandatory Fields",
619
648
  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(
649
+ children: /* @__PURE__ */ s(ue, { row: !0, children: [
650
+ H == null ? void 0 : H.map((e) => /* @__PURE__ */ a(
622
651
  $,
623
652
  {
624
653
  control: d,
@@ -629,7 +658,7 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
629
658
  },
630
659
  e.value
631
660
  )),
632
- re === !0 && /* @__PURE__ */ a(
661
+ ne === !0 && /* @__PURE__ */ a(
633
662
  $,
634
663
  {
635
664
  name: "isBankDetailsMandatory",
@@ -644,7 +673,7 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
644
673
  )
645
674
  }
646
675
  ) }),
647
- /* @__PURE__ */ t(
676
+ /* @__PURE__ */ s(
648
677
  j,
649
678
  {
650
679
  className: "flex items-center justify-end gap-3 pt-6 border-t",
@@ -658,7 +687,7 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
658
687
  size: "small",
659
688
  onClick: k,
660
689
  "data-testid": "managerole-close-button",
661
- children: H("Close")
690
+ children: P("Close")
662
691
  }
663
692
  ),
664
693
  /* @__PURE__ */ a(
@@ -669,7 +698,7 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
669
698
  size: "small",
670
699
  type: "submit",
671
700
  "data-testid": "managerole-submit-button",
672
- children: b ? `${H("Update Role")}` : `${H("Add Role")}`
701
+ children: b ? `${P("Update Role")}` : `${P("Add Role")}`
673
702
  }
674
703
  )
675
704
  ]
@@ -684,7 +713,7 @@ const Re = [{ name: "WEB" }, { name: "MOBILE" }, { name: "BOTH" }], Be = ({
684
713
  }
685
714
  );
686
715
  };
687
- Be.propTypes = {
716
+ Le.propTypes = {
688
717
  isUpdate: y.bool,
689
718
  role: y.object,
690
719
  onClose: y.func,
@@ -694,6 +723,6 @@ Be.propTypes = {
694
723
  isRoleListModified: y.bool
695
724
  };
696
725
  export {
697
- Be as default
726
+ Le as default
698
727
  };
699
- //# sourceMappingURL=ManageRole-ByqBmjuc.js.map
728
+ //# sourceMappingURL=ManageRole-CuXmWQyp.js.map