@argusoft/medplat-app-shell 1.0.6 → 1.0.8
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/package.json +139 -141
- package/src/GlobalErrorBoundary.jsx +31 -0
- package/src/SilentErrorFallback.jsx +68 -0
- package/src/TrackingProviderWrapper.jsx +40 -0
- package/src/_tests_/__mocks__/MockTranslationProvider.jsx +21 -0
- package/src/_tests_/__mocks__/ckeditor.js +45 -0
- package/src/_tests_/__mocks__/fileMock.js +1 -0
- package/src/_tests_/__mocks__/useranalytics.js +5 -0
- package/src/_tests_/views/components/Dashboard/DashboardUI.test.jsx +137 -0
- package/src/_tests_/views/components/Dashboard/DashboardUIMock.js +877 -0
- package/src/_tests_/views/components/ForgotPassword/ForgotPassword.test.jsx +314 -0
- package/src/_tests_/views/components/LocationDirective/LocationDirective.test.jsx.disable +229 -0
- package/src/_tests_/views/components/LocationDirective/mockLocationDirective.js +810 -0
- package/src/_tests_/views/components/LocationType/MockLocationType.js +42259 -0
- package/src/_tests_/views/components/LocationType/addlocationtype.test.jsx.disable +276 -0
- package/src/_tests_/views/components/LocationType/editlocationtype.test.jsx.disable +262 -0
- package/src/_tests_/views/components/LocationType/locationtype.test.jsx.disable +148 -0
- package/src/_tests_/views/components/Profile/UpdateProfileModalData.js +4396 -0
- package/src/_tests_/views/components/Profile/updateprofilemodal.test.jsx +282 -0
- package/src/_tests_/views/components/SideBar/MockSideBar.js +1379 -0
- package/src/_tests_/views/components/SideBar/SideBar.test.jsx +98 -0
- package/src/_tests_/views/components/SystemConfig/ManageSystemConfig/AddManageSystemConfig.test.jsx.disable +164 -0
- package/src/_tests_/views/components/SystemConfig/ManageSystemConfig/UpdateManageSystemConfig.test.jsx.disable +157 -0
- package/src/_tests_/views/components/SystemConfig/MockSystemConfig.js +1280 -0
- package/src/_tests_/views/components/SystemConfig/SystemConfig.test.jsx.disable +165 -0
- package/src/_tests_/views/components/login/Login.test.jsx +276 -0
- package/src/_tests_/views/components/login/MockAuthorise.js +2414 -0
- package/src/_tests_/views/components/login/ServiceResponse.js +595 -0
- package/src/_tests_/views/components/user/MockManageUser.js +7965 -0
- package/src/_tests_/views/components/user/manageuser.test.jsx.disable +989 -0
- package/src/_tests_/views/components/user/mockUsersData.js +582 -0
- package/src/assets/img/OASISLogin.png +0 -0
- package/src/assets/img/bahaarNew.png +0 -0
- package/src/assets/img/dnhdd4K.png +0 -0
- package/src/assets/img/govtofup.png +0 -0
- package/src/assets/img/sewarural4K.png +0 -0
- package/src/assets/img/techo4K.png +0 -0
- package/src/assets/img/up4K.png +0 -0
- package/src/common/HolidayList.jsx +573 -0
- package/src/common/MalaciaousInputUtil.js +23 -0
- package/src/common/SafeHtml.jsx +17 -0
- package/src/common/VersionManager.jsx +109 -0
- package/src/common/constants/PerformanceDashboard.js +514 -0
- package/src/common/constants/app.constant.js +781 -0
- package/src/common/constants/cccVerificationConstants.js +18 -0
- package/src/common/constants/fhsrConstant.js +33 -0
- package/src/common/constants/gvk-verification.constant.js +76 -0
- package/src/common/constants/search.constant.js +23 -0
- package/src/common/constants/teleconsulatationConstant.jsx +1339 -0
- package/src/common/directives/SearchTemplate.jsx +784 -0
- package/src/common/directives/SearchTemplate.scss +14 -0
- package/src/common/dynamicView/DynamicView.jsx +353 -0
- package/src/common/dynamicView/InputFieldComponent.jsx +1501 -0
- package/src/common/dynamicView/InputViewComponent.jsx +298 -0
- package/src/common/dynamicView/InputViewComponent.scss +15 -0
- package/src/common/env.js +5 -0
- package/src/common/filters/locationNameFilter.js +26 -0
- package/src/common/fontAwesomeIcons/FontAwesomeIcons.jsx +27 -0
- package/src/common/fontAwesomeIcons/FontAwesomeIconsNames.js +1968 -0
- package/src/common/fontPreferences/fontSizeProvider.jsx +34 -0
- package/src/common/fontPreferences/fontSizeSelector.jsx +116 -0
- package/src/common/getAssignedFeature/getAssignedFeature.js +32 -0
- package/src/common/interceptors/AxiosInterceptor.js +216 -0
- package/src/common/languageTranslator/TranslationContext.js +5 -0
- package/src/common/languageTranslator/TranslationProvider.jsx +24 -0
- package/src/common/languageTranslator/i18n.js +49 -0
- package/src/common/services/AuthenticateService.js +116 -0
- package/src/common/services/DownloadFile.js +35 -0
- package/src/common/services/ForgotPassword.js +18 -0
- package/src/common/services/FormConfiguratorService.js +195 -0
- package/src/common/services/GlobalApis.js +84 -0
- package/src/common/services/InterceptorNavigationService.js +17 -0
- package/src/common/services/LocationService.js +65 -0
- package/src/common/services/LocationType.js +11 -0
- package/src/common/services/QueryBuilder.js +36 -0
- package/src/common/services/Roles.js +28 -0
- package/src/common/services/SyncWithServer.js +15 -0
- package/src/common/services/SystemConfig.js +15 -0
- package/src/common/services/TranslationService.js +70 -0
- package/src/common/services/TwoFactorService.js +7 -0
- package/src/common/services/Users.js +91 -0
- package/src/common/services/Webtasks.js +27 -0
- package/src/common/services/util/Convert-pad-data-to-API-format.jsx +167 -0
- package/src/common/services/util/Convert-to-UI-format.jsx +82 -0
- package/src/common/services/util/EmptyPrescriptionPadData.jsx +11 -0
- package/src/common/services/util/GeneralUtil.js +456 -0
- package/src/common/services/util/Prescription-pad-util.js +339 -0
- package/src/common/services/util/PrescriptionPadData.js +67 -0
- package/src/common/services/util/PrescriptionpadCommonUtil.js +96 -0
- package/src/common/services/util/ReportFieldUtil.jsx +398 -0
- package/src/common/services/util/WebSocketContext.jsx +261 -0
- package/src/common/syncWithServer/SyncWithServerDialog.jsx +170 -0
- package/src/common/syncWithServer/SyncWithServerDialogSkeleton.jsx +67 -0
- package/src/common/tests/CustomWrapper.jsx +49 -0
- package/src/common/tests/TranslationWrapper.jsx +38 -0
- package/src/common/themeProvider/ColorInputs.jsx +97 -0
- package/src/common/themeProvider/EditableColorInput.jsx +128 -0
- package/src/common/themeProvider/ThemeEditor.jsx +319 -0
- package/src/common/themeProvider/ThemeProvider.jsx +210 -0
- package/src/common/themeProvider/themeConfig.js +558 -0
- package/src/common/toaster/toaster.jsx +30 -0
- package/src/firebaseConfig.js +24 -0
- package/src/global.scss +221 -0
- package/src/hooks/.gitkeep +0 -0
- package/src/hooks/useAESEncryption.js +56 -0
- package/src/hooks/useCaching.js +43 -0
- package/src/hooks/useDebounce.js +34 -0
- package/src/hooks/useDebounceFn.js +50 -0
- package/src/hooks/useDownloadPdf.js +358 -0
- package/src/hooks/useDownloadXlsx.js +55 -0
- package/src/hooks/useListValueFieldValues.js +30 -0
- package/src/hooks/useLocationHierarchies.js +63 -0
- package/src/hooks/useLocationHierarchyTranslate.js +16 -0
- package/src/hooks/useOnline.js +27 -0
- package/src/hooks/usePagination.js +63 -0
- package/src/hooks/useRefreshToken.js +87 -0
- package/src/hooks/useScript.js +25 -0
- package/src/hooks/useStopwatch.js +75 -0
- package/src/hooks/useTrackEvent.js +22 -0
- package/src/hooks/useWebAudioRecorder.js +115 -0
- package/src/layout/LoaderComponet.jsx +22 -0
- package/src/layout/LoaderContext.jsx +29 -0
- package/src/layout/mainLayout/AdaptiveZoom.jsx +27 -0
- package/src/layout/mainLayout/Chatbot.jsx +243 -0
- package/src/layout/mainLayout/Layout.jsx +445 -0
- package/src/layout/mainLayout/Profile/UpdateProfileModal.jsx +684 -0
- package/src/layout/mainLayout/header/LogoutModal.jsx +131 -0
- package/src/layout/mainLayout/header/Navbar.jsx +1677 -0
- package/src/layout/mainLayout/header/Navbar.scss +4 -0
- package/src/layout/mainLayout/header/index.js +0 -0
- package/src/layout/mainLayout/sidebar/SideBar.jsx +1402 -0
- package/src/layout/mainLayout/sidebar/Sidebar.css +159 -0
- package/src/layout/mainLayout/sidebar/index.js +0 -0
- package/src/logo.svg +1 -0
- package/src/reportWebVitals.js +13 -0
- package/src/setupFirebaseMessaging.js +28 -0
- package/src/setupTests.js +8 -0
- package/src/store/actions/AuthenticationActions.js +0 -0
- package/src/store/actions/ReportsActions.js +0 -0
- package/src/store/actions/TranslationAction.js +0 -0
- package/src/store/index.js +8 -0
- package/src/store/reducer.js +46 -0
- package/src/store/reducers/AuthenticationReducer.js +50 -0
- package/src/store/reducers/CalendarEventReducer.js +41 -0
- package/src/store/reducers/ConditionClipboardReducer.js +45 -0
- package/src/store/reducers/FeatureReducer.js +27 -0
- package/src/store/reducers/FormConfiguratorReducer.js +38 -0
- package/src/store/reducers/LoadingReducer.js +20 -0
- package/src/store/reducers/MembersAuthenticationReducer.js +28 -0
- package/src/store/reducers/PrescriptionPadReducer.js +329 -0
- package/src/store/reducers/QuestionaireReducer.js +29 -0
- package/src/store/reducers/ReportsReducer.js +24 -0
- package/src/store/reducers/SkeletonReducer.js +20 -0
- package/src/store/reducers/ThemeReducer.js +106 -0
- package/src/store/reducers/TranslationReducer.js +126 -0
- package/src/store/reducers/dashboardEditorSlice.js +77 -0
- package/src/store/reducers/districtHealthDashboardSlice.js +58 -0
- package/src/store/reducers/immunizationSlice.js +234 -0
- package/src/store/slices/dashboardPagesSlice.js +51 -0
- package/src/store/slices/dashboardSlice.js +14 -0
- package/src/utils/.gitkeep +0 -0
- package/src/utils/FormConstants.js +2629 -0
- package/src/utils/GujaratTopoChart.jsx +483 -0
- package/src/utils/UUIDgenerator.js +8 -0
- package/src/utils/appointment-utils/appointment-utils.js +123 -0
- package/src/utils/feature.js +42 -0
- package/src/utils/getThemeColor.js +12 -0
- package/src/utils/localStorageHelper.js +11 -0
- package/src/utils/notifications/enable-push-notifications.js +27 -0
- package/src/utils/resolveAppliedStyle.js +11 -0
- package/src/utils/themeConfigs.js +1483 -0
- package/src/views/custom-components/.gitkeep +0 -0
- package/src/views/custom-components/AgIconButton/RIf.jsx +14 -0
- package/src/views/custom-components/AgIconButton/button.jsx +108 -0
- package/src/views/custom-components/AgIconButton/waterDrop.jsx +95 -0
- package/src/views/custom-components/AgIconButton/waterDrop.scss +37 -0
- package/src/views/custom-components/AlertPlaceholder.jsx +32 -0
- package/src/views/custom-components/AllFaIconsSelector.jsx +56 -0
- package/src/views/custom-components/CkEditor/CkEditor.js +102 -0
- package/src/views/custom-components/CustomAccordion.jsx +72 -0
- package/src/views/custom-components/CustomActionIcons.jsx +118 -0
- package/src/views/custom-components/CustomAutoComplete.jsx +188 -0
- package/src/views/custom-components/CustomCheckBox.jsx +60 -0
- package/src/views/custom-components/CustomConfirmationModal.jsx +118 -0
- package/src/views/custom-components/CustomCountrySelect.jsx +129 -0
- package/src/views/custom-components/CustomDatePicker.jsx +122 -0
- package/src/views/custom-components/CustomDropdown.jsx +191 -0
- package/src/views/custom-components/CustomFileUpload.jsx +387 -0
- package/src/views/custom-components/CustomFullCalendar.jsx +514 -0
- package/src/views/custom-components/CustomInfiniteScroll.jsx +126 -0
- package/src/views/custom-components/CustomRadioComponent.jsx +65 -0
- package/src/views/custom-components/CustomStatsComponent.jsx +114 -0
- package/src/views/custom-components/CustomSvgUpload.jsx +170 -0
- package/src/views/custom-components/CustomSwitch.jsx +37 -0
- package/src/views/custom-components/CustomTabPanel.jsx +19 -0
- package/src/views/custom-components/CustomTextArea.jsx +62 -0
- package/src/views/custom-components/CustomTextArea.scss +27 -0
- package/src/views/custom-components/CustomTextField.jsx +116 -0
- package/src/views/custom-components/CustomToggleSwitch.jsx +138 -0
- package/src/views/custom-components/CustomTooltip.jsx +51 -0
- package/src/views/custom-components/CustomZoomImage.jsx +134 -0
- package/src/views/custom-components/CustomizedTable/CustomizedTableV2.jsx +1407 -0
- package/src/views/custom-components/CustomizedTable/VirtualizeTableBody.jsx +295 -0
- package/src/views/custom-components/CustomizedTable/helper.jsx +159 -0
- package/src/views/custom-components/CustomizedTable.jsx +532 -0
- package/src/views/custom-components/EditInputField.jsx +174 -0
- package/src/views/custom-components/FieldDescription.jsx +22 -0
- package/src/views/custom-components/FileDisplayComponent.jsx +138 -0
- package/src/views/custom-components/FormItem.jsx +53 -0
- package/src/views/custom-components/GenericChart.jsx +80 -0
- package/src/views/custom-components/InfoBadge.jsx +60 -0
- package/src/views/custom-components/PostgresEditor.jsx +801 -0
- package/src/views/custom-components/ResizableEditAutocompleteField.jsx +249 -0
- package/src/views/custom-components/ResizableEditInputField.jsx +215 -0
- package/src/views/custom-components/ResizeableEditSelectField.jsx +197 -0
- package/src/views/custom-components/SideOverlay.jsx +113 -0
- package/src/views/custom-components/SideOverlay.scss +42 -0
- package/src/views/custom-components/calendar.scss +571 -0
- package/src/views/feature-components/.gitkeep +0 -0
- package/src/views/feature-components/Dashboard/DashboardUI.jsx +1043 -0
- package/src/views/feature-components/Dashboard/DhnddModal/AshaDataQualityVerificationModal.jsx +278 -0
- package/src/views/feature-components/Dashboard/PinFeatureModal.jsx +143 -0
- package/src/views/feature-components/Dashboard/QuickLinks.jsx +163 -0
- package/src/views/feature-components/Dashboard/Taskbar.jsx +56 -0
- package/src/views/feature-components/Dashboard/WebtasksFilterForm.jsx +109 -0
- package/src/views/feature-components/Dashboard/WidgetCard.jsx +161 -0
- package/src/views/feature-components/Dashboard/actionModal.jsx +263 -0
- package/src/views/feature-components/Dashboard/ekavachModal/HealthWorkerIncorrectDetailsModal.jsx +332 -0
- package/src/views/feature-components/Dashboard/ekavachModal/MoMaternalDeathVerifcationModal.jsx +275 -0
- package/src/views/feature-components/Dashboard/ekavachModal/MoVerficationForChildScreeningMoadal.jsx +566 -0
- package/src/views/feature-components/FeatureUsageAnalytics/FeatureUsageAnalytics.jsx +989 -0
- package/src/views/feature-components/Features/NewServerManagement.jsx +217 -0
- package/src/views/feature-components/Features/ServerManagement.scss +120 -0
- package/src/views/feature-components/ForgotPassword/ForgotPassword.jsx +226 -0
- package/src/views/feature-components/LocationDirective/LocationDirective.jsx +992 -0
- package/src/views/feature-components/LocationDirective/LocationDirectiveV2.jsx +909 -0
- package/src/views/feature-components/NotFound.jsx +66 -0
- package/src/views/feature-components/Onboarding/Onboarding.jsx +1400 -0
- package/src/views/feature-components/Skeletons.js +115 -0
- package/src/views/feature-components/Unauthorized.jsx +48 -0
- package/src/views/feature-components/VerifyRoute.jsx +88 -0
- package/src/views/feature-components/YearlyRecap/YearlyRecap.jsx +357 -0
- package/src/views/feature-components/YearlyRecap/components/RecapSlide.jsx +183 -0
- package/src/views/feature-components/YearlyRecap/languageTranslator/TranslationContext.js +5 -0
- package/src/views/feature-components/YearlyRecap/languageTranslator/TranslationProvider.jsx +26 -0
- package/src/views/feature-components/YearlyRecap/languageTranslator/i18n.js +46 -0
- package/src/views/feature-components/YearlyRecap/languageTranslator/translations.json +167 -0
- package/src/views/feature-components/YearlyRecap/slides/IntroSlide.jsx +233 -0
- package/src/views/feature-components/YearlyRecap/slides/MaternalHealthSlide.jsx +146 -0
- package/src/views/feature-components/YearlyRecap/slides/MetricSlide.jsx +227 -0
- package/src/views/feature-components/YearlyRecap/slides/OutroSlide.jsx +701 -0
- package/src/views/feature-components/YearlyRecap/slides/ReachSlide.jsx +273 -0
- package/src/views/feature-components/login/Login.jsx +840 -0
- package/src/views/feature-components/login/Login.scss +154 -0
- package/src/views/feature-components/login/LoginConfigurator.jsx +1149 -0
- package/src/views/feature-components/login/TwoFactorSetupModal.jsx +411 -0
- package/src/views/feature-components/login/simplifyMenu.js +45 -0
- package/src/views/feature-components/system-config/ManageSystemConfigs.jsx +284 -0
- package/src/views/feature-components/system-config/SystemConfig.jsx +299 -0
- package/src/views/feature-components/users/ChangePasswordModal.jsx +243 -0
- package/src/views/feature-components/users/PasswordField.jsx +56 -0
- package/dist/index.css +0 -1
- package/dist/index.js +0 -32001
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useTranslateProvider } from '@/common/languageTranslator/TranslationContext';
|
|
4
|
+
import { syncWithServer } from '@/common/services/SyncWithServer';
|
|
5
|
+
import { showToast } from '@/common/toaster/toaster';
|
|
6
|
+
import {
|
|
7
|
+
Button,
|
|
8
|
+
Checkbox,
|
|
9
|
+
Dialog,
|
|
10
|
+
DialogActions,
|
|
11
|
+
DialogContent,
|
|
12
|
+
DialogTitle,
|
|
13
|
+
FormControlLabel,
|
|
14
|
+
FormGroup,
|
|
15
|
+
Typography,
|
|
16
|
+
} from '@mui/material';
|
|
17
|
+
import { SyncWithServerDialogSkeleton } from '@/common/syncWithServer/SyncWithServerDialogSkeleton';
|
|
18
|
+
import PropTypes from 'prop-types';
|
|
19
|
+
import { executeQuery } from '@/common/services/GlobalApis';
|
|
20
|
+
|
|
21
|
+
const SyncWithServerDialog = ({ featureUUID, isOpen, handleClose, dataTestId }) => {
|
|
22
|
+
const [servers, setServers] = useState([]);
|
|
23
|
+
const [selectedServers, setSelectedServers] = useState([]);
|
|
24
|
+
const { translate } = useTranslateProvider();
|
|
25
|
+
const [loading, setLoading] = useState(false);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const loadServers = async () => {
|
|
29
|
+
setLoading((cur) => !cur);
|
|
30
|
+
try {
|
|
31
|
+
let serversList = servers || [];
|
|
32
|
+
if (!servers.length) {
|
|
33
|
+
const serverList = await executeQuery({
|
|
34
|
+
code: 'get_active_server_list',
|
|
35
|
+
parameters: {},
|
|
36
|
+
});
|
|
37
|
+
serversList = serverList?.data?.result;
|
|
38
|
+
setServers(() => serversList);
|
|
39
|
+
}
|
|
40
|
+
const selectedServerList = await executeQuery({
|
|
41
|
+
code: 'get_server_list_which_are_in_sync_for_auto_sync_configuration',
|
|
42
|
+
parameters: { featureUUID },
|
|
43
|
+
});
|
|
44
|
+
const selectedServerIds = selectedServerList?.data?.result.map(
|
|
45
|
+
({ server_name }) => serversList?.find((server) => server.server_name === server_name)?.id
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
setSelectedServers(() => selectedServerIds);
|
|
49
|
+
// setLoading((cur) => !cur);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error(error);
|
|
52
|
+
} finally {
|
|
53
|
+
setLoading((cur) => !cur);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
if (isOpen) {
|
|
58
|
+
loadServers();
|
|
59
|
+
}
|
|
60
|
+
}, [featureUUID]);
|
|
61
|
+
|
|
62
|
+
const handleSelection = (e) => {
|
|
63
|
+
const { value } = e.target;
|
|
64
|
+
const serverId = parseInt(value);
|
|
65
|
+
if (selectedServers.includes(serverId)) {
|
|
66
|
+
setSelectedServers(() => [...selectedServers.filter((id) => serverId !== id)]);
|
|
67
|
+
} else {
|
|
68
|
+
setSelectedServers(() => [...selectedServers, serverId]);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleCancel = () => {
|
|
73
|
+
handleClose();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const handleSaveClick = async () => {
|
|
77
|
+
try {
|
|
78
|
+
const reqData = {
|
|
79
|
+
featureUUID,
|
|
80
|
+
serverlist: selectedServers,
|
|
81
|
+
};
|
|
82
|
+
handleClose();
|
|
83
|
+
await syncWithServer(reqData);
|
|
84
|
+
showToast({ message: 'Synced Successfully', type: 'success' });
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error(error);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<SyncWithServerDialogSkeleton isOpen={isOpen} loading={loading}>
|
|
92
|
+
<Dialog
|
|
93
|
+
open={isOpen}
|
|
94
|
+
onClose={handleCancel}
|
|
95
|
+
maxWidth="xs"
|
|
96
|
+
fullWidth
|
|
97
|
+
sx={{
|
|
98
|
+
'& .MuiDialog-paper': {
|
|
99
|
+
position: 'absolute',
|
|
100
|
+
top: '5%', // Position from the top of the screen
|
|
101
|
+
margin: 0,
|
|
102
|
+
transform: 'translate(0, 0)', // Remove centering
|
|
103
|
+
},
|
|
104
|
+
}}
|
|
105
|
+
data-testid={dataTestId}
|
|
106
|
+
>
|
|
107
|
+
<DialogTitle className="p-2.5 px-5">
|
|
108
|
+
<div>
|
|
109
|
+
<Typography variant="body1" className="flex font-medium text-lg text-customBlue" component="div">
|
|
110
|
+
{translate('Sync with Server')}
|
|
111
|
+
</Typography>
|
|
112
|
+
</div>
|
|
113
|
+
</DialogTitle>
|
|
114
|
+
<DialogContent dividers>
|
|
115
|
+
<Typography variant="body2" gutterBottom>
|
|
116
|
+
{translate('Select Server with you want to sync this feature')}
|
|
117
|
+
</Typography>
|
|
118
|
+
<FormGroup>
|
|
119
|
+
{servers?.map((server) => (
|
|
120
|
+
<FormControlLabel
|
|
121
|
+
key={server.id}
|
|
122
|
+
control={
|
|
123
|
+
<Checkbox
|
|
124
|
+
checked={selectedServers.includes(server.id)}
|
|
125
|
+
value={server.id}
|
|
126
|
+
onChange={handleSelection}
|
|
127
|
+
/>
|
|
128
|
+
}
|
|
129
|
+
label={server.server_name}
|
|
130
|
+
sx={{
|
|
131
|
+
'& .MuiFormControlLabel-label': {
|
|
132
|
+
fontSize: '12px',
|
|
133
|
+
},
|
|
134
|
+
}}
|
|
135
|
+
/>
|
|
136
|
+
))}
|
|
137
|
+
</FormGroup>
|
|
138
|
+
</DialogContent>
|
|
139
|
+
<DialogActions>
|
|
140
|
+
<Button
|
|
141
|
+
size="small"
|
|
142
|
+
variant="contained"
|
|
143
|
+
onClick={handleCancel}
|
|
144
|
+
color="secondary"
|
|
145
|
+
data-testid="syncwithserver-button-close"
|
|
146
|
+
>
|
|
147
|
+
{translate('Cancel')}
|
|
148
|
+
</Button>
|
|
149
|
+
<Button
|
|
150
|
+
size="small"
|
|
151
|
+
variant="contained"
|
|
152
|
+
onClick={handleSaveClick}
|
|
153
|
+
color="primary"
|
|
154
|
+
data-testid="syncwithserver-button-save"
|
|
155
|
+
>
|
|
156
|
+
{translate('Save')}
|
|
157
|
+
</Button>
|
|
158
|
+
</DialogActions>
|
|
159
|
+
</Dialog>
|
|
160
|
+
</SyncWithServerDialogSkeleton>
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
SyncWithServerDialog.propTypes = {
|
|
165
|
+
featureUUID: PropTypes.any,
|
|
166
|
+
isOpen: PropTypes.any,
|
|
167
|
+
handleClose: PropTypes.any,
|
|
168
|
+
dataTestId: PropTypes.any,
|
|
169
|
+
};
|
|
170
|
+
export default SyncWithServerDialog;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useSelector } from 'react-redux';
|
|
4
|
+
import { getUseSkeleton } from '@/store/reducers/SkeletonReducer';
|
|
5
|
+
export const SyncWithServerDialogSkeleton = ({ isOpen, children, loading }) => {
|
|
6
|
+
const useSkeleton = useSelector(getUseSkeleton);
|
|
7
|
+
if (!useSkeleton) {
|
|
8
|
+
return children;
|
|
9
|
+
}
|
|
10
|
+
if (!loading) return children;
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
{isOpen && (
|
|
15
|
+
<div className="fixed inset-0 flex items-start justify-center pt-[3%] z-[1300] bg-[rgba(0,0,0,0.5)] shadow-lg ">
|
|
16
|
+
<div className="bg-white rounded-md shadow-lg w-full max-w-md">
|
|
17
|
+
<div className="p-4 border-b">
|
|
18
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[24px] w-[150px]"></div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div className="p-4 border-b">
|
|
22
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[20px] w-[90%] mb-4"></div>
|
|
23
|
+
|
|
24
|
+
<div className="space-y-5 mt-3">
|
|
25
|
+
<div className="flex items-center">
|
|
26
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[20px] w-[20px] mr-2"></div>
|
|
27
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[16px] w-[120px]"></div>
|
|
28
|
+
</div>
|
|
29
|
+
<div className="flex items-center">
|
|
30
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[20px] w-[20px] mr-2"></div>
|
|
31
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[16px] w-[140px]"></div>
|
|
32
|
+
</div>
|
|
33
|
+
<div className="flex items-center">
|
|
34
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[20px] w-[20px] mr-2"></div>
|
|
35
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[16px] w-[100px]"></div>
|
|
36
|
+
</div>
|
|
37
|
+
<div className="flex items-center">
|
|
38
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[20px] w-[20px] mr-2"></div>
|
|
39
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[16px] w-[130px]"></div>
|
|
40
|
+
</div>
|
|
41
|
+
<div className="flex items-center">
|
|
42
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[20px] w-[20px] mr-2"></div>
|
|
43
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[16px] w-[100px]"></div>
|
|
44
|
+
</div>
|
|
45
|
+
<div className="flex items-center">
|
|
46
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[20px] w-[20px] mr-2"></div>
|
|
47
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[16px] w-[130px]"></div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div className="p-2 flex justify-end space-x-2 border-t">
|
|
53
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[32px] w-[70px]"></div>
|
|
54
|
+
<div className="bg-gray-300 animate-pulse rounded-sm h-[32px] w-[60px]"></div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
)}
|
|
59
|
+
</>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
SyncWithServerDialogSkeleton.propTypes = {
|
|
64
|
+
isOpen: PropTypes.any,
|
|
65
|
+
children: PropTypes.any,
|
|
66
|
+
loading: PropTypes.any,
|
|
67
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Provider } from 'react-redux';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
|
|
7
|
+
import store from '@/store';
|
|
8
|
+
import MockTranslationProvider from '@/_tests_/__mocks__/MockTranslationProvider';
|
|
9
|
+
|
|
10
|
+
const CustomWrapper = ({ children, options }) => {
|
|
11
|
+
// Extract URL and parameters from options
|
|
12
|
+
const { url, ...params } = options;
|
|
13
|
+
|
|
14
|
+
// Determine if params object is not empty
|
|
15
|
+
const hasParams = Object.keys(params).length > 0;
|
|
16
|
+
|
|
17
|
+
// Construct the initial entries for MemoryRouter
|
|
18
|
+
const initialEntries = [url];
|
|
19
|
+
if (hasParams) {
|
|
20
|
+
initialEntries[0] = `${url}/${Object.values(params)[0]}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Construct the route path based on the presence of params
|
|
24
|
+
const routePath = hasParams ? `${url}/:${Object.keys(params)[0]}` : url;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<MockTranslationProvider>
|
|
28
|
+
<Provider store={store}>
|
|
29
|
+
<MemoryRouter initialEntries={initialEntries} future={{ v7_startTransition: true, v7_relativeSplatPath: true }}>
|
|
30
|
+
<Routes>
|
|
31
|
+
<Route path={routePath} element={children} />
|
|
32
|
+
</Routes>
|
|
33
|
+
</MemoryRouter>
|
|
34
|
+
</Provider>
|
|
35
|
+
</MockTranslationProvider>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const customRender = (ui, options) => {
|
|
40
|
+
return render(<CustomWrapper options={options}>{ui}</CustomWrapper>, options);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
CustomWrapper.propTypes = {
|
|
44
|
+
options: PropTypes.any,
|
|
45
|
+
children: PropTypes.any,
|
|
46
|
+
url: PropTypes.any,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { customRender };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { useSelector } from 'react-redux';
|
|
3
|
+
import { I18nextProvider } from 'react-i18next';
|
|
4
|
+
import { BrowserRouter as Router } from 'react-router-dom';
|
|
5
|
+
import { initializeI18n } from '@/common/languageTranslator/i18n';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import TranslationProvider from '../languageTranslator/TranslationProvider';
|
|
8
|
+
|
|
9
|
+
function TranslationWrapper({ children }) {
|
|
10
|
+
const translations = useSelector((state) => state.Translation); // Get translations from Redux store
|
|
11
|
+
const [i18nInstance, setI18nInstance] = useState(null);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (translations) {
|
|
15
|
+
const preferredLanguage = translations?.translationLanguage || 'en';
|
|
16
|
+
const i18n = initializeI18n(translations, preferredLanguage); // Dynamically initialize i18n with translations
|
|
17
|
+
setI18nInstance(i18n); // Mark i18n as initialized
|
|
18
|
+
}
|
|
19
|
+
}, [translations]);
|
|
20
|
+
|
|
21
|
+
if (!i18nInstance) {
|
|
22
|
+
return null; // Render nothing until i18n is ready
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<I18nextProvider i18n={i18nInstance}>
|
|
27
|
+
<TranslationProvider>
|
|
28
|
+
<Router>{children}</Router>
|
|
29
|
+
</TranslationProvider>
|
|
30
|
+
</I18nextProvider>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
TranslationWrapper.propTypes = {
|
|
35
|
+
children: PropTypes.any,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default TranslationWrapper;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Box, Typography, FormControl, FormLabel } from '@mui/material';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import EditableColorInput from './EditableColorInput';
|
|
4
|
+
|
|
5
|
+
const ColorInputs = ({ updatedConfig, handleColorChange, themeStyle }) => {
|
|
6
|
+
if (themeStyle !== 'palette') {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const config = updatedConfig[themeStyle];
|
|
10
|
+
|
|
11
|
+
// Only show these palette groups in the UI
|
|
12
|
+
const allowedGroups = ['primary', 'text', 'custom'];
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Box
|
|
16
|
+
sx={{
|
|
17
|
+
mb: 4,
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexWrap: 'wrap',
|
|
20
|
+
gap: 3,
|
|
21
|
+
'& > *': {
|
|
22
|
+
flex: '1 1 calc(33.33% - 24px)',
|
|
23
|
+
minWidth: 380,
|
|
24
|
+
},
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
{Object.entries(config).map(
|
|
28
|
+
([colorGroup, colors]) =>
|
|
29
|
+
allowedGroups.includes(colorGroup) && (
|
|
30
|
+
<Box
|
|
31
|
+
key={colorGroup}
|
|
32
|
+
sx={{
|
|
33
|
+
p: 3,
|
|
34
|
+
border: '1px solid',
|
|
35
|
+
borderColor: 'divider',
|
|
36
|
+
borderRadius: 1,
|
|
37
|
+
bgcolor: 'background.paper',
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
<Typography
|
|
41
|
+
variant="subtitle1"
|
|
42
|
+
sx={{
|
|
43
|
+
mb: 2,
|
|
44
|
+
fontWeight: 600,
|
|
45
|
+
color: 'text.primary',
|
|
46
|
+
textTransform: 'capitalize',
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
{colorGroup}
|
|
50
|
+
</Typography>
|
|
51
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
|
|
52
|
+
{Object.entries(colors).map(([colorKey, colorValue]) => (
|
|
53
|
+
<FormControl key={colorKey} fullWidth>
|
|
54
|
+
<Box
|
|
55
|
+
sx={{
|
|
56
|
+
display: 'flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
height: 48,
|
|
59
|
+
justifyContent: 'flex-start',
|
|
60
|
+
flexWrap: 'nowrap',
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<FormLabel
|
|
64
|
+
sx={{
|
|
65
|
+
minWidth: 140,
|
|
66
|
+
width: 160,
|
|
67
|
+
color: 'text.secondary',
|
|
68
|
+
textTransform: 'none',
|
|
69
|
+
fontSize: '13px',
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
{colorKey.replace(/([A-Z])/g, ' $1').replace(/^./, (str) => str.toUpperCase())}
|
|
73
|
+
</FormLabel>
|
|
74
|
+
<EditableColorInput
|
|
75
|
+
colorGroup={colorGroup}
|
|
76
|
+
colorKey={colorKey}
|
|
77
|
+
colorValue={colorValue}
|
|
78
|
+
onColorChange={handleColorChange}
|
|
79
|
+
/>
|
|
80
|
+
</Box>
|
|
81
|
+
</FormControl>
|
|
82
|
+
))}
|
|
83
|
+
</Box>
|
|
84
|
+
</Box>
|
|
85
|
+
)
|
|
86
|
+
)}
|
|
87
|
+
</Box>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
ColorInputs.propTypes = {
|
|
92
|
+
updatedConfig: PropTypes.any,
|
|
93
|
+
handleColorChange: PropTypes.any,
|
|
94
|
+
themeStyle: PropTypes.any,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default ColorInputs;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Box, Input, Typography, IconButton } from '@mui/material';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
+
import { faFloppyDisk, faPen, faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
6
|
+
|
|
7
|
+
const EditableColorInput = ({ colorGroup, colorKey, colorValue, onColorChange }) => {
|
|
8
|
+
const initialHex = colorValue.startsWith('#') ? colorValue : `#${colorValue}`;
|
|
9
|
+
const [editing, setEditing] = useState(false);
|
|
10
|
+
const [localValue, setLocalValue] = useState(initialHex);
|
|
11
|
+
const [error, setError] = useState('');
|
|
12
|
+
|
|
13
|
+
const isValidHex = (value) => /^#[0-9A-Fa-f]{6}$/.test(value);
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!editing) {
|
|
17
|
+
setLocalValue(colorValue.startsWith('#') ? colorValue : `#${colorValue}`);
|
|
18
|
+
}
|
|
19
|
+
}, [colorValue, editing]);
|
|
20
|
+
|
|
21
|
+
const handleEditClick = () => {
|
|
22
|
+
setEditing(true);
|
|
23
|
+
setError('');
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handleSaveClick = () => {
|
|
27
|
+
if (isValidHex(localValue)) {
|
|
28
|
+
onColorChange(colorGroup, colorKey, localValue);
|
|
29
|
+
setEditing(false);
|
|
30
|
+
} else {
|
|
31
|
+
setError('Invalid color code');
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const handleCancelClick = () => {
|
|
36
|
+
setLocalValue(colorValue.startsWith('#') ? colorValue : `#${colorValue}`);
|
|
37
|
+
setError('');
|
|
38
|
+
setEditing(false);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const handleColorPickerChange = (e) => {
|
|
42
|
+
const newColor = e.target.value;
|
|
43
|
+
if (editing) {
|
|
44
|
+
setLocalValue(newColor);
|
|
45
|
+
} else {
|
|
46
|
+
onColorChange(colorGroup, colorKey, newColor);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const pickerValue = editing && isValidHex(localValue) ? localValue : colorValue;
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, whiteSpace: 'nowrap' }}>
|
|
54
|
+
<Input
|
|
55
|
+
type="color"
|
|
56
|
+
value={pickerValue}
|
|
57
|
+
onChange={handleColorPickerChange}
|
|
58
|
+
sx={{
|
|
59
|
+
width: 32,
|
|
60
|
+
height: 32,
|
|
61
|
+
padding: 0,
|
|
62
|
+
cursor: 'pointer',
|
|
63
|
+
flexShrink: 0,
|
|
64
|
+
'&::-webkit-color-swatch': {
|
|
65
|
+
borderRadius: '4px',
|
|
66
|
+
border: 'none',
|
|
67
|
+
},
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
<Input
|
|
71
|
+
type="text"
|
|
72
|
+
value={localValue}
|
|
73
|
+
onChange={(e) => {
|
|
74
|
+
const val = e.target.value;
|
|
75
|
+
if (!val.startsWith('#')) {
|
|
76
|
+
setLocalValue(`#${val}`);
|
|
77
|
+
} else {
|
|
78
|
+
setLocalValue(val);
|
|
79
|
+
}
|
|
80
|
+
if (error) setError('');
|
|
81
|
+
}}
|
|
82
|
+
disabled={!editing}
|
|
83
|
+
error={!!error}
|
|
84
|
+
sx={{
|
|
85
|
+
width: 80,
|
|
86
|
+
flexShrink: 0,
|
|
87
|
+
fontSize: '13px',
|
|
88
|
+
'& .MuiInput-input': {
|
|
89
|
+
py: '4px',
|
|
90
|
+
lineHeight: 1.2,
|
|
91
|
+
height: 32,
|
|
92
|
+
boxSizing: 'border-box',
|
|
93
|
+
},
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>
|
|
97
|
+
{editing ? (
|
|
98
|
+
<>
|
|
99
|
+
<IconButton onClick={handleSaveClick} size="small" color="primary">
|
|
100
|
+
<FontAwesomeIcon icon={faFloppyDisk} className="text-md" />
|
|
101
|
+
</IconButton>
|
|
102
|
+
<IconButton onClick={handleCancelClick} size="small" color="secondary">
|
|
103
|
+
<FontAwesomeIcon icon={faXmark} className="text-md" />
|
|
104
|
+
</IconButton>
|
|
105
|
+
</>
|
|
106
|
+
) : (
|
|
107
|
+
<IconButton onClick={handleEditClick} size="small">
|
|
108
|
+
<FontAwesomeIcon icon={faPen} className="text-md" />
|
|
109
|
+
</IconButton>
|
|
110
|
+
)}
|
|
111
|
+
{error && (
|
|
112
|
+
<Typography variant="caption" color="error" sx={{ ml: 0.5, whiteSpace: 'nowrap' }}>
|
|
113
|
+
{error}
|
|
114
|
+
</Typography>
|
|
115
|
+
)}
|
|
116
|
+
</Box>
|
|
117
|
+
</Box>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
EditableColorInput.propTypes = {
|
|
122
|
+
colorGroup: PropTypes.any,
|
|
123
|
+
colorKey: PropTypes.any,
|
|
124
|
+
colorValue: PropTypes.any,
|
|
125
|
+
onColorChange: PropTypes.any,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export default EditableColorInput;
|