@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.
- package/dist/AccessRights-sgIhYR30.js +1238 -0
- package/dist/AccessRights-sgIhYR30.js.map +1 -0
- package/dist/AddEditQueryBuilder-BaZxS2Cm.js +289 -0
- package/dist/AddEditQueryBuilder-BaZxS2Cm.js.map +1 -0
- package/dist/AddEditQueryBuilder.css +1 -0
- package/dist/AddFeatures-BxXCC6ex.js +212 -0
- package/dist/AddFeatures-BxXCC6ex.js.map +1 -0
- package/dist/AddLabelModal-DE3ploGD.js +734 -0
- package/dist/AddLabelModal-DE3ploGD.js.map +1 -0
- package/dist/AddMenuConfiguration-QWfpcnuP.js +2237 -0
- package/dist/AddMenuConfiguration-QWfpcnuP.js.map +1 -0
- package/dist/AddMenuConfiguration.css +1 -0
- package/dist/AddRoleDrawer-ZK1eejxI.js +453 -0
- package/dist/AddRoleDrawer-ZK1eejxI.js.map +1 -0
- package/dist/AppModal-BgZyfrd-.js +428 -0
- package/dist/AppModal-BgZyfrd-.js.map +1 -0
- package/dist/ChangePasswordModal-MV7g8tkA.js +176 -0
- package/dist/ChangePasswordModal-MV7g8tkA.js.map +1 -0
- package/dist/ConditionConfig-BqWe0NKO.js +395 -0
- package/dist/ConditionConfig-BqWe0NKO.js.map +1 -0
- package/dist/ConditionConfig.css +1 -0
- package/dist/EntityManagement-D-x6Qzal.js +50 -0
- package/dist/EntityManagement-D-x6Qzal.js.map +1 -0
- package/dist/EventConfigurations-jGCJ4LqP.js +384 -0
- package/dist/EventConfigurations-jGCJ4LqP.js.map +1 -0
- package/dist/EventConfigurations.css +1 -0
- package/dist/EventsExceptionModal-BF6E1Np7.js +200 -0
- package/dist/EventsExceptionModal-BF6E1Np7.js.map +1 -0
- package/dist/EventsSkeleton-BN7_0IGs.js +74 -0
- package/dist/EventsSkeleton-BN7_0IGs.js.map +1 -0
- package/dist/FeatureMenu-BYSRoNm0.js +249 -0
- package/dist/FeatureMenu-BYSRoNm0.js.map +1 -0
- package/dist/Features-CKMmuqcs.js +11 -0
- package/dist/Features-CKMmuqcs.js.map +1 -0
- package/dist/FlywayQuery-Cx2sly6g.js +169 -0
- package/dist/FlywayQuery-Cx2sly6g.js.map +1 -0
- package/dist/ImmunizationConfigurationBase-CdCgDaAl.js +5299 -0
- package/dist/ImmunizationConfigurationBase-CdCgDaAl.js.map +1 -0
- package/dist/ImmunizationConfigurationBase.css +1 -0
- package/dist/ImmunizationConfigurationsList-CQnxWa09.js +335 -0
- package/dist/ImmunizationConfigurationsList-CQnxWa09.js.map +1 -0
- package/dist/ImmunizationSkeleton-D2tdv5k-.js +186 -0
- package/dist/ImmunizationSkeleton-D2tdv5k-.js.map +1 -0
- package/dist/LanguagesModal-rk6IGQwY.js +394 -0
- package/dist/LanguagesModal-rk6IGQwY.js.map +1 -0
- package/dist/ManageDynamicFeature-CeeqiS3K.js +4189 -0
- package/dist/ManageDynamicFeature-CeeqiS3K.js.map +1 -0
- package/dist/ManageEventConfiguration-BRXh51fc.js +1017 -0
- package/dist/ManageEventConfiguration-BRXh51fc.js.map +1 -0
- package/dist/ManageEventConfiguration.css +1 -0
- package/dist/ManageNotification-B4prX-9Z.js +6819 -0
- package/dist/ManageNotification-B4prX-9Z.js.map +1 -0
- package/dist/ManageRole-ByqBmjuc.js +699 -0
- package/dist/ManageRole-ByqBmjuc.js.map +1 -0
- package/dist/ManageTranslation-BTxvSYKb.js +616 -0
- package/dist/ManageTranslation-BTxvSYKb.js.map +1 -0
- package/dist/ManageTranslation.css +1 -0
- package/dist/ManageUser-PHiTNyF8.js +2160 -0
- package/dist/ManageUser-PHiTNyF8.js.map +1 -0
- package/dist/ManageUser.css +1 -0
- package/dist/MobileMenuManagement-DmQU5TTo.js +108 -0
- package/dist/MobileMenuManagement-DmQU5TTo.js.map +1 -0
- package/dist/MobileTypeEventConfigModal-BCp-SF4-.js +783 -0
- package/dist/MobileTypeEventConfigModal-BCp-SF4-.js.map +1 -0
- package/dist/NewServerManagement-5YcAtF-g.js +1002 -0
- package/dist/NewServerManagement-5YcAtF-g.js.map +1 -0
- package/dist/NotificationFlywayQuery-BY8Zzml_.js +244 -0
- package/dist/NotificationFlywayQuery-BY8Zzml_.js.map +1 -0
- package/dist/NotificationList-BkpOrCpM.js +400 -0
- package/dist/NotificationList-BkpOrCpM.js.map +1 -0
- package/dist/OtherTypeEventConfigModal-DPB8IYzj.js +2001 -0
- package/dist/OtherTypeEventConfigModal-DPB8IYzj.js.map +1 -0
- package/dist/QueryBuilder-Cus_mRwZ.js +378 -0
- package/dist/QueryBuilder-Cus_mRwZ.js.map +1 -0
- package/dist/QueryBuilder.css +1 -0
- package/dist/QueryManagement-DXA73N2j.js +671 -0
- package/dist/QueryManagement-DXA73N2j.js.map +1 -0
- package/dist/QueryManagement.css +1 -0
- package/dist/RoleManagement-CLaEJ90J.js +410 -0
- package/dist/RoleManagement-CLaEJ90J.js.map +1 -0
- package/dist/ServerSyncModal-uNjGCQJz.js +869 -0
- package/dist/ServerSyncModal-uNjGCQJz.js.map +1 -0
- package/dist/ShowFlywayQuery-DMsAbtOW.js +130 -0
- package/dist/ShowFlywayQuery-DMsAbtOW.js.map +1 -0
- package/dist/ShowFlywayQuery-DVRCd384.js +259 -0
- package/dist/ShowFlywayQuery-DVRCd384.js.map +1 -0
- package/dist/ShowQueryHistory-BDN0tzHg.js +190 -0
- package/dist/ShowQueryHistory-BDN0tzHg.js.map +1 -0
- package/dist/SubMenu-BHcSNSUF.js +187 -0
- package/dist/SubMenu-BHcSNSUF.js.map +1 -0
- package/dist/TableDetails-DzREeJkm.js +1508 -0
- package/dist/TableDetails-DzREeJkm.js.map +1 -0
- package/dist/TableList-B9hr05Hs.js +428 -0
- package/dist/TableList-B9hr05Hs.js.map +1 -0
- package/dist/TypeConfiguration-BYM8PjV9.js +117 -0
- package/dist/TypeConfiguration-BYM8PjV9.js.map +1 -0
- package/dist/UserList-BxB1tCwM.js +13042 -0
- package/dist/UserList-BxB1tCwM.js.map +1 -0
- package/dist/UserList.css +1 -0
- package/dist/UserListSkeleton-cglK2SaU.js +184 -0
- package/dist/UserListSkeleton-cglK2SaU.js.map +1 -0
- package/dist/WidgetList-BSApErov.js +188 -0
- package/dist/WidgetList-BSApErov.js.map +1 -0
- package/dist/_commonjsHelpers-BItOPCY9.js +29 -0
- package/dist/_commonjsHelpers-BItOPCY9.js.map +1 -0
- package/dist/i18next-CTOWN_jH.js +1394 -0
- package/dist/i18next-CTOWN_jH.js.map +1 -0
- package/dist/index.js +481 -0
- package/dist/index.js.map +1 -0
- package/dist/manageImmunization-B4swS745.js +1204 -0
- package/dist/manageImmunization-B4swS745.js.map +1 -0
- package/dist/manageImmunization.css +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,4189 @@
|
|
|
1
|
+
import { jsx as t, jsxs as s, Fragment as he } from "react/jsx-runtime";
|
|
2
|
+
import { executeAll as Ft, execute as H } from "@/common/services/QueryBuilder";
|
|
3
|
+
import { useDebounceFn as fn } from "@/hooks/useDebounceFn.js";
|
|
4
|
+
import Ee from "@/views/custom-components/CustomDropdown";
|
|
5
|
+
import zi from "@/views/custom-components/CustomSvgUpload";
|
|
6
|
+
import ie from "@/views/custom-components/CustomTextField";
|
|
7
|
+
import { yupResolver as vn } from "@hookform/resolvers/yup";
|
|
8
|
+
import { Editor as Li } from "@monaco-editor/react";
|
|
9
|
+
import { generateUUID as hn } from "@/utils/UUIDgenerator";
|
|
10
|
+
import { getRoleList as $i, executeQuery as Qi } from "@/common/services/GlobalApis";
|
|
11
|
+
import { Dialog as Fn, DialogTitle as Tn, DialogContent as _n, DialogContentText as Ji, Grid2 as Se, Divider as Ke, Chip as lt, FormControl as ne, TextField as Vn, IconButton as Re, Box as c, Alert as ji, DialogActions as En, Button as z, useTheme as Dn, debounce as Gi, Step as Hi, Typography as m, Accordion as kt, AccordionSummary as It, AccordionDetails as wt, Tooltip as Yi, RadioGroup as pn, FormControlLabel as dt, Radio as ct, Checkbox as gn, FormGroup as Ki, TableContainer as yn, Table as bn, TableHead as xn, TableRow as ut, TableCell as te, TableBody as Sn, Stack as Pn, Select as Zi, MenuItem as Cn, Modal as Xi, Card as er, alpha as tr } from "@mui/material";
|
|
12
|
+
import Y from "@mui/material/Grid2";
|
|
13
|
+
import { t as y } from "./i18next-CTOWN_jH.js";
|
|
14
|
+
import nr, { useState as x, useRef as ir, useMemo as Nn, useEffect as se, useCallback as rr } from "react";
|
|
15
|
+
import { useForm as ft, Controller as Q, useWatch as mt } from "react-hook-form";
|
|
16
|
+
import { useSelector as ar } from "react-redux";
|
|
17
|
+
import { useLocation as sr, useNavigate as or } from "react-router";
|
|
18
|
+
import * as U from "yup";
|
|
19
|
+
import { showToast as fe } from "@/common/toaster/toaster";
|
|
20
|
+
import { FormConfiguratorService as kn } from "@/common/services/FormConfiguratorService";
|
|
21
|
+
import I from "prop-types";
|
|
22
|
+
import { useDebounceFn as lr } from "@/hooks/useDebounceFn";
|
|
23
|
+
import de from "@/common/fontAwesomeIcons/FontAwesomeIcons";
|
|
24
|
+
import De from "@/views/custom-components/CustomAutoComplete.jsx";
|
|
25
|
+
import { a as In } from "./Features-CKMmuqcs.js";
|
|
26
|
+
import we from "@/views/custom-components/CustomSwitch";
|
|
27
|
+
import dr from "@/views/custom-components/CustomTextArea";
|
|
28
|
+
import vt from "@/views/custom-components/CustomCheckBox";
|
|
29
|
+
import wn from "@/views/custom-components/CustomDatePicker";
|
|
30
|
+
import ye from "@/views/custom-components/FieldDescription";
|
|
31
|
+
import { useTranslateProvider as cr } from "@/common/languageTranslator/TranslationContext";
|
|
32
|
+
import { getFeatureData as ur, updateUserMenuItems as mr } from "@/common/services/Features";
|
|
33
|
+
import fr from "@/views/custom-components/CustomRadioComponent";
|
|
34
|
+
function An({
|
|
35
|
+
mainFormCtrl: T,
|
|
36
|
+
openAddFormModal: B,
|
|
37
|
+
setModal: W,
|
|
38
|
+
reloadForms: D
|
|
39
|
+
}) {
|
|
40
|
+
const [l, b] = x(""), [C, K] = x([]), [re, M] = x(!0), q = U.object().shape({
|
|
41
|
+
formName: U.string().required("Enter form name"),
|
|
42
|
+
formCode: U.string().required("Enter form code").matches(
|
|
43
|
+
/^[A-Z_]*$/,
|
|
44
|
+
"Only uppercase letters and underscores are allowed"
|
|
45
|
+
),
|
|
46
|
+
state: U.string().required("Select state"),
|
|
47
|
+
formType: U.string().required("Select form type"),
|
|
48
|
+
description: U.string().required("Enter description")
|
|
49
|
+
}), v = ft({
|
|
50
|
+
defaultValues: {
|
|
51
|
+
formName: "",
|
|
52
|
+
formCode: "",
|
|
53
|
+
state: "ACTIVE",
|
|
54
|
+
description: "",
|
|
55
|
+
menuConfigId: null,
|
|
56
|
+
pageParams: "",
|
|
57
|
+
formType: null,
|
|
58
|
+
navigationState: "medplat.form"
|
|
59
|
+
},
|
|
60
|
+
resolver: vn(q),
|
|
61
|
+
mode: "onChange"
|
|
62
|
+
}), ce = () => {
|
|
63
|
+
if (l.trim() && !C.includes(l)) {
|
|
64
|
+
const N = [...C, l];
|
|
65
|
+
K(N), b(""), v.setValue("pageParams", N.join(","));
|
|
66
|
+
}
|
|
67
|
+
}, X = (N) => {
|
|
68
|
+
const S = C.filter((P) => P !== N);
|
|
69
|
+
K(S), v.setValue("pageParams", S.join(","));
|
|
70
|
+
}, L = (N) => {
|
|
71
|
+
const S = N.target.value;
|
|
72
|
+
/^[a-zA-Z_]*$/.test(S) && b(S);
|
|
73
|
+
}, pe = () => {
|
|
74
|
+
W(!1);
|
|
75
|
+
}, J = (N) => {
|
|
76
|
+
j(N);
|
|
77
|
+
}, j = (N) => {
|
|
78
|
+
if (!re) {
|
|
79
|
+
fe({ message: "Form Code is already taken!", type: "error" });
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const S = () => {
|
|
83
|
+
const P = new FormData();
|
|
84
|
+
return P.append(
|
|
85
|
+
"form",
|
|
86
|
+
new Blob([JSON.stringify(N)], {
|
|
87
|
+
type: "application/json"
|
|
88
|
+
})
|
|
89
|
+
), console.log(P), P;
|
|
90
|
+
};
|
|
91
|
+
N.isSeparateFeature = !0, kn.saveForm(S()).then(() => {
|
|
92
|
+
fe({
|
|
93
|
+
message: "Configuration created sucessfully!",
|
|
94
|
+
type: "success"
|
|
95
|
+
});
|
|
96
|
+
let P = [];
|
|
97
|
+
N.formName && N.formName.length > 0 && P.push({
|
|
98
|
+
code: "medplat_form_insert_into_translation_master",
|
|
99
|
+
parameters: {
|
|
100
|
+
translation_key: N.formName.replaceAll(" ", ""),
|
|
101
|
+
translation_value: N.formName,
|
|
102
|
+
form_code: N.formCode
|
|
103
|
+
},
|
|
104
|
+
sequence: 1
|
|
105
|
+
}), P.length > 0 && Ft(P), T.setValue("formCode", N.formCode), T.setValue("version", "DRAFT"), T.setValue("navigationState", N.navigationState), pe(), v.reset({
|
|
106
|
+
formName: "",
|
|
107
|
+
formCode: "",
|
|
108
|
+
state: "ACTIVE",
|
|
109
|
+
description: "",
|
|
110
|
+
menuConfigId: null,
|
|
111
|
+
pageParams: "",
|
|
112
|
+
formType: null,
|
|
113
|
+
navigationState: "medplat.form"
|
|
114
|
+
}), D();
|
|
115
|
+
});
|
|
116
|
+
}, ge = lr(async (N) => {
|
|
117
|
+
if (!(N != null && N.trim())) return;
|
|
118
|
+
const S = (await kn.checkFormCodeAvailability(N)).data;
|
|
119
|
+
return M(S), S;
|
|
120
|
+
}, 500);
|
|
121
|
+
return /* @__PURE__ */ t(
|
|
122
|
+
Fn,
|
|
123
|
+
{
|
|
124
|
+
open: B,
|
|
125
|
+
fullWidth: !0,
|
|
126
|
+
maxWidth: "lg",
|
|
127
|
+
onClose: pe,
|
|
128
|
+
slotProps: {
|
|
129
|
+
paper: {
|
|
130
|
+
style: {
|
|
131
|
+
borderRadius: "8px"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
children: /* @__PURE__ */ s(
|
|
136
|
+
"form",
|
|
137
|
+
{
|
|
138
|
+
noValidate: !0,
|
|
139
|
+
onSubmit: (N) => {
|
|
140
|
+
N.preventDefault(), N.stopPropagation(), v.handleSubmit(J)();
|
|
141
|
+
},
|
|
142
|
+
children: [
|
|
143
|
+
/* @__PURE__ */ t(Tn, { children: "Add new form" }),
|
|
144
|
+
/* @__PURE__ */ s(_n, { children: [
|
|
145
|
+
/* @__PURE__ */ t(Ji, { id: "alert-dialog-slide-description", children: "Please enter all details" }),
|
|
146
|
+
/* @__PURE__ */ s(Se, { container: !0, spacing: 2, columns: 12, sx: { mt: 1 }, children: [
|
|
147
|
+
/* @__PURE__ */ t(Se, { size: 12, children: /* @__PURE__ */ t(Ke, { children: /* @__PURE__ */ t(lt, { label: "Basic Details", size: "small" }) }) }),
|
|
148
|
+
/* @__PURE__ */ t(Se, { size: 4, children: /* @__PURE__ */ t(
|
|
149
|
+
ie,
|
|
150
|
+
{
|
|
151
|
+
control: v.control,
|
|
152
|
+
name: "formName",
|
|
153
|
+
id: "formName",
|
|
154
|
+
fullWidth: !0,
|
|
155
|
+
size: "small",
|
|
156
|
+
label: "Name",
|
|
157
|
+
errors: v.formState.errors,
|
|
158
|
+
required: !0
|
|
159
|
+
}
|
|
160
|
+
) }),
|
|
161
|
+
/* @__PURE__ */ t(Se, { size: 4, children: /* @__PURE__ */ t(
|
|
162
|
+
ie,
|
|
163
|
+
{
|
|
164
|
+
control: v.control,
|
|
165
|
+
name: "formCode",
|
|
166
|
+
id: "formCode",
|
|
167
|
+
fullWidth: !0,
|
|
168
|
+
size: "small",
|
|
169
|
+
label: "Code",
|
|
170
|
+
errors: {
|
|
171
|
+
...v.formState.errors,
|
|
172
|
+
...re === !1 && {
|
|
173
|
+
formCode: { message: "Form Code is already taken!" }
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
required: !0,
|
|
177
|
+
onChange: (N) => {
|
|
178
|
+
const S = N.target.value.toUpperCase().replace(/[^A-Z_]/g, "");
|
|
179
|
+
v.setValue("formCode", S), v.setValue(
|
|
180
|
+
"navigationState",
|
|
181
|
+
`medplat.form.${S}`
|
|
182
|
+
), ge(S);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
) }),
|
|
186
|
+
/* @__PURE__ */ t(Se, { size: 2, children: /* @__PURE__ */ t(ne, { required: !0, fullWidth: !0, size: "small", children: /* @__PURE__ */ t(
|
|
187
|
+
Ee,
|
|
188
|
+
{
|
|
189
|
+
control: v.control,
|
|
190
|
+
name: "state",
|
|
191
|
+
id: "state",
|
|
192
|
+
options: ["ACTIVE", "INACTIVE"],
|
|
193
|
+
errors: v.formState.errors,
|
|
194
|
+
size: "small",
|
|
195
|
+
placeholder: "",
|
|
196
|
+
label: "State",
|
|
197
|
+
required: !0
|
|
198
|
+
}
|
|
199
|
+
) }) }),
|
|
200
|
+
/* @__PURE__ */ t(Se, { size: 2, children: /* @__PURE__ */ t(ne, { required: !0, fullWidth: !0, size: "small", children: /* @__PURE__ */ t(
|
|
201
|
+
Ee,
|
|
202
|
+
{
|
|
203
|
+
control: v.control,
|
|
204
|
+
name: "formType",
|
|
205
|
+
id: "formType",
|
|
206
|
+
options: ["FORM", "SEARCH"],
|
|
207
|
+
errors: v.formState.errors,
|
|
208
|
+
size: "small",
|
|
209
|
+
placeholder: "",
|
|
210
|
+
label: "Type",
|
|
211
|
+
required: !0
|
|
212
|
+
}
|
|
213
|
+
) }) }),
|
|
214
|
+
/* @__PURE__ */ t(Se, { size: 12, children: /* @__PURE__ */ t(
|
|
215
|
+
ie,
|
|
216
|
+
{
|
|
217
|
+
control: v.control,
|
|
218
|
+
name: "description",
|
|
219
|
+
id: "description",
|
|
220
|
+
fullWidth: !0,
|
|
221
|
+
multiline: !0,
|
|
222
|
+
rows: 2,
|
|
223
|
+
size: "small",
|
|
224
|
+
label: "Description",
|
|
225
|
+
errors: v.formState.errors,
|
|
226
|
+
required: !0
|
|
227
|
+
}
|
|
228
|
+
) }),
|
|
229
|
+
/* @__PURE__ */ t(Se, { size: 12, children: /* @__PURE__ */ t(Ke, { children: /* @__PURE__ */ t(lt, { label: "Page Param Details", size: "small" }) }) }),
|
|
230
|
+
/* @__PURE__ */ s(Se, { size: 12, children: [
|
|
231
|
+
/* @__PURE__ */ t(
|
|
232
|
+
Q,
|
|
233
|
+
{
|
|
234
|
+
name: "pageParams",
|
|
235
|
+
control: v.control,
|
|
236
|
+
render: ({ field: N }) => /* @__PURE__ */ t(
|
|
237
|
+
Vn,
|
|
238
|
+
{
|
|
239
|
+
...N,
|
|
240
|
+
label: "Page Params",
|
|
241
|
+
size: "small",
|
|
242
|
+
placeholder: "Add Page Params",
|
|
243
|
+
value: l,
|
|
244
|
+
onChange: L,
|
|
245
|
+
onKeyDown: (S) => {
|
|
246
|
+
S.key === "Enter" && (S.preventDefault(), ce());
|
|
247
|
+
},
|
|
248
|
+
fullWidth: !0,
|
|
249
|
+
slotProps: {
|
|
250
|
+
input: {
|
|
251
|
+
endAdornment: /* @__PURE__ */ t(Re, { color: "primary", onClick: ce, children: /* @__PURE__ */ t(
|
|
252
|
+
de,
|
|
253
|
+
{
|
|
254
|
+
iconName: "faArrowRightToBracket",
|
|
255
|
+
size: "xs"
|
|
256
|
+
}
|
|
257
|
+
) })
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
/* @__PURE__ */ t(c, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mt: 2 }, children: C.map((N, S) => /* @__PURE__ */ t(
|
|
265
|
+
lt,
|
|
266
|
+
{
|
|
267
|
+
label: N,
|
|
268
|
+
onDelete: () => X(N),
|
|
269
|
+
color: "primary"
|
|
270
|
+
},
|
|
271
|
+
S + 1
|
|
272
|
+
)) }),
|
|
273
|
+
C.length === 0 && /* @__PURE__ */ t(ji, { severity: "info", variant: "outlined", children: "No page params added" })
|
|
274
|
+
] }),
|
|
275
|
+
["FORM", "SEARCH"].includes(v.getValues("formType")) && /* @__PURE__ */ s(he, { children: [
|
|
276
|
+
/* @__PURE__ */ t(Se, { size: 12, children: /* @__PURE__ */ t(Ke, { children: /* @__PURE__ */ t(lt, { label: "Route Details", size: "small" }) }) }),
|
|
277
|
+
/* @__PURE__ */ t(
|
|
278
|
+
ie,
|
|
279
|
+
{
|
|
280
|
+
control: v.control,
|
|
281
|
+
name: "navigationState",
|
|
282
|
+
id: "navigationState",
|
|
283
|
+
fullWidth: !0,
|
|
284
|
+
size: "small",
|
|
285
|
+
label: "Navigation State",
|
|
286
|
+
errors: v.formState.errors,
|
|
287
|
+
disabled: !0
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
] })
|
|
291
|
+
] })
|
|
292
|
+
] }),
|
|
293
|
+
/* @__PURE__ */ s(En, { children: [
|
|
294
|
+
/* @__PURE__ */ t(z, { type: "submit", color: "success", children: "Create" }),
|
|
295
|
+
/* @__PURE__ */ t(z, { onClick: pe, children: "Close" })
|
|
296
|
+
] })
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
An.propTypes = {
|
|
304
|
+
mainFormCtrl: I.any,
|
|
305
|
+
openAddFormModal: I.any,
|
|
306
|
+
setModal: I.any,
|
|
307
|
+
reloadForms: I.any
|
|
308
|
+
};
|
|
309
|
+
const Tt = ({
|
|
310
|
+
permission: T,
|
|
311
|
+
index: B,
|
|
312
|
+
depth: W = 0,
|
|
313
|
+
onEdit: D,
|
|
314
|
+
onRemove: l,
|
|
315
|
+
handleAddChildClick: b,
|
|
316
|
+
isLastChild: C = !1,
|
|
317
|
+
isDynamicFeature: K
|
|
318
|
+
}) => {
|
|
319
|
+
var q;
|
|
320
|
+
const re = Dn(), M = (v) => v.replaceAll(".child.", ".");
|
|
321
|
+
return /* @__PURE__ */ s(c, { sx: { position: "relative", pl: W * 3 }, children: [
|
|
322
|
+
W > 0 && /* @__PURE__ */ s(he, { children: [
|
|
323
|
+
/* @__PURE__ */ t(
|
|
324
|
+
c,
|
|
325
|
+
{
|
|
326
|
+
sx: {
|
|
327
|
+
position: "absolute",
|
|
328
|
+
left: 16,
|
|
329
|
+
top: 0,
|
|
330
|
+
bottom: C ? "50%" : 0,
|
|
331
|
+
width: 2,
|
|
332
|
+
bgcolor: re.palette.divider
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
),
|
|
336
|
+
/* @__PURE__ */ t(
|
|
337
|
+
c,
|
|
338
|
+
{
|
|
339
|
+
sx: {
|
|
340
|
+
position: "absolute",
|
|
341
|
+
left: 16,
|
|
342
|
+
top: 22,
|
|
343
|
+
width: 24,
|
|
344
|
+
height: 2,
|
|
345
|
+
bgcolor: re.palette.divider
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
)
|
|
349
|
+
] }),
|
|
350
|
+
/* @__PURE__ */ s(
|
|
351
|
+
c,
|
|
352
|
+
{
|
|
353
|
+
sx: {
|
|
354
|
+
display: "flex",
|
|
355
|
+
alignItems: "center",
|
|
356
|
+
gap: 1.5,
|
|
357
|
+
border: `1px solid ${re.palette.divider}`,
|
|
358
|
+
borderRadius: 2,
|
|
359
|
+
padding: "8px 12px",
|
|
360
|
+
backgroundColor: W === 0 ? re.palette.background.paper : tr(re.palette.background.paper, 0.8),
|
|
361
|
+
ml: W > 0 ? 3 : 0,
|
|
362
|
+
position: "relative"
|
|
363
|
+
},
|
|
364
|
+
children: [
|
|
365
|
+
W === 0 && /* @__PURE__ */ s(m, { sx: { width: 24, color: "text.secondary" }, children: [
|
|
366
|
+
B + 1,
|
|
367
|
+
"."
|
|
368
|
+
] }),
|
|
369
|
+
/* @__PURE__ */ t(m, { sx: { flexGrow: 1, fontWeight: 500 }, children: M(T.permissionId) }),
|
|
370
|
+
W === 0 && /* @__PURE__ */ t(
|
|
371
|
+
z,
|
|
372
|
+
{
|
|
373
|
+
variant: "outlined",
|
|
374
|
+
size: "small",
|
|
375
|
+
startIcon: /* @__PURE__ */ t(de, { iconName: "faPlus" }),
|
|
376
|
+
onClick: () => b(T),
|
|
377
|
+
children: "Add Child"
|
|
378
|
+
}
|
|
379
|
+
),
|
|
380
|
+
(!T.isDefault || T.isDefault && !K) && /* @__PURE__ */ t(
|
|
381
|
+
Re,
|
|
382
|
+
{
|
|
383
|
+
color: "secondary",
|
|
384
|
+
onClick: () => D(T, B),
|
|
385
|
+
children: /* @__PURE__ */ t(de, { iconName: "faEdit", size: "sm" })
|
|
386
|
+
}
|
|
387
|
+
),
|
|
388
|
+
!T.isDefault && /* @__PURE__ */ t(Re, { color: "error", onClick: () => l(T), children: /* @__PURE__ */ t(de, { iconName: "faTrash", size: "sm" }) })
|
|
389
|
+
]
|
|
390
|
+
}
|
|
391
|
+
),
|
|
392
|
+
((q = T.childPermissions) == null ? void 0 : q.length) > 0 && /* @__PURE__ */ t(Pn, { spacing: 1, sx: { mt: 1 }, children: T.childPermissions.map((v, ce) => /* @__PURE__ */ t(
|
|
393
|
+
Tt,
|
|
394
|
+
{
|
|
395
|
+
permission: v,
|
|
396
|
+
index: ce,
|
|
397
|
+
depth: W + 1,
|
|
398
|
+
onEdit: D,
|
|
399
|
+
onRemove: l,
|
|
400
|
+
handleAddChildClick: b,
|
|
401
|
+
isLastChild: ce === T.childPermissions.length - 1,
|
|
402
|
+
isDynamicFeature: K
|
|
403
|
+
},
|
|
404
|
+
ce
|
|
405
|
+
)) })
|
|
406
|
+
] });
|
|
407
|
+
}, Wn = ({
|
|
408
|
+
permissions: T,
|
|
409
|
+
onEdit: B,
|
|
410
|
+
onRemove: W,
|
|
411
|
+
handleAddChildClick: D,
|
|
412
|
+
isDynamicFeature: l
|
|
413
|
+
}) => /* @__PURE__ */ t(Pn, { spacing: 1, children: T.map((b, C) => /* @__PURE__ */ t(
|
|
414
|
+
Tt,
|
|
415
|
+
{
|
|
416
|
+
permission: b,
|
|
417
|
+
index: C,
|
|
418
|
+
depth: 0,
|
|
419
|
+
onEdit: B,
|
|
420
|
+
onRemove: W,
|
|
421
|
+
handleAddChildClick: D,
|
|
422
|
+
isLastChild: C === T.length - 1,
|
|
423
|
+
isDynamicFeature: l
|
|
424
|
+
},
|
|
425
|
+
C
|
|
426
|
+
)) }), qn = ({
|
|
427
|
+
open: T,
|
|
428
|
+
onClose: B,
|
|
429
|
+
onSave: W,
|
|
430
|
+
formCtrl: D,
|
|
431
|
+
editData: l,
|
|
432
|
+
parentPermissionId: b = null,
|
|
433
|
+
mode: C = "add-parent",
|
|
434
|
+
permissionTypes: K,
|
|
435
|
+
setPermissionTypes: re,
|
|
436
|
+
existingPermissionIds: M,
|
|
437
|
+
isDynamicFeature: q = !0
|
|
438
|
+
}) => {
|
|
439
|
+
var Oe, Ue, xe;
|
|
440
|
+
const [v, ce] = x(""), [X, L] = x([]), [pe, J] = x(""), j = {
|
|
441
|
+
permissionType: "",
|
|
442
|
+
permissionId: "--",
|
|
443
|
+
permissionName: "",
|
|
444
|
+
permissionDesc: "",
|
|
445
|
+
enabled: !0,
|
|
446
|
+
permissionSuffix: "",
|
|
447
|
+
parentPermissionSuffix: ""
|
|
448
|
+
}, ge = {
|
|
449
|
+
backendUrl: "",
|
|
450
|
+
urlType: "",
|
|
451
|
+
queryCodeRequired: l ? (Oe = l == null ? void 0 : l.backendUrl) != null && Oe.trim() && ((Ue = l == null ? void 0 : l.urlType) != null && Ue.trim()) ? !1 : (xe = l == null ? void 0 : l.queryCode) != null && xe.trim() ? !0 : void 0 : void 0,
|
|
452
|
+
queryCode: ""
|
|
453
|
+
}, N = q ? j : { ...j, ...ge }, {
|
|
454
|
+
control: S,
|
|
455
|
+
watch: P,
|
|
456
|
+
handleSubmit: Ze,
|
|
457
|
+
reset: Ce,
|
|
458
|
+
setValue: O,
|
|
459
|
+
getValues: Pe,
|
|
460
|
+
setError: be,
|
|
461
|
+
clearErrors: ve,
|
|
462
|
+
formState: Ae
|
|
463
|
+
} = ft({
|
|
464
|
+
mode: "onChange",
|
|
465
|
+
defaultValues: N
|
|
466
|
+
}), G = P("queryCodeRequired"), E = P("permissionType"), Me = P("permissionSuffix"), Xe = P("backendUrl"), Fe = P("queryCode"), ht = [
|
|
467
|
+
{ label: "Query", value: !0 },
|
|
468
|
+
{ label: "API", value: !1 }
|
|
469
|
+
], $ = (h = {}) => ({ ...q ? j : { ...j, ...ge }, ...h }), Ne = P("parentPermissionSuffix"), We = (h) => h.trim().toLowerCase().split(/\s+/).map(
|
|
470
|
+
(p, w) => w === 0 ? p : p.charAt(0).toUpperCase() + p.slice(1)
|
|
471
|
+
).join(""), et = async (h) => {
|
|
472
|
+
const p = (await H({
|
|
473
|
+
code: "GET_ALL_QUERY_CODE",
|
|
474
|
+
parameters: { search: h }
|
|
475
|
+
})).data;
|
|
476
|
+
L((p == null ? void 0 : p.result) || []);
|
|
477
|
+
};
|
|
478
|
+
se(() => {
|
|
479
|
+
!q && (async () => {
|
|
480
|
+
const p = (await H({
|
|
481
|
+
code: "GET_ALL_QUERY_CODE",
|
|
482
|
+
parameters: {
|
|
483
|
+
search: Pe("queryCode") ? Pe("queryCode") : ""
|
|
484
|
+
}
|
|
485
|
+
})).data;
|
|
486
|
+
L((p == null ? void 0 : p.result) || []), J(Pe("queryCode"));
|
|
487
|
+
})();
|
|
488
|
+
}, [Fe]), se(() => {
|
|
489
|
+
G === !0 && !Xe ? (O("backendUrl", ""), O("urlType", "")) : G === !1 && !Fe && O("queryCode", "");
|
|
490
|
+
}, [G]), se(() => {
|
|
491
|
+
var h, p, w;
|
|
492
|
+
if (T) {
|
|
493
|
+
if (C === "edit" && l) {
|
|
494
|
+
const _ = {
|
|
495
|
+
permissionType: l.permissionType || "",
|
|
496
|
+
permissionId: l.permissionId || "--",
|
|
497
|
+
permissionName: l.permissionName || "",
|
|
498
|
+
permissionDesc: l.permissionDesc || "",
|
|
499
|
+
enabled: !!l.enabled,
|
|
500
|
+
permissionSuffix: ""
|
|
501
|
+
};
|
|
502
|
+
if (q)
|
|
503
|
+
Ce(_);
|
|
504
|
+
else {
|
|
505
|
+
const ae = ((h = l == null ? void 0 : l.backendUrl) == null ? void 0 : h.trim()) && ((p = l == null ? void 0 : l.urlType) == null ? void 0 : p.trim()), V = (w = l == null ? void 0 : l.queryCode) == null ? void 0 : w.trim();
|
|
506
|
+
Ce({
|
|
507
|
+
..._,
|
|
508
|
+
urlType: l.urlType || "",
|
|
509
|
+
backendUrl: l.backendUrl || "",
|
|
510
|
+
queryCode: l.queryCode || "",
|
|
511
|
+
queryCodeRequired: l ? ae ? !1 : V ? !0 : void 0 : void 0
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
if (C === "add-child" && b) {
|
|
517
|
+
const _ = b.split(".")[0] || "";
|
|
518
|
+
Ce(
|
|
519
|
+
$({
|
|
520
|
+
permissionType: _,
|
|
521
|
+
permissionId: b,
|
|
522
|
+
permissionName: "",
|
|
523
|
+
permissionDesc: "",
|
|
524
|
+
enabled: !0,
|
|
525
|
+
permissionSuffix: "",
|
|
526
|
+
urlType: "",
|
|
527
|
+
backendUrl: "",
|
|
528
|
+
queryCodeRequired: void 0,
|
|
529
|
+
queryCode: ""
|
|
530
|
+
})
|
|
531
|
+
);
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
Ce($());
|
|
535
|
+
}
|
|
536
|
+
}, [T, C, l, b, Ce]), se(() => {
|
|
537
|
+
if (C === "add-parent") {
|
|
538
|
+
const h = (E == null ? void 0 : E.type) === "menu" ? "view" : E == null ? void 0 : E.type;
|
|
539
|
+
if (!h) {
|
|
540
|
+
O("permissionId", "--");
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
const p = D.getValues("menuType") || "menuType", w = D.getValues("featureConstant") || "feature";
|
|
544
|
+
let _;
|
|
545
|
+
if (q)
|
|
546
|
+
_ = `${h}.${p}.${w}`;
|
|
547
|
+
else {
|
|
548
|
+
const ae = D.getValues("menuName");
|
|
549
|
+
_ = `${h}.${p}.${We(ae)}`;
|
|
550
|
+
}
|
|
551
|
+
Ne != null && Ne.trim() && (_ = `${_}.${Ne.trim()}`), O("permissionId", _);
|
|
552
|
+
}
|
|
553
|
+
}, [E, Ne, C]), se(() => {
|
|
554
|
+
G === !0 && !Xe ? (O("backendUrl", ""), O("urlType", "")) : G === !1 && !Fe && O("queryCode", "");
|
|
555
|
+
}, [G]), se(() => {
|
|
556
|
+
if (C === "add-child" && b !== null) {
|
|
557
|
+
const h = b.split(".")[0] || "", p = `${b}.child`, w = Me ? `${p}.${Me}` : p;
|
|
558
|
+
O("permissionId", w), O("permissionType", h);
|
|
559
|
+
}
|
|
560
|
+
}, [Me, C, b, O]);
|
|
561
|
+
const tt = (h) => {
|
|
562
|
+
const p = {
|
|
563
|
+
permissionId: h.permissionId,
|
|
564
|
+
permissionType: h.permissionType || (b ? b.split(".")[0] : ""),
|
|
565
|
+
permissionName: h.permissionName,
|
|
566
|
+
permissionDesc: h.permissionDesc,
|
|
567
|
+
enabled: h.enabled,
|
|
568
|
+
backendUrl: h != null && h.backendUrl && !G ? h.backendUrl : null,
|
|
569
|
+
urlType: h != null && h.urlType && !G ? h.urlType : null,
|
|
570
|
+
queryCode: h != null && h.queryCode && G ? h.queryCode : null,
|
|
571
|
+
childPermissions: [],
|
|
572
|
+
isDefault: l != null && l.isDefault ? l == null ? void 0 : l.isDefault : !1
|
|
573
|
+
};
|
|
574
|
+
W(p), Ce(), B();
|
|
575
|
+
}, Be = async (h) => !h || h === "--" ? void 0 : (await H({
|
|
576
|
+
code: "CHECK_UNIQUE_PERMISSION_ID",
|
|
577
|
+
parameters: { permissionId: h }
|
|
578
|
+
})).data.result[0].exists;
|
|
579
|
+
return /* @__PURE__ */ s(Fn, { open: T, onClose: B, fullWidth: !0, maxWidth: "sm", children: [
|
|
580
|
+
/* @__PURE__ */ t(Tn, { children: C === "edit" ? "Edit Permission" : "Add Permission" }),
|
|
581
|
+
/* @__PURE__ */ s(
|
|
582
|
+
_n,
|
|
583
|
+
{
|
|
584
|
+
sx: { display: "flex", flexDirection: "column", gap: 2, mt: 1 },
|
|
585
|
+
children: [
|
|
586
|
+
C !== "add-child" && C !== "edit" && /* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
587
|
+
/* @__PURE__ */ s(
|
|
588
|
+
m,
|
|
589
|
+
{
|
|
590
|
+
sx: { minWidth: 160, fontWeight: 500, color: "text.secondary" },
|
|
591
|
+
children: [
|
|
592
|
+
"Permission Type",
|
|
593
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" })
|
|
594
|
+
]
|
|
595
|
+
}
|
|
596
|
+
),
|
|
597
|
+
/* @__PURE__ */ t(ne, { fullWidth: !0, size: "small", children: /* @__PURE__ */ t(
|
|
598
|
+
Q,
|
|
599
|
+
{
|
|
600
|
+
name: "permissionType",
|
|
601
|
+
control: S,
|
|
602
|
+
rules: { required: !0 },
|
|
603
|
+
render: ({ field: h }) => /* @__PURE__ */ t(
|
|
604
|
+
De,
|
|
605
|
+
{
|
|
606
|
+
id: "permissionType",
|
|
607
|
+
name: "permissionType",
|
|
608
|
+
control: S,
|
|
609
|
+
singleSelect: !0,
|
|
610
|
+
checkEquality: "type",
|
|
611
|
+
freeSolo: !0,
|
|
612
|
+
disableClearable: !1,
|
|
613
|
+
placeholder: "Choose permission type",
|
|
614
|
+
options: K ? !v || K.some(
|
|
615
|
+
(p) => p.type.toLowerCase() === v.toLowerCase()
|
|
616
|
+
) ? K : [
|
|
617
|
+
...K,
|
|
618
|
+
{ type: `__add_new__${v}`, isNew: !0 }
|
|
619
|
+
] : [],
|
|
620
|
+
getOptionLabel: (p) => p.isNew ? `Add "${p.type.replace("__add_new__", "")}"` : p.type,
|
|
621
|
+
onInputChange: (p, w) => ce(w),
|
|
622
|
+
onChange: (p, w) => {
|
|
623
|
+
if (!w) {
|
|
624
|
+
h.onChange(null), O("permissionId", "--");
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
if (w.isNew) {
|
|
628
|
+
const _ = w.type.replace("__add_new__", ""), ae = { type: _ };
|
|
629
|
+
re(
|
|
630
|
+
(V) => V.some((Te) => Te.type === _) ? V : [...V, ae]
|
|
631
|
+
), h.onChange(ae);
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
h.onChange(w);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
)
|
|
638
|
+
}
|
|
639
|
+
) })
|
|
640
|
+
] }),
|
|
641
|
+
C === "add-child" ? /* @__PURE__ */ t(he, { children: /* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
642
|
+
/* @__PURE__ */ s(
|
|
643
|
+
m,
|
|
644
|
+
{
|
|
645
|
+
sx: {
|
|
646
|
+
minWidth: 160,
|
|
647
|
+
fontWeight: 500,
|
|
648
|
+
color: "text.secondary"
|
|
649
|
+
},
|
|
650
|
+
children: [
|
|
651
|
+
"Permission ID",
|
|
652
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" })
|
|
653
|
+
]
|
|
654
|
+
}
|
|
655
|
+
),
|
|
656
|
+
/* @__PURE__ */ s(c, { sx: { display: "flex", gap: 1, flexGrow: 1 }, children: [
|
|
657
|
+
/* @__PURE__ */ t(
|
|
658
|
+
ie,
|
|
659
|
+
{
|
|
660
|
+
control: S,
|
|
661
|
+
name: "parentPermissionDisplay",
|
|
662
|
+
value: `${b}.child.`,
|
|
663
|
+
disabled: !0,
|
|
664
|
+
fullWidth: !0
|
|
665
|
+
}
|
|
666
|
+
),
|
|
667
|
+
/* @__PURE__ */ t(
|
|
668
|
+
ie,
|
|
669
|
+
{
|
|
670
|
+
control: S,
|
|
671
|
+
name: "permissionSuffix",
|
|
672
|
+
placeholder: "Enter child suffix",
|
|
673
|
+
errors: Ae.errors,
|
|
674
|
+
fullWidth: !0,
|
|
675
|
+
onChange: async (h) => {
|
|
676
|
+
const p = h.target.value.trim();
|
|
677
|
+
if (O("permissionSuffix", p), p.toLowerCase() === "child") {
|
|
678
|
+
be("permissionSuffix", {
|
|
679
|
+
type: "manual",
|
|
680
|
+
message: "Suffix cannot be 'child'"
|
|
681
|
+
});
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
ve("permissionSuffix");
|
|
685
|
+
const w = `${b}.child.${p}`;
|
|
686
|
+
if (O("permissionId", w), M != null && M.has(w)) {
|
|
687
|
+
be("permissionSuffix", {
|
|
688
|
+
type: "manual",
|
|
689
|
+
message: "Permission ID already exists"
|
|
690
|
+
});
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
await Be(w) ? be("permissionSuffix", {
|
|
694
|
+
type: "manual",
|
|
695
|
+
message: "Permission ID already exists in DB"
|
|
696
|
+
}) : ve("permissionSuffix");
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
)
|
|
700
|
+
] })
|
|
701
|
+
] }) }) : C === "add-parent" ? E != null && E.type ? /* @__PURE__ */ t(he, { children: /* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
702
|
+
/* @__PURE__ */ s(
|
|
703
|
+
m,
|
|
704
|
+
{
|
|
705
|
+
sx: {
|
|
706
|
+
minWidth: 160,
|
|
707
|
+
fontWeight: 500,
|
|
708
|
+
color: "text.secondary"
|
|
709
|
+
},
|
|
710
|
+
children: [
|
|
711
|
+
"Permission ID",
|
|
712
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" })
|
|
713
|
+
]
|
|
714
|
+
}
|
|
715
|
+
),
|
|
716
|
+
/* @__PURE__ */ t(
|
|
717
|
+
ie,
|
|
718
|
+
{
|
|
719
|
+
control: S,
|
|
720
|
+
name: "baseId",
|
|
721
|
+
value: `${(E == null ? void 0 : E.type) === "menu" ? "view" : E == null ? void 0 : E.type}.${D.getValues("menuType")}.${q ? D.getValues("featureConstant") : We(D.getValues("menuName"))}.`,
|
|
722
|
+
disabled: !0,
|
|
723
|
+
fullWidth: !0
|
|
724
|
+
}
|
|
725
|
+
),
|
|
726
|
+
/* @__PURE__ */ t(
|
|
727
|
+
ie,
|
|
728
|
+
{
|
|
729
|
+
control: S,
|
|
730
|
+
name: "parentPermissionSuffix",
|
|
731
|
+
placeholder: "Enter suffix",
|
|
732
|
+
errors: Ae.errors,
|
|
733
|
+
fullWidth: !0,
|
|
734
|
+
onChange: async (h) => {
|
|
735
|
+
const p = h.target.value.trim();
|
|
736
|
+
if (O("parentPermissionSuffix", p), p.toLowerCase() === "child") {
|
|
737
|
+
be("parentPermissionSuffix", {
|
|
738
|
+
type: "manual",
|
|
739
|
+
message: "Suffix cannot be 'child'"
|
|
740
|
+
});
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
ve("parentPermissionSuffix");
|
|
744
|
+
const w = (E == null ? void 0 : E.type) === "menu" ? "view" : (E == null ? void 0 : E.type) || E || "", _ = D.getValues("menuType"), ae = D.getValues("featureConstant");
|
|
745
|
+
let V;
|
|
746
|
+
if (q ? V = `${w}.${_}.${ae}.${p}` : V = `${w}.${_}.${We(D.getValues("menuName"))}.${p}`, O("permissionId", V), M != null && M.has(V)) {
|
|
747
|
+
be("parentPermissionSuffix", {
|
|
748
|
+
type: "manual",
|
|
749
|
+
message: "Permission ID already exists"
|
|
750
|
+
});
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
await Be(V) ? be("parentPermissionSuffix", {
|
|
754
|
+
type: "manual",
|
|
755
|
+
message: "Permission ID already exists in DB"
|
|
756
|
+
}) : ve("parentPermissionSuffix");
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
)
|
|
760
|
+
] }) }) : /* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
761
|
+
/* @__PURE__ */ s(
|
|
762
|
+
m,
|
|
763
|
+
{
|
|
764
|
+
sx: { minWidth: 160, fontWeight: 500, color: "text.secondary" },
|
|
765
|
+
children: [
|
|
766
|
+
"Permission ID",
|
|
767
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" })
|
|
768
|
+
]
|
|
769
|
+
}
|
|
770
|
+
),
|
|
771
|
+
/* @__PURE__ */ t(
|
|
772
|
+
ie,
|
|
773
|
+
{
|
|
774
|
+
control: S,
|
|
775
|
+
name: "permissionId",
|
|
776
|
+
value: "--",
|
|
777
|
+
disabled: !0,
|
|
778
|
+
fullWidth: !0
|
|
779
|
+
}
|
|
780
|
+
)
|
|
781
|
+
] }) : /* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
782
|
+
/* @__PURE__ */ s(
|
|
783
|
+
m,
|
|
784
|
+
{
|
|
785
|
+
sx: {
|
|
786
|
+
minWidth: 160,
|
|
787
|
+
fontWeight: 500,
|
|
788
|
+
color: "text.secondary"
|
|
789
|
+
},
|
|
790
|
+
children: [
|
|
791
|
+
"Permission ID",
|
|
792
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" })
|
|
793
|
+
]
|
|
794
|
+
}
|
|
795
|
+
),
|
|
796
|
+
/* @__PURE__ */ t(
|
|
797
|
+
ie,
|
|
798
|
+
{
|
|
799
|
+
control: S,
|
|
800
|
+
name: "permissionId",
|
|
801
|
+
label: "Permission ID",
|
|
802
|
+
disabled: !0,
|
|
803
|
+
fullWidth: !0
|
|
804
|
+
}
|
|
805
|
+
)
|
|
806
|
+
] }),
|
|
807
|
+
/* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
808
|
+
/* @__PURE__ */ s(
|
|
809
|
+
m,
|
|
810
|
+
{
|
|
811
|
+
sx: { minWidth: 160, fontWeight: 500, color: "text.secondary" },
|
|
812
|
+
children: [
|
|
813
|
+
"Permission Name",
|
|
814
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" })
|
|
815
|
+
]
|
|
816
|
+
}
|
|
817
|
+
),
|
|
818
|
+
/* @__PURE__ */ t(
|
|
819
|
+
Q,
|
|
820
|
+
{
|
|
821
|
+
name: "permissionName",
|
|
822
|
+
control: S,
|
|
823
|
+
rules: { required: !0 },
|
|
824
|
+
render: ({ field: h }) => /* @__PURE__ */ t(
|
|
825
|
+
ie,
|
|
826
|
+
{
|
|
827
|
+
control: S,
|
|
828
|
+
...h,
|
|
829
|
+
placeholder: "Enter name"
|
|
830
|
+
}
|
|
831
|
+
)
|
|
832
|
+
}
|
|
833
|
+
)
|
|
834
|
+
] }),
|
|
835
|
+
/* @__PURE__ */ s(c, { display: "flex", alignItems: "flex-start", gap: 2, children: [
|
|
836
|
+
/* @__PURE__ */ t(
|
|
837
|
+
m,
|
|
838
|
+
{
|
|
839
|
+
sx: {
|
|
840
|
+
minWidth: 160,
|
|
841
|
+
fontWeight: 500,
|
|
842
|
+
color: "text.secondary",
|
|
843
|
+
mt: 1
|
|
844
|
+
},
|
|
845
|
+
children: "Description"
|
|
846
|
+
}
|
|
847
|
+
),
|
|
848
|
+
/* @__PURE__ */ t(
|
|
849
|
+
Q,
|
|
850
|
+
{
|
|
851
|
+
name: "permissionDesc",
|
|
852
|
+
control: S,
|
|
853
|
+
render: ({ field: h }) => /* @__PURE__ */ t(
|
|
854
|
+
dr,
|
|
855
|
+
{
|
|
856
|
+
control: S,
|
|
857
|
+
...h,
|
|
858
|
+
placeholder: "Enter description (optional)",
|
|
859
|
+
minRows: 2
|
|
860
|
+
}
|
|
861
|
+
)
|
|
862
|
+
}
|
|
863
|
+
)
|
|
864
|
+
] }),
|
|
865
|
+
!q && /* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
866
|
+
/* @__PURE__ */ s(
|
|
867
|
+
m,
|
|
868
|
+
{
|
|
869
|
+
sx: {
|
|
870
|
+
minWidth: 160,
|
|
871
|
+
fontWeight: 500,
|
|
872
|
+
color: "text.secondary"
|
|
873
|
+
},
|
|
874
|
+
children: [
|
|
875
|
+
"Type",
|
|
876
|
+
" "
|
|
877
|
+
]
|
|
878
|
+
}
|
|
879
|
+
),
|
|
880
|
+
/* @__PURE__ */ t(
|
|
881
|
+
fr,
|
|
882
|
+
{
|
|
883
|
+
name: "queryCodeRequired",
|
|
884
|
+
control: S,
|
|
885
|
+
options: ht,
|
|
886
|
+
direction: "row",
|
|
887
|
+
dataTestId: "queryOrApi"
|
|
888
|
+
}
|
|
889
|
+
)
|
|
890
|
+
] }),
|
|
891
|
+
!q && G !== void 0 && /* @__PURE__ */ t(he, { children: G === !1 ? /* @__PURE__ */ s(he, { children: [
|
|
892
|
+
/* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
893
|
+
/* @__PURE__ */ t(
|
|
894
|
+
m,
|
|
895
|
+
{
|
|
896
|
+
sx: {
|
|
897
|
+
minWidth: 160,
|
|
898
|
+
fontWeight: 500,
|
|
899
|
+
color: "text.secondary"
|
|
900
|
+
},
|
|
901
|
+
children: "URL Type"
|
|
902
|
+
}
|
|
903
|
+
),
|
|
904
|
+
/* @__PURE__ */ t(ne, { fullWidth: !0, size: "small", children: /* @__PURE__ */ t(
|
|
905
|
+
Q,
|
|
906
|
+
{
|
|
907
|
+
name: "urlType",
|
|
908
|
+
control: S,
|
|
909
|
+
render: ({ field: h }) => /* @__PURE__ */ s(Zi, { ...h, displayEmpty: !0, children: [
|
|
910
|
+
/* @__PURE__ */ t(Cn, { value: "", children: /* @__PURE__ */ t("em", { children: "Select Type" }) }),
|
|
911
|
+
["GET", "POST", "PUT", "DELETE"].map((p) => /* @__PURE__ */ t(Cn, { value: p, children: p }, p))
|
|
912
|
+
] })
|
|
913
|
+
}
|
|
914
|
+
) })
|
|
915
|
+
] }),
|
|
916
|
+
/* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
917
|
+
/* @__PURE__ */ t(
|
|
918
|
+
m,
|
|
919
|
+
{
|
|
920
|
+
sx: {
|
|
921
|
+
minWidth: 160,
|
|
922
|
+
fontWeight: 500,
|
|
923
|
+
color: "text.secondary"
|
|
924
|
+
},
|
|
925
|
+
children: "Backend URL"
|
|
926
|
+
}
|
|
927
|
+
),
|
|
928
|
+
/* @__PURE__ */ t(
|
|
929
|
+
Q,
|
|
930
|
+
{
|
|
931
|
+
name: "backendUrl",
|
|
932
|
+
control: S,
|
|
933
|
+
render: ({ field: h }) => /* @__PURE__ */ t(
|
|
934
|
+
ie,
|
|
935
|
+
{
|
|
936
|
+
control: S,
|
|
937
|
+
...h,
|
|
938
|
+
placeholder: "Enter URL"
|
|
939
|
+
}
|
|
940
|
+
)
|
|
941
|
+
}
|
|
942
|
+
)
|
|
943
|
+
] })
|
|
944
|
+
] }) : /* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
945
|
+
/* @__PURE__ */ t(
|
|
946
|
+
m,
|
|
947
|
+
{
|
|
948
|
+
sx: {
|
|
949
|
+
minWidth: 160,
|
|
950
|
+
fontWeight: 500,
|
|
951
|
+
color: "text.secondary"
|
|
952
|
+
},
|
|
953
|
+
children: "Query Code"
|
|
954
|
+
}
|
|
955
|
+
),
|
|
956
|
+
/* @__PURE__ */ t(
|
|
957
|
+
Q,
|
|
958
|
+
{
|
|
959
|
+
name: "queryCode",
|
|
960
|
+
control: S,
|
|
961
|
+
render: ({ field: h, fieldState: { error: p } }) => /* @__PURE__ */ t(
|
|
962
|
+
De,
|
|
963
|
+
{
|
|
964
|
+
id: "queryCode",
|
|
965
|
+
name: "queryCode",
|
|
966
|
+
control: S,
|
|
967
|
+
options: X,
|
|
968
|
+
getOptionLabel: (w) => (w == null ? void 0 : w.code) || "",
|
|
969
|
+
checkEquality: "code",
|
|
970
|
+
inputValue: pe,
|
|
971
|
+
disableClearable: !1,
|
|
972
|
+
value: (X == null ? void 0 : X.find((w) => w.code === h.value)) || null,
|
|
973
|
+
onInputChange: (w, _, ae) => {
|
|
974
|
+
ae === "input" && (J(_), et(_));
|
|
975
|
+
},
|
|
976
|
+
singleSelect: !0,
|
|
977
|
+
onChange: (w, _) => {
|
|
978
|
+
h.onChange((_ == null ? void 0 : _.code) || ""), J((_ == null ? void 0 : _.code) || "");
|
|
979
|
+
},
|
|
980
|
+
placeholder: "Search Query Code...",
|
|
981
|
+
errors: p,
|
|
982
|
+
fullWidth: !0,
|
|
983
|
+
freeSolo: !1
|
|
984
|
+
}
|
|
985
|
+
)
|
|
986
|
+
}
|
|
987
|
+
)
|
|
988
|
+
] }) }),
|
|
989
|
+
/* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
990
|
+
/* @__PURE__ */ s(
|
|
991
|
+
m,
|
|
992
|
+
{
|
|
993
|
+
sx: { minWidth: 160, fontWeight: 500, color: "text.secondary" },
|
|
994
|
+
children: [
|
|
995
|
+
"Is Active",
|
|
996
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" })
|
|
997
|
+
]
|
|
998
|
+
}
|
|
999
|
+
),
|
|
1000
|
+
/* @__PURE__ */ t(
|
|
1001
|
+
Q,
|
|
1002
|
+
{
|
|
1003
|
+
name: "enabled",
|
|
1004
|
+
control: S,
|
|
1005
|
+
render: ({ field: h }) => /* @__PURE__ */ t(
|
|
1006
|
+
we,
|
|
1007
|
+
{
|
|
1008
|
+
...h,
|
|
1009
|
+
disabled: (l == null ? void 0 : l.isDefault) && !q,
|
|
1010
|
+
checked: h.value,
|
|
1011
|
+
onChange: (p) => h.onChange(p.target.checked)
|
|
1012
|
+
}
|
|
1013
|
+
)
|
|
1014
|
+
}
|
|
1015
|
+
)
|
|
1016
|
+
] })
|
|
1017
|
+
]
|
|
1018
|
+
}
|
|
1019
|
+
),
|
|
1020
|
+
/* @__PURE__ */ s(En, { children: [
|
|
1021
|
+
/* @__PURE__ */ t(z, { onClick: B, children: "Cancel" }),
|
|
1022
|
+
/* @__PURE__ */ t(
|
|
1023
|
+
z,
|
|
1024
|
+
{
|
|
1025
|
+
onClick: Ze(tt),
|
|
1026
|
+
variant: "contained",
|
|
1027
|
+
disabled: !Ae.isValid || Object.keys(Ae.errors).length > 0,
|
|
1028
|
+
children: C === "edit" ? "Update" : C === "add-child" ? "Add Child" : "Add"
|
|
1029
|
+
}
|
|
1030
|
+
)
|
|
1031
|
+
] })
|
|
1032
|
+
] });
|
|
1033
|
+
}, Rn = ({
|
|
1034
|
+
open: T,
|
|
1035
|
+
onClose: B,
|
|
1036
|
+
onSave: W,
|
|
1037
|
+
entityData: D,
|
|
1038
|
+
permissions: l = []
|
|
1039
|
+
}) => {
|
|
1040
|
+
const { control: b, watch: C, getValues: K } = ft({
|
|
1041
|
+
defaultValues: {
|
|
1042
|
+
noStartDate: !0,
|
|
1043
|
+
noEndDate: !0,
|
|
1044
|
+
startDate: null,
|
|
1045
|
+
endDate: null,
|
|
1046
|
+
isBackendOnly: !1
|
|
1047
|
+
}
|
|
1048
|
+
}), re = C("noStartDate"), M = C("noEndDate"), q = C("startDate"), v = C("endDate"), ce = () => {
|
|
1049
|
+
const L = K();
|
|
1050
|
+
X(L);
|
|
1051
|
+
}, X = (L) => {
|
|
1052
|
+
const pe = [];
|
|
1053
|
+
D.forEach((J) => {
|
|
1054
|
+
if (J.type === "user") {
|
|
1055
|
+
const j = Array.isArray(J.id) ? J.id : [J.id];
|
|
1056
|
+
pe.push(
|
|
1057
|
+
...j.map((ge) => ({
|
|
1058
|
+
entityType: "user",
|
|
1059
|
+
user_id: ge,
|
|
1060
|
+
name: J.name,
|
|
1061
|
+
startDate: L.noStartDate ? null : L.startDate,
|
|
1062
|
+
endDate: L.noEndDate ? null : L.endDate,
|
|
1063
|
+
isBackendOnly: L.isBackendOnly,
|
|
1064
|
+
permissions: JSON.parse(JSON.stringify(l))
|
|
1065
|
+
}))
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
J.type === "role" && J.ids.forEach((j, ge) => {
|
|
1069
|
+
pe.push({
|
|
1070
|
+
entityType: "role",
|
|
1071
|
+
role_id: j,
|
|
1072
|
+
name: J.names[ge],
|
|
1073
|
+
startDate: L.noStartDate ? null : L.startDate,
|
|
1074
|
+
endDate: L.noEndDate ? null : L.endDate,
|
|
1075
|
+
isBackendOnly: L.isBackendOnly,
|
|
1076
|
+
permissions: JSON.parse(JSON.stringify(l))
|
|
1077
|
+
});
|
|
1078
|
+
});
|
|
1079
|
+
}), pe.forEach((J) => W(J)), B();
|
|
1080
|
+
};
|
|
1081
|
+
return /* @__PURE__ */ t(Xi, { open: T, onClose: B, children: /* @__PURE__ */ t(c, { className: "fixed inset-0 flex items-start justify-center z-50 bg-opacity-10 overflow-y-auto", children: /* @__PURE__ */ s(er, { className: "relative mt-10 p-4 shadow-lg flex flex-col rounded-xl", children: [
|
|
1082
|
+
/* @__PURE__ */ s(Y, { className: "flex justify-between items-center mb-4", children: [
|
|
1083
|
+
/* @__PURE__ */ t(m, { variant: "h6", children: "Grant Access" }),
|
|
1084
|
+
/* @__PURE__ */ t(Re, { onClick: B, children: /* @__PURE__ */ t(de, { iconName: "faXmark", size: "sm" }) })
|
|
1085
|
+
] }),
|
|
1086
|
+
/* @__PURE__ */ t(Y, { container: !0, spacing: 2, children: /* @__PURE__ */ s(Y, { item: !0, xs: 12, display: "flex", gap: 2, children: [
|
|
1087
|
+
/* @__PURE__ */ s(c, { display: "flex", flexDirection: "column", flex: 1, children: [
|
|
1088
|
+
/* @__PURE__ */ t(
|
|
1089
|
+
vt,
|
|
1090
|
+
{
|
|
1091
|
+
label: "No Start Date",
|
|
1092
|
+
name: "noStartDate",
|
|
1093
|
+
control: b,
|
|
1094
|
+
sx: { mb: 1 }
|
|
1095
|
+
}
|
|
1096
|
+
),
|
|
1097
|
+
/* @__PURE__ */ t(
|
|
1098
|
+
wn,
|
|
1099
|
+
{
|
|
1100
|
+
name: "startDate",
|
|
1101
|
+
control: b,
|
|
1102
|
+
disabled: re,
|
|
1103
|
+
maxDate: v || void 0
|
|
1104
|
+
}
|
|
1105
|
+
)
|
|
1106
|
+
] }),
|
|
1107
|
+
/* @__PURE__ */ s(c, { display: "flex", flexDirection: "column", flex: 1, children: [
|
|
1108
|
+
/* @__PURE__ */ t(
|
|
1109
|
+
vt,
|
|
1110
|
+
{
|
|
1111
|
+
label: "No End Date",
|
|
1112
|
+
name: "noEndDate",
|
|
1113
|
+
control: b,
|
|
1114
|
+
sx: { mb: 1 }
|
|
1115
|
+
}
|
|
1116
|
+
),
|
|
1117
|
+
/* @__PURE__ */ t(
|
|
1118
|
+
wn,
|
|
1119
|
+
{
|
|
1120
|
+
name: "endDate",
|
|
1121
|
+
control: b,
|
|
1122
|
+
disabled: M,
|
|
1123
|
+
minDate: q || void 0
|
|
1124
|
+
}
|
|
1125
|
+
)
|
|
1126
|
+
] })
|
|
1127
|
+
] }) }),
|
|
1128
|
+
/* @__PURE__ */ t(c, { mt: 2, children: /* @__PURE__ */ t(
|
|
1129
|
+
vt,
|
|
1130
|
+
{
|
|
1131
|
+
label: "Is Backend Only?",
|
|
1132
|
+
name: "isBackendOnly",
|
|
1133
|
+
control: b
|
|
1134
|
+
}
|
|
1135
|
+
) }),
|
|
1136
|
+
/* @__PURE__ */ s(Y, { className: "flex justify-end gap-2 mt-4", children: [
|
|
1137
|
+
/* @__PURE__ */ t(z, { type: "button", variant: "outlined", onClick: B, children: "Cancel" }),
|
|
1138
|
+
/* @__PURE__ */ t(z, { variant: "contained", type: "button", onClick: ce, children: "Save" })
|
|
1139
|
+
] })
|
|
1140
|
+
] }) }) });
|
|
1141
|
+
}, _t = ({ permissions: T, onToggle: B, isChild: W = !1 }) => {
|
|
1142
|
+
const D = (l) => l.replaceAll(".child", "");
|
|
1143
|
+
return T.map((l, b) => {
|
|
1144
|
+
var C;
|
|
1145
|
+
return /* @__PURE__ */ s(
|
|
1146
|
+
c,
|
|
1147
|
+
{
|
|
1148
|
+
display: "flex",
|
|
1149
|
+
flexDirection: "column",
|
|
1150
|
+
gap: 1,
|
|
1151
|
+
ml: W ? 2 : 0,
|
|
1152
|
+
children: [
|
|
1153
|
+
/* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 1, children: [
|
|
1154
|
+
/* @__PURE__ */ t(
|
|
1155
|
+
we,
|
|
1156
|
+
{
|
|
1157
|
+
sx: {
|
|
1158
|
+
transform: "scale(0.75)",
|
|
1159
|
+
transformOrigin: "left center"
|
|
1160
|
+
},
|
|
1161
|
+
checked: !!l.enabled,
|
|
1162
|
+
disabled: W,
|
|
1163
|
+
onChange: () => {
|
|
1164
|
+
W || B(l);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
),
|
|
1168
|
+
/* @__PURE__ */ t(m, { variant: "subtitle1", children: D(l.permissionId) })
|
|
1169
|
+
] }),
|
|
1170
|
+
((C = l.childPermissions) == null ? void 0 : C.length) > 0 && /* @__PURE__ */ t(
|
|
1171
|
+
_t,
|
|
1172
|
+
{
|
|
1173
|
+
permissions: l.childPermissions,
|
|
1174
|
+
onToggle: B,
|
|
1175
|
+
isChild: !0
|
|
1176
|
+
}
|
|
1177
|
+
)
|
|
1178
|
+
]
|
|
1179
|
+
},
|
|
1180
|
+
b
|
|
1181
|
+
);
|
|
1182
|
+
});
|
|
1183
|
+
};
|
|
1184
|
+
function Jr() {
|
|
1185
|
+
var tn, nn, rn, an, sn, on, ln, dn, cn, un, mn;
|
|
1186
|
+
const { translate: T } = cr(), B = ir(null), W = sr(), D = or(), { isNew: l } = W.state || {}, b = Nn(
|
|
1187
|
+
() => new URLSearchParams(W.search),
|
|
1188
|
+
[W.search]
|
|
1189
|
+
), C = Dn(), [K, re] = x([]), [M, q] = x(!1), [v, ce] = x([]), [X, L] = x([]), [pe, J] = x(), [j, ge] = x({}), [N, S] = x(!1), [P, Ze] = x(!1), [Ce, O] = x(""), [Pe, be] = x(""), [ve, Ae] = x(""), [G, E] = x(), [Me, Xe] = x([]), [Fe, ht] = x(!1), [$, Ne] = x(0), [We, et] = x(!1), [tt, Be] = x([]), [Oe, Ue] = x([]), [xe, h] = x([]), [p, w] = x([]), [_, ae] = x([]), [V, Te] = x({}), [ze, Le] = x([]), [$e, Mn] = x({}), [ue, Qe] = x([]), [Bn, Je] = x(!1), [je, nt] = x("add-parent"), [pt, it] = x(null), [On, rt] = x(null), [Un, at] = x(null), [zn, gt] = x(!1), [Ln, $n] = x(null), [ke, qe] = x([]), [Qn, Vt] = x(!1), [_e, st] = x(!1), [Et, Jn] = x(!1), [Z, Dt] = x({ value: !1, length: 0 }), [jn, Gn] = x([
|
|
1190
|
+
{ type: "update" },
|
|
1191
|
+
{ type: "menu" },
|
|
1192
|
+
{ type: "create" },
|
|
1193
|
+
{ type: "download" },
|
|
1194
|
+
{ type: "execute" }
|
|
1195
|
+
]), [Ie, Hn] = x([]), [Yn, Ge] = x(""), [Kn, He] = x(""), [yt, bt] = x({
|
|
1196
|
+
basicConfig: !0,
|
|
1197
|
+
trainingConfig: !1,
|
|
1198
|
+
notificationConfig: !1
|
|
1199
|
+
}), [Pt, Zn] = nr.useState(null), Xn = (e) => tt.includes(e), [ei, At] = x(/* @__PURE__ */ new Set()), ti = ar((e) => e.theme.mode), R = [
|
|
1200
|
+
{ key: "featureDetails", label: "Feature Details" },
|
|
1201
|
+
{ key: "mobileConfig", label: "Mobile Config" },
|
|
1202
|
+
{ key: "formLinking", label: "Form Linking" },
|
|
1203
|
+
{ key: "additionalPermissions", label: "Permission Management" },
|
|
1204
|
+
{ key: "assignFeatures", label: "Assignment" },
|
|
1205
|
+
{ key: "submit", label: "Submit" }
|
|
1206
|
+
], ni = U.object().shape({
|
|
1207
|
+
menuName: U.string().required("Enter Feature Name"),
|
|
1208
|
+
featureConstant: U.string().when("isDynamicFeature", {
|
|
1209
|
+
is: !0,
|
|
1210
|
+
then: (e) => e.required("Enter Feature Constant"),
|
|
1211
|
+
otherwise: (e) => e.notRequired()
|
|
1212
|
+
}),
|
|
1213
|
+
navigationState: U.string().when("isDynamicFeature", {
|
|
1214
|
+
is: !1,
|
|
1215
|
+
then: (e) => e.required("Enter Navigation State").matches(
|
|
1216
|
+
/^(techo\.[a-zA-Z]+\.[a-zA-Z]+|medplat\.form\.[a-zA-Z_]+)$/,
|
|
1217
|
+
"invalid format for state"
|
|
1218
|
+
),
|
|
1219
|
+
otherwise: (e) => e.notRequired()
|
|
1220
|
+
}),
|
|
1221
|
+
menuType: U.string().required("Enter Feature Type"),
|
|
1222
|
+
icon: U.string().when("$showMobileFields", {
|
|
1223
|
+
is: !0,
|
|
1224
|
+
then: (e) => e.required("Please upload an icon"),
|
|
1225
|
+
otherwise: (e) => e.notRequired()
|
|
1226
|
+
}),
|
|
1227
|
+
conditions: U.string().transform((e) => e ? e.trim() : ""),
|
|
1228
|
+
mobileMode: U.string().when("$showMobileFields", {
|
|
1229
|
+
is: !0,
|
|
1230
|
+
then: (e) => e.required("Please select a mode"),
|
|
1231
|
+
otherwise: (e) => e.notRequired()
|
|
1232
|
+
}),
|
|
1233
|
+
trainingQuery: U.string().when("trainingRequired", {
|
|
1234
|
+
is: !0,
|
|
1235
|
+
then: (e) => e.required("Please select a training query"),
|
|
1236
|
+
otherwise: (e) => e.notRequired()
|
|
1237
|
+
}),
|
|
1238
|
+
notificationBadgeType: U.string().when("notificationBadgeEnabled", {
|
|
1239
|
+
is: !0,
|
|
1240
|
+
then: (e) => e.required("Please select a badge type"),
|
|
1241
|
+
otherwise: (e) => e.notRequired()
|
|
1242
|
+
}),
|
|
1243
|
+
notificationBadgeQuery: U.string().when(
|
|
1244
|
+
["notificationBadgeEnabled", "notificationBadgeType"],
|
|
1245
|
+
(e, n) => {
|
|
1246
|
+
const [i, r] = e;
|
|
1247
|
+
return i && r ? n.required(
|
|
1248
|
+
r === "COUNT" ? "Please select a count query" : "Please select a nudge query"
|
|
1249
|
+
) : n.notRequired();
|
|
1250
|
+
}
|
|
1251
|
+
),
|
|
1252
|
+
updatedFields: U.array().when(
|
|
1253
|
+
["isDynamicFeature", "isNew", "isUpdate", "showFields"],
|
|
1254
|
+
(e, n) => {
|
|
1255
|
+
const [i, r, o, u] = e;
|
|
1256
|
+
return i === !1 && (r == null ? void 0 : r.val) === !1 && (o == null ? void 0 : o.value) === !0 && u === !0 ? n.of(
|
|
1257
|
+
U.object().shape({
|
|
1258
|
+
value: U.string().required("Right is required")
|
|
1259
|
+
})
|
|
1260
|
+
) : n.optional();
|
|
1261
|
+
}
|
|
1262
|
+
)
|
|
1263
|
+
}), a = ft({
|
|
1264
|
+
defaultValues: {
|
|
1265
|
+
menuName: "",
|
|
1266
|
+
featureConstant: "",
|
|
1267
|
+
navigationState: "medplat.form",
|
|
1268
|
+
menuType: "",
|
|
1269
|
+
menuGroup: "",
|
|
1270
|
+
isDynamicFeature: !0,
|
|
1271
|
+
isWebFeature: !1,
|
|
1272
|
+
isMobileFeature: !1,
|
|
1273
|
+
accessRights: [],
|
|
1274
|
+
entityName: null,
|
|
1275
|
+
mobileEntitiesSync: [],
|
|
1276
|
+
icon: "",
|
|
1277
|
+
mobileMode: null,
|
|
1278
|
+
conditions: "",
|
|
1279
|
+
formCode: "",
|
|
1280
|
+
version: null,
|
|
1281
|
+
additionalPermissions: [],
|
|
1282
|
+
fields: [],
|
|
1283
|
+
updatedFields: [],
|
|
1284
|
+
trainingRequired: !1,
|
|
1285
|
+
trainingQuery: "",
|
|
1286
|
+
notificationBadgeEnabled: !1,
|
|
1287
|
+
notificationBadgeType: "",
|
|
1288
|
+
notificationBadgeQuery: ""
|
|
1289
|
+
},
|
|
1290
|
+
resolver: vn(ni),
|
|
1291
|
+
mode: "onChange"
|
|
1292
|
+
}), A = mt({
|
|
1293
|
+
control: a.control,
|
|
1294
|
+
name: "isDynamicFeature"
|
|
1295
|
+
}), Wt = mt({
|
|
1296
|
+
control: a.control,
|
|
1297
|
+
name: "isMobileFeature"
|
|
1298
|
+
}), qt = mt({
|
|
1299
|
+
control: a.control,
|
|
1300
|
+
name: "isWebFeature"
|
|
1301
|
+
}), ii = mt({
|
|
1302
|
+
control: a.control,
|
|
1303
|
+
name: ai((tn = R[$]) == null ? void 0 : tn.key)
|
|
1304
|
+
}), ri = a.watch();
|
|
1305
|
+
function ai(e) {
|
|
1306
|
+
switch (e) {
|
|
1307
|
+
case "featureDetails":
|
|
1308
|
+
return A ? ["menuName", "featureConstant", "menuType"] : ["menuName", "navigationState", "menuType"];
|
|
1309
|
+
case "mobileConfig":
|
|
1310
|
+
return M ? [
|
|
1311
|
+
"icon",
|
|
1312
|
+
"mobileMode",
|
|
1313
|
+
"trainingRequired",
|
|
1314
|
+
"trainingQuery",
|
|
1315
|
+
"notificationBadgeEnabled",
|
|
1316
|
+
"notificationBadgeType",
|
|
1317
|
+
"notificationBadgeQuery"
|
|
1318
|
+
] : [];
|
|
1319
|
+
case "formLinking":
|
|
1320
|
+
return A ? ["formCode", "version"] : [];
|
|
1321
|
+
case "additionalPermissions":
|
|
1322
|
+
return !A && (l == null ? void 0 : l.val) === !1 ? ["updatedFields"] : ["additionalPermissions"];
|
|
1323
|
+
default:
|
|
1324
|
+
return [];
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
const Rt = Nn(() => {
|
|
1328
|
+
var n;
|
|
1329
|
+
switch ((n = R[$]) == null ? void 0 : n.key) {
|
|
1330
|
+
case "featureDetails": {
|
|
1331
|
+
const i = !!a.formState.errors.navigationState, r = !!a.formState.errors.featureConstant;
|
|
1332
|
+
return a.formState.isValid && !!a.getValues("menuName") && (A ? !!a.getValues("featureConstant") && !r : !!a.getValues("navigationState") && !i) && !!a.getValues("menuType");
|
|
1333
|
+
}
|
|
1334
|
+
case "mobileConfig": {
|
|
1335
|
+
if (!M) return !0;
|
|
1336
|
+
const i = !!a.getValues("icon"), r = !!a.getValues("mobileMode"), o = a.getValues("trainingRequired"), u = a.getValues("trainingQuery"), d = a.getValues("notificationBadgeEnabled"), f = a.getValues("notificationBadgeType"), g = a.getValues("notificationBadgeQuery");
|
|
1337
|
+
return i && r && (!o || !!u) && (!d || !!f) && (!d || !f || !!g);
|
|
1338
|
+
}
|
|
1339
|
+
case "formLinking": {
|
|
1340
|
+
if (!A) return !0;
|
|
1341
|
+
const i = a.getValues("formCode"), r = a.getValues("version");
|
|
1342
|
+
return !!i && !!r;
|
|
1343
|
+
}
|
|
1344
|
+
case "additionalPermissions": {
|
|
1345
|
+
if (!A && (l == null ? void 0 : l.val) === !1 && _e)
|
|
1346
|
+
return (a.getValues("updatedFields") || []).every(
|
|
1347
|
+
(o) => o.value && o.value.trim()
|
|
1348
|
+
);
|
|
1349
|
+
{
|
|
1350
|
+
const i = a.getValues("additionalPermissions") || [];
|
|
1351
|
+
return i.length > 0 && i.every(
|
|
1352
|
+
(o) => {
|
|
1353
|
+
var u, d, f, g;
|
|
1354
|
+
return ((u = o.permissionId) == null ? void 0 : u.trim()) && ((d = o.permissionName) == null ? void 0 : d.trim()) && ((g = (f = o.permissionType) == null ? void 0 : f.type) == null ? void 0 : g.trim());
|
|
1355
|
+
}
|
|
1356
|
+
);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
default:
|
|
1360
|
+
return !0;
|
|
1361
|
+
}
|
|
1362
|
+
}, [
|
|
1363
|
+
ii,
|
|
1364
|
+
a.formState.isValid,
|
|
1365
|
+
$,
|
|
1366
|
+
M
|
|
1367
|
+
]), Ye = R.filter(
|
|
1368
|
+
(e) => (e.key !== "mobileConfig" || M) && (e.key !== "formLinking" || A)
|
|
1369
|
+
), xt = async () => {
|
|
1370
|
+
const e = R[$].key;
|
|
1371
|
+
if (Xn(e)) {
|
|
1372
|
+
Mt();
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
await a.trigger(Bt(e)) && (At((i) => new Set(i).add(e)), Be((i) => i.filter((r) => r !== e)), Mt());
|
|
1376
|
+
}, Mt = () => {
|
|
1377
|
+
const e = R[$].key, n = Ye.findIndex(
|
|
1378
|
+
(r) => r.key === e
|
|
1379
|
+
), i = Ye[n + 1];
|
|
1380
|
+
if (i) {
|
|
1381
|
+
i.key === "additionalPermissions" && ue.length === 0 && ci(), e === "additionalPermissions" && i.key === "assignFeatures" && qe(
|
|
1382
|
+
li(ue, ke)
|
|
1383
|
+
);
|
|
1384
|
+
const r = R.findIndex(
|
|
1385
|
+
(o) => o.key === i.key
|
|
1386
|
+
);
|
|
1387
|
+
Ne(r);
|
|
1388
|
+
}
|
|
1389
|
+
};
|
|
1390
|
+
se(() => {
|
|
1391
|
+
if (P === !0) {
|
|
1392
|
+
const e = a.getValues("mobileMode");
|
|
1393
|
+
Zn(e);
|
|
1394
|
+
}
|
|
1395
|
+
}, [P, a]), se(() => {
|
|
1396
|
+
A ? a.setValue("navigationState", "medplat.form") : (b.get("featureId") === null && a.setValue("navigationState", ""), a.setValue("featureConstant", ""), O(""), a.clearErrors("featureConstant"));
|
|
1397
|
+
}, [A]);
|
|
1398
|
+
const Bt = (e) => {
|
|
1399
|
+
switch (e) {
|
|
1400
|
+
case "formLinking":
|
|
1401
|
+
return ["formCode", "version"];
|
|
1402
|
+
case "additionalPermissions":
|
|
1403
|
+
return ["permissionId", "permissionName", "permissionType"];
|
|
1404
|
+
default:
|
|
1405
|
+
return [];
|
|
1406
|
+
}
|
|
1407
|
+
}, si = () => {
|
|
1408
|
+
$ === 0 && D("/ui/medplat/manage/menu");
|
|
1409
|
+
const e = R[$].key, n = Ye.findIndex(
|
|
1410
|
+
(r) => r.key === e
|
|
1411
|
+
), i = Ye[n - 1];
|
|
1412
|
+
if (i) {
|
|
1413
|
+
const r = R.findIndex(
|
|
1414
|
+
(o) => o.key === i.key
|
|
1415
|
+
);
|
|
1416
|
+
Ne(r);
|
|
1417
|
+
}
|
|
1418
|
+
}, oi = (e) => {
|
|
1419
|
+
const n = R[e].key;
|
|
1420
|
+
return ei.has(n);
|
|
1421
|
+
};
|
|
1422
|
+
se(() => {
|
|
1423
|
+
(async () => {
|
|
1424
|
+
var e;
|
|
1425
|
+
if (await hi(), await pi(), await gi(), ht(!0), await Lt(), await yi(), await Ve(), b.get("featureId") && A) {
|
|
1426
|
+
const { data: n } = await In(b.get("featureId"));
|
|
1427
|
+
if (n != null && n.permissions) {
|
|
1428
|
+
const i = Ot(
|
|
1429
|
+
n.permissions
|
|
1430
|
+
);
|
|
1431
|
+
if (((e = n == null ? void 0 : n.userMenuItemDtos) == null ? void 0 : e.length) > 0) {
|
|
1432
|
+
const o = Ut(
|
|
1433
|
+
i,
|
|
1434
|
+
n.userMenuItemDtos
|
|
1435
|
+
).map((u) => ({
|
|
1436
|
+
...u,
|
|
1437
|
+
permissions: St(u.permissions)
|
|
1438
|
+
}));
|
|
1439
|
+
qe(o);
|
|
1440
|
+
}
|
|
1441
|
+
Qe(i);
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
})();
|
|
1445
|
+
}, []), se(() => {
|
|
1446
|
+
if ($e != null && $e.userMenuItemDtos) {
|
|
1447
|
+
const e = a.getValues("updatedFields") || [], n = e == null ? void 0 : e.reduce((r, o) => (r[o.name] = o.enabled, r), {}), i = $e.userMenuItemDtos.map((r) => {
|
|
1448
|
+
let o = {};
|
|
1449
|
+
try {
|
|
1450
|
+
o = r.featureJson ? JSON.parse(r.featureJson) : {};
|
|
1451
|
+
} catch (d) {
|
|
1452
|
+
console.warn("Invalid JSON in featureJson:", d);
|
|
1453
|
+
}
|
|
1454
|
+
const u = {
|
|
1455
|
+
...n,
|
|
1456
|
+
...o
|
|
1457
|
+
};
|
|
1458
|
+
return {
|
|
1459
|
+
...r,
|
|
1460
|
+
featureJson: JSON.stringify(u)
|
|
1461
|
+
};
|
|
1462
|
+
});
|
|
1463
|
+
Le(i);
|
|
1464
|
+
}
|
|
1465
|
+
}, [$e]), se(() => {
|
|
1466
|
+
try {
|
|
1467
|
+
const e = b.get("featureId");
|
|
1468
|
+
if (b.get("featureType") && e) {
|
|
1469
|
+
const i = async () => {
|
|
1470
|
+
var r;
|
|
1471
|
+
if (l != null && l.val) {
|
|
1472
|
+
const { data: o } = await In(e);
|
|
1473
|
+
if (Vt(!0), await zt(), o != null && o.permissions) {
|
|
1474
|
+
const u = Ot(
|
|
1475
|
+
o.permissions
|
|
1476
|
+
);
|
|
1477
|
+
if (((r = o == null ? void 0 : o.userMenuItemDtos) == null ? void 0 : r.length) > 0) {
|
|
1478
|
+
const f = Ut(
|
|
1479
|
+
u,
|
|
1480
|
+
o.userMenuItemDtos
|
|
1481
|
+
).map((g) => ({
|
|
1482
|
+
...g,
|
|
1483
|
+
permissions: St(g.permissions)
|
|
1484
|
+
}));
|
|
1485
|
+
qe(f);
|
|
1486
|
+
}
|
|
1487
|
+
Qe(u);
|
|
1488
|
+
}
|
|
1489
|
+
Dt((u) => ({ ...u, value: !0, length: 0 }));
|
|
1490
|
+
} else {
|
|
1491
|
+
const { data: o } = await ur(e);
|
|
1492
|
+
Mn(o), await zt();
|
|
1493
|
+
const u = JSON.parse(o.featureJson || "{}"), d = Object.keys(u).map((f, g) => ({
|
|
1494
|
+
id: g + 1,
|
|
1495
|
+
value: f,
|
|
1496
|
+
checkbox: u[f],
|
|
1497
|
+
updated: !0
|
|
1498
|
+
}));
|
|
1499
|
+
a.setValue("updatedFields", d), st(d.length > 0), d.length > 0 && Vt(!0), Dt((f) => ({ ...f, value: !0, length: u.length || 0 })), Jn(o == null ? void 0 : o.isSeparateFeature);
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
Ct(), i();
|
|
1503
|
+
}
|
|
1504
|
+
} catch (e) {
|
|
1505
|
+
fe({
|
|
1506
|
+
type: "error",
|
|
1507
|
+
message: `error :${e == null ? void 0 : e.message}`
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
}, [b, a.setValue, Fe, G]);
|
|
1511
|
+
const Ot = (e) => {
|
|
1512
|
+
const n = a.getValues("menuType"), i = a.getValues("featureConstant"), r = (d) => d.trim().toLowerCase().split(/\s+/).map(
|
|
1513
|
+
(f, g) => g === 0 ? f : f.charAt(0).toUpperCase() + f.slice(1)
|
|
1514
|
+
).join("");
|
|
1515
|
+
let o;
|
|
1516
|
+
if (!A || (i == null ? void 0 : i.length) === 0) {
|
|
1517
|
+
const d = a.getValues("menuName");
|
|
1518
|
+
o = `view.${n}.${r(d)}`;
|
|
1519
|
+
} else
|
|
1520
|
+
o = `view.${n}.${i}`;
|
|
1521
|
+
const u = (d) => {
|
|
1522
|
+
const f = d.id === o;
|
|
1523
|
+
return {
|
|
1524
|
+
permissionId: d.id,
|
|
1525
|
+
permissionType: { type: d.type },
|
|
1526
|
+
permissionName: d.name,
|
|
1527
|
+
permissionDesc: d.desc || "",
|
|
1528
|
+
enabled: d.is_active,
|
|
1529
|
+
isDefault: f,
|
|
1530
|
+
childPermissions: d.child ? d.child.map((g) => u(g)) : [],
|
|
1531
|
+
urlType: (d == null ? void 0 : d.httpMethod) || "",
|
|
1532
|
+
backendUrl: (d == null ? void 0 : d.url) || "",
|
|
1533
|
+
queryCodeRequired: !(d != null && d.url),
|
|
1534
|
+
queryCode: (d == null ? void 0 : d.queryCodes) || ""
|
|
1535
|
+
};
|
|
1536
|
+
};
|
|
1537
|
+
return e.map(u);
|
|
1538
|
+
}, Ut = (e, n) => {
|
|
1539
|
+
if (!Array.isArray(n)) return [];
|
|
1540
|
+
const i = (r, o) => {
|
|
1541
|
+
var g;
|
|
1542
|
+
const u = ((g = r.childPermissions) == null ? void 0 : g.map(
|
|
1543
|
+
(F) => i(F, o)
|
|
1544
|
+
)) || [], d = u.some((F) => F.enabled), f = o.includes(r.permissionId) || d;
|
|
1545
|
+
return { ...r, enabled: f, childPermissions: u };
|
|
1546
|
+
};
|
|
1547
|
+
return n.map((r) => {
|
|
1548
|
+
var g, F, k, me, ee, oe, le;
|
|
1549
|
+
const o = ((g = r.permissions) == null ? void 0 : g.map((Nt) => Nt.id)) || [], u = !!r.roleName || !!r.designationId || !!r.roleId, d = !!r.userId || !!r.fullName, f = e.map(
|
|
1550
|
+
(Nt) => i(Nt, o)
|
|
1551
|
+
);
|
|
1552
|
+
return {
|
|
1553
|
+
entityType: u ? "role" : "user",
|
|
1554
|
+
user_id: d && r.userId || null,
|
|
1555
|
+
role_id: u && (r.designationId || r.roleId) || null,
|
|
1556
|
+
name: d ? r.fullName || "" : r.roleName || "",
|
|
1557
|
+
startDate: ((k = (F = r.permissions) == null ? void 0 : F[0]) == null ? void 0 : k.startDate) || null,
|
|
1558
|
+
endDate: ((ee = (me = r.permissions) == null ? void 0 : me[0]) == null ? void 0 : ee.endDate) || null,
|
|
1559
|
+
isBackendOnly: ((le = (oe = r.permissions) == null ? void 0 : oe[0]) == null ? void 0 : le.isBackendOnly) || !1,
|
|
1560
|
+
permissions: f
|
|
1561
|
+
};
|
|
1562
|
+
});
|
|
1563
|
+
}, St = (e) => {
|
|
1564
|
+
const n = (i) => {
|
|
1565
|
+
var o, u;
|
|
1566
|
+
let r = [];
|
|
1567
|
+
if ((o = i.childPermissions) != null && o.length) {
|
|
1568
|
+
r = i.childPermissions.map(n);
|
|
1569
|
+
const d = r.every((f) => f.enabled);
|
|
1570
|
+
i.enabled = i.enabled || d;
|
|
1571
|
+
}
|
|
1572
|
+
return i.enabled && ((u = i.childPermissions) != null && u.length) && (r = r.map((d) => {
|
|
1573
|
+
var f;
|
|
1574
|
+
return {
|
|
1575
|
+
...d,
|
|
1576
|
+
enabled: !0,
|
|
1577
|
+
childPermissions: (f = d.childPermissions) != null && f.length ? St(d.childPermissions) : []
|
|
1578
|
+
};
|
|
1579
|
+
})), {
|
|
1580
|
+
...i,
|
|
1581
|
+
childPermissions: r
|
|
1582
|
+
};
|
|
1583
|
+
};
|
|
1584
|
+
return e.map(n);
|
|
1585
|
+
}, li = (e, n) => {
|
|
1586
|
+
const i = /* @__PURE__ */ new Map(), r = (u) => {
|
|
1587
|
+
u.forEach((d) => {
|
|
1588
|
+
var f;
|
|
1589
|
+
i.set(d.permissionId, d), (f = d.childPermissions) != null && f.length && r(d.childPermissions);
|
|
1590
|
+
});
|
|
1591
|
+
};
|
|
1592
|
+
r(e);
|
|
1593
|
+
const o = (u, d) => u.map((f) => {
|
|
1594
|
+
const g = (d == null ? void 0 : d.find((k) => k.permissionId === f.permissionId)) || {}, F = o(
|
|
1595
|
+
f.childPermissions || [],
|
|
1596
|
+
g.childPermissions || []
|
|
1597
|
+
);
|
|
1598
|
+
return {
|
|
1599
|
+
...f,
|
|
1600
|
+
enabled: g.enabled ?? f.enabled,
|
|
1601
|
+
childPermissions: F
|
|
1602
|
+
};
|
|
1603
|
+
});
|
|
1604
|
+
return n.map((u) => ({
|
|
1605
|
+
...u,
|
|
1606
|
+
permissions: o(e, u.permissions)
|
|
1607
|
+
}));
|
|
1608
|
+
}, di = async () => {
|
|
1609
|
+
try {
|
|
1610
|
+
const e = (await H({
|
|
1611
|
+
code: "RETREIVE_DYNAMIC_FEATURE_INFO",
|
|
1612
|
+
parameters: {
|
|
1613
|
+
id: parseInt(b.get("featureId")),
|
|
1614
|
+
menuType: b.get("featureType")
|
|
1615
|
+
}
|
|
1616
|
+
})).data;
|
|
1617
|
+
if (e.result) {
|
|
1618
|
+
let n = e.result[0];
|
|
1619
|
+
const i = (() => {
|
|
1620
|
+
try {
|
|
1621
|
+
return n.mobile_config ? JSON.parse(n.mobile_config) : {};
|
|
1622
|
+
} catch {
|
|
1623
|
+
return {};
|
|
1624
|
+
}
|
|
1625
|
+
})(), o = ((i == null ? void 0 : i.mobile_entities_sync) ?? []).map(
|
|
1626
|
+
(f) => X == null ? void 0 : X.find((g) => g.tableName === f)
|
|
1627
|
+
).filter(Boolean);
|
|
1628
|
+
a.reset({
|
|
1629
|
+
menuName: n.menuName ? n.menuName : "",
|
|
1630
|
+
featureConstant: n.featureConstant ? n.featureConstant : "",
|
|
1631
|
+
navigationState: n.navigationState ? n.navigationState : "medplat.form",
|
|
1632
|
+
isDynamicFeature: n.isDynamicFeature !== void 0 && n.isDynamicFeature !== null ? n.isDynamicFeature : !1,
|
|
1633
|
+
menuType: n.menuType ? n.menuType : "",
|
|
1634
|
+
menuGroup: n.group_id ? n.group_id.toString() : "",
|
|
1635
|
+
isWebFeature: n.isWebFeature ? n.isWebFeature : !1,
|
|
1636
|
+
isMobileFeature: n.isMobileFeature ? n.isMobileFeature : !1,
|
|
1637
|
+
entityName: (i == null ? void 0 : i.entity_name) ?? "",
|
|
1638
|
+
mobileMode: (i == null ? void 0 : i.mobile_mode) ?? null,
|
|
1639
|
+
icon: (i == null ? void 0 : i.icon) ?? "",
|
|
1640
|
+
mobileEntitiesSync: i != null && i.mobile_entities_sync ? i.mobile_entities_sync : [],
|
|
1641
|
+
conditions: (i == null ? void 0 : i.conditions) ?? "",
|
|
1642
|
+
formCode: n.formCode ? n.formCode : "",
|
|
1643
|
+
version: n.currentVersion ? n.currentVersion : "",
|
|
1644
|
+
trainingRequired: (i == null ? void 0 : i.training_required) ?? !1,
|
|
1645
|
+
trainingQuery: (i == null ? void 0 : i.training_query) ?? "",
|
|
1646
|
+
notificationBadgeEnabled: (i == null ? void 0 : i.notification_badge_enabled) ?? !1,
|
|
1647
|
+
notificationBadgeType: (i == null ? void 0 : i.notification_badge_type) ?? "",
|
|
1648
|
+
notificationBadgeQuery: (i == null ? void 0 : i.notification_badge_query) ?? ""
|
|
1649
|
+
}), ae(o), n.isMobileFeature && q(!0);
|
|
1650
|
+
const u = (i == null ? void 0 : i.training_query) ?? "", d = (i == null ? void 0 : i.notification_badge_query) ?? "";
|
|
1651
|
+
u && (Ge(u), Ve(u)), d && (He(d), Ve(d)), n.formCode && (be(n.formCode), Ae(n.formCode)), Ct(), Ze(!0);
|
|
1652
|
+
}
|
|
1653
|
+
} catch (e) {
|
|
1654
|
+
fe({
|
|
1655
|
+
message: e.message,
|
|
1656
|
+
type: "error"
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
}, zt = async () => {
|
|
1660
|
+
try {
|
|
1661
|
+
const e = (await H({
|
|
1662
|
+
code: "RETREIVE_DYNAMIC_FEATURE_INFO",
|
|
1663
|
+
parameters: {
|
|
1664
|
+
id: parseInt(b.get("featureId")),
|
|
1665
|
+
menuType: b.get("featureType")
|
|
1666
|
+
}
|
|
1667
|
+
})).data;
|
|
1668
|
+
if (e.result) {
|
|
1669
|
+
let n = e.result[0];
|
|
1670
|
+
const i = (() => {
|
|
1671
|
+
try {
|
|
1672
|
+
return n.mobile_config ? JSON.parse(n.mobile_config) : {};
|
|
1673
|
+
} catch {
|
|
1674
|
+
return {};
|
|
1675
|
+
}
|
|
1676
|
+
})(), r = (g, F = null) => {
|
|
1677
|
+
try {
|
|
1678
|
+
return !g || typeof g != "string" ? F : JSON.parse(g);
|
|
1679
|
+
} catch {
|
|
1680
|
+
return F;
|
|
1681
|
+
}
|
|
1682
|
+
}, u = ((i == null ? void 0 : i.mobile_entities_sync) ?? []).map(
|
|
1683
|
+
(g) => X == null ? void 0 : X.find((F) => F.tableName === g)
|
|
1684
|
+
).filter(Boolean);
|
|
1685
|
+
a.setValue("menuName", n.menuName ? n.menuName : ""), a.setValue(
|
|
1686
|
+
"navigationState",
|
|
1687
|
+
n.navigationState ? n.navigationState : ""
|
|
1688
|
+
), a.setValue(
|
|
1689
|
+
"isDynamicFeature",
|
|
1690
|
+
n.isDynamicFeature !== void 0 && n.isDynamicFeature !== null ? n.isDynamicFeature : !1
|
|
1691
|
+
), a.setValue("menuType", n.menuType ? n.menuType : ""), a.setValue(
|
|
1692
|
+
"menuGroup",
|
|
1693
|
+
n.group_id ? n.group_id.toString() : ""
|
|
1694
|
+
), a.setValue(
|
|
1695
|
+
"isWebFeature",
|
|
1696
|
+
n.isWebFeature ? n.isWebFeature : !1
|
|
1697
|
+
), a.setValue(
|
|
1698
|
+
"isMobileFeature",
|
|
1699
|
+
n.isMobileFeature ? n.isMobileFeature : !1
|
|
1700
|
+
), a.setValue("entityName", (i == null ? void 0 : i.entity_name) ?? ""), a.setValue("mobileMode", (i == null ? void 0 : i.mobile_mode) ?? null), a.setValue("icon", (i == null ? void 0 : i.icon) ?? ""), a.setValue(
|
|
1701
|
+
"mobileEntitiesSync",
|
|
1702
|
+
(i == null ? void 0 : i.mobile_entities_sync) ?? []
|
|
1703
|
+
), a.setValue("conditions", (i == null ? void 0 : i.conditions) ?? ""), a.setValue(
|
|
1704
|
+
"trainingRequired",
|
|
1705
|
+
(i == null ? void 0 : i.training_required) ?? !1
|
|
1706
|
+
), a.setValue("trainingQuery", (i == null ? void 0 : i.training_query) ?? ""), a.setValue(
|
|
1707
|
+
"notificationBadgeEnabled",
|
|
1708
|
+
(i == null ? void 0 : i.notification_badge_enabled) ?? !1
|
|
1709
|
+
), a.setValue(
|
|
1710
|
+
"notificationBadgeType",
|
|
1711
|
+
(i == null ? void 0 : i.notification_badge_type) ?? ""
|
|
1712
|
+
), a.setValue(
|
|
1713
|
+
"notificationBadgeQuery",
|
|
1714
|
+
(i == null ? void 0 : i.notification_badge_query) ?? ""
|
|
1715
|
+
), ae(u), n.isMobileFeature && q(!0);
|
|
1716
|
+
const d = (i == null ? void 0 : i.training_query) ?? "", f = (i == null ? void 0 : i.notification_badge_query) ?? "";
|
|
1717
|
+
d && (Ge(d), Ve(d)), f && (He(f), Ve(f)), Ze(!0);
|
|
1718
|
+
}
|
|
1719
|
+
} catch (e) {
|
|
1720
|
+
fe({
|
|
1721
|
+
message: e.message,
|
|
1722
|
+
type: "error"
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
}, ci = () => {
|
|
1726
|
+
const e = a.getValues("menuType") || "menuType", n = a.getValues("featureConstant") || "feature", i = (u) => u.trim().toLowerCase().split(/\s+/).map(
|
|
1727
|
+
(d, f) => f === 0 ? d : d.charAt(0).toUpperCase() + d.slice(1)
|
|
1728
|
+
).join("");
|
|
1729
|
+
let r;
|
|
1730
|
+
if (A)
|
|
1731
|
+
r = `view.${e}.${n}`;
|
|
1732
|
+
else {
|
|
1733
|
+
const u = a.getValues("menuName");
|
|
1734
|
+
r = `view.${e}.${i(u)}`;
|
|
1735
|
+
}
|
|
1736
|
+
const o = {
|
|
1737
|
+
permissionId: r,
|
|
1738
|
+
permissionType: { type: "menu" },
|
|
1739
|
+
permissionName: `view ${n}`,
|
|
1740
|
+
permissionDesc: "",
|
|
1741
|
+
enabled: !0,
|
|
1742
|
+
isDefault: !0,
|
|
1743
|
+
childPermissions: [],
|
|
1744
|
+
...A === !1 && {
|
|
1745
|
+
backendUrl: "",
|
|
1746
|
+
urlType: "",
|
|
1747
|
+
queryCode: ""
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
Qe([o]);
|
|
1751
|
+
}, ui = (e) => {
|
|
1752
|
+
w(e);
|
|
1753
|
+
}, mi = (e) => {
|
|
1754
|
+
const n = (e == null ? void 0 : e.map((i) => i == null ? void 0 : i.tableName)) || [];
|
|
1755
|
+
ae(e), a.setValue("mobileEntitiesSync", n);
|
|
1756
|
+
}, fi = (e, n) => {
|
|
1757
|
+
Te(n);
|
|
1758
|
+
};
|
|
1759
|
+
se(() => {
|
|
1760
|
+
const e = (b == null ? void 0 : b.get("staticOrDynamic")) === "STATIC";
|
|
1761
|
+
Fe && G && b.get("featureId") && !e && di();
|
|
1762
|
+
}, [Fe, G]);
|
|
1763
|
+
const hi = async () => {
|
|
1764
|
+
const e = (await H({
|
|
1765
|
+
code: "fetch_menu_groups"
|
|
1766
|
+
})).data;
|
|
1767
|
+
Xe(e.result.map((n) => n.menu_type)), E(e.result);
|
|
1768
|
+
}, pi = async () => {
|
|
1769
|
+
const e = (await H({
|
|
1770
|
+
code: "mfa_retreive_all_table_names"
|
|
1771
|
+
})).data;
|
|
1772
|
+
ce(e.result.map((n) => n.table_name));
|
|
1773
|
+
}, gi = async () => {
|
|
1774
|
+
const e = (await H({
|
|
1775
|
+
code: "retrieve_synced_tables"
|
|
1776
|
+
})).data;
|
|
1777
|
+
L(e == null ? void 0 : e.result);
|
|
1778
|
+
}, Lt = async () => {
|
|
1779
|
+
const e = (await H({
|
|
1780
|
+
code: "mfa_retrieve_separate_feature_forms"
|
|
1781
|
+
})).data;
|
|
1782
|
+
if (e.result) {
|
|
1783
|
+
let n = e.result;
|
|
1784
|
+
J(n);
|
|
1785
|
+
let i = {};
|
|
1786
|
+
return n.forEach((r) => {
|
|
1787
|
+
try {
|
|
1788
|
+
const o = JSON.parse(r.versions);
|
|
1789
|
+
i[r.form_code] = o;
|
|
1790
|
+
} catch (o) {
|
|
1791
|
+
console.error("Invalid JSON in form.versions:", r.versions, o), i[r.form_code] = [];
|
|
1792
|
+
}
|
|
1793
|
+
}), ge(i), i;
|
|
1794
|
+
}
|
|
1795
|
+
}, yi = async () => {
|
|
1796
|
+
try {
|
|
1797
|
+
const { data: e } = await H({
|
|
1798
|
+
code: "user_search_for_selectize",
|
|
1799
|
+
parameters: {
|
|
1800
|
+
searchString: ""
|
|
1801
|
+
}
|
|
1802
|
+
});
|
|
1803
|
+
Ue(e == null ? void 0 : e.result);
|
|
1804
|
+
const n = await $i();
|
|
1805
|
+
h(n.data);
|
|
1806
|
+
} catch (e) {
|
|
1807
|
+
console.error("Error fetching users or roles:", e);
|
|
1808
|
+
}
|
|
1809
|
+
}, Ve = async (e = "") => {
|
|
1810
|
+
try {
|
|
1811
|
+
const n = (await H({
|
|
1812
|
+
code: "GET_ALL_QUERY_CODE",
|
|
1813
|
+
parameters: { search: e }
|
|
1814
|
+
})).data;
|
|
1815
|
+
Hn((n == null ? void 0 : n.result) || []);
|
|
1816
|
+
} catch (n) {
|
|
1817
|
+
console.error("Error fetching query codes:", n);
|
|
1818
|
+
}
|
|
1819
|
+
}, $t = () => a.getValues("isMobileFeature") && a.getValues("isWebFeature") ? xe : xe.filter((e) => {
|
|
1820
|
+
const { roleType: n } = e;
|
|
1821
|
+
return !!(n === null || a.getValues("isMobileFeature") && (n === "MOBILE" || n === "BOTH") || a.getValues("isWebFeature") && (n === "WEB" || n === "BOTH"));
|
|
1822
|
+
});
|
|
1823
|
+
se(() => {
|
|
1824
|
+
if (!(xe != null && xe.length)) return;
|
|
1825
|
+
const e = ze.filter((n) => {
|
|
1826
|
+
if (!n.roleName) return !0;
|
|
1827
|
+
const i = xe.find((o) => o.name === n.roleName);
|
|
1828
|
+
if (!i) return !0;
|
|
1829
|
+
const { roleType: r } = i;
|
|
1830
|
+
return !(!Wt && r === "MOBILE" || !qt && r === "WEB");
|
|
1831
|
+
});
|
|
1832
|
+
Le(e);
|
|
1833
|
+
}, [Wt, qt, xe]);
|
|
1834
|
+
const bi = (e) => {
|
|
1835
|
+
const { firstName: n, lastName: i, userName: r } = e;
|
|
1836
|
+
return !n && !i && !r ? "" : n && !i && !r ? n : `${n} ${i} (${r})`;
|
|
1837
|
+
}, Ct = () => {
|
|
1838
|
+
re(() => {
|
|
1839
|
+
const e = a.getValues("menuType") ? JSON.parse(
|
|
1840
|
+
G == null ? void 0 : G.find(
|
|
1841
|
+
(i) => i.menu_type === a.getValues("menuType")
|
|
1842
|
+
).groupNames
|
|
1843
|
+
) : null, n = e == null ? void 0 : e.filter((i) => i.id !== null);
|
|
1844
|
+
return n != null && n.length || a.setValue("menuGroup", ""), n;
|
|
1845
|
+
});
|
|
1846
|
+
}, xi = (e) => {
|
|
1847
|
+
a.setValue("menuGroup", e.target.value);
|
|
1848
|
+
}, Si = (e) => {
|
|
1849
|
+
e.target.checked ? q(!0) : (q(!1), a.setValue("entityName", null), a.setValue("icon", null), a.setValue("mobileEntitiesSync", null), a.setValue("conditions", null), a.setValue("mobileMode", null));
|
|
1850
|
+
}, Ci = (e) => {
|
|
1851
|
+
e.target.checked || (a.setValue("formCode", null), a.setValue("version", null));
|
|
1852
|
+
}, Ni = () => {
|
|
1853
|
+
nt("add-parent"), it(null), rt(null), at(null), Je(!0);
|
|
1854
|
+
}, ki = (e) => {
|
|
1855
|
+
nt("add-child"), it(e.permissionId), rt(null), at(null), Je(!0);
|
|
1856
|
+
}, Ii = (e) => {
|
|
1857
|
+
nt("edit"), it(null), rt(e), at(e.permissionId), Je(!0);
|
|
1858
|
+
}, Qt = (e, n, i) => e.map((r) => r.permissionId === n ? {
|
|
1859
|
+
...r,
|
|
1860
|
+
childPermissions: [...r.childPermissions || [], i]
|
|
1861
|
+
} : {
|
|
1862
|
+
...r,
|
|
1863
|
+
childPermissions: Qt(
|
|
1864
|
+
r.childPermissions || [],
|
|
1865
|
+
n,
|
|
1866
|
+
i
|
|
1867
|
+
)
|
|
1868
|
+
}), Jt = (e, n, i) => e.map((r) => r.permissionId === n ? {
|
|
1869
|
+
...i,
|
|
1870
|
+
childPermissions: r.childPermissions || []
|
|
1871
|
+
} : {
|
|
1872
|
+
...r,
|
|
1873
|
+
childPermissions: Jt(
|
|
1874
|
+
r.childPermissions || [],
|
|
1875
|
+
n,
|
|
1876
|
+
i
|
|
1877
|
+
)
|
|
1878
|
+
}), jt = (e, n) => e.filter((i) => i.permissionId !== n).map((i) => ({
|
|
1879
|
+
...i,
|
|
1880
|
+
childPermissions: jt(
|
|
1881
|
+
i.childPermissions || [],
|
|
1882
|
+
n
|
|
1883
|
+
)
|
|
1884
|
+
})), wi = (e) => {
|
|
1885
|
+
Qe((n) => {
|
|
1886
|
+
let i = [...n];
|
|
1887
|
+
if (je === "add-parent")
|
|
1888
|
+
i = [...n, e];
|
|
1889
|
+
else if (je === "add-child") {
|
|
1890
|
+
const r = (d, f) => {
|
|
1891
|
+
var g;
|
|
1892
|
+
for (const F of d) {
|
|
1893
|
+
if (F.permissionId === f) return F;
|
|
1894
|
+
if ((g = F.childPermissions) != null && g.length) {
|
|
1895
|
+
const k = r(F.childPermissions, f);
|
|
1896
|
+
if (k) return k;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
return null;
|
|
1900
|
+
}, o = r(n, pt), u = {
|
|
1901
|
+
...e,
|
|
1902
|
+
permissionType: typeof o.permissionType == "string" ? { type: o.permissionType } : o.permissionType
|
|
1903
|
+
};
|
|
1904
|
+
i = Qt(
|
|
1905
|
+
n,
|
|
1906
|
+
pt,
|
|
1907
|
+
u
|
|
1908
|
+
);
|
|
1909
|
+
} else je === "edit" && (i = Jt(
|
|
1910
|
+
n,
|
|
1911
|
+
Un,
|
|
1912
|
+
e
|
|
1913
|
+
));
|
|
1914
|
+
return i;
|
|
1915
|
+
}), Je(!1), nt("add-parent"), it(null), rt(null), at(null);
|
|
1916
|
+
}, vi = (e) => {
|
|
1917
|
+
const n = typeof e == "string" ? e : e.permissionId;
|
|
1918
|
+
Qe((i) => jt(i, n));
|
|
1919
|
+
};
|
|
1920
|
+
se(() => {
|
|
1921
|
+
a.setValue("additionalPermissions", ue);
|
|
1922
|
+
}, [ue, a]);
|
|
1923
|
+
const ot = (e, n = null) => {
|
|
1924
|
+
let i = [];
|
|
1925
|
+
return e.forEach((r) => {
|
|
1926
|
+
const {
|
|
1927
|
+
permissionId: o,
|
|
1928
|
+
permissionType: u,
|
|
1929
|
+
permissionName: d,
|
|
1930
|
+
permissionDesc: f,
|
|
1931
|
+
enabled: g,
|
|
1932
|
+
backendUrl: F,
|
|
1933
|
+
urlType: k,
|
|
1934
|
+
queryCode: me
|
|
1935
|
+
} = r;
|
|
1936
|
+
i.push({
|
|
1937
|
+
permissionId: o,
|
|
1938
|
+
permissionType: u == null ? void 0 : u.type,
|
|
1939
|
+
permissionName: d,
|
|
1940
|
+
permissionDesc: f,
|
|
1941
|
+
parentPermissionId: n,
|
|
1942
|
+
enabled: g,
|
|
1943
|
+
backendUrl: F,
|
|
1944
|
+
urlType: k,
|
|
1945
|
+
queryCode: me
|
|
1946
|
+
}), r.childPermissions && r.childPermissions.length > 0 && (i = i.concat(
|
|
1947
|
+
ot(r.childPermissions, o)
|
|
1948
|
+
));
|
|
1949
|
+
}), i;
|
|
1950
|
+
}, Fi = () => {
|
|
1951
|
+
(async () => {
|
|
1952
|
+
let e = await Lt();
|
|
1953
|
+
ge(e), be(a.getValues("formCode"));
|
|
1954
|
+
})();
|
|
1955
|
+
}, Gt = JSON.stringify(
|
|
1956
|
+
(nn = Z.value ? a.getValues("updatedFields") : a.getValues("fields")) == null ? void 0 : nn.reduce((e, n) => {
|
|
1957
|
+
var i;
|
|
1958
|
+
return (i = n.value) != null && i.trim() && (e[n.value.trim()] = n.checkbox), e;
|
|
1959
|
+
}, {})
|
|
1960
|
+
), Ti = () => {
|
|
1961
|
+
if (!A && (l == null ? void 0 : l.val) === !1)
|
|
1962
|
+
try {
|
|
1963
|
+
const e = [];
|
|
1964
|
+
V != null && V.id && e.push({
|
|
1965
|
+
designationId: null,
|
|
1966
|
+
userId: V.id,
|
|
1967
|
+
fullName: `${V.firstName || ""} ${V.lastName || ""}`.trim(),
|
|
1968
|
+
featureJson: Gt
|
|
1969
|
+
}), (p == null ? void 0 : p.length) > 0 && e.push(
|
|
1970
|
+
...p.map((n) => ({
|
|
1971
|
+
designationId: n.id,
|
|
1972
|
+
roleName: n.name,
|
|
1973
|
+
featureJson: Gt
|
|
1974
|
+
}))
|
|
1975
|
+
), Le((n) => [...n, ...e]), fe({
|
|
1976
|
+
message: "Menu item added successfully",
|
|
1977
|
+
type: "success"
|
|
1978
|
+
}), w([]), Te({});
|
|
1979
|
+
} catch (e) {
|
|
1980
|
+
console.error(e), fe({
|
|
1981
|
+
message: "Cannot add menu item",
|
|
1982
|
+
type: "error"
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1985
|
+
else {
|
|
1986
|
+
const e = [];
|
|
1987
|
+
if (V != null && V.id && e.push({
|
|
1988
|
+
type: "user",
|
|
1989
|
+
id: V.id,
|
|
1990
|
+
name: V.firstName + " " + V.lastName
|
|
1991
|
+
}), p.length > 0 && e.push({
|
|
1992
|
+
type: "role",
|
|
1993
|
+
ids: p.map((n) => n.id),
|
|
1994
|
+
names: p.map((n) => n.name)
|
|
1995
|
+
}), e.length === 0) return;
|
|
1996
|
+
$n(e), gt(!0), Te(null), w([]);
|
|
1997
|
+
}
|
|
1998
|
+
}, Ht = (e) => {
|
|
1999
|
+
const n = [], i = (r, o) => {
|
|
2000
|
+
for (const u of r)
|
|
2001
|
+
u.enabled && n.push({
|
|
2002
|
+
permission_id: u.permissionId,
|
|
2003
|
+
user_id: o.user_id || null,
|
|
2004
|
+
role_id: o.role_id || null,
|
|
2005
|
+
is_backend_only: o.isBackendOnly || !1,
|
|
2006
|
+
start_date: o.startDate || null,
|
|
2007
|
+
end_date: o.endDate || null
|
|
2008
|
+
});
|
|
2009
|
+
};
|
|
2010
|
+
for (const r of e)
|
|
2011
|
+
i(r.permissions || [], r);
|
|
2012
|
+
return n;
|
|
2013
|
+
}, _i = (e, n) => {
|
|
2014
|
+
qe((i) => {
|
|
2015
|
+
const r = [...i];
|
|
2016
|
+
return r[e] = {
|
|
2017
|
+
...r[e],
|
|
2018
|
+
permissions: Yt(
|
|
2019
|
+
r[e].permissions,
|
|
2020
|
+
n.permissionId,
|
|
2021
|
+
!n.enabled
|
|
2022
|
+
)
|
|
2023
|
+
}, r;
|
|
2024
|
+
});
|
|
2025
|
+
}, Yt = (e, n, i) => e.map((o) => {
|
|
2026
|
+
var u, d;
|
|
2027
|
+
if (o.permissionId === n)
|
|
2028
|
+
return {
|
|
2029
|
+
...o,
|
|
2030
|
+
enabled: i,
|
|
2031
|
+
childPermissions: (u = o.childPermissions) != null && u.length ? Kt(o.childPermissions, i) : []
|
|
2032
|
+
};
|
|
2033
|
+
if ((d = o.childPermissions) != null && d.length) {
|
|
2034
|
+
const f = Yt(
|
|
2035
|
+
o.childPermissions,
|
|
2036
|
+
n,
|
|
2037
|
+
i
|
|
2038
|
+
), g = f.length > 0 && f.every((F) => F.enabled === !0);
|
|
2039
|
+
return {
|
|
2040
|
+
...o,
|
|
2041
|
+
enabled: g,
|
|
2042
|
+
childPermissions: f
|
|
2043
|
+
};
|
|
2044
|
+
}
|
|
2045
|
+
return o;
|
|
2046
|
+
}), Kt = (e, n) => e.map((i) => {
|
|
2047
|
+
var r;
|
|
2048
|
+
return {
|
|
2049
|
+
...i,
|
|
2050
|
+
enabled: n,
|
|
2051
|
+
childPermissions: (r = i.childPermissions) != null && r.length ? Kt(i.childPermissions, n) : []
|
|
2052
|
+
};
|
|
2053
|
+
}), Vi = async (e) => {
|
|
2054
|
+
(await H({
|
|
2055
|
+
code: "check_unique_feature_constant",
|
|
2056
|
+
parameters: {
|
|
2057
|
+
featureConstant: e
|
|
2058
|
+
}
|
|
2059
|
+
})).data.result[0].exists ? a.setError("featureConstant", {
|
|
2060
|
+
type: "manual",
|
|
2061
|
+
message: "Feature constant already exists"
|
|
2062
|
+
}) : O(`${e} Feature constant is available`);
|
|
2063
|
+
}, Ei = async (e) => {
|
|
2064
|
+
(await H({
|
|
2065
|
+
code: "CHECK_UNIQUE_NAVIGATION_STATE",
|
|
2066
|
+
parameters: {
|
|
2067
|
+
featureState: e
|
|
2068
|
+
}
|
|
2069
|
+
})).data.result[0].exists ? a.setError("navigationState", {
|
|
2070
|
+
type: "manual",
|
|
2071
|
+
message: "Feature State already exists"
|
|
2072
|
+
}) : O(`${e} Feature State is available`);
|
|
2073
|
+
}, Di = fn(Vi, 500), Pi = fn(
|
|
2074
|
+
Ei,
|
|
2075
|
+
500
|
|
2076
|
+
), Zt = Gi(
|
|
2077
|
+
async (e, n, i) => {
|
|
2078
|
+
const { data: r } = await H({
|
|
2079
|
+
code: "user_search_for_selectize",
|
|
2080
|
+
parameters: {
|
|
2081
|
+
searchString: e
|
|
2082
|
+
}
|
|
2083
|
+
});
|
|
2084
|
+
n(r.result), i({ firstName: e, lastName: "", userName: "" });
|
|
2085
|
+
},
|
|
2086
|
+
500
|
|
2087
|
+
), Ai = async (e) => {
|
|
2088
|
+
const n = ot(ue);
|
|
2089
|
+
let i = {
|
|
2090
|
+
code: "insert_dynamic_feature_into_menu_config",
|
|
2091
|
+
parameters: {
|
|
2092
|
+
menuName: e.menuName ? e.menuName : null,
|
|
2093
|
+
featureConstant: e.featureConstant ? e.featureConstant : null,
|
|
2094
|
+
formCode: e.formCode && e.formCode !== "" ? e.formCode : null,
|
|
2095
|
+
prevFormCode: ve || null,
|
|
2096
|
+
deLinkPrevForm: ve !== e.formCode,
|
|
2097
|
+
menuType: e.menuType ? e.menuType : null,
|
|
2098
|
+
menuGroup: e.menuGroup ? parseInt(e.menuGroup) : null,
|
|
2099
|
+
navigationState: e.navigationState && e.formCode && e.formCode !== "" ? e.navigationState : null,
|
|
2100
|
+
formVersion: e.version ? e.version : null,
|
|
2101
|
+
isMobileFeature: e.isMobileFeature ? e.isMobileFeature : null,
|
|
2102
|
+
isWebFeature: e.isWebFeature ? e.isWebFeature : null,
|
|
2103
|
+
permissions: JSON.stringify(n),
|
|
2104
|
+
mobileConfig: JSON.stringify({
|
|
2105
|
+
entity_name: e.entityName ?? null,
|
|
2106
|
+
mobile_mode: e.mobileMode ? e.mobileMode.toUpperCase() : null,
|
|
2107
|
+
icon: e.icon ?? null,
|
|
2108
|
+
mobile_entities_sync: e.mobileEntitiesSync ?? [],
|
|
2109
|
+
conditions: e.conditions ?? null,
|
|
2110
|
+
training_required: e.trainingRequired ?? !1,
|
|
2111
|
+
training_query: e.trainingQuery ?? null,
|
|
2112
|
+
notification_badge_enabled: e.notificationBadgeEnabled ?? !1,
|
|
2113
|
+
notification_badge_type: e.notificationBadgeType ?? null,
|
|
2114
|
+
notification_badge_query: e.notificationBadgeQuery ?? null
|
|
2115
|
+
})
|
|
2116
|
+
}
|
|
2117
|
+
};
|
|
2118
|
+
try {
|
|
2119
|
+
if (await H(i)) {
|
|
2120
|
+
let o = [];
|
|
2121
|
+
e.menuName && e.menuName.length > 0 && o.push({
|
|
2122
|
+
code: "medplat_form_insert_into_translation_master",
|
|
2123
|
+
parameters: {
|
|
2124
|
+
translation_key: e.menuName.replaceAll(" ", ""),
|
|
2125
|
+
translation_value: e.menuName,
|
|
2126
|
+
form_code: "General"
|
|
2127
|
+
},
|
|
2128
|
+
sequence: 1
|
|
2129
|
+
}), o.length > 0 && await Ft(o);
|
|
2130
|
+
const u = Ht(ke);
|
|
2131
|
+
u && await H({
|
|
2132
|
+
code: "GRANT_PERMISSION_USER_MAP",
|
|
2133
|
+
parameters: {
|
|
2134
|
+
permissionUserMap: JSON.stringify(u)
|
|
2135
|
+
}
|
|
2136
|
+
});
|
|
2137
|
+
}
|
|
2138
|
+
fe({
|
|
2139
|
+
message: b.get("featureId") ? "Feature updated successfully" : "New Dynamic feature created successfully!",
|
|
2140
|
+
type: "success"
|
|
2141
|
+
}), et(!0);
|
|
2142
|
+
} catch (r) {
|
|
2143
|
+
fe({
|
|
2144
|
+
message: r.message,
|
|
2145
|
+
type: "error"
|
|
2146
|
+
});
|
|
2147
|
+
}
|
|
2148
|
+
}, Wi = async (e) => {
|
|
2149
|
+
var n, i, r, o;
|
|
2150
|
+
try {
|
|
2151
|
+
let u = null, d = null, f = null;
|
|
2152
|
+
const g = hn();
|
|
2153
|
+
(n = e == null ? void 0 : e.menuGroup) != null && n.length && (u = hn());
|
|
2154
|
+
const F = ot(ue), k = {
|
|
2155
|
+
code: "insert_menu_config",
|
|
2156
|
+
parameters: {
|
|
2157
|
+
UUID: g,
|
|
2158
|
+
featureJson: null,
|
|
2159
|
+
menuGroup: e.menuGroup ? parseInt(e.menuGroup) : null,
|
|
2160
|
+
groupUUID: u,
|
|
2161
|
+
menuName: e.menuName ? e.menuName : null,
|
|
2162
|
+
menuType: e.menuType ? e.menuType : null,
|
|
2163
|
+
navigationState: e.navigationState ? e.navigationState : null,
|
|
2164
|
+
subgroupId: d,
|
|
2165
|
+
subgroupUUID: f,
|
|
2166
|
+
isMobileFeature: e != null && e.isMobileFeature ? e == null ? void 0 : e.isMobileFeature : null,
|
|
2167
|
+
isWebFeature: e != null && e.isWebFeature ? e == null ? void 0 : e.isWebFeature : null,
|
|
2168
|
+
permissions: JSON.stringify(F),
|
|
2169
|
+
isNewFeature: "true",
|
|
2170
|
+
mobileConfig: JSON.stringify({
|
|
2171
|
+
entity_name: (e == null ? void 0 : e.entityName) ?? null,
|
|
2172
|
+
mobile_mode: e != null && e.mobileMode ? e == null ? void 0 : e.mobileMode.toUpperCase() : null,
|
|
2173
|
+
icon: (e == null ? void 0 : e.icon) ?? null,
|
|
2174
|
+
mobile_entities_sync: (e == null ? void 0 : e.mobileEntitiesSync) ?? [],
|
|
2175
|
+
conditions: (e == null ? void 0 : e.conditions) ?? null,
|
|
2176
|
+
training_required: e.trainingRequired ?? !1,
|
|
2177
|
+
training_query: e.trainingQuery ?? null,
|
|
2178
|
+
notification_badge_enabled: e.notificationBadgeEnabled ?? !1,
|
|
2179
|
+
notification_badge_type: e.notificationBadgeType ?? null,
|
|
2180
|
+
notification_badge_query: e.notificationBadgeQuery ?? null
|
|
2181
|
+
})
|
|
2182
|
+
}
|
|
2183
|
+
};
|
|
2184
|
+
if (Z.value && (l == null ? void 0 : l.val) === !1) {
|
|
2185
|
+
k.code = "update_menu_config";
|
|
2186
|
+
const { fields: ee, updatedFields: oe } = e, le = Z.value && _e ? en(oe) : (i = ee[0]) != null && i.value && _e ? en(ee) : {};
|
|
2187
|
+
a.setValue("featureJson", le), delete k.parameters.UUID, delete k.parameters.groupUUID, delete k.parameters.subgroupUUID, delete k.parameters.permissions, delete k.parameters.isNewFeature, k.parameters.featureType = b.get("featureType"), k.parameters.featureId = b.get("featureId"), k.parameters.featureJson = le;
|
|
2188
|
+
}
|
|
2189
|
+
let me;
|
|
2190
|
+
if (Z.value && (l == null ? void 0 : l.val) === !1) {
|
|
2191
|
+
const { data: ee } = await Qi(k);
|
|
2192
|
+
me = ee, await mr((r = ee == null ? void 0 : ee.result[0]) == null ? void 0 : r.id, ze);
|
|
2193
|
+
} else {
|
|
2194
|
+
Z.value && (delete k.parameters.UUID, delete k.parameters.groupUUID, delete k.parameters.subgroupUUID, delete k.parameters.isNewFeature, k.parameters.featureType = b.get("featureType"), k.parameters.featureId = b.get("featureId"));
|
|
2195
|
+
const { data: ee } = await H(k);
|
|
2196
|
+
if (me = ee, ee) {
|
|
2197
|
+
let oe = [];
|
|
2198
|
+
e.menuName && e.menuName.length > 0 && oe.push({
|
|
2199
|
+
code: "medplat_form_insert_into_translation_master",
|
|
2200
|
+
parameters: {
|
|
2201
|
+
translation_key: e.menuName.replaceAll(" ", ""),
|
|
2202
|
+
translation_value: e.menuName,
|
|
2203
|
+
form_code: "General"
|
|
2204
|
+
},
|
|
2205
|
+
sequence: 1
|
|
2206
|
+
}), oe.length > 0 && await Ft(oe);
|
|
2207
|
+
const le = Ht(ke);
|
|
2208
|
+
le && await H({
|
|
2209
|
+
code: "GRANT_PERMISSION_USER_MAP",
|
|
2210
|
+
parameters: {
|
|
2211
|
+
permissionUserMap: JSON.stringify(le)
|
|
2212
|
+
}
|
|
2213
|
+
});
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
(o = me == null ? void 0 : me.result) != null && o.length ? fe({
|
|
2217
|
+
message: Z.value ? "FEATURE EDITED SUCCESFULLY" : "FEATURE ADDED SUCCESFULLY",
|
|
2218
|
+
type: "success"
|
|
2219
|
+
}) : fe({
|
|
2220
|
+
message: "FEATURE CONFIGURATION ALREADY EXISTS ",
|
|
2221
|
+
type: "error"
|
|
2222
|
+
}), et(!0);
|
|
2223
|
+
} catch (u) {
|
|
2224
|
+
fe({
|
|
2225
|
+
message: u.message,
|
|
2226
|
+
type: "error"
|
|
2227
|
+
});
|
|
2228
|
+
}
|
|
2229
|
+
}, Xt = async (e) => {
|
|
2230
|
+
A ? Ai(e) : Wi(e);
|
|
2231
|
+
}, en = (e) => JSON.stringify(
|
|
2232
|
+
e == null ? void 0 : e.reduce((n, i) => (n[i.value] = i.checkbox, n), {})
|
|
2233
|
+
), qi = (e, n) => {
|
|
2234
|
+
e && e.type === "change" && Ri(n);
|
|
2235
|
+
}, Ri = rr(
|
|
2236
|
+
(e) => {
|
|
2237
|
+
Zt(e, Ue, Te);
|
|
2238
|
+
},
|
|
2239
|
+
[Zt]
|
|
2240
|
+
), Mi = () => {
|
|
2241
|
+
st(!_e), _e || (Z.value ? a.setValue("updatedFields", [
|
|
2242
|
+
{ id: 1, value: "", checkbox: !1 }
|
|
2243
|
+
]) : a.setValue("fields", [{ id: 1, value: "", checkbox: !1 }]));
|
|
2244
|
+
}, Bi = (e) => {
|
|
2245
|
+
const i = (Z.value ? a.getValues("updatedFields") : a.getValues("fields")).map((r) => r.id === e ? { ...r, checkbox: !r.checkbox } : r);
|
|
2246
|
+
Z.value ? a.setValue("updatedFields", i) : a.setValue("fields", i);
|
|
2247
|
+
}, Oi = () => {
|
|
2248
|
+
const e = Z.value ? a.getValues("updatedFields") : a.getValues("fields"), n = e[(e == null ? void 0 : e.length) - 1];
|
|
2249
|
+
if ((n == null ? void 0 : n.value.trim()) === "") {
|
|
2250
|
+
alert("Enter the right name before adding a new one.");
|
|
2251
|
+
return;
|
|
2252
|
+
}
|
|
2253
|
+
const i = {
|
|
2254
|
+
id: e.length + 1,
|
|
2255
|
+
value: "",
|
|
2256
|
+
checkbox: !1
|
|
2257
|
+
};
|
|
2258
|
+
Z.value ? a.setValue("updatedFields", [...e, i]) : a.setValue("fields", [...e, i]);
|
|
2259
|
+
}, Ui = (e) => {
|
|
2260
|
+
const i = (Z.value ? a.getValues("updatedFields") : a.getValues("fields")).filter((r) => r.id !== e);
|
|
2261
|
+
Z.value ? a.setValue("updatedFields", i) : a.setValue("fields", i), (i == null ? void 0 : i.length) === 0 && (Z.value ? st(!0) : st(!1));
|
|
2262
|
+
};
|
|
2263
|
+
return /* @__PURE__ */ t(
|
|
2264
|
+
"form",
|
|
2265
|
+
{
|
|
2266
|
+
noValidate: !0,
|
|
2267
|
+
ref: B,
|
|
2268
|
+
onSubmit: a.handleSubmit(Xt),
|
|
2269
|
+
method: "POST",
|
|
2270
|
+
children: /* @__PURE__ */ t(c, { sx: { width: "100%", p: 3, borderRadius: 2 }, children: /* @__PURE__ */ s(c, { sx: { display: "flex" }, children: [
|
|
2271
|
+
/* @__PURE__ */ t(
|
|
2272
|
+
c,
|
|
2273
|
+
{
|
|
2274
|
+
sx: {
|
|
2275
|
+
width: "30%",
|
|
2276
|
+
maxHeight: "87vh",
|
|
2277
|
+
background: `linear-gradient(to right, ${C.palette.custom.featureList || "#3576BA"}, ${C.palette.custom.black2 || "#1C2128"})`,
|
|
2278
|
+
p: 3,
|
|
2279
|
+
borderTopLeftRadius: 16,
|
|
2280
|
+
borderBottomLeftRadius: 16,
|
|
2281
|
+
borderTopRightRadius: 0,
|
|
2282
|
+
borderBottomRightRadius: 0,
|
|
2283
|
+
display: "flex",
|
|
2284
|
+
flexDirection: "column",
|
|
2285
|
+
justifyContent: "center",
|
|
2286
|
+
gap: 5
|
|
2287
|
+
},
|
|
2288
|
+
children: R.map((e, n) => {
|
|
2289
|
+
const i = n === $, r = oi(n), o = Ye.some((F) => F.key === e.key) && !r && !i, u = !o && !r && !i;
|
|
2290
|
+
let d = "transparent", f = "2px solid rgba(255,255,255,0.5)", g = "white";
|
|
2291
|
+
return i ? (d = "#BEE2FD", g = "#1e3a8a", f = "2px solid #BEE2FD") : r ? (d = "white", g = "#4caf50", f = "2px solid #4caf50") : o ? (d = "transparent", g = "white", f = "2px solid #BEE2FD") : u && (d = "transparent", g = "rgba(255,255,255,0.5)", f = "2px solid rgba(255,255,255,0.2)"), /* @__PURE__ */ t(Hi, { sx: { p: 0, m: 0 }, children: /* @__PURE__ */ s(
|
|
2292
|
+
c,
|
|
2293
|
+
{
|
|
2294
|
+
sx: {
|
|
2295
|
+
display: "flex",
|
|
2296
|
+
alignItems: "center",
|
|
2297
|
+
position: "relative",
|
|
2298
|
+
backgroundColor: i ? "custom.gray3" : "transparent",
|
|
2299
|
+
px: 1,
|
|
2300
|
+
py: 1,
|
|
2301
|
+
transition: "all 0.3s ease",
|
|
2302
|
+
borderRadius: 2,
|
|
2303
|
+
minHeight: 64
|
|
2304
|
+
},
|
|
2305
|
+
children: [
|
|
2306
|
+
n < (R == null ? void 0 : R.length) - 1 && /* @__PURE__ */ t(
|
|
2307
|
+
c,
|
|
2308
|
+
{
|
|
2309
|
+
sx: {
|
|
2310
|
+
position: "absolute",
|
|
2311
|
+
top: "45%",
|
|
2312
|
+
left: 22,
|
|
2313
|
+
height: "calc(100% + -10px)",
|
|
2314
|
+
width: 2,
|
|
2315
|
+
backgroundColor: "white",
|
|
2316
|
+
opacity: u ? 0.3 : 1,
|
|
2317
|
+
zIndex: 0,
|
|
2318
|
+
transform: "translateY(50%)"
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
),
|
|
2322
|
+
/* @__PURE__ */ t(
|
|
2323
|
+
c,
|
|
2324
|
+
{
|
|
2325
|
+
sx: {
|
|
2326
|
+
width: 32,
|
|
2327
|
+
height: 32,
|
|
2328
|
+
borderRadius: "50%",
|
|
2329
|
+
backgroundColor: d,
|
|
2330
|
+
border: f,
|
|
2331
|
+
color: g,
|
|
2332
|
+
fontWeight: "bold",
|
|
2333
|
+
fontSize: 14,
|
|
2334
|
+
display: "flex",
|
|
2335
|
+
alignItems: "center",
|
|
2336
|
+
justifyContent: "center",
|
|
2337
|
+
zIndex: 1,
|
|
2338
|
+
flexShrink: 0
|
|
2339
|
+
},
|
|
2340
|
+
children: r && !i ? /* @__PURE__ */ t(de, { iconName: "faCheck", size: "lg" }) : n + 1
|
|
2341
|
+
}
|
|
2342
|
+
),
|
|
2343
|
+
/* @__PURE__ */ s(c, { sx: { ml: 2 }, children: [
|
|
2344
|
+
/* @__PURE__ */ s(
|
|
2345
|
+
m,
|
|
2346
|
+
{
|
|
2347
|
+
variant: "caption",
|
|
2348
|
+
sx: {
|
|
2349
|
+
color: r ? "primary.main" : "white",
|
|
2350
|
+
fontWeight: "bold",
|
|
2351
|
+
textTransform: "uppercase",
|
|
2352
|
+
fontSize: 14,
|
|
2353
|
+
opacity: u ? 0.5 : 1
|
|
2354
|
+
},
|
|
2355
|
+
children: [
|
|
2356
|
+
"STEP ",
|
|
2357
|
+
n + 1
|
|
2358
|
+
]
|
|
2359
|
+
}
|
|
2360
|
+
),
|
|
2361
|
+
/* @__PURE__ */ t(
|
|
2362
|
+
m,
|
|
2363
|
+
{
|
|
2364
|
+
variant: "subtitle2",
|
|
2365
|
+
sx: {
|
|
2366
|
+
color: r ? "primary.main" : "white",
|
|
2367
|
+
fontWeight: "bold",
|
|
2368
|
+
textTransform: "uppercase",
|
|
2369
|
+
fontSize: 14,
|
|
2370
|
+
opacity: u ? 0.5 : 1
|
|
2371
|
+
},
|
|
2372
|
+
children: e.label
|
|
2373
|
+
}
|
|
2374
|
+
)
|
|
2375
|
+
] })
|
|
2376
|
+
]
|
|
2377
|
+
}
|
|
2378
|
+
) }, e.key);
|
|
2379
|
+
})
|
|
2380
|
+
}
|
|
2381
|
+
),
|
|
2382
|
+
/* @__PURE__ */ s(
|
|
2383
|
+
c,
|
|
2384
|
+
{
|
|
2385
|
+
sx: {
|
|
2386
|
+
width: "80%",
|
|
2387
|
+
backgroundColor: "background.paper",
|
|
2388
|
+
padding: 2,
|
|
2389
|
+
borderRadius: "10px",
|
|
2390
|
+
display: "flex",
|
|
2391
|
+
flexDirection: "column",
|
|
2392
|
+
maxHeight: "87vh",
|
|
2393
|
+
overflowY: "auto"
|
|
2394
|
+
},
|
|
2395
|
+
children: [
|
|
2396
|
+
((rn = R[$]) == null ? void 0 : rn.key) === "featureDetails" && /* @__PURE__ */ t(c, { display: "flex", justifyContent: "center", children: /* @__PURE__ */ s(c, { width: "80%", children: [
|
|
2397
|
+
/* @__PURE__ */ t(
|
|
2398
|
+
m,
|
|
2399
|
+
{
|
|
2400
|
+
variant: "h5",
|
|
2401
|
+
sx: {
|
|
2402
|
+
fontWeight: "bold",
|
|
2403
|
+
textAlign: "center",
|
|
2404
|
+
marginBottom: 1,
|
|
2405
|
+
marginTop: 2
|
|
2406
|
+
},
|
|
2407
|
+
children: y("Feature Details")
|
|
2408
|
+
}
|
|
2409
|
+
),
|
|
2410
|
+
/* @__PURE__ */ t(
|
|
2411
|
+
m,
|
|
2412
|
+
{
|
|
2413
|
+
sx: { textAlign: "center", marginBottom: 4, color: "grey" },
|
|
2414
|
+
children: "Please provide the necessary details for the new feature, including its name, constant, and where it should be linked in the menu."
|
|
2415
|
+
}
|
|
2416
|
+
),
|
|
2417
|
+
/* @__PURE__ */ t(Y, { children: /* @__PURE__ */ s(
|
|
2418
|
+
ne,
|
|
2419
|
+
{
|
|
2420
|
+
variant: "outlined",
|
|
2421
|
+
className: "m-3 flex flex-row items-center w-[80%] justify-between",
|
|
2422
|
+
children: [
|
|
2423
|
+
/* @__PURE__ */ s(
|
|
2424
|
+
m,
|
|
2425
|
+
{
|
|
2426
|
+
variant: "subtitle1",
|
|
2427
|
+
className: "whitespace-nowrap",
|
|
2428
|
+
children: [
|
|
2429
|
+
y("Is"),
|
|
2430
|
+
" ",
|
|
2431
|
+
y("dynamic"),
|
|
2432
|
+
" ",
|
|
2433
|
+
y("feature? "),
|
|
2434
|
+
":"
|
|
2435
|
+
]
|
|
2436
|
+
}
|
|
2437
|
+
),
|
|
2438
|
+
/* @__PURE__ */ t(c, { className: "w-[60%]", children: /* @__PURE__ */ t(
|
|
2439
|
+
Q,
|
|
2440
|
+
{
|
|
2441
|
+
name: "isDynamicFeature",
|
|
2442
|
+
control: a.control,
|
|
2443
|
+
rules: { required: "Required field" },
|
|
2444
|
+
render: ({ field: e }) => /* @__PURE__ */ t(
|
|
2445
|
+
we,
|
|
2446
|
+
{
|
|
2447
|
+
checked: e.value,
|
|
2448
|
+
disabled: !!b.get("featureId"),
|
|
2449
|
+
onChange: (n) => {
|
|
2450
|
+
e.onChange(n.target.checked), Ci(n);
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
)
|
|
2454
|
+
}
|
|
2455
|
+
) })
|
|
2456
|
+
]
|
|
2457
|
+
}
|
|
2458
|
+
) }),
|
|
2459
|
+
/* @__PURE__ */ t(Y, { children: /* @__PURE__ */ s(
|
|
2460
|
+
ne,
|
|
2461
|
+
{
|
|
2462
|
+
variant: "outlined",
|
|
2463
|
+
className: " m-3 flex flex-row items-center w-[80%] justify-between",
|
|
2464
|
+
children: [
|
|
2465
|
+
/* @__PURE__ */ s(m, { variant: "subtitle1", children: [
|
|
2466
|
+
y("Feature"),
|
|
2467
|
+
" ",
|
|
2468
|
+
y("Name"),
|
|
2469
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" }),
|
|
2470
|
+
" :"
|
|
2471
|
+
] }),
|
|
2472
|
+
/* @__PURE__ */ t(c, { className: "w-[60%]", children: /* @__PURE__ */ t(
|
|
2473
|
+
ie,
|
|
2474
|
+
{
|
|
2475
|
+
control: a.control,
|
|
2476
|
+
id: "menuName",
|
|
2477
|
+
name: "menuName",
|
|
2478
|
+
errors: a.formState.errors,
|
|
2479
|
+
disabled: Et,
|
|
2480
|
+
placeholder: "Feature Name"
|
|
2481
|
+
}
|
|
2482
|
+
) })
|
|
2483
|
+
]
|
|
2484
|
+
}
|
|
2485
|
+
) }),
|
|
2486
|
+
A ? /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ s(
|
|
2487
|
+
ne,
|
|
2488
|
+
{
|
|
2489
|
+
variant: "outlined",
|
|
2490
|
+
className: " m-3 flex flex-row items-center w-[80%] justify-between",
|
|
2491
|
+
children: [
|
|
2492
|
+
/* @__PURE__ */ s(m, { variant: "subtitle1", children: [
|
|
2493
|
+
y("Feature"),
|
|
2494
|
+
" ",
|
|
2495
|
+
y("Constant"),
|
|
2496
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" }),
|
|
2497
|
+
" :"
|
|
2498
|
+
] }),
|
|
2499
|
+
/* @__PURE__ */ t(c, { className: "w-[60%]", children: /* @__PURE__ */ t(
|
|
2500
|
+
ie,
|
|
2501
|
+
{
|
|
2502
|
+
control: a.control,
|
|
2503
|
+
id: "featureConstant",
|
|
2504
|
+
name: "featureConstant",
|
|
2505
|
+
errors: a.formState.errors,
|
|
2506
|
+
successMessage: Ce,
|
|
2507
|
+
placeholder: "Feature Constant",
|
|
2508
|
+
disabled: P,
|
|
2509
|
+
onChange: (e) => Di(e.target.value)
|
|
2510
|
+
}
|
|
2511
|
+
) })
|
|
2512
|
+
]
|
|
2513
|
+
}
|
|
2514
|
+
) }, "static-feature") : /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ s(
|
|
2515
|
+
ne,
|
|
2516
|
+
{
|
|
2517
|
+
variant: "outlined",
|
|
2518
|
+
className: " m-2 flex flex-row items-center w-[80%] justify-between",
|
|
2519
|
+
children: [
|
|
2520
|
+
/* @__PURE__ */ s(m, { variant: "subtitle1", children: [
|
|
2521
|
+
y("Feature"),
|
|
2522
|
+
" ",
|
|
2523
|
+
y("State"),
|
|
2524
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 mx-1", children: "*" }),
|
|
2525
|
+
/* @__PURE__ */ t(
|
|
2526
|
+
ye,
|
|
2527
|
+
{
|
|
2528
|
+
title: /* @__PURE__ */ t(
|
|
2529
|
+
m,
|
|
2530
|
+
{
|
|
2531
|
+
fontSize: 12,
|
|
2532
|
+
maxWidth: 200,
|
|
2533
|
+
sx: { whiteSpace: "pre-line" },
|
|
2534
|
+
children: `Must follow one of these formats:
|
|
2535
|
+
• techo.*
|
|
2536
|
+
• medplat.form.*`
|
|
2537
|
+
}
|
|
2538
|
+
),
|
|
2539
|
+
size: "sm"
|
|
2540
|
+
}
|
|
2541
|
+
)
|
|
2542
|
+
] }),
|
|
2543
|
+
/* @__PURE__ */ t(c, { className: "w-[60%]", children: /* @__PURE__ */ t(
|
|
2544
|
+
ie,
|
|
2545
|
+
{
|
|
2546
|
+
control: a.control,
|
|
2547
|
+
id: "navigationState",
|
|
2548
|
+
name: "navigationState",
|
|
2549
|
+
placeholder: "Feature State",
|
|
2550
|
+
disabled: Et || P,
|
|
2551
|
+
successMessage: Ce,
|
|
2552
|
+
dataTestId: "managefeature-textfield-feature-state",
|
|
2553
|
+
errors: a.formState.errors,
|
|
2554
|
+
onChange: (e) => Pi(
|
|
2555
|
+
e.target.value
|
|
2556
|
+
)
|
|
2557
|
+
}
|
|
2558
|
+
) })
|
|
2559
|
+
]
|
|
2560
|
+
}
|
|
2561
|
+
) }, "dynamic-feature"),
|
|
2562
|
+
/* @__PURE__ */ t(Y, { children: /* @__PURE__ */ s(
|
|
2563
|
+
ne,
|
|
2564
|
+
{
|
|
2565
|
+
variant: "outlined",
|
|
2566
|
+
className: " m-3 flex flex-row items-center w-[80%] justify-between",
|
|
2567
|
+
children: [
|
|
2568
|
+
/* @__PURE__ */ s(m, { variant: "subtitle1", children: [
|
|
2569
|
+
y("Link"),
|
|
2570
|
+
" ",
|
|
2571
|
+
y("to"),
|
|
2572
|
+
" ",
|
|
2573
|
+
y("Menu"),
|
|
2574
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" }),
|
|
2575
|
+
" :"
|
|
2576
|
+
] }),
|
|
2577
|
+
/* @__PURE__ */ t(c, { className: " w-[60%]", children: /* @__PURE__ */ t(
|
|
2578
|
+
Ee,
|
|
2579
|
+
{
|
|
2580
|
+
control: a.control,
|
|
2581
|
+
name: "menuType",
|
|
2582
|
+
options: Me,
|
|
2583
|
+
errors: a.formState.errors,
|
|
2584
|
+
disableClearable: !1,
|
|
2585
|
+
onChange: (e) => {
|
|
2586
|
+
a.setValue("menuType", e.target.value), Ct();
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
) })
|
|
2590
|
+
]
|
|
2591
|
+
}
|
|
2592
|
+
) }),
|
|
2593
|
+
/* @__PURE__ */ t(Y, { children: (K == null ? void 0 : K.length) > 0 && /* @__PURE__ */ s(
|
|
2594
|
+
ne,
|
|
2595
|
+
{
|
|
2596
|
+
variant: "outlined",
|
|
2597
|
+
className: " m-3 flex flex-row items-center w-[80%] justify-between",
|
|
2598
|
+
children: [
|
|
2599
|
+
/* @__PURE__ */ s(m, { variant: "subtitle1", children: [
|
|
2600
|
+
y("Menu"),
|
|
2601
|
+
" ",
|
|
2602
|
+
y("SubGroup"),
|
|
2603
|
+
" :"
|
|
2604
|
+
] }),
|
|
2605
|
+
/* @__PURE__ */ t(c, { className: " w-[60%]", children: /* @__PURE__ */ t(
|
|
2606
|
+
Ee,
|
|
2607
|
+
{
|
|
2608
|
+
control: a.control,
|
|
2609
|
+
name: "menuGroup",
|
|
2610
|
+
errors: a.formState.errors,
|
|
2611
|
+
displayName: "name",
|
|
2612
|
+
optionValue: "id",
|
|
2613
|
+
options: K,
|
|
2614
|
+
disableClearable: !1,
|
|
2615
|
+
onChange: xi
|
|
2616
|
+
}
|
|
2617
|
+
) })
|
|
2618
|
+
]
|
|
2619
|
+
}
|
|
2620
|
+
) }),
|
|
2621
|
+
/* @__PURE__ */ t(Y, { children: /* @__PURE__ */ s(
|
|
2622
|
+
ne,
|
|
2623
|
+
{
|
|
2624
|
+
variant: "outlined",
|
|
2625
|
+
className: "m-3 flex flex-row items-center w-[80%] justify-between",
|
|
2626
|
+
children: [
|
|
2627
|
+
/* @__PURE__ */ s(
|
|
2628
|
+
m,
|
|
2629
|
+
{
|
|
2630
|
+
variant: "subtitle1",
|
|
2631
|
+
className: "whitespace-nowrap",
|
|
2632
|
+
children: [
|
|
2633
|
+
y("Enable"),
|
|
2634
|
+
" ",
|
|
2635
|
+
y("feature"),
|
|
2636
|
+
" ",
|
|
2637
|
+
y("for"),
|
|
2638
|
+
":"
|
|
2639
|
+
]
|
|
2640
|
+
}
|
|
2641
|
+
),
|
|
2642
|
+
/* @__PURE__ */ s(c, { className: "w-[60%] flex flex-row gap-6 items-center", children: [
|
|
2643
|
+
/* @__PURE__ */ s(c, { className: "flex items-center gap-1", children: [
|
|
2644
|
+
/* @__PURE__ */ t(m, { variant: "subtitle1", children: y("Web") }),
|
|
2645
|
+
/* @__PURE__ */ t(
|
|
2646
|
+
Q,
|
|
2647
|
+
{
|
|
2648
|
+
name: "isWebFeature",
|
|
2649
|
+
control: a.control,
|
|
2650
|
+
render: ({ field: e }) => /* @__PURE__ */ t(
|
|
2651
|
+
we,
|
|
2652
|
+
{
|
|
2653
|
+
...e,
|
|
2654
|
+
checked: e.value,
|
|
2655
|
+
onChange: (n) => e.onChange(n.target.checked)
|
|
2656
|
+
}
|
|
2657
|
+
)
|
|
2658
|
+
}
|
|
2659
|
+
)
|
|
2660
|
+
] }),
|
|
2661
|
+
/* @__PURE__ */ s(c, { className: "flex items-center gap-1", children: [
|
|
2662
|
+
/* @__PURE__ */ t(m, { variant: "subtitle1", children: y("Mobile") }),
|
|
2663
|
+
/* @__PURE__ */ t(
|
|
2664
|
+
Q,
|
|
2665
|
+
{
|
|
2666
|
+
name: "isMobileFeature",
|
|
2667
|
+
control: a.control,
|
|
2668
|
+
render: ({ field: e }) => /* @__PURE__ */ t(
|
|
2669
|
+
we,
|
|
2670
|
+
{
|
|
2671
|
+
...e,
|
|
2672
|
+
checked: e.value,
|
|
2673
|
+
onChange: (n) => {
|
|
2674
|
+
e.onChange(n.target.checked), Si(n);
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
)
|
|
2678
|
+
}
|
|
2679
|
+
)
|
|
2680
|
+
] })
|
|
2681
|
+
] })
|
|
2682
|
+
]
|
|
2683
|
+
}
|
|
2684
|
+
) })
|
|
2685
|
+
] }) }),
|
|
2686
|
+
((an = R[$]) == null ? void 0 : an.key) === "mobileConfig" && M && /* @__PURE__ */ t(c, { display: "flex", justifyContent: "center", children: /* @__PURE__ */ s(c, { width: "95%", children: [
|
|
2687
|
+
/* @__PURE__ */ t(
|
|
2688
|
+
m,
|
|
2689
|
+
{
|
|
2690
|
+
variant: "h5",
|
|
2691
|
+
sx: { fontWeight: "bold", textAlign: "center", mb: 1 },
|
|
2692
|
+
children: y("Mobile Setup")
|
|
2693
|
+
}
|
|
2694
|
+
),
|
|
2695
|
+
/* @__PURE__ */ t(
|
|
2696
|
+
m,
|
|
2697
|
+
{
|
|
2698
|
+
sx: { textAlign: "center", mb: 3, color: "grey" },
|
|
2699
|
+
children: "Set up how this feature should behave and appear in the mobile app, including its entity, icon and condition query."
|
|
2700
|
+
}
|
|
2701
|
+
),
|
|
2702
|
+
/* @__PURE__ */ s(
|
|
2703
|
+
kt,
|
|
2704
|
+
{
|
|
2705
|
+
expanded: yt.basicConfig,
|
|
2706
|
+
onChange: () => bt((e) => ({
|
|
2707
|
+
...e,
|
|
2708
|
+
basicConfig: !e.basicConfig
|
|
2709
|
+
})),
|
|
2710
|
+
sx: {
|
|
2711
|
+
mb: 1.5,
|
|
2712
|
+
borderRadius: 2,
|
|
2713
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.08)",
|
|
2714
|
+
border: "1px solid rgba(33, 150, 243, 0.2)",
|
|
2715
|
+
borderLeft: "4px solid #2196f3",
|
|
2716
|
+
"&:before": { display: "none" },
|
|
2717
|
+
overflow: "hidden"
|
|
2718
|
+
},
|
|
2719
|
+
children: [
|
|
2720
|
+
/* @__PURE__ */ t(
|
|
2721
|
+
It,
|
|
2722
|
+
{
|
|
2723
|
+
expandIcon: /* @__PURE__ */ t(de, { iconName: "faChevronDown", size: "sm" }),
|
|
2724
|
+
sx: {
|
|
2725
|
+
backgroundColor: "rgba(33, 150, 243, 0.06)",
|
|
2726
|
+
"&:hover": {
|
|
2727
|
+
backgroundColor: "rgba(33, 150, 243, 0.12)"
|
|
2728
|
+
},
|
|
2729
|
+
minHeight: 52
|
|
2730
|
+
},
|
|
2731
|
+
children: /* @__PURE__ */ t(m, { fontWeight: 700, fontSize: 15, children: "Basic Config" })
|
|
2732
|
+
}
|
|
2733
|
+
),
|
|
2734
|
+
/* @__PURE__ */ s(
|
|
2735
|
+
wt,
|
|
2736
|
+
{
|
|
2737
|
+
sx: { display: "flex", flexDirection: "column", gap: 2 },
|
|
2738
|
+
children: [
|
|
2739
|
+
/* @__PURE__ */ s(
|
|
2740
|
+
c,
|
|
2741
|
+
{
|
|
2742
|
+
display: "flex",
|
|
2743
|
+
flexDirection: "row",
|
|
2744
|
+
alignItems: "center",
|
|
2745
|
+
children: [
|
|
2746
|
+
/* @__PURE__ */ s(
|
|
2747
|
+
c,
|
|
2748
|
+
{
|
|
2749
|
+
display: "flex",
|
|
2750
|
+
alignItems: "center",
|
|
2751
|
+
gap: 2,
|
|
2752
|
+
sx: { width: "50%" },
|
|
2753
|
+
children: [
|
|
2754
|
+
/* @__PURE__ */ s(
|
|
2755
|
+
m,
|
|
2756
|
+
{
|
|
2757
|
+
variant: "subtitle1",
|
|
2758
|
+
sx: { minWidth: "140px", flexShrink: 0 },
|
|
2759
|
+
children: [
|
|
2760
|
+
y("Feature Icon"),
|
|
2761
|
+
" ",
|
|
2762
|
+
/* @__PURE__ */ t("span", { style: { color: "#d32f2f" }, children: "* " }),
|
|
2763
|
+
/* @__PURE__ */ t(
|
|
2764
|
+
ye,
|
|
2765
|
+
{
|
|
2766
|
+
title: /* @__PURE__ */ t(m, { fontSize: 12, maxWidth: 200, children: "Upload Feature Icon" }),
|
|
2767
|
+
size: "sm"
|
|
2768
|
+
}
|
|
2769
|
+
)
|
|
2770
|
+
]
|
|
2771
|
+
}
|
|
2772
|
+
),
|
|
2773
|
+
/* @__PURE__ */ t(Yi, { title: "Upload Icon", children: /* @__PURE__ */ t(
|
|
2774
|
+
c,
|
|
2775
|
+
{
|
|
2776
|
+
sx: {
|
|
2777
|
+
transform: "scale(0.55)",
|
|
2778
|
+
transformOrigin: "left center",
|
|
2779
|
+
"& svg": {
|
|
2780
|
+
fontSize: "2.5rem"
|
|
2781
|
+
}
|
|
2782
|
+
},
|
|
2783
|
+
children: /* @__PURE__ */ t(
|
|
2784
|
+
zi,
|
|
2785
|
+
{
|
|
2786
|
+
onUpload: (e) => a.setValue("icon", e),
|
|
2787
|
+
formControl: a,
|
|
2788
|
+
name: "icon",
|
|
2789
|
+
accept: "image/svg+xml, image/svg",
|
|
2790
|
+
errors: M ? a.formState.errors : null,
|
|
2791
|
+
triggerType: "icon"
|
|
2792
|
+
}
|
|
2793
|
+
)
|
|
2794
|
+
}
|
|
2795
|
+
) })
|
|
2796
|
+
]
|
|
2797
|
+
}
|
|
2798
|
+
),
|
|
2799
|
+
/* @__PURE__ */ s(
|
|
2800
|
+
c,
|
|
2801
|
+
{
|
|
2802
|
+
display: "flex",
|
|
2803
|
+
alignItems: "center",
|
|
2804
|
+
gap: 2,
|
|
2805
|
+
my: 4,
|
|
2806
|
+
sx: { width: "50%" },
|
|
2807
|
+
children: [
|
|
2808
|
+
/* @__PURE__ */ s(
|
|
2809
|
+
m,
|
|
2810
|
+
{
|
|
2811
|
+
variant: "subtitle1",
|
|
2812
|
+
sx: { minWidth: "140px", flexShrink: 0 },
|
|
2813
|
+
children: [
|
|
2814
|
+
y("Mode"),
|
|
2815
|
+
" ",
|
|
2816
|
+
/* @__PURE__ */ t("span", { style: { color: "#d32f2f" }, children: "* " }),
|
|
2817
|
+
/* @__PURE__ */ t(
|
|
2818
|
+
ye,
|
|
2819
|
+
{
|
|
2820
|
+
title: /* @__PURE__ */ t(m, { fontSize: 12, maxWidth: 200, children: "Choose whether this feature should work online or offline" }),
|
|
2821
|
+
size: "sm"
|
|
2822
|
+
}
|
|
2823
|
+
)
|
|
2824
|
+
]
|
|
2825
|
+
}
|
|
2826
|
+
),
|
|
2827
|
+
/* @__PURE__ */ t(c, { sx: { display: "flex", flex: 1 }, children: /* @__PURE__ */ t(
|
|
2828
|
+
Q,
|
|
2829
|
+
{
|
|
2830
|
+
name: "mobileMode",
|
|
2831
|
+
control: a.control,
|
|
2832
|
+
render: ({ field: e, fieldState: { error: n } }) => /* @__PURE__ */ s(he, { children: [
|
|
2833
|
+
/* @__PURE__ */ s(
|
|
2834
|
+
pn,
|
|
2835
|
+
{
|
|
2836
|
+
value: e.value ?? "",
|
|
2837
|
+
row: !0,
|
|
2838
|
+
...e,
|
|
2839
|
+
children: [
|
|
2840
|
+
/* @__PURE__ */ t(
|
|
2841
|
+
dt,
|
|
2842
|
+
{
|
|
2843
|
+
value: "ONLINE",
|
|
2844
|
+
control: /* @__PURE__ */ t(
|
|
2845
|
+
ct,
|
|
2846
|
+
{
|
|
2847
|
+
disabled: P && Pt !== null
|
|
2848
|
+
}
|
|
2849
|
+
),
|
|
2850
|
+
label: "Online"
|
|
2851
|
+
}
|
|
2852
|
+
),
|
|
2853
|
+
/* @__PURE__ */ t(
|
|
2854
|
+
dt,
|
|
2855
|
+
{
|
|
2856
|
+
value: "OFFLINE",
|
|
2857
|
+
control: /* @__PURE__ */ t(
|
|
2858
|
+
ct,
|
|
2859
|
+
{
|
|
2860
|
+
disabled: P && Pt !== null
|
|
2861
|
+
}
|
|
2862
|
+
),
|
|
2863
|
+
label: "Offline"
|
|
2864
|
+
}
|
|
2865
|
+
)
|
|
2866
|
+
]
|
|
2867
|
+
}
|
|
2868
|
+
),
|
|
2869
|
+
(n == null ? void 0 : n.message) && /* @__PURE__ */ t(
|
|
2870
|
+
m,
|
|
2871
|
+
{
|
|
2872
|
+
variant: "caption",
|
|
2873
|
+
color: "error",
|
|
2874
|
+
sx: { mt: 0.5 },
|
|
2875
|
+
children: n.message
|
|
2876
|
+
}
|
|
2877
|
+
)
|
|
2878
|
+
] })
|
|
2879
|
+
}
|
|
2880
|
+
) })
|
|
2881
|
+
]
|
|
2882
|
+
}
|
|
2883
|
+
)
|
|
2884
|
+
]
|
|
2885
|
+
}
|
|
2886
|
+
),
|
|
2887
|
+
/* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
2888
|
+
/* @__PURE__ */ s(
|
|
2889
|
+
m,
|
|
2890
|
+
{
|
|
2891
|
+
variant: "subtitle1",
|
|
2892
|
+
sx: { minWidth: "140px", flexShrink: 0 },
|
|
2893
|
+
children: [
|
|
2894
|
+
y("Entity Name"),
|
|
2895
|
+
" ",
|
|
2896
|
+
/* @__PURE__ */ t(
|
|
2897
|
+
ye,
|
|
2898
|
+
{
|
|
2899
|
+
title: /* @__PURE__ */ t(m, { fontSize: 12, maxWidth: 200, children: "Select Entity Name" }),
|
|
2900
|
+
size: "sm"
|
|
2901
|
+
}
|
|
2902
|
+
)
|
|
2903
|
+
]
|
|
2904
|
+
}
|
|
2905
|
+
),
|
|
2906
|
+
/* @__PURE__ */ t(
|
|
2907
|
+
c,
|
|
2908
|
+
{
|
|
2909
|
+
sx: {
|
|
2910
|
+
display: "flex",
|
|
2911
|
+
alignItems: "center",
|
|
2912
|
+
gap: 2,
|
|
2913
|
+
flex: 1
|
|
2914
|
+
},
|
|
2915
|
+
children: /* @__PURE__ */ t(
|
|
2916
|
+
Ee,
|
|
2917
|
+
{
|
|
2918
|
+
control: a.control,
|
|
2919
|
+
name: "entityName",
|
|
2920
|
+
options: v || [],
|
|
2921
|
+
errors: M ? a.formState.errors : null,
|
|
2922
|
+
size: "small",
|
|
2923
|
+
disableClearable: !1,
|
|
2924
|
+
sx: { flex: 1 }
|
|
2925
|
+
}
|
|
2926
|
+
)
|
|
2927
|
+
}
|
|
2928
|
+
)
|
|
2929
|
+
] }),
|
|
2930
|
+
a.getValues("entityName") && ((sn = a.getValues("entityName")) == null ? void 0 : sn.trim().length) > 0 && /* @__PURE__ */ s(
|
|
2931
|
+
c,
|
|
2932
|
+
{
|
|
2933
|
+
display: "flex",
|
|
2934
|
+
alignItems: "flex-start",
|
|
2935
|
+
gap: 2,
|
|
2936
|
+
my: 2,
|
|
2937
|
+
children: [
|
|
2938
|
+
/* @__PURE__ */ s(
|
|
2939
|
+
m,
|
|
2940
|
+
{
|
|
2941
|
+
variant: "subtitle1",
|
|
2942
|
+
sx: {
|
|
2943
|
+
minWidth: "140px",
|
|
2944
|
+
flexShrink: 0,
|
|
2945
|
+
pt: 0.5
|
|
2946
|
+
},
|
|
2947
|
+
children: [
|
|
2948
|
+
y("Condition Query"),
|
|
2949
|
+
" :",
|
|
2950
|
+
" ",
|
|
2951
|
+
/* @__PURE__ */ t(
|
|
2952
|
+
ye,
|
|
2953
|
+
{
|
|
2954
|
+
title: /* @__PURE__ */ t(m, { fontSize: 12, maxWidth: 200, children: "Write Condition Query in the editor" }),
|
|
2955
|
+
size: "sm"
|
|
2956
|
+
}
|
|
2957
|
+
)
|
|
2958
|
+
]
|
|
2959
|
+
}
|
|
2960
|
+
),
|
|
2961
|
+
/* @__PURE__ */ t(
|
|
2962
|
+
c,
|
|
2963
|
+
{
|
|
2964
|
+
flex: 1,
|
|
2965
|
+
sx: {
|
|
2966
|
+
border: "1px solid #bdbdbd",
|
|
2967
|
+
borderRadius: 2,
|
|
2968
|
+
height: "20vh",
|
|
2969
|
+
overflow: "hidden",
|
|
2970
|
+
boxShadow: "0 1px 6px rgba(0, 0, 0, 0.08)"
|
|
2971
|
+
},
|
|
2972
|
+
children: /* @__PURE__ */ t(
|
|
2973
|
+
Q,
|
|
2974
|
+
{
|
|
2975
|
+
name: "conditions",
|
|
2976
|
+
control: a.control,
|
|
2977
|
+
render: ({ field: e, fieldState: { error: n } }) => /* @__PURE__ */ s(he, { children: [
|
|
2978
|
+
/* @__PURE__ */ t(
|
|
2979
|
+
Li,
|
|
2980
|
+
{
|
|
2981
|
+
height: "100%",
|
|
2982
|
+
defaultLanguage: "sql",
|
|
2983
|
+
theme: ti == "light" ? "light" : "vs-dark",
|
|
2984
|
+
options: {
|
|
2985
|
+
fontSize: 13,
|
|
2986
|
+
minimap: { enabled: !1 },
|
|
2987
|
+
automaticLayout: !0,
|
|
2988
|
+
scrollBeyondLastLine: !1,
|
|
2989
|
+
wordWrap: "on",
|
|
2990
|
+
occurrencesHighlight: !1,
|
|
2991
|
+
selectionHighlight: !1
|
|
2992
|
+
},
|
|
2993
|
+
value: e.value || "",
|
|
2994
|
+
onChange: e.onChange,
|
|
2995
|
+
editorProps: { $blockScrolling: !0 }
|
|
2996
|
+
}
|
|
2997
|
+
),
|
|
2998
|
+
(n == null ? void 0 : n.message) && /* @__PURE__ */ t(
|
|
2999
|
+
m,
|
|
3000
|
+
{
|
|
3001
|
+
variant: "caption",
|
|
3002
|
+
color: "error",
|
|
3003
|
+
sx: { mt: 0.75, ml: 1 },
|
|
3004
|
+
children: n.message
|
|
3005
|
+
}
|
|
3006
|
+
)
|
|
3007
|
+
] })
|
|
3008
|
+
}
|
|
3009
|
+
)
|
|
3010
|
+
}
|
|
3011
|
+
)
|
|
3012
|
+
]
|
|
3013
|
+
}
|
|
3014
|
+
),
|
|
3015
|
+
/* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
3016
|
+
/* @__PURE__ */ s(
|
|
3017
|
+
m,
|
|
3018
|
+
{
|
|
3019
|
+
variant: "subtitle1",
|
|
3020
|
+
sx: { minWidth: "140px", flexShrink: 0 },
|
|
3021
|
+
children: [
|
|
3022
|
+
y("Tables to sync"),
|
|
3023
|
+
" ",
|
|
3024
|
+
/* @__PURE__ */ t(
|
|
3025
|
+
ye,
|
|
3026
|
+
{
|
|
3027
|
+
title: /* @__PURE__ */ t(m, { fontSize: 12, maxWidth: 200, children: "Select at least one table to sync" }),
|
|
3028
|
+
size: "sm"
|
|
3029
|
+
}
|
|
3030
|
+
)
|
|
3031
|
+
]
|
|
3032
|
+
}
|
|
3033
|
+
),
|
|
3034
|
+
/* @__PURE__ */ t(
|
|
3035
|
+
c,
|
|
3036
|
+
{
|
|
3037
|
+
sx: {
|
|
3038
|
+
display: "flex",
|
|
3039
|
+
alignItems: "center",
|
|
3040
|
+
gap: 2,
|
|
3041
|
+
flex: 1
|
|
3042
|
+
},
|
|
3043
|
+
children: /* @__PURE__ */ t(
|
|
3044
|
+
De,
|
|
3045
|
+
{
|
|
3046
|
+
id: "mobileEntitiesSync",
|
|
3047
|
+
name: "mobileEntitiesSync",
|
|
3048
|
+
control: a.control,
|
|
3049
|
+
options: X,
|
|
3050
|
+
onChange: (e, n) => mi(n),
|
|
3051
|
+
getOptionLabel: (e) => e == null ? void 0 : e.tableName,
|
|
3052
|
+
checkEquality: "tableName",
|
|
3053
|
+
errors: M ? a.formState.errors : null,
|
|
3054
|
+
dataTestId: "syncentities-select-table",
|
|
3055
|
+
value: _,
|
|
3056
|
+
fullWidth: !0
|
|
3057
|
+
}
|
|
3058
|
+
)
|
|
3059
|
+
}
|
|
3060
|
+
)
|
|
3061
|
+
] })
|
|
3062
|
+
]
|
|
3063
|
+
}
|
|
3064
|
+
)
|
|
3065
|
+
]
|
|
3066
|
+
}
|
|
3067
|
+
),
|
|
3068
|
+
/* @__PURE__ */ s(
|
|
3069
|
+
kt,
|
|
3070
|
+
{
|
|
3071
|
+
expanded: yt.trainingConfig,
|
|
3072
|
+
onChange: () => bt((e) => ({
|
|
3073
|
+
...e,
|
|
3074
|
+
trainingConfig: !e.trainingConfig
|
|
3075
|
+
})),
|
|
3076
|
+
sx: {
|
|
3077
|
+
mb: 1.5,
|
|
3078
|
+
borderRadius: 2,
|
|
3079
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.08)",
|
|
3080
|
+
border: "1px solid rgba(76, 175, 80, 0.2)",
|
|
3081
|
+
borderLeft: "4px solid #4caf50",
|
|
3082
|
+
"&:before": { display: "none" },
|
|
3083
|
+
overflow: "hidden"
|
|
3084
|
+
},
|
|
3085
|
+
children: [
|
|
3086
|
+
/* @__PURE__ */ t(
|
|
3087
|
+
It,
|
|
3088
|
+
{
|
|
3089
|
+
expandIcon: /* @__PURE__ */ t(de, { iconName: "faChevronDown", size: "sm" }),
|
|
3090
|
+
sx: {
|
|
3091
|
+
backgroundColor: "rgba(76, 175, 80, 0.06)",
|
|
3092
|
+
"&:hover": {
|
|
3093
|
+
backgroundColor: "rgba(76, 175, 80, 0.12)"
|
|
3094
|
+
},
|
|
3095
|
+
minHeight: 52
|
|
3096
|
+
},
|
|
3097
|
+
children: /* @__PURE__ */ t(m, { fontWeight: 700, fontSize: 15, children: "Training Config" })
|
|
3098
|
+
}
|
|
3099
|
+
),
|
|
3100
|
+
/* @__PURE__ */ s(
|
|
3101
|
+
wt,
|
|
3102
|
+
{
|
|
3103
|
+
sx: { display: "flex", flexDirection: "column", gap: 2 },
|
|
3104
|
+
children: [
|
|
3105
|
+
/* @__PURE__ */ s(
|
|
3106
|
+
c,
|
|
3107
|
+
{
|
|
3108
|
+
display: "flex",
|
|
3109
|
+
alignItems: "center",
|
|
3110
|
+
justifyContent: "space-between",
|
|
3111
|
+
children: [
|
|
3112
|
+
/* @__PURE__ */ s(
|
|
3113
|
+
m,
|
|
3114
|
+
{
|
|
3115
|
+
variant: "subtitle1",
|
|
3116
|
+
sx: { minWidth: "200px", flexShrink: 0 },
|
|
3117
|
+
children: [
|
|
3118
|
+
y("Training Required"),
|
|
3119
|
+
" ",
|
|
3120
|
+
/* @__PURE__ */ t(
|
|
3121
|
+
ye,
|
|
3122
|
+
{
|
|
3123
|
+
title: /* @__PURE__ */ t(m, { fontSize: 12, maxWidth: 220, children: y(
|
|
3124
|
+
"Enable if the user must complete training before accessing this feature"
|
|
3125
|
+
) }),
|
|
3126
|
+
size: "sm"
|
|
3127
|
+
}
|
|
3128
|
+
)
|
|
3129
|
+
]
|
|
3130
|
+
}
|
|
3131
|
+
),
|
|
3132
|
+
/* @__PURE__ */ t(c, { sx: { flex: 1 }, children: /* @__PURE__ */ t(
|
|
3133
|
+
Q,
|
|
3134
|
+
{
|
|
3135
|
+
name: "trainingRequired",
|
|
3136
|
+
control: a.control,
|
|
3137
|
+
render: ({ field: e }) => /* @__PURE__ */ t(
|
|
3138
|
+
we,
|
|
3139
|
+
{
|
|
3140
|
+
...e,
|
|
3141
|
+
checked: !!e.value,
|
|
3142
|
+
onChange: (n) => {
|
|
3143
|
+
e.onChange(n.target.checked), n.target.checked || (a.setValue("trainingQuery", ""), Ge(""));
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
3146
|
+
)
|
|
3147
|
+
}
|
|
3148
|
+
) })
|
|
3149
|
+
]
|
|
3150
|
+
}
|
|
3151
|
+
),
|
|
3152
|
+
a.watch("trainingRequired") && /* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
3153
|
+
/* @__PURE__ */ s(
|
|
3154
|
+
m,
|
|
3155
|
+
{
|
|
3156
|
+
variant: "subtitle1",
|
|
3157
|
+
sx: { minWidth: "200px", flexShrink: 0 },
|
|
3158
|
+
children: [
|
|
3159
|
+
y("Training Query"),
|
|
3160
|
+
" ",
|
|
3161
|
+
/* @__PURE__ */ t(
|
|
3162
|
+
ye,
|
|
3163
|
+
{
|
|
3164
|
+
title: /* @__PURE__ */ t(m, { fontSize: 12, maxWidth: 220, children: y(
|
|
3165
|
+
"Select a query that returns a boolean — true if training is completed, false otherwise"
|
|
3166
|
+
) }),
|
|
3167
|
+
size: "sm"
|
|
3168
|
+
}
|
|
3169
|
+
)
|
|
3170
|
+
]
|
|
3171
|
+
}
|
|
3172
|
+
),
|
|
3173
|
+
/* @__PURE__ */ t(c, { sx: { flex: 1 }, children: /* @__PURE__ */ t(
|
|
3174
|
+
Q,
|
|
3175
|
+
{
|
|
3176
|
+
name: "trainingQuery",
|
|
3177
|
+
control: a.control,
|
|
3178
|
+
render: ({ field: e, fieldState: { error: n } }) => /* @__PURE__ */ t(
|
|
3179
|
+
De,
|
|
3180
|
+
{
|
|
3181
|
+
id: "trainingQuery",
|
|
3182
|
+
name: "trainingQuery",
|
|
3183
|
+
control: a.control,
|
|
3184
|
+
options: Ie,
|
|
3185
|
+
getOptionLabel: (i) => (i == null ? void 0 : i.code) || "",
|
|
3186
|
+
checkEquality: "code",
|
|
3187
|
+
inputValue: Yn,
|
|
3188
|
+
disableClearable: !1,
|
|
3189
|
+
singleSelect: !0,
|
|
3190
|
+
value: (Ie == null ? void 0 : Ie.find(
|
|
3191
|
+
(i) => i.code === e.value
|
|
3192
|
+
)) || null,
|
|
3193
|
+
onInputChange: (i, r, o) => {
|
|
3194
|
+
o === "input" && (Ge(r), Ve(r));
|
|
3195
|
+
},
|
|
3196
|
+
onChange: (i, r) => {
|
|
3197
|
+
e.onChange((r == null ? void 0 : r.code) || ""), Ge((r == null ? void 0 : r.code) || "");
|
|
3198
|
+
},
|
|
3199
|
+
placeholder: "Search training query code...",
|
|
3200
|
+
errors: n,
|
|
3201
|
+
fullWidth: !0,
|
|
3202
|
+
freeSolo: !1
|
|
3203
|
+
}
|
|
3204
|
+
)
|
|
3205
|
+
}
|
|
3206
|
+
) })
|
|
3207
|
+
] })
|
|
3208
|
+
]
|
|
3209
|
+
}
|
|
3210
|
+
)
|
|
3211
|
+
]
|
|
3212
|
+
}
|
|
3213
|
+
),
|
|
3214
|
+
/* @__PURE__ */ s(
|
|
3215
|
+
kt,
|
|
3216
|
+
{
|
|
3217
|
+
expanded: yt.notificationConfig,
|
|
3218
|
+
onChange: () => bt((e) => ({
|
|
3219
|
+
...e,
|
|
3220
|
+
notificationConfig: !e.notificationConfig
|
|
3221
|
+
})),
|
|
3222
|
+
sx: {
|
|
3223
|
+
mb: 1.5,
|
|
3224
|
+
borderRadius: 2,
|
|
3225
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.08)",
|
|
3226
|
+
border: "1px solid rgba(255, 152, 0, 0.2)",
|
|
3227
|
+
borderLeft: "4px solid #ff9800",
|
|
3228
|
+
"&:before": { display: "none" },
|
|
3229
|
+
overflow: "hidden"
|
|
3230
|
+
},
|
|
3231
|
+
children: [
|
|
3232
|
+
/* @__PURE__ */ t(
|
|
3233
|
+
It,
|
|
3234
|
+
{
|
|
3235
|
+
expandIcon: /* @__PURE__ */ t(de, { iconName: "faChevronDown", size: "sm" }),
|
|
3236
|
+
sx: {
|
|
3237
|
+
backgroundColor: "rgba(255, 152, 0, 0.06)",
|
|
3238
|
+
"&:hover": {
|
|
3239
|
+
backgroundColor: "rgba(255, 152, 0, 0.12)"
|
|
3240
|
+
},
|
|
3241
|
+
minHeight: 52
|
|
3242
|
+
},
|
|
3243
|
+
children: /* @__PURE__ */ s(m, { fontWeight: 700, fontSize: 15, children: [
|
|
3244
|
+
y("Notification Config"),
|
|
3245
|
+
" "
|
|
3246
|
+
] })
|
|
3247
|
+
}
|
|
3248
|
+
),
|
|
3249
|
+
/* @__PURE__ */ s(
|
|
3250
|
+
wt,
|
|
3251
|
+
{
|
|
3252
|
+
sx: { display: "flex", flexDirection: "column", gap: 2 },
|
|
3253
|
+
children: [
|
|
3254
|
+
/* @__PURE__ */ s(
|
|
3255
|
+
c,
|
|
3256
|
+
{
|
|
3257
|
+
display: "flex",
|
|
3258
|
+
alignItems: "center",
|
|
3259
|
+
justifyContent: "space-between",
|
|
3260
|
+
children: [
|
|
3261
|
+
/* @__PURE__ */ s(
|
|
3262
|
+
m,
|
|
3263
|
+
{
|
|
3264
|
+
variant: "subtitle1",
|
|
3265
|
+
sx: { minWidth: "200px", flexShrink: 0 },
|
|
3266
|
+
children: [
|
|
3267
|
+
y("Enable Notification Badge"),
|
|
3268
|
+
" ",
|
|
3269
|
+
/* @__PURE__ */ t(
|
|
3270
|
+
ye,
|
|
3271
|
+
{
|
|
3272
|
+
title: /* @__PURE__ */ t(m, { fontSize: 12, maxWidth: 220, children: y(
|
|
3273
|
+
"Show a count or nudge badge on this feature's icon in the mobile app"
|
|
3274
|
+
) }),
|
|
3275
|
+
size: "sm"
|
|
3276
|
+
}
|
|
3277
|
+
)
|
|
3278
|
+
]
|
|
3279
|
+
}
|
|
3280
|
+
),
|
|
3281
|
+
/* @__PURE__ */ t(c, { sx: { flex: 1 }, children: /* @__PURE__ */ t(
|
|
3282
|
+
Q,
|
|
3283
|
+
{
|
|
3284
|
+
name: "notificationBadgeEnabled",
|
|
3285
|
+
control: a.control,
|
|
3286
|
+
render: ({ field: e }) => /* @__PURE__ */ t(
|
|
3287
|
+
we,
|
|
3288
|
+
{
|
|
3289
|
+
...e,
|
|
3290
|
+
checked: !!e.value,
|
|
3291
|
+
onChange: (n) => {
|
|
3292
|
+
e.onChange(n.target.checked), n.target.checked || (a.setValue(
|
|
3293
|
+
"notificationBadgeType",
|
|
3294
|
+
""
|
|
3295
|
+
), a.setValue(
|
|
3296
|
+
"notificationBadgeQuery",
|
|
3297
|
+
""
|
|
3298
|
+
), He(""));
|
|
3299
|
+
}
|
|
3300
|
+
}
|
|
3301
|
+
)
|
|
3302
|
+
}
|
|
3303
|
+
) })
|
|
3304
|
+
]
|
|
3305
|
+
}
|
|
3306
|
+
),
|
|
3307
|
+
a.watch("notificationBadgeEnabled") && /* @__PURE__ */ s(he, { children: [
|
|
3308
|
+
/* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
3309
|
+
/* @__PURE__ */ s(
|
|
3310
|
+
m,
|
|
3311
|
+
{
|
|
3312
|
+
variant: "subtitle1",
|
|
3313
|
+
sx: { minWidth: "200px", flexShrink: 0 },
|
|
3314
|
+
children: [
|
|
3315
|
+
y("Badge Type"),
|
|
3316
|
+
" ",
|
|
3317
|
+
/* @__PURE__ */ t(
|
|
3318
|
+
ye,
|
|
3319
|
+
{
|
|
3320
|
+
title: /* @__PURE__ */ t(m, { fontSize: 12, maxWidth: 220, children: y(
|
|
3321
|
+
`Count Based: query returns a number.
|
|
3322
|
+
|
|
3323
|
+
Nudge Based: query returns true/false.`
|
|
3324
|
+
) }),
|
|
3325
|
+
size: "sm"
|
|
3326
|
+
}
|
|
3327
|
+
)
|
|
3328
|
+
]
|
|
3329
|
+
}
|
|
3330
|
+
),
|
|
3331
|
+
/* @__PURE__ */ t(c, { sx: { flex: 1 }, children: /* @__PURE__ */ t(
|
|
3332
|
+
Q,
|
|
3333
|
+
{
|
|
3334
|
+
name: "notificationBadgeType",
|
|
3335
|
+
control: a.control,
|
|
3336
|
+
render: ({ field: e }) => /* @__PURE__ */ s(pn, { row: !0, ...e, children: [
|
|
3337
|
+
/* @__PURE__ */ t(
|
|
3338
|
+
dt,
|
|
3339
|
+
{
|
|
3340
|
+
value: "COUNT",
|
|
3341
|
+
control: /* @__PURE__ */ t(ct, {}),
|
|
3342
|
+
label: "Count Based"
|
|
3343
|
+
}
|
|
3344
|
+
),
|
|
3345
|
+
/* @__PURE__ */ t(
|
|
3346
|
+
dt,
|
|
3347
|
+
{
|
|
3348
|
+
value: "NUDGE",
|
|
3349
|
+
control: /* @__PURE__ */ t(ct, {}),
|
|
3350
|
+
label: "Nudge Based"
|
|
3351
|
+
}
|
|
3352
|
+
)
|
|
3353
|
+
] })
|
|
3354
|
+
}
|
|
3355
|
+
) })
|
|
3356
|
+
] }),
|
|
3357
|
+
a.watch("notificationBadgeType") && /* @__PURE__ */ s(c, { display: "flex", alignItems: "center", gap: 2, children: [
|
|
3358
|
+
/* @__PURE__ */ s(
|
|
3359
|
+
m,
|
|
3360
|
+
{
|
|
3361
|
+
variant: "subtitle1",
|
|
3362
|
+
sx: { minWidth: "200px", flexShrink: 0 },
|
|
3363
|
+
children: [
|
|
3364
|
+
a.watch("notificationBadgeType") === "COUNT" ? "Count Query" : "Nudge Query",
|
|
3365
|
+
" ",
|
|
3366
|
+
/* @__PURE__ */ t(
|
|
3367
|
+
ye,
|
|
3368
|
+
{
|
|
3369
|
+
title: /* @__PURE__ */ t(m, { fontSize: 12, maxWidth: 220, children: a.watch(
|
|
3370
|
+
"notificationBadgeType"
|
|
3371
|
+
) === "COUNT" ? "Select a query that returns a numeric count for the badge" : "Select a query that returns true/false to show or hide the badge" }),
|
|
3372
|
+
size: "sm"
|
|
3373
|
+
}
|
|
3374
|
+
)
|
|
3375
|
+
]
|
|
3376
|
+
}
|
|
3377
|
+
),
|
|
3378
|
+
/* @__PURE__ */ t(c, { sx: { flex: 1 }, children: /* @__PURE__ */ t(
|
|
3379
|
+
Q,
|
|
3380
|
+
{
|
|
3381
|
+
name: "notificationBadgeQuery",
|
|
3382
|
+
control: a.control,
|
|
3383
|
+
render: ({
|
|
3384
|
+
field: e,
|
|
3385
|
+
fieldState: { error: n }
|
|
3386
|
+
}) => /* @__PURE__ */ t(
|
|
3387
|
+
De,
|
|
3388
|
+
{
|
|
3389
|
+
id: "notificationBadgeQuery",
|
|
3390
|
+
name: "notificationBadgeQuery",
|
|
3391
|
+
control: a.control,
|
|
3392
|
+
options: Ie,
|
|
3393
|
+
getOptionLabel: (i) => (i == null ? void 0 : i.code) || "",
|
|
3394
|
+
checkEquality: "code",
|
|
3395
|
+
inputValue: Kn,
|
|
3396
|
+
disableClearable: !1,
|
|
3397
|
+
singleSelect: !0,
|
|
3398
|
+
value: (Ie == null ? void 0 : Ie.find(
|
|
3399
|
+
(i) => i.code === e.value
|
|
3400
|
+
)) || null,
|
|
3401
|
+
onInputChange: (i, r, o) => {
|
|
3402
|
+
o === "input" && (He(r), Ve(r));
|
|
3403
|
+
},
|
|
3404
|
+
onChange: (i, r) => {
|
|
3405
|
+
e.onChange((r == null ? void 0 : r.code) || ""), He(
|
|
3406
|
+
(r == null ? void 0 : r.code) || ""
|
|
3407
|
+
);
|
|
3408
|
+
},
|
|
3409
|
+
placeholder: a.watch(
|
|
3410
|
+
"notificationBadgeType"
|
|
3411
|
+
) === "COUNT" ? "Search count query code..." : "Search nudge query code...",
|
|
3412
|
+
errors: n,
|
|
3413
|
+
fullWidth: !0,
|
|
3414
|
+
freeSolo: !1
|
|
3415
|
+
}
|
|
3416
|
+
)
|
|
3417
|
+
}
|
|
3418
|
+
) })
|
|
3419
|
+
] })
|
|
3420
|
+
] })
|
|
3421
|
+
]
|
|
3422
|
+
}
|
|
3423
|
+
)
|
|
3424
|
+
]
|
|
3425
|
+
}
|
|
3426
|
+
)
|
|
3427
|
+
] }) }),
|
|
3428
|
+
((on = R[$]) == null ? void 0 : on.key) === "formLinking" && A && /* @__PURE__ */ t(c, { display: "flex", justifyContent: "center", children: /* @__PURE__ */ s(c, { width: "80%", children: [
|
|
3429
|
+
/* @__PURE__ */ t(
|
|
3430
|
+
m,
|
|
3431
|
+
{
|
|
3432
|
+
variant: "h5",
|
|
3433
|
+
sx: {
|
|
3434
|
+
fontWeight: "bold",
|
|
3435
|
+
textAlign: "center",
|
|
3436
|
+
marginBottom: 1,
|
|
3437
|
+
marginTop: 2
|
|
3438
|
+
},
|
|
3439
|
+
children: y("Form Linking")
|
|
3440
|
+
}
|
|
3441
|
+
),
|
|
3442
|
+
/* @__PURE__ */ t(
|
|
3443
|
+
m,
|
|
3444
|
+
{
|
|
3445
|
+
sx: { textAlign: "center", mb: 4, color: "grey" },
|
|
3446
|
+
children: "Link this feature to an existing form, or create a new form to be associated with it."
|
|
3447
|
+
}
|
|
3448
|
+
),
|
|
3449
|
+
/* @__PURE__ */ s(Y, { container: !0, mt: 3, className: "flex flex-col w-[98%]", children: [
|
|
3450
|
+
/* @__PURE__ */ t(
|
|
3451
|
+
m,
|
|
3452
|
+
{
|
|
3453
|
+
variant: "subtitle1",
|
|
3454
|
+
sx: {
|
|
3455
|
+
marginLeft: 1,
|
|
3456
|
+
marginBottom: "0.5rem",
|
|
3457
|
+
fontWeight: 600
|
|
3458
|
+
},
|
|
3459
|
+
children: "Use Existing Form"
|
|
3460
|
+
}
|
|
3461
|
+
),
|
|
3462
|
+
/* @__PURE__ */ t(Y, { container: !0, sx: { alignItems: "center" }, children: /* @__PURE__ */ s(
|
|
3463
|
+
ne,
|
|
3464
|
+
{
|
|
3465
|
+
variant: "outlined",
|
|
3466
|
+
className: "m-3 flex flex-row items-center w-[80%] justify-between",
|
|
3467
|
+
children: [
|
|
3468
|
+
/* @__PURE__ */ s(m, { variant: "subtitle1", children: [
|
|
3469
|
+
y("Select"),
|
|
3470
|
+
" ",
|
|
3471
|
+
y("Form"),
|
|
3472
|
+
":"
|
|
3473
|
+
] }),
|
|
3474
|
+
/* @__PURE__ */ t(c, { className: "w-[60%]", children: /* @__PURE__ */ t(
|
|
3475
|
+
Ee,
|
|
3476
|
+
{
|
|
3477
|
+
control: a.control,
|
|
3478
|
+
name: "formCode",
|
|
3479
|
+
options: pe || [],
|
|
3480
|
+
getOptionDisabled: (e) => e.menu_config_id && e.menu_config_id !== parseInt(b.get("featureId")),
|
|
3481
|
+
displayName: "form_name",
|
|
3482
|
+
optionValue: "form_code",
|
|
3483
|
+
errors: a.formState.errors,
|
|
3484
|
+
size: "small",
|
|
3485
|
+
disableClearable: !1,
|
|
3486
|
+
onChange: (e) => {
|
|
3487
|
+
e.target.value ? (a.setValue(
|
|
3488
|
+
"navigationState",
|
|
3489
|
+
`medplat.form.${e.target.value}`
|
|
3490
|
+
), be(e.target.value)) : (a.setValue("version", null), a.setValue(
|
|
3491
|
+
"navigationState",
|
|
3492
|
+
"medplat.form."
|
|
3493
|
+
));
|
|
3494
|
+
}
|
|
3495
|
+
}
|
|
3496
|
+
) })
|
|
3497
|
+
]
|
|
3498
|
+
}
|
|
3499
|
+
) }),
|
|
3500
|
+
/* @__PURE__ */ s(
|
|
3501
|
+
ne,
|
|
3502
|
+
{
|
|
3503
|
+
variant: "outlined",
|
|
3504
|
+
className: "m-3 flex flex-row items-center w-[80%] justify-between",
|
|
3505
|
+
children: [
|
|
3506
|
+
/* @__PURE__ */ s(m, { variant: "subtitle1", children: [
|
|
3507
|
+
y("Select"),
|
|
3508
|
+
" ",
|
|
3509
|
+
y("Version"),
|
|
3510
|
+
":"
|
|
3511
|
+
] }),
|
|
3512
|
+
/* @__PURE__ */ t(c, { className: "w-[60%]", children: /* @__PURE__ */ t(
|
|
3513
|
+
Ee,
|
|
3514
|
+
{
|
|
3515
|
+
control: a.control,
|
|
3516
|
+
name: "version",
|
|
3517
|
+
options: Array.isArray(j == null ? void 0 : j[Pe]) ? j[Pe].map(
|
|
3518
|
+
(e) => e.version
|
|
3519
|
+
) : [],
|
|
3520
|
+
errors: a.formState.errors,
|
|
3521
|
+
disableClearable: !1,
|
|
3522
|
+
size: "small"
|
|
3523
|
+
}
|
|
3524
|
+
) })
|
|
3525
|
+
]
|
|
3526
|
+
}
|
|
3527
|
+
),
|
|
3528
|
+
/* @__PURE__ */ t(
|
|
3529
|
+
Ke,
|
|
3530
|
+
{
|
|
3531
|
+
sx: {
|
|
3532
|
+
width: "80%",
|
|
3533
|
+
margin: "1rem auto",
|
|
3534
|
+
position: "relative"
|
|
3535
|
+
},
|
|
3536
|
+
children: /* @__PURE__ */ t(
|
|
3537
|
+
m,
|
|
3538
|
+
{
|
|
3539
|
+
variant: "caption",
|
|
3540
|
+
sx: {
|
|
3541
|
+
position: "absolute",
|
|
3542
|
+
top: "-0.6rem",
|
|
3543
|
+
left: "50%",
|
|
3544
|
+
transform: "translateX(-50%)",
|
|
3545
|
+
backgroundColor: "background.paper",
|
|
3546
|
+
padding: "0 0.5rem"
|
|
3547
|
+
},
|
|
3548
|
+
children: "OR"
|
|
3549
|
+
}
|
|
3550
|
+
)
|
|
3551
|
+
}
|
|
3552
|
+
),
|
|
3553
|
+
/* @__PURE__ */ s(c, { className: "flex justify-center", children: [
|
|
3554
|
+
/* @__PURE__ */ t(
|
|
3555
|
+
z,
|
|
3556
|
+
{
|
|
3557
|
+
variant: "outlined",
|
|
3558
|
+
size: "small",
|
|
3559
|
+
onClick: () => {
|
|
3560
|
+
a.setValue("formCode", null), S(!0);
|
|
3561
|
+
},
|
|
3562
|
+
children: "Add New Form"
|
|
3563
|
+
}
|
|
3564
|
+
),
|
|
3565
|
+
N && /* @__PURE__ */ t(
|
|
3566
|
+
An,
|
|
3567
|
+
{
|
|
3568
|
+
mainFormCtrl: a,
|
|
3569
|
+
openAddFormModal: N,
|
|
3570
|
+
setModal: (e) => {
|
|
3571
|
+
S(e);
|
|
3572
|
+
},
|
|
3573
|
+
reloadForms: Fi
|
|
3574
|
+
}
|
|
3575
|
+
)
|
|
3576
|
+
] })
|
|
3577
|
+
] })
|
|
3578
|
+
] }) }),
|
|
3579
|
+
((ln = R[$]) == null ? void 0 : ln.key) === "additionalPermissions" && /* @__PURE__ */ t(Y, { item: !0, xs: 12, md: 6, children: /* @__PURE__ */ s(c, { mt: 3, className: "flex flex-col w-full", children: [
|
|
3580
|
+
/* @__PURE__ */ t(
|
|
3581
|
+
m,
|
|
3582
|
+
{
|
|
3583
|
+
variant: "h5",
|
|
3584
|
+
sx: { fontWeight: "bold", textAlign: "center", mb: 1 },
|
|
3585
|
+
children: "Additional Permissions"
|
|
3586
|
+
}
|
|
3587
|
+
),
|
|
3588
|
+
/* @__PURE__ */ t(
|
|
3589
|
+
m,
|
|
3590
|
+
{
|
|
3591
|
+
sx: { textAlign: "center", mb: 4, color: "grey" },
|
|
3592
|
+
children: "Define custom permissions for this feature. These will be used to control fine-grained permissions beyond default roles."
|
|
3593
|
+
}
|
|
3594
|
+
),
|
|
3595
|
+
!A && (l == null ? void 0 : l.val) === !1 ? /* @__PURE__ */ s(he, { children: [
|
|
3596
|
+
/* @__PURE__ */ t(Y, { children: /* @__PURE__ */ s(
|
|
3597
|
+
ne,
|
|
3598
|
+
{
|
|
3599
|
+
variant: "outlined",
|
|
3600
|
+
className: "flex flex-row items-center ml-3 ",
|
|
3601
|
+
children: [
|
|
3602
|
+
/* @__PURE__ */ t(m, { variant: "body2", children: T("Add feature JSON access rights") }),
|
|
3603
|
+
/* @__PURE__ */ t(
|
|
3604
|
+
gn,
|
|
3605
|
+
{
|
|
3606
|
+
disabled: Qn,
|
|
3607
|
+
checked: _e,
|
|
3608
|
+
onChange: Mi,
|
|
3609
|
+
"data-testid": "managefeature-checkbox-access-rights"
|
|
3610
|
+
}
|
|
3611
|
+
)
|
|
3612
|
+
]
|
|
3613
|
+
}
|
|
3614
|
+
) }),
|
|
3615
|
+
/* @__PURE__ */ t(Y, { children: Z.value && _e && /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ t(Ki, { className: "ml-2", children: (dn = a.getValues("updatedFields")) == null ? void 0 : dn.map((e, n) => {
|
|
3616
|
+
var i;
|
|
3617
|
+
return /* @__PURE__ */ s(
|
|
3618
|
+
Y,
|
|
3619
|
+
{
|
|
3620
|
+
className: " mb-2.5 flex flex-row items-center ",
|
|
3621
|
+
children: [
|
|
3622
|
+
/* @__PURE__ */ t(ne, { children: /* @__PURE__ */ t(
|
|
3623
|
+
Q,
|
|
3624
|
+
{
|
|
3625
|
+
name: `updatedFields[${n}].value`,
|
|
3626
|
+
control: a.control,
|
|
3627
|
+
render: ({ field: r }) => /* @__PURE__ */ t(
|
|
3628
|
+
Vn,
|
|
3629
|
+
{
|
|
3630
|
+
...r,
|
|
3631
|
+
label: `${T("Right")} ${n + 1}`,
|
|
3632
|
+
value: r.value || "",
|
|
3633
|
+
sx: {
|
|
3634
|
+
"& .MuiInputLabel-root": {
|
|
3635
|
+
fontSize: "14px"
|
|
3636
|
+
},
|
|
3637
|
+
"& .MuiInputBase-input": {
|
|
3638
|
+
fontSize: "14px"
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
)
|
|
3643
|
+
}
|
|
3644
|
+
) }),
|
|
3645
|
+
/* @__PURE__ */ t(
|
|
3646
|
+
gn,
|
|
3647
|
+
{
|
|
3648
|
+
disabled: e.updated,
|
|
3649
|
+
checked: e.checkbox,
|
|
3650
|
+
onChange: () => Bi(e.id),
|
|
3651
|
+
className: " mr-2.5",
|
|
3652
|
+
"data-testid": `managefeature-checkbox-updated-right-${n + 1}`
|
|
3653
|
+
}
|
|
3654
|
+
),
|
|
3655
|
+
n + 1 === ((i = a.getValues("updatedFields")) == null ? void 0 : i.length) && /* @__PURE__ */ t(
|
|
3656
|
+
z,
|
|
3657
|
+
{
|
|
3658
|
+
variant: "contained",
|
|
3659
|
+
color: "primary",
|
|
3660
|
+
onClick: Oi,
|
|
3661
|
+
size: "small",
|
|
3662
|
+
className: " mr-2.5",
|
|
3663
|
+
disabled: !ri.updatedFields.some(
|
|
3664
|
+
(r) => r.id === (e == null ? void 0 : e.id) && r.value
|
|
3665
|
+
),
|
|
3666
|
+
"data-testid": "managefeature-button-add-updated",
|
|
3667
|
+
children: T("Add")
|
|
3668
|
+
}
|
|
3669
|
+
),
|
|
3670
|
+
!e.updated && /* @__PURE__ */ t(
|
|
3671
|
+
z,
|
|
3672
|
+
{
|
|
3673
|
+
variant: "contained",
|
|
3674
|
+
size: "small",
|
|
3675
|
+
color: "secondary",
|
|
3676
|
+
onClick: () => Ui(e.id),
|
|
3677
|
+
"data-testid": `managefeature-button-delete-updated-${n + 1}`,
|
|
3678
|
+
children: T("Delete")
|
|
3679
|
+
}
|
|
3680
|
+
)
|
|
3681
|
+
]
|
|
3682
|
+
},
|
|
3683
|
+
e.id
|
|
3684
|
+
);
|
|
3685
|
+
}) }) }) })
|
|
3686
|
+
] }) : /* @__PURE__ */ s(he, { children: [
|
|
3687
|
+
(ue == null ? void 0 : ue.length) === 0 ? /* @__PURE__ */ t(
|
|
3688
|
+
m,
|
|
3689
|
+
{
|
|
3690
|
+
variant: "subtitle1",
|
|
3691
|
+
color: "text.secondary",
|
|
3692
|
+
align: "center",
|
|
3693
|
+
sx: { py: 2 },
|
|
3694
|
+
children: "No permissions added yet."
|
|
3695
|
+
}
|
|
3696
|
+
) : /* @__PURE__ */ t(
|
|
3697
|
+
Wn,
|
|
3698
|
+
{
|
|
3699
|
+
permissions: ue,
|
|
3700
|
+
onEdit: (e) => Ii(e),
|
|
3701
|
+
onRemove: (e) => vi(e),
|
|
3702
|
+
handleAddChildClick: (e) => ki(e),
|
|
3703
|
+
isDynamicFeature: A
|
|
3704
|
+
}
|
|
3705
|
+
),
|
|
3706
|
+
/* @__PURE__ */ t(
|
|
3707
|
+
c,
|
|
3708
|
+
{
|
|
3709
|
+
sx: {
|
|
3710
|
+
display: "flex",
|
|
3711
|
+
justifyContent: "flex-end",
|
|
3712
|
+
mt: 2
|
|
3713
|
+
},
|
|
3714
|
+
children: /* @__PURE__ */ t(
|
|
3715
|
+
z,
|
|
3716
|
+
{
|
|
3717
|
+
variant: "outlined",
|
|
3718
|
+
size: "small",
|
|
3719
|
+
startIcon: /* @__PURE__ */ t(de, { iconName: "faPlus" }),
|
|
3720
|
+
onClick: Ni,
|
|
3721
|
+
sx: {
|
|
3722
|
+
textTransform: "none",
|
|
3723
|
+
fontWeight: 500,
|
|
3724
|
+
borderRadius: 2,
|
|
3725
|
+
px: 2,
|
|
3726
|
+
py: 0.75,
|
|
3727
|
+
minWidth: 120
|
|
3728
|
+
},
|
|
3729
|
+
children: "Add Parent Permission"
|
|
3730
|
+
}
|
|
3731
|
+
)
|
|
3732
|
+
}
|
|
3733
|
+
),
|
|
3734
|
+
/* @__PURE__ */ t(
|
|
3735
|
+
qn,
|
|
3736
|
+
{
|
|
3737
|
+
open: Bn,
|
|
3738
|
+
onClose: () => Je(!1),
|
|
3739
|
+
onSave: wi,
|
|
3740
|
+
formCtrl: a,
|
|
3741
|
+
editData: On,
|
|
3742
|
+
parentPermissionId: je === "add-child" ? pt : null,
|
|
3743
|
+
mode: je,
|
|
3744
|
+
permissionTypes: jn,
|
|
3745
|
+
setPermissionTypes: Gn,
|
|
3746
|
+
existingPermissionIds: new Set(
|
|
3747
|
+
ot(ue).map(
|
|
3748
|
+
(e) => e.permissionId
|
|
3749
|
+
)
|
|
3750
|
+
),
|
|
3751
|
+
isDynamicFeature: A
|
|
3752
|
+
}
|
|
3753
|
+
)
|
|
3754
|
+
] })
|
|
3755
|
+
] }) }),
|
|
3756
|
+
((cn = R[$]) == null ? void 0 : cn.key) === "assignFeatures" && /* @__PURE__ */ s(c, { mt: 3, className: "flex flex-col w-full", children: [
|
|
3757
|
+
/* @__PURE__ */ t(
|
|
3758
|
+
m,
|
|
3759
|
+
{
|
|
3760
|
+
variant: "h5",
|
|
3761
|
+
sx: { fontWeight: "bold", textAlign: "center", mb: 1 },
|
|
3762
|
+
children: y("Assign Features")
|
|
3763
|
+
}
|
|
3764
|
+
),
|
|
3765
|
+
/* @__PURE__ */ t(m, { sx: { textAlign: "center", mb: 4, color: "grey" }, children: "Assign this feature to specific users or roles. You can toggle individual permissions below after assigning." }),
|
|
3766
|
+
/* @__PURE__ */ s(c, { display: "flex", gap: 2, flexWrap: "wrap", mb: 3, children: [
|
|
3767
|
+
/* @__PURE__ */ s(c, { flex: "1 1 300px", minWidth: 300, children: [
|
|
3768
|
+
/* @__PURE__ */ t(m, { variant: "subtitle1", sx: { mb: 1 }, children: y("User") }),
|
|
3769
|
+
/* @__PURE__ */ t(
|
|
3770
|
+
De,
|
|
3771
|
+
{
|
|
3772
|
+
id: "roles",
|
|
3773
|
+
name: "roles",
|
|
3774
|
+
control: a.control,
|
|
3775
|
+
options: !A && (l == null ? void 0 : l.val) === !1 ? Oe.filter(
|
|
3776
|
+
(e) => !ke.some(
|
|
3777
|
+
(n) => n.entityType === "user" && n.user_id === e.id
|
|
3778
|
+
)
|
|
3779
|
+
) : Oe,
|
|
3780
|
+
value: V,
|
|
3781
|
+
singleSelect: !0,
|
|
3782
|
+
onChange: fi,
|
|
3783
|
+
onInputChange: qi,
|
|
3784
|
+
getOptionLabel: bi,
|
|
3785
|
+
"data-testid": "accessrights-autocomplete-user",
|
|
3786
|
+
fullWidth: !0
|
|
3787
|
+
}
|
|
3788
|
+
)
|
|
3789
|
+
] }),
|
|
3790
|
+
/* @__PURE__ */ s(c, { flex: "1 1 300px", minWidth: 300, children: [
|
|
3791
|
+
/* @__PURE__ */ t(m, { variant: "subtitle1", sx: { mb: 1 }, children: y("Role") }),
|
|
3792
|
+
/* @__PURE__ */ t(
|
|
3793
|
+
De,
|
|
3794
|
+
{
|
|
3795
|
+
id: "selectedRoles",
|
|
3796
|
+
name: "selectedRoles",
|
|
3797
|
+
control: a.control,
|
|
3798
|
+
options: !A && (l == null ? void 0 : l.val) === !1 ? $t().filter(
|
|
3799
|
+
(e) => !ke.some(
|
|
3800
|
+
(n) => n.entityType === "role" && n.role_id === e.id
|
|
3801
|
+
)
|
|
3802
|
+
) : $t(),
|
|
3803
|
+
onChange: (e, n) => ui(n),
|
|
3804
|
+
getOptionLabel: (e) => e == null ? void 0 : e.name,
|
|
3805
|
+
dataTestId: "accessrights-select-role",
|
|
3806
|
+
value: p,
|
|
3807
|
+
fullWidth: !0
|
|
3808
|
+
}
|
|
3809
|
+
)
|
|
3810
|
+
] }),
|
|
3811
|
+
/* @__PURE__ */ t(
|
|
3812
|
+
c,
|
|
3813
|
+
{
|
|
3814
|
+
display: "flex",
|
|
3815
|
+
alignItems: "flex-end",
|
|
3816
|
+
flexShrink: 0,
|
|
3817
|
+
sx: { minWidth: 120 },
|
|
3818
|
+
children: /* @__PURE__ */ t(
|
|
3819
|
+
z,
|
|
3820
|
+
{
|
|
3821
|
+
variant: "contained",
|
|
3822
|
+
size: "medium",
|
|
3823
|
+
fullWidth: !0,
|
|
3824
|
+
disabled: !(p.length > 0 || V != null && V.id),
|
|
3825
|
+
"data-testid": "accessrights-add-button",
|
|
3826
|
+
onClick: Ti,
|
|
3827
|
+
sx: { minWidth: 120, marginBottom: "10px" },
|
|
3828
|
+
children: y("Add")
|
|
3829
|
+
}
|
|
3830
|
+
)
|
|
3831
|
+
}
|
|
3832
|
+
)
|
|
3833
|
+
] }),
|
|
3834
|
+
!A && (l == null ? void 0 : l.val) === !1 ? /* @__PURE__ */ t(yn, { sx: { maxHeight: 360, overflowY: "auto" }, children: /* @__PURE__ */ s(bn, { size: "small", children: [
|
|
3835
|
+
/* @__PURE__ */ t(xn, { children: /* @__PURE__ */ s(ut, { children: [
|
|
3836
|
+
/* @__PURE__ */ t(te, { sx: { fontWeight: "bold" }, children: y("Type") }),
|
|
3837
|
+
/* @__PURE__ */ t(te, { sx: { fontWeight: "bold" }, children: y("Name") }),
|
|
3838
|
+
/* @__PURE__ */ t(te, { sx: { fontWeight: "bold" }, children: y("Access Right") }),
|
|
3839
|
+
/* @__PURE__ */ t(te, { sx: { fontWeight: "bold" }, children: y("Actions") })
|
|
3840
|
+
] }) }),
|
|
3841
|
+
/* @__PURE__ */ t(Sn, { children: ze.map((e, n) => /* @__PURE__ */ s(ut, { children: [
|
|
3842
|
+
/* @__PURE__ */ t(te, { children: e.designationId ? "Role" : "User" }),
|
|
3843
|
+
/* @__PURE__ */ t(te, { children: e.roleName || e.fullName }),
|
|
3844
|
+
/* @__PURE__ */ t(te, { children: /* @__PURE__ */ t(
|
|
3845
|
+
c,
|
|
3846
|
+
{
|
|
3847
|
+
display: "flex",
|
|
3848
|
+
flexDirection: "column",
|
|
3849
|
+
gap: 1,
|
|
3850
|
+
children: (() => {
|
|
3851
|
+
const i = Z.value ? a.getValues("updatedFields") : a.getValues("fields"), r = i == null ? void 0 : i.reduce((f, g) => (f[g.value] = g.checkbox, f), {}), o = e.featureJson ? JSON.parse(e.featureJson) : {}, u = Object.fromEntries(
|
|
3852
|
+
Object.entries(o).map(
|
|
3853
|
+
([f, g]) => [
|
|
3854
|
+
f,
|
|
3855
|
+
g === !0 || g === "true"
|
|
3856
|
+
]
|
|
3857
|
+
)
|
|
3858
|
+
), d = {
|
|
3859
|
+
...u,
|
|
3860
|
+
...Object.fromEntries(
|
|
3861
|
+
Object.entries(
|
|
3862
|
+
r || {}
|
|
3863
|
+
).filter(
|
|
3864
|
+
([f]) => !(f in u)
|
|
3865
|
+
)
|
|
3866
|
+
)
|
|
3867
|
+
};
|
|
3868
|
+
return Object.entries(d).map(
|
|
3869
|
+
([f, g]) => /* @__PURE__ */ s(
|
|
3870
|
+
c,
|
|
3871
|
+
{
|
|
3872
|
+
display: "flex",
|
|
3873
|
+
alignItems: "center",
|
|
3874
|
+
gap: 1,
|
|
3875
|
+
children: [
|
|
3876
|
+
/* @__PURE__ */ t(
|
|
3877
|
+
we,
|
|
3878
|
+
{
|
|
3879
|
+
sx: {
|
|
3880
|
+
transform: "scale(0.75)",
|
|
3881
|
+
transformOrigin: "left center"
|
|
3882
|
+
},
|
|
3883
|
+
checked: !!g,
|
|
3884
|
+
onChange: () => {
|
|
3885
|
+
const F = [
|
|
3886
|
+
...ze
|
|
3887
|
+
];
|
|
3888
|
+
let k = {};
|
|
3889
|
+
try {
|
|
3890
|
+
k = e.featureJson ? JSON.parse(
|
|
3891
|
+
e.featureJson
|
|
3892
|
+
) : {};
|
|
3893
|
+
} catch (oe) {
|
|
3894
|
+
console.warn(
|
|
3895
|
+
"Invalid JSON in featureJson:",
|
|
3896
|
+
oe
|
|
3897
|
+
);
|
|
3898
|
+
}
|
|
3899
|
+
const ee = (Z.value ? a.getValues(
|
|
3900
|
+
"updatedFields"
|
|
3901
|
+
) : a.getValues(
|
|
3902
|
+
"fields"
|
|
3903
|
+
) || []).reduce(
|
|
3904
|
+
(oe, le) => (oe[le.value] = le.value in k ? k[le.value] : le.checkbox, oe),
|
|
3905
|
+
{}
|
|
3906
|
+
);
|
|
3907
|
+
ee[f] = !g, F[n] = {
|
|
3908
|
+
...e,
|
|
3909
|
+
featureJson: JSON.stringify(
|
|
3910
|
+
ee
|
|
3911
|
+
)
|
|
3912
|
+
}, Le(F);
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
),
|
|
3916
|
+
/* @__PURE__ */ t(m, { variant: "subtitle1", children: f })
|
|
3917
|
+
]
|
|
3918
|
+
},
|
|
3919
|
+
f
|
|
3920
|
+
)
|
|
3921
|
+
);
|
|
3922
|
+
})()
|
|
3923
|
+
}
|
|
3924
|
+
) }),
|
|
3925
|
+
/* @__PURE__ */ t(te, { children: /* @__PURE__ */ t(
|
|
3926
|
+
Re,
|
|
3927
|
+
{
|
|
3928
|
+
size: "small",
|
|
3929
|
+
color: "error",
|
|
3930
|
+
onClick: () => {
|
|
3931
|
+
const i = ze.filter(
|
|
3932
|
+
(r, o) => o !== n
|
|
3933
|
+
);
|
|
3934
|
+
Le(i);
|
|
3935
|
+
},
|
|
3936
|
+
children: /* @__PURE__ */ t(
|
|
3937
|
+
de,
|
|
3938
|
+
{
|
|
3939
|
+
iconName: "faTrashAlt",
|
|
3940
|
+
size: "sm"
|
|
3941
|
+
}
|
|
3942
|
+
)
|
|
3943
|
+
}
|
|
3944
|
+
) })
|
|
3945
|
+
] }, n)) })
|
|
3946
|
+
] }) }) : /* @__PURE__ */ t(he, { children: ke.length > 0 && /* @__PURE__ */ t(
|
|
3947
|
+
yn,
|
|
3948
|
+
{
|
|
3949
|
+
sx: { maxHeight: 360, overflowY: "auto" },
|
|
3950
|
+
children: /* @__PURE__ */ s(bn, { size: "small", children: [
|
|
3951
|
+
/* @__PURE__ */ t(xn, { children: /* @__PURE__ */ s(ut, { children: [
|
|
3952
|
+
/* @__PURE__ */ t(te, { sx: { fontWeight: "bold" }, children: y("Type") }),
|
|
3953
|
+
/* @__PURE__ */ t(te, { sx: { fontWeight: "bold" }, children: y("Name") }),
|
|
3954
|
+
/* @__PURE__ */ t(te, { sx: { fontWeight: "bold" }, children: y("Permissions") }),
|
|
3955
|
+
/* @__PURE__ */ t(te, { sx: { fontWeight: "bold" }, children: y("Actions") })
|
|
3956
|
+
] }) }),
|
|
3957
|
+
/* @__PURE__ */ t(Sn, { children: ke.map((e, n) => /* @__PURE__ */ s(ut, { children: [
|
|
3958
|
+
/* @__PURE__ */ t(te, { children: e.entityType === "role" ? "Role" : "User" }),
|
|
3959
|
+
/* @__PURE__ */ t(te, { children: e.name }),
|
|
3960
|
+
/* @__PURE__ */ t(te, { children: /* @__PURE__ */ t(
|
|
3961
|
+
_t,
|
|
3962
|
+
{
|
|
3963
|
+
permissions: e.permissions,
|
|
3964
|
+
onToggle: (i) => _i(n, i)
|
|
3965
|
+
}
|
|
3966
|
+
) }),
|
|
3967
|
+
/* @__PURE__ */ t(te, { children: /* @__PURE__ */ t(
|
|
3968
|
+
Re,
|
|
3969
|
+
{
|
|
3970
|
+
size: "small",
|
|
3971
|
+
color: "error",
|
|
3972
|
+
onClick: () => {
|
|
3973
|
+
const i = ke.filter(
|
|
3974
|
+
(r, o) => o !== n
|
|
3975
|
+
);
|
|
3976
|
+
qe(i);
|
|
3977
|
+
},
|
|
3978
|
+
children: /* @__PURE__ */ t(
|
|
3979
|
+
de,
|
|
3980
|
+
{
|
|
3981
|
+
iconName: "faTrashAlt",
|
|
3982
|
+
size: "sm"
|
|
3983
|
+
}
|
|
3984
|
+
)
|
|
3985
|
+
}
|
|
3986
|
+
) })
|
|
3987
|
+
] }, n)) })
|
|
3988
|
+
] })
|
|
3989
|
+
}
|
|
3990
|
+
) }),
|
|
3991
|
+
/* @__PURE__ */ t(
|
|
3992
|
+
Rn,
|
|
3993
|
+
{
|
|
3994
|
+
open: zn,
|
|
3995
|
+
onClose: () => gt(!1),
|
|
3996
|
+
permissions: ue,
|
|
3997
|
+
entityData: Ln,
|
|
3998
|
+
onSave: (e) => {
|
|
3999
|
+
qe((n) => [...n, e]), gt(!1);
|
|
4000
|
+
}
|
|
4001
|
+
}
|
|
4002
|
+
)
|
|
4003
|
+
] }),
|
|
4004
|
+
((un = R[$]) == null ? void 0 : un.key) === "submit" && We && /* @__PURE__ */ s(
|
|
4005
|
+
c,
|
|
4006
|
+
{
|
|
4007
|
+
sx: {
|
|
4008
|
+
mt: 4,
|
|
4009
|
+
display: "flex",
|
|
4010
|
+
flexDirection: "column",
|
|
4011
|
+
alignItems: "center",
|
|
4012
|
+
justifyContent: "center",
|
|
4013
|
+
textAlign: "center",
|
|
4014
|
+
minHeight: "300px",
|
|
4015
|
+
px: 3,
|
|
4016
|
+
mx: "auto",
|
|
4017
|
+
maxWidth: 500,
|
|
4018
|
+
backgroundColor: "background.default",
|
|
4019
|
+
borderRadius: 3,
|
|
4020
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.1)",
|
|
4021
|
+
border: `1px solid ${C.palette.divider}`,
|
|
4022
|
+
p: 6
|
|
4023
|
+
},
|
|
4024
|
+
children: [
|
|
4025
|
+
/* @__PURE__ */ t(c, { sx: { color: "success.main", fontSize: 40, mb: 2 }, children: /* @__PURE__ */ t(de, { iconName: "faCheckCircle" }) }),
|
|
4026
|
+
/* @__PURE__ */ s(
|
|
4027
|
+
m,
|
|
4028
|
+
{
|
|
4029
|
+
variant: "h6",
|
|
4030
|
+
gutterBottom: !0,
|
|
4031
|
+
sx: { fontWeight: "bold" },
|
|
4032
|
+
children: [
|
|
4033
|
+
"Feature was successfully",
|
|
4034
|
+
b.get("featureId") ? "updated" : "created",
|
|
4035
|
+
"!"
|
|
4036
|
+
]
|
|
4037
|
+
}
|
|
4038
|
+
),
|
|
4039
|
+
/* @__PURE__ */ t(Ke, { sx: { my: 2, width: "100%" } }),
|
|
4040
|
+
/* @__PURE__ */ s(m, { variant: "subtitle1", gutterBottom: !0, children: [
|
|
4041
|
+
/* @__PURE__ */ t("strong", { children: "Feature Name:" }),
|
|
4042
|
+
" ",
|
|
4043
|
+
a.getValues("menuName")
|
|
4044
|
+
] }),
|
|
4045
|
+
A && /* @__PURE__ */ s(m, { variant: "subtitle1", gutterBottom: !0, children: [
|
|
4046
|
+
/* @__PURE__ */ t("strong", { children: "Feature Constant:" }),
|
|
4047
|
+
" ",
|
|
4048
|
+
a.getValues("featureConstant")
|
|
4049
|
+
] }),
|
|
4050
|
+
/* @__PURE__ */ t(c, { mt: 5, width: "100%", display: "flex", justifyContent: "center", children: a.getValues("formCode") && a.getValues("version") ? /* @__PURE__ */ t(
|
|
4051
|
+
z,
|
|
4052
|
+
{
|
|
4053
|
+
variant: "contained",
|
|
4054
|
+
color: "primary",
|
|
4055
|
+
onClick: () => {
|
|
4056
|
+
var r;
|
|
4057
|
+
const e = a.getValues("formCode"), n = a.getValues("version"), i = (r = j == null ? void 0 : j[e]) == null ? void 0 : r.find(
|
|
4058
|
+
(o) => o.version === n
|
|
4059
|
+
);
|
|
4060
|
+
i != null && i.uuid ? D(
|
|
4061
|
+
`/ui/medplat/admin/medplatForms/form/${i.uuid}`
|
|
4062
|
+
) : console.warn("Could not find matching version UUID");
|
|
4063
|
+
},
|
|
4064
|
+
children: "Configure Form"
|
|
4065
|
+
}
|
|
4066
|
+
) : /* @__PURE__ */ t(
|
|
4067
|
+
z,
|
|
4068
|
+
{
|
|
4069
|
+
variant: "outlined",
|
|
4070
|
+
color: "primary",
|
|
4071
|
+
onClick: () => D("/ui/medplat/manage/menu"),
|
|
4072
|
+
children: "Go Back to Menu"
|
|
4073
|
+
}
|
|
4074
|
+
) })
|
|
4075
|
+
]
|
|
4076
|
+
}
|
|
4077
|
+
),
|
|
4078
|
+
!We && /* @__PURE__ */ s(
|
|
4079
|
+
c,
|
|
4080
|
+
{
|
|
4081
|
+
mt: "auto",
|
|
4082
|
+
display: "flex",
|
|
4083
|
+
justifyContent: "flex-end",
|
|
4084
|
+
gap: 2,
|
|
4085
|
+
sx: { paddingTop: 4 },
|
|
4086
|
+
children: [
|
|
4087
|
+
/* @__PURE__ */ t(
|
|
4088
|
+
z,
|
|
4089
|
+
{
|
|
4090
|
+
variant: "outlined",
|
|
4091
|
+
sx: { color: "text.secondary" },
|
|
4092
|
+
onClick: si,
|
|
4093
|
+
children: "Back"
|
|
4094
|
+
}
|
|
4095
|
+
),
|
|
4096
|
+
((mn = R[$]) == null ? void 0 : mn.key) !== "submit" && (() => {
|
|
4097
|
+
var f;
|
|
4098
|
+
const e = (f = R[$]) == null ? void 0 : f.key, n = ["formLinking"].includes(e), i = tt.includes(e), [r, o] = a.getValues(Bt(e)), u = e === "formLinking" ? !!(r != null && r.trim()) || !!(o != null && o.trim()) : e === "additionalPermissions" ? Array.isArray(r) && r.length > 0 : !1, d = a.handleSubmit(
|
|
4099
|
+
(g) => {
|
|
4100
|
+
Xt(g);
|
|
4101
|
+
const F = R.findIndex(
|
|
4102
|
+
(k) => k.key === "submit"
|
|
4103
|
+
);
|
|
4104
|
+
At((k) => new Set(k).add(e)), Ne(F);
|
|
4105
|
+
}
|
|
4106
|
+
);
|
|
4107
|
+
return e === "assignFeatures" || e === "accessRights" ? /* @__PURE__ */ t(
|
|
4108
|
+
z,
|
|
4109
|
+
{
|
|
4110
|
+
variant: "contained",
|
|
4111
|
+
onClick: d,
|
|
4112
|
+
children: "Save"
|
|
4113
|
+
}
|
|
4114
|
+
) : n ? Rt ? /* @__PURE__ */ t(z, { variant: "contained", onClick: xt, children: "Next" }) : u ? /* @__PURE__ */ t(z, { variant: "contained", disabled: !0, children: "Next" }) : /* @__PURE__ */ t(
|
|
4115
|
+
z,
|
|
4116
|
+
{
|
|
4117
|
+
variant: "outlined",
|
|
4118
|
+
color: "secondary",
|
|
4119
|
+
onClick: () => {
|
|
4120
|
+
i || Be((g) => [...g, e]), xt();
|
|
4121
|
+
},
|
|
4122
|
+
children: "Skip for now"
|
|
4123
|
+
}
|
|
4124
|
+
) : /* @__PURE__ */ t(
|
|
4125
|
+
z,
|
|
4126
|
+
{
|
|
4127
|
+
variant: "contained",
|
|
4128
|
+
onClick: xt,
|
|
4129
|
+
disabled: !Rt,
|
|
4130
|
+
children: "Next"
|
|
4131
|
+
}
|
|
4132
|
+
);
|
|
4133
|
+
})()
|
|
4134
|
+
]
|
|
4135
|
+
}
|
|
4136
|
+
)
|
|
4137
|
+
]
|
|
4138
|
+
}
|
|
4139
|
+
)
|
|
4140
|
+
] }) })
|
|
4141
|
+
}
|
|
4142
|
+
);
|
|
4143
|
+
}
|
|
4144
|
+
Wn.propTypes = {
|
|
4145
|
+
permissions: I.any,
|
|
4146
|
+
onEdit: I.any,
|
|
4147
|
+
onRemove: I.any,
|
|
4148
|
+
handleAddChildClick: I.any,
|
|
4149
|
+
isDynamicFeature: I.any
|
|
4150
|
+
};
|
|
4151
|
+
qn.propTypes = {
|
|
4152
|
+
open: I.any,
|
|
4153
|
+
onClose: I.any,
|
|
4154
|
+
onSave: I.any,
|
|
4155
|
+
formCtrl: I.any,
|
|
4156
|
+
editData: I.any,
|
|
4157
|
+
parentPermissionId: I.any,
|
|
4158
|
+
mode: I.any,
|
|
4159
|
+
permissionTypes: I.any,
|
|
4160
|
+
setPermissionTypes: I.any,
|
|
4161
|
+
isDynamicFeature: I.any,
|
|
4162
|
+
existingPermissionIds: I.any
|
|
4163
|
+
};
|
|
4164
|
+
Tt.propTypes = {
|
|
4165
|
+
permission: I.any,
|
|
4166
|
+
index: I.any,
|
|
4167
|
+
depth: I.any,
|
|
4168
|
+
onEdit: I.any,
|
|
4169
|
+
onRemove: I.any,
|
|
4170
|
+
handleAddChildClick: I.any,
|
|
4171
|
+
isLastChild: I.any,
|
|
4172
|
+
isDynamicFeature: I.any
|
|
4173
|
+
};
|
|
4174
|
+
_t.propTypes = {
|
|
4175
|
+
permissions: I.any,
|
|
4176
|
+
onToggle: I.any,
|
|
4177
|
+
isChild: I.any
|
|
4178
|
+
};
|
|
4179
|
+
Rn.propTypes = {
|
|
4180
|
+
open: I.any,
|
|
4181
|
+
onClose: I.any,
|
|
4182
|
+
onSave: I.any,
|
|
4183
|
+
entityData: I.any,
|
|
4184
|
+
permissions: I.any
|
|
4185
|
+
};
|
|
4186
|
+
export {
|
|
4187
|
+
Jr as default
|
|
4188
|
+
};
|
|
4189
|
+
//# sourceMappingURL=ManageDynamicFeature-CeeqiS3K.js.map
|