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