@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,456 @@
|
|
|
1
|
+
import { showToast } from '@/common/toaster/toaster';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import medplatLogo from '@/assets/img/medplat-highres.png';
|
|
4
|
+
import techoLogo from '@/assets/img/techo_plus.png';
|
|
5
|
+
import sewaruralLogo from '@/assets/img/sewarural.png';
|
|
6
|
+
import dnhddLogo from '@/assets/img/dnhdd.png';
|
|
7
|
+
import dnhddFaviconLogo from '@/assets/img/ddd_phmp.png';
|
|
8
|
+
import imomcareLogo from '@/assets/img/imomcare.png';
|
|
9
|
+
import medplatFavIcon from '@/assets/img/medplat-loader.gif';
|
|
10
|
+
import sathLogo from '@/assets/img/sath.png';
|
|
11
|
+
import ekavachLogo from '@/assets/img/ekavach.png';
|
|
12
|
+
import sathLightLogo from '@/assets/img/saath-light-logo.png';
|
|
13
|
+
import oasisLogo from '@/assets/img/oasis-logo.png';
|
|
14
|
+
|
|
15
|
+
import * as yup from 'yup';
|
|
16
|
+
import APP_CONFIG from '@/common/constants/app.constant';
|
|
17
|
+
import CryptoJS from 'crypto-js';
|
|
18
|
+
|
|
19
|
+
const GeneralUtil = {};
|
|
20
|
+
GeneralUtil.getEnv = () => {
|
|
21
|
+
return import.meta.env.VITE_APP_IMPLEMENTATION;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
GeneralUtil.isBahaar = GeneralUtil.getEnv() === 'bahaar';
|
|
25
|
+
GeneralUtil.isTecho = GeneralUtil.getEnv() === 'gujarat' || GeneralUtil.getEnv() === 'gujaratStaging';
|
|
26
|
+
GeneralUtil.isSewaRural = GeneralUtil.getEnv() === 'sewarural';
|
|
27
|
+
GeneralUtil.isPhmp = GeneralUtil.getEnv() === 'dnhdd';
|
|
28
|
+
GeneralUtil.isImomcare = GeneralUtil.getEnv() === 'imomcare';
|
|
29
|
+
GeneralUtil.isEkavach = GeneralUtil.getEnv() === 'ekavach';
|
|
30
|
+
GeneralUtil.isChip = GeneralUtil.getEnv() === 'chip';
|
|
31
|
+
GeneralUtil.isMedplat = GeneralUtil.getEnv() === 'medplat';
|
|
32
|
+
GeneralUtil.isOasis = GeneralUtil.getEnv() === 'oasis';
|
|
33
|
+
|
|
34
|
+
GeneralUtil.getImagesPath = () => {
|
|
35
|
+
if (GeneralUtil.isMedplat) {
|
|
36
|
+
return medplatLogo;
|
|
37
|
+
}
|
|
38
|
+
if (GeneralUtil.isTecho) {
|
|
39
|
+
return techoLogo;
|
|
40
|
+
}
|
|
41
|
+
if (GeneralUtil.isSewaRural) {
|
|
42
|
+
return sewaruralLogo;
|
|
43
|
+
}
|
|
44
|
+
if (GeneralUtil.isPhmp) {
|
|
45
|
+
return dnhddLogo;
|
|
46
|
+
}
|
|
47
|
+
if (GeneralUtil.isImomcare) {
|
|
48
|
+
return imomcareLogo;
|
|
49
|
+
}
|
|
50
|
+
if (GeneralUtil.isBahaar) {
|
|
51
|
+
return sathLogo;
|
|
52
|
+
}
|
|
53
|
+
if (GeneralUtil.isEkavach) {
|
|
54
|
+
return ekavachLogo;
|
|
55
|
+
}
|
|
56
|
+
if (GeneralUtil.isOasis) {
|
|
57
|
+
return oasisLogo;
|
|
58
|
+
}
|
|
59
|
+
return medplatLogo;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
GeneralUtil.getNavbarLogo = () => {
|
|
63
|
+
if (GeneralUtil.isBahaar) {
|
|
64
|
+
return sathLightLogo;
|
|
65
|
+
}
|
|
66
|
+
if (GeneralUtil.isEkavach) {
|
|
67
|
+
return ekavachLogo;
|
|
68
|
+
}
|
|
69
|
+
if (GeneralUtil.isTecho) {
|
|
70
|
+
return techoLogo;
|
|
71
|
+
}
|
|
72
|
+
if (GeneralUtil.isSewaRural) {
|
|
73
|
+
return sewaruralLogo;
|
|
74
|
+
}
|
|
75
|
+
if (GeneralUtil.isPhmp) {
|
|
76
|
+
return dnhddLogo;
|
|
77
|
+
}
|
|
78
|
+
if (GeneralUtil.isImomcare) {
|
|
79
|
+
return imomcareLogo;
|
|
80
|
+
}
|
|
81
|
+
if (GeneralUtil.isMedplat) {
|
|
82
|
+
return medplatLogo;
|
|
83
|
+
}
|
|
84
|
+
if (GeneralUtil.isOasis) {
|
|
85
|
+
return oasisLogo;
|
|
86
|
+
}
|
|
87
|
+
return medplatLogo;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
GeneralUtil.getAppFavicon = () => {
|
|
91
|
+
if (GeneralUtil.isBahaar) {
|
|
92
|
+
return sathLogo;
|
|
93
|
+
}
|
|
94
|
+
if (GeneralUtil.isEkavach) {
|
|
95
|
+
return ekavachLogo;
|
|
96
|
+
}
|
|
97
|
+
if (GeneralUtil.isTecho) {
|
|
98
|
+
return techoLogo;
|
|
99
|
+
}
|
|
100
|
+
if (GeneralUtil.isSewaRural) {
|
|
101
|
+
return sewaruralLogo;
|
|
102
|
+
}
|
|
103
|
+
if (GeneralUtil.isPhmp) {
|
|
104
|
+
return dnhddFaviconLogo;
|
|
105
|
+
}
|
|
106
|
+
if (GeneralUtil.isImomcare) {
|
|
107
|
+
return imomcareLogo;
|
|
108
|
+
}
|
|
109
|
+
if (GeneralUtil.isMedplat) {
|
|
110
|
+
return medplatFavIcon;
|
|
111
|
+
}
|
|
112
|
+
if (GeneralUtil.isOasis) {
|
|
113
|
+
return oasisLogo;
|
|
114
|
+
}
|
|
115
|
+
return medplatFavIcon;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
GeneralUtil.getAppName = () => {
|
|
119
|
+
if (GeneralUtil.isMedplat) {
|
|
120
|
+
return 'Medplat-React';
|
|
121
|
+
}
|
|
122
|
+
if (GeneralUtil.isBahaar) {
|
|
123
|
+
return 'Saath';
|
|
124
|
+
}
|
|
125
|
+
if (GeneralUtil.isEkavach) {
|
|
126
|
+
return 'eKavach';
|
|
127
|
+
}
|
|
128
|
+
if (GeneralUtil.isTecho) {
|
|
129
|
+
return 'TeCHO+';
|
|
130
|
+
}
|
|
131
|
+
if (GeneralUtil.isSewaRural) {
|
|
132
|
+
return 'Sewa Rural';
|
|
133
|
+
}
|
|
134
|
+
if (GeneralUtil.isPhmp) {
|
|
135
|
+
return 'DNHDD-PHMP';
|
|
136
|
+
}
|
|
137
|
+
if (GeneralUtil.isImomcare) {
|
|
138
|
+
return 'iMomCare';
|
|
139
|
+
}
|
|
140
|
+
if (GeneralUtil.isOasis) {
|
|
141
|
+
return 'OASIS Bandhu App';
|
|
142
|
+
}
|
|
143
|
+
return 'Medplat-React';
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
GeneralUtil.getLogoImages = () => {
|
|
147
|
+
let imagesPath = GeneralUtil.getImagesPath();
|
|
148
|
+
let logoImages = [];
|
|
149
|
+
|
|
150
|
+
if (GeneralUtil.isMedplat) {
|
|
151
|
+
logoImages = [
|
|
152
|
+
{
|
|
153
|
+
link: 'https://gujhealth.gujarat.gov.in/',
|
|
154
|
+
source: `${imagesPath}govtofgujarat.png`,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
link: 'http://nhm.gov.in',
|
|
158
|
+
source: `img/nhm-logo.png`,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
link: 'http://www.sewarural.org/',
|
|
162
|
+
source: `${imagesPath}sewa-rural.png`,
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
link: 'http://unicef.in',
|
|
166
|
+
source: `img/unicef.png`,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
link: 'http://emri.in',
|
|
170
|
+
source: `${imagesPath}gvk-emri.png`,
|
|
171
|
+
},
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
if (GeneralUtil.isSewaRural) {
|
|
175
|
+
logoImages = [
|
|
176
|
+
{
|
|
177
|
+
link: 'http://www.sewarural.org/',
|
|
178
|
+
source: `${imagesPath}sewa-rural.png`,
|
|
179
|
+
},
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
if (GeneralUtil.isTecho) {
|
|
183
|
+
logoImages = [
|
|
184
|
+
{
|
|
185
|
+
link: 'https://www.telangana.gov.in/',
|
|
186
|
+
source: `${imagesPath}govtoftelangana.png`,
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
link: 'http://nhm.gov.in',
|
|
190
|
+
source: `img/nhm-logo.png`,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
link: 'https://www.armman.org/',
|
|
194
|
+
source: `${imagesPath}armman.png`,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
link: 'http://unicef.in',
|
|
198
|
+
source: `img/unicef.png`,
|
|
199
|
+
},
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
if (GeneralUtil.isEkavach) {
|
|
203
|
+
logoImages = [
|
|
204
|
+
{
|
|
205
|
+
link: 'https://uk.gov.in/',
|
|
206
|
+
source: `${imagesPath}govtofuttarakhand.png`,
|
|
207
|
+
},
|
|
208
|
+
];
|
|
209
|
+
}
|
|
210
|
+
if (GeneralUtil.isPhmp) {
|
|
211
|
+
logoImages = [];
|
|
212
|
+
}
|
|
213
|
+
if (GeneralUtil.isImomcare) {
|
|
214
|
+
logoImages = [
|
|
215
|
+
{
|
|
216
|
+
link: 'https://chipstaging.argusoft.com/',
|
|
217
|
+
source: `${imagesPath}ZDCHP.png`,
|
|
218
|
+
},
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
if (GeneralUtil.isImomcare) {
|
|
222
|
+
logoImages = [];
|
|
223
|
+
}
|
|
224
|
+
if (GeneralUtil.isEkavach) {
|
|
225
|
+
logoImages = [];
|
|
226
|
+
}
|
|
227
|
+
if (GeneralUtil.isOasis) {
|
|
228
|
+
logoImages = [
|
|
229
|
+
{
|
|
230
|
+
link: 'https://www.lshtm.ac.uk/',
|
|
231
|
+
source: `${imagesPath}lshtm-logo.png`,
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
link: 'https://phfi.org/',
|
|
235
|
+
source: `${imagesPath}phfi-logo.png`,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
link: 'https://www.dsprud.org/',
|
|
239
|
+
source: `${imagesPath}dsprud-logo.png`,
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
link: 'https://www.ficci.in/',
|
|
243
|
+
source: `${imagesPath}ficci-logo.png`,
|
|
244
|
+
},
|
|
245
|
+
];
|
|
246
|
+
}
|
|
247
|
+
return [imagesPath, logoImages];
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
GeneralUtil.showMessageOnApiCallFailure = function (error, errorMsg) {
|
|
251
|
+
const responseError = error.response;
|
|
252
|
+
if (responseError && responseError.status === 499) {
|
|
253
|
+
showToast({ message: 'Multiple actions detected', type: 'warning' });
|
|
254
|
+
} else {
|
|
255
|
+
if (responseError && responseError.status === 401 && responseError.data.error === 'invalid_token') {
|
|
256
|
+
showToast({ message: 'Your Session has Expired!', type: 'error' });
|
|
257
|
+
} else if (responseError?.data?.message) {
|
|
258
|
+
let backendMessage = responseError?.data?.message || '';
|
|
259
|
+
if (backendMessage.startsWith('VALIDATION_ERROR:')) {
|
|
260
|
+
backendMessage = backendMessage.replace('VALIDATION_ERROR:', '');
|
|
261
|
+
}
|
|
262
|
+
showToast({ message: backendMessage, type: 'error' });
|
|
263
|
+
} else if (errorMsg) {
|
|
264
|
+
showToast({ message: errorMsg, type: 'error' });
|
|
265
|
+
} else {
|
|
266
|
+
showToast({ message: 'Operation unsuccessful. Something went wrong', type: 'error' });
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
GeneralUtil.getAgeInYears = (date, comparatorDate = dayjs()) => {
|
|
272
|
+
return `${comparatorDate.diff(date, 'year')} years`;
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
GeneralUtil.getAgeInYearsAndMonths = (date, comparatorDate = dayjs()) => {
|
|
276
|
+
const years = comparatorDate.diff(date, 'year');
|
|
277
|
+
const months = comparatorDate.diff(date, 'month') % 12;
|
|
278
|
+
return `${years} years and ${months} months`;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
GeneralUtil.getEncodedData = async (encryptionKey, initVector, data) => {
|
|
282
|
+
const key = CryptoJS.enc.Utf8.parse(encryptionKey.substring(0, 16));
|
|
283
|
+
const iv = CryptoJS.enc.Utf8.parse(initVector.substring(0, 16));
|
|
284
|
+
|
|
285
|
+
const encrypted = CryptoJS.AES.encrypt(data, key, {
|
|
286
|
+
iv: iv,
|
|
287
|
+
mode: CryptoJS.mode.CBC,
|
|
288
|
+
padding: CryptoJS.pad.Pkcs7,
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
return encrypted.toString();
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
GeneralUtil.getDecryptedData = async (encryptionKey, initVector, data) => {
|
|
295
|
+
const key = CryptoJS.enc.Utf8.parse(encryptionKey.substring(0, 16));
|
|
296
|
+
const iv = CryptoJS.enc.Utf8.parse(initVector.substring(0, 16));
|
|
297
|
+
|
|
298
|
+
const decrypted = CryptoJS.AES.decrypt(data, key, {
|
|
299
|
+
iv: iv,
|
|
300
|
+
mode: CryptoJS.mode.CBC,
|
|
301
|
+
padding: CryptoJS.pad.Pkcs7,
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
return decrypted.toString(CryptoJS.enc.Utf8);
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
GeneralUtil.naviagationFunc = (item) => {
|
|
308
|
+
const regex = /([a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*?)\(\{id:'([^']+)'\}\)/;
|
|
309
|
+
const match = item?.navigationState.match(regex);
|
|
310
|
+
const formatToCamelCase = (str) => str.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
|
|
311
|
+
|
|
312
|
+
if (match) {
|
|
313
|
+
let structure = match[1].replace(/\./g, '/');
|
|
314
|
+
structure = formatToCamelCase(structure);
|
|
315
|
+
const id = match[2];
|
|
316
|
+
let path = `${structure}/${id}`;
|
|
317
|
+
path = path.replace(/^techo\//, 'medplat/');
|
|
318
|
+
return path;
|
|
319
|
+
} else {
|
|
320
|
+
let path = item.navigationState.replace(/\./g, '/');
|
|
321
|
+
path = formatToCamelCase(path);
|
|
322
|
+
path = path.replace(/^techo\//, 'medplat/');
|
|
323
|
+
return path;
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
GeneralUtil.createLocationValidationSchema = (requiredUptoLevel = 1) => {
|
|
328
|
+
const schemaShape = {};
|
|
329
|
+
|
|
330
|
+
for (let level = 1; level <= requiredUptoLevel; level++) {
|
|
331
|
+
schemaShape[`level${level}`] = yup.mixed().required(`Location Level ${level} is required`);
|
|
332
|
+
}
|
|
333
|
+
return yup.object().shape(schemaShape);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
GeneralUtil.angularRedirectionRouteMatch = (user, navigate) => {
|
|
337
|
+
let result = false;
|
|
338
|
+
const navigationArray = [
|
|
339
|
+
'https://demo.medplat.org',
|
|
340
|
+
'https://bahaar-stg.medplat.co.in',
|
|
341
|
+
// Gujarat Prod & Staging
|
|
342
|
+
'https://techostaging.argusoft.com',
|
|
343
|
+
'https://techo.gujarat.gov.in',
|
|
344
|
+
// Staging URLs
|
|
345
|
+
'https://sewarural-stg.argusservices.in',
|
|
346
|
+
'https://phmp-staging.ddd.gov.in',
|
|
347
|
+
'https://i-momcare-stg.uhs.edu.kh',
|
|
348
|
+
// Prod URLS
|
|
349
|
+
'https://care.sewarural.org',
|
|
350
|
+
'https://phmp.ddd.gov.in',
|
|
351
|
+
'https://i-momcare.uhs.edu.kh',
|
|
352
|
+
// Training
|
|
353
|
+
'https://caretrg.sewarural.org',
|
|
354
|
+
// eKavach Production, Staging and Training
|
|
355
|
+
'https://ekavach.upnrhm.gov.in',
|
|
356
|
+
'https://ekavach-stg.upnrhm.gov.in',
|
|
357
|
+
'https://ekavach-trg.upnrhm.gov.in',
|
|
358
|
+
];
|
|
359
|
+
const hostname = window.location.origin;
|
|
360
|
+
const isMatch = navigationArray.some((url) => hostname === url);
|
|
361
|
+
// this one is needed to match explicitely for medplat-argusservices to redirect in angular of demo medplat
|
|
362
|
+
if (isMatch) {
|
|
363
|
+
let allMenu = [];
|
|
364
|
+
Object.entries(user?.features || {}).forEach(([key, element]) => {
|
|
365
|
+
// const isDuplicate = (name) => allMenu.some((item) => item.name === name);
|
|
366
|
+
const processItems = (items, groupName, subGroupName = null) => {
|
|
367
|
+
items.forEach((item) => {
|
|
368
|
+
if (item.isGroup || item.isSubGroup) {
|
|
369
|
+
if (item.subGroups && item.subGroups.length > 0) {
|
|
370
|
+
processItems(item.subGroups, groupName, item.name);
|
|
371
|
+
}
|
|
372
|
+
} else {
|
|
373
|
+
if (item.navigationState) {
|
|
374
|
+
allMenu.push({
|
|
375
|
+
...item,
|
|
376
|
+
groupName: groupName,
|
|
377
|
+
...(subGroupName && { subGroupName: subGroupName }),
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
};
|
|
383
|
+
processItems(element, key);
|
|
384
|
+
});
|
|
385
|
+
let pathMenu = [];
|
|
386
|
+
allMenu?.forEach((data) => {
|
|
387
|
+
const regex = /([a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*?)\(\{id:'([^']+)'\}\)/;
|
|
388
|
+
const match = data?.navigationState?.match(regex);
|
|
389
|
+
const formatToCamelCase = (str) => {
|
|
390
|
+
return str?.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
if (match) {
|
|
394
|
+
let structure = match[1].replace(/\./g, '/'); // Replace dots with slashes
|
|
395
|
+
structure = formatToCamelCase(structure); // Convert all hyphenated words to camelCase
|
|
396
|
+
const id = match[2];
|
|
397
|
+
const path = `${structure}/${id}`;
|
|
398
|
+
pathMenu.push({ path, navigationState: data.navigationState });
|
|
399
|
+
} else {
|
|
400
|
+
let path = data?.navigationState?.replace(/\./g, '/'); // Replace dots with slashes
|
|
401
|
+
path = formatToCamelCase(path);
|
|
402
|
+
pathMenu.push({ path, navigationState: data.navigationState });
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
const pathName = window.location.pathname.replace('/ui/', '').replace(/^medplat\//, 'techo/');
|
|
407
|
+
|
|
408
|
+
const menuItem = pathMenu.find((menu) => menu?.path?.toLowerCase() === pathName?.toLowerCase());
|
|
409
|
+
|
|
410
|
+
if (menuItem) {
|
|
411
|
+
result = false;
|
|
412
|
+
let path;
|
|
413
|
+
if (isMatch) {
|
|
414
|
+
path = hostname + '/imtecho-ui/#!/' + pathName;
|
|
415
|
+
} else {
|
|
416
|
+
path = APP_CONFIG.angularUrl + 'imtecho-ui/#!/' + pathName;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const token = JSON.parse(localStorage.getItem('token'));
|
|
420
|
+
const message = { token: token, state: menuItem?.navigationState, userId: user?.id };
|
|
421
|
+
let reactAppWindow = window.open(path, 'angularTab');
|
|
422
|
+
if (reactAppWindow && !reactAppWindow.closed) {
|
|
423
|
+
reactAppWindow.close(); // Close the existing tab
|
|
424
|
+
reactAppWindow = window.open(path, 'angularTab'); //reopen it
|
|
425
|
+
}
|
|
426
|
+
setTimeout(() => {
|
|
427
|
+
reactAppWindow.postMessage(message, path);
|
|
428
|
+
}, 500);
|
|
429
|
+
navigate(-1);
|
|
430
|
+
} else {
|
|
431
|
+
result = true;
|
|
432
|
+
}
|
|
433
|
+
} else {
|
|
434
|
+
result = true;
|
|
435
|
+
}
|
|
436
|
+
return result;
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
GeneralUtil.formatLocalDateTime = () => {
|
|
440
|
+
const date = new Date();
|
|
441
|
+
const pad = (num) => (num < 10 ? '0' + num : num);
|
|
442
|
+
|
|
443
|
+
const timezoneOffsetMinutes = -date.getTimezoneOffset();
|
|
444
|
+
const sign = timezoneOffsetMinutes >= 0 ? '+' : '-';
|
|
445
|
+
const offsetHours = Math.floor(Math.abs(timezoneOffsetMinutes) / 60);
|
|
446
|
+
const offsetMinutes = Math.abs(timezoneOffsetMinutes) % 60;
|
|
447
|
+
|
|
448
|
+
// Construct the formatted date string
|
|
449
|
+
const formattedDate =
|
|
450
|
+
`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}` +
|
|
451
|
+
`T${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}` +
|
|
452
|
+
`${sign}${pad(offsetHours)}:${pad(offsetMinutes)}`;
|
|
453
|
+
return formattedDate;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
export default GeneralUtil;
|