@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,77 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import { themeConfigs } from '@/utils/themeConfigs';
|
|
3
|
+
import { dashboardInitialState, dashboardReducers } from '@/store/slices/dashboardSlice';
|
|
4
|
+
import { dashboardPagesInitialState, dashboardPagesReducers } from '@/store/slices/dashboardPagesSlice';
|
|
5
|
+
|
|
6
|
+
const initialState = {
|
|
7
|
+
dashboardTheme: {
|
|
8
|
+
currentTheme: 'DEFAULT',
|
|
9
|
+
previousTheme: 'DEFAULT',
|
|
10
|
+
},
|
|
11
|
+
themeConfig: themeConfigs.DEFAULT,
|
|
12
|
+
viewMode: 'grid',
|
|
13
|
+
viewFilterMode: 'All',
|
|
14
|
+
...dashboardInitialState,
|
|
15
|
+
...dashboardPagesInitialState,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const dashboardConfiguratorSlice = createSlice({
|
|
19
|
+
name: 'dashboardEditor',
|
|
20
|
+
initialState,
|
|
21
|
+
reducers: {
|
|
22
|
+
setDashboardTheme: (state, action) => {
|
|
23
|
+
state.dashboardTheme = action.payload;
|
|
24
|
+
},
|
|
25
|
+
setThemeConfig: (state, action) => {
|
|
26
|
+
state.themeConfig = action.payload;
|
|
27
|
+
},
|
|
28
|
+
setViewMode: (state, action) => {
|
|
29
|
+
state.viewMode = action.payload;
|
|
30
|
+
},
|
|
31
|
+
setViewFilterMode: (state, action) => {
|
|
32
|
+
state.viewFilterMode = action.payload;
|
|
33
|
+
},
|
|
34
|
+
...dashboardReducers,
|
|
35
|
+
...dashboardPagesReducers,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const {
|
|
40
|
+
setDashboardTheme,
|
|
41
|
+
setThemeConfig,
|
|
42
|
+
setViewMode,
|
|
43
|
+
setViewFilterMode,
|
|
44
|
+
setDashboardData,
|
|
45
|
+
setBreadCrumbsStack,
|
|
46
|
+
setSelectedPageData,
|
|
47
|
+
setRootPageData,
|
|
48
|
+
setParentPageId,
|
|
49
|
+
setIsPageEditable,
|
|
50
|
+
setCardIdOfPage,
|
|
51
|
+
setIsSavePageData,
|
|
52
|
+
setCurrentPageInsightData,
|
|
53
|
+
setSelectedFiltersAndLayout,
|
|
54
|
+
setCurrentFilterValues,
|
|
55
|
+
setPassedFilterValues,
|
|
56
|
+
} = dashboardConfiguratorSlice.actions;
|
|
57
|
+
|
|
58
|
+
export const getDashboardTheme = (state) => state.dashboardConfigurator.dashboardTheme;
|
|
59
|
+
export const getThemeConfig = (state) => state.dashboardConfigurator.themeConfig;
|
|
60
|
+
export const getViewMode = (state) => state.dashboardConfigurator.viewMode;
|
|
61
|
+
export const getViewFilterMode = (state) => state.dashboardConfigurator.viewFilterMode;
|
|
62
|
+
//Dashboard getter
|
|
63
|
+
export const getDashboardData = (state) => state.dashboardConfigurator.dashboardData;
|
|
64
|
+
export const getBreadCrumbsStack = (state) => state.dashboardConfigurator.breadCrumbsStack;
|
|
65
|
+
//DashboardPage getter
|
|
66
|
+
export const getSelectedPageData = (state) => state.dashboardConfigurator.selectedPageData;
|
|
67
|
+
export const getParentPageId = (state) => state.dashboardConfigurator.parentPageId;
|
|
68
|
+
export const getIsPageEditable = (state) => state.dashboardConfigurator.isPageEditable;
|
|
69
|
+
export const getCardIdOfPage = (state) => state.dashboardConfigurator.cardIdOfPage;
|
|
70
|
+
export const getIsSavePageData = (state) => state.dashboardConfigurator.isSavePageData;
|
|
71
|
+
export const getRootPageData = (state) => state.dashboardConfigurator.rootPageData;
|
|
72
|
+
export const getCurrentPageInsightData = (state) => state.dashboardConfigurator.currentPageInsightData;
|
|
73
|
+
export const getSelectedFiltersAndLayout = (state) => state.dashboardConfigurator.selectedFiltersAndLayout;
|
|
74
|
+
export const getCurrentFilterValues = (state) => state.dashboardConfigurator.currentFilterValues;
|
|
75
|
+
export const getPassedFilterValues = (state) => state.dashboardConfigurator.passedFilterValues;
|
|
76
|
+
|
|
77
|
+
export const dashboardConfiguratorReducer = dashboardConfiguratorSlice.reducer;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
const initialState = {
|
|
4
|
+
canViewAiInfo: false,
|
|
5
|
+
chatMessages: [],
|
|
6
|
+
filterOptions: {
|
|
7
|
+
firstFilterOptions: [],
|
|
8
|
+
secondFilterOptions: [],
|
|
9
|
+
selectedFirstFilter: { value: '__ALL_FIRST__', label: '' },
|
|
10
|
+
selectedSecondFilter: { value: '__ALL_SECOND__', label: '' },
|
|
11
|
+
},
|
|
12
|
+
rootLocationType: null,
|
|
13
|
+
isActionSaved: true,
|
|
14
|
+
filterContext: {},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const DistrictHealthDashboardSlice = createSlice({
|
|
18
|
+
name: 'districtHealthDashboard',
|
|
19
|
+
initialState,
|
|
20
|
+
reducers: {
|
|
21
|
+
setCanViewAiInfo: (state, action) => {
|
|
22
|
+
state.canViewAiInfo = action.payload;
|
|
23
|
+
},
|
|
24
|
+
setChatMessages: (state, action) => {
|
|
25
|
+
state.chatMessages = action.payload;
|
|
26
|
+
},
|
|
27
|
+
setFilterOptions: (state, action) => {
|
|
28
|
+
state.filterOptions = { ...state.filterOptions, ...action.payload };
|
|
29
|
+
},
|
|
30
|
+
setRootLocationType: (state, action) => {
|
|
31
|
+
state.rootLocationType = action.payload;
|
|
32
|
+
},
|
|
33
|
+
setIsActionSaved: (state, action) => {
|
|
34
|
+
state.isActionSaved = action.payload;
|
|
35
|
+
},
|
|
36
|
+
setFilterContext: (state, action) => {
|
|
37
|
+
state.filterContext = { ...state.filterContext, ...action.payload };
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const {
|
|
43
|
+
setCanViewAiInfo,
|
|
44
|
+
setChatMessages,
|
|
45
|
+
setFilterOptions,
|
|
46
|
+
setRootLocationType,
|
|
47
|
+
setIsActionSaved,
|
|
48
|
+
setFilterContext,
|
|
49
|
+
} = DistrictHealthDashboardSlice.actions;
|
|
50
|
+
|
|
51
|
+
export const getCanViewAiInfo = (state) => state.districtHealthDashboard.canViewAiInfo;
|
|
52
|
+
export const getChatMessages = (state) => state.districtHealthDashboard.chatMessages;
|
|
53
|
+
export const getFilterOptions = (state) => state.districtHealthDashboard.filterOptions;
|
|
54
|
+
export const getRootLocationType = (state) => state.districtHealthDashboard.rootLocationType;
|
|
55
|
+
export const getIsActionSaved = (state) => state.districtHealthDashboard.isActionSaved;
|
|
56
|
+
export const getFilterContext = (state) => state.districtHealthDashboard.filterContext;
|
|
57
|
+
|
|
58
|
+
export const districtHealthDashboardReducer = DistrictHealthDashboardSlice.reducer;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
const createInitialState = () => ({
|
|
4
|
+
vaccines: [],
|
|
5
|
+
selectedVaccineIds: [],
|
|
6
|
+
views: [
|
|
7
|
+
{
|
|
8
|
+
id: 'landing',
|
|
9
|
+
name: 'Dashboard',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: 'schedule-config',
|
|
13
|
+
name: 'Schedule Config',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: 'summary',
|
|
17
|
+
name: 'Configuration Summary',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
currentViewId: 'summary',
|
|
21
|
+
scheduledVaccines: [],
|
|
22
|
+
baseDateMaster: [],
|
|
23
|
+
recipientMaster: [],
|
|
24
|
+
dbTablesMaster: [],
|
|
25
|
+
filtersMaster: [],
|
|
26
|
+
featureRights: {},
|
|
27
|
+
isConfigLoaded: false,
|
|
28
|
+
validationErrors: {},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const initialState = createInitialState();
|
|
32
|
+
|
|
33
|
+
const upsertByIdOrCode = (items = [], incoming = {}) => {
|
|
34
|
+
const matchIndex = items.findIndex(
|
|
35
|
+
(item) =>
|
|
36
|
+
(incoming.id !== undefined && item?.id === incoming.id) ||
|
|
37
|
+
(incoming.code && item?.code === incoming.code),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
if (matchIndex === -1) {
|
|
41
|
+
return [...items, incoming];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return items.map((item, index) =>
|
|
45
|
+
index === matchIndex
|
|
46
|
+
? {
|
|
47
|
+
...item,
|
|
48
|
+
...incoming,
|
|
49
|
+
}
|
|
50
|
+
: item,
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const immunizationSlice = createSlice({
|
|
55
|
+
name: 'immunization',
|
|
56
|
+
initialState,
|
|
57
|
+
reducers: {
|
|
58
|
+
toggleVaccine: (state, action) => {
|
|
59
|
+
const id = action.payload;
|
|
60
|
+
if (!Array.isArray(state.selectedVaccineIds)) state.selectedVaccineIds = [];
|
|
61
|
+
|
|
62
|
+
const index = state.selectedVaccineIds.indexOf(id);
|
|
63
|
+
if (index > -1) {
|
|
64
|
+
state.selectedVaccineIds.splice(index, 1);
|
|
65
|
+
} else {
|
|
66
|
+
state.selectedVaccineIds.push(id);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
setVaccines: (state, action) => {
|
|
70
|
+
const vaccines = Array.isArray(action.payload) ? action.payload : [];
|
|
71
|
+
state.vaccines = vaccines;
|
|
72
|
+
if (state.selectedVaccineIds.length === 0) {
|
|
73
|
+
state.selectedVaccineIds = vaccines
|
|
74
|
+
.filter((vaccine) => vaccine.isActive)
|
|
75
|
+
.map((vaccine) => vaccine.id);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
setSelectedVaccineIds: (state, action) => {
|
|
79
|
+
state.selectedVaccineIds = action.payload;
|
|
80
|
+
},
|
|
81
|
+
addCustomVaccine: (state, action) => {
|
|
82
|
+
const payload = action.payload || {};
|
|
83
|
+
const {
|
|
84
|
+
name,
|
|
85
|
+
vaccine_name,
|
|
86
|
+
disease,
|
|
87
|
+
target_prevention,
|
|
88
|
+
id,
|
|
89
|
+
baseDateCode,
|
|
90
|
+
base_date_code,
|
|
91
|
+
recipientType,
|
|
92
|
+
recipient_type,
|
|
93
|
+
} = payload;
|
|
94
|
+
const finalName = name || vaccine_name || 'Unnamed Vaccine';
|
|
95
|
+
const finalCategory = disease || target_prevention || 'General';
|
|
96
|
+
|
|
97
|
+
const vaccines = Array.isArray(state.vaccines) ? state.vaccines : [];
|
|
98
|
+
const validIds = vaccines.map((v) => Number(v?.id)).filter((id) => !Number.isNaN(id));
|
|
99
|
+
const nextId = validIds.length > 0 ? Math.max(...validIds) + 1 : 1;
|
|
100
|
+
|
|
101
|
+
const finalId = id || nextId;
|
|
102
|
+
const newVaccine = {
|
|
103
|
+
id: finalId,
|
|
104
|
+
name: finalName,
|
|
105
|
+
category: finalCategory,
|
|
106
|
+
doses: 0,
|
|
107
|
+
doseType: 'FIXED',
|
|
108
|
+
doseDetails: {},
|
|
109
|
+
regions: [],
|
|
110
|
+
dependencies: [],
|
|
111
|
+
isActive: payload.isActive !== undefined ? payload.isActive : false,
|
|
112
|
+
baseDateCode: baseDateCode || base_date_code || null,
|
|
113
|
+
recipientType: recipientType || recipient_type || '',
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
if (!Array.isArray(state.vaccines)) state.vaccines = [];
|
|
117
|
+
state.vaccines.push(newVaccine);
|
|
118
|
+
},
|
|
119
|
+
setCurrentView: (state, action) => {
|
|
120
|
+
state.currentViewId = action.payload;
|
|
121
|
+
},
|
|
122
|
+
updateScheduledVaccine: (state, action) => {
|
|
123
|
+
const updatedVaccine = action.payload;
|
|
124
|
+
const index = state.scheduledVaccines.findIndex((v) => v.id === updatedVaccine.id);
|
|
125
|
+
if (index !== -1) {
|
|
126
|
+
state.scheduledVaccines[index] = {
|
|
127
|
+
...state.scheduledVaccines[index],
|
|
128
|
+
...updatedVaccine,
|
|
129
|
+
};
|
|
130
|
+
} else {
|
|
131
|
+
state.scheduledVaccines.push(updatedVaccine);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
setBaseDatesMaster: (state, action) => {
|
|
135
|
+
state.baseDateMaster = action.payload;
|
|
136
|
+
},
|
|
137
|
+
setRecipientMaster: (state, action) => {
|
|
138
|
+
state.recipientMaster = action.payload;
|
|
139
|
+
},
|
|
140
|
+
setDbTablesMaster: (state, action) => {
|
|
141
|
+
state.dbTablesMaster = action.payload;
|
|
142
|
+
},
|
|
143
|
+
setFiltersMaster: (state, action) => {
|
|
144
|
+
state.filtersMaster = action.payload;
|
|
145
|
+
},
|
|
146
|
+
upsertBaseDateMasterItem: (state, action) => {
|
|
147
|
+
state.baseDateMaster = upsertByIdOrCode(state.baseDateMaster, action.payload);
|
|
148
|
+
},
|
|
149
|
+
upsertRecipientMasterItem: (state, action) => {
|
|
150
|
+
state.recipientMaster = upsertByIdOrCode(state.recipientMaster, action.payload);
|
|
151
|
+
},
|
|
152
|
+
updateBaseDateMasterStatus: (state, action) => {
|
|
153
|
+
const { code, is_active } = action.payload;
|
|
154
|
+
state.baseDateMaster = state.baseDateMaster.map((item) =>
|
|
155
|
+
item.code === code ? { ...item, is_active } : item,
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
upsertFilterMasterItem: (state, action) => {
|
|
159
|
+
state.filtersMaster = upsertByIdOrCode(state.filtersMaster, action.payload);
|
|
160
|
+
},
|
|
161
|
+
updateFilterMasterStatus: (state, action) => {
|
|
162
|
+
const { code, is_active } = action.payload;
|
|
163
|
+
state.filtersMaster = state.filtersMaster.map((item) =>
|
|
164
|
+
item.code === code ? { ...item, is_active } : item,
|
|
165
|
+
);
|
|
166
|
+
},
|
|
167
|
+
setFeatureRights: (state, action) => {
|
|
168
|
+
state.featureRights = action.payload || {};
|
|
169
|
+
},
|
|
170
|
+
setImmunizationConfigLoaded: (state, action) => {
|
|
171
|
+
state.isConfigLoaded = action.payload;
|
|
172
|
+
},
|
|
173
|
+
resetImmunizationState: () => createInitialState(),
|
|
174
|
+
activateSelectedVaccines: (state) => {
|
|
175
|
+
state.vaccines = state.vaccines.map((v) => ({
|
|
176
|
+
...v,
|
|
177
|
+
isActive: state.selectedVaccineIds.includes(v.id),
|
|
178
|
+
}));
|
|
179
|
+
},
|
|
180
|
+
setVaccineStatus: (state, action) => {
|
|
181
|
+
const { vaccineId, status } = action.payload;
|
|
182
|
+
const vIndex = state.vaccines.findIndex((v) => v.id === vaccineId);
|
|
183
|
+
if (vIndex !== -1) {
|
|
184
|
+
state.vaccines[vIndex].isActive = status;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (!Array.isArray(state.selectedVaccineIds)) state.selectedVaccineIds = [];
|
|
188
|
+
const sIndex = state.selectedVaccineIds.indexOf(vaccineId);
|
|
189
|
+
if (status && sIndex === -1) {
|
|
190
|
+
state.selectedVaccineIds.push(vaccineId);
|
|
191
|
+
} else if (!status && sIndex !== -1) {
|
|
192
|
+
state.selectedVaccineIds.splice(sIndex, 1);
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
setValidationErrors: (state, action) => {
|
|
196
|
+
const { vaccineId, errors } = action.payload;
|
|
197
|
+
state.validationErrors[vaccineId] = errors;
|
|
198
|
+
},
|
|
199
|
+
clearValidationErrors: (state, action) => {
|
|
200
|
+
const vaccineId = action.payload;
|
|
201
|
+
if (vaccineId) {
|
|
202
|
+
delete state.validationErrors[vaccineId];
|
|
203
|
+
} else {
|
|
204
|
+
state.validationErrors = {};
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
export const {
|
|
211
|
+
toggleVaccine,
|
|
212
|
+
setVaccines,
|
|
213
|
+
addCustomVaccine,
|
|
214
|
+
setCurrentView,
|
|
215
|
+
updateScheduledVaccine,
|
|
216
|
+
setBaseDatesMaster,
|
|
217
|
+
setRecipientMaster,
|
|
218
|
+
setDbTablesMaster,
|
|
219
|
+
setFiltersMaster,
|
|
220
|
+
upsertBaseDateMasterItem,
|
|
221
|
+
upsertRecipientMasterItem,
|
|
222
|
+
updateBaseDateMasterStatus,
|
|
223
|
+
upsertFilterMasterItem,
|
|
224
|
+
updateFilterMasterStatus,
|
|
225
|
+
setFeatureRights,
|
|
226
|
+
setImmunizationConfigLoaded,
|
|
227
|
+
resetImmunizationState,
|
|
228
|
+
activateSelectedVaccines,
|
|
229
|
+
setSelectedVaccineIds,
|
|
230
|
+
setValidationErrors,
|
|
231
|
+
clearValidationErrors,
|
|
232
|
+
setVaccineStatus,
|
|
233
|
+
} = immunizationSlice.actions;
|
|
234
|
+
export default immunizationSlice.reducer;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const dashboardPagesInitialState = {
|
|
2
|
+
selectedPageData: {
|
|
3
|
+
pageId: null,
|
|
4
|
+
pageCode: '',
|
|
5
|
+
},
|
|
6
|
+
rootPageData: {
|
|
7
|
+
pageCode: '',
|
|
8
|
+
pageName: '',
|
|
9
|
+
},
|
|
10
|
+
parentPageId: null,
|
|
11
|
+
isPageEditable: true,
|
|
12
|
+
cardIdOfPage: '',
|
|
13
|
+
isSavePageData: false, //it is used when a card is being used as reference but not saved in current page.
|
|
14
|
+
currentPageInsightData: { layout: null, filters: null },
|
|
15
|
+
selectedFiltersAndLayout: { layout: null, filters: null }, //data to send it to child components
|
|
16
|
+
currentFilterValues: {}, // filterValues of current page
|
|
17
|
+
passedFilterValues: {}, //passed to childPage
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const dashboardPagesReducers = {
|
|
21
|
+
setSelectedPageData: (state, action) => {
|
|
22
|
+
state.selectedPageData = { ...state.selectedPageData, ...action.payload };
|
|
23
|
+
},
|
|
24
|
+
setRootPageData: (state, action) => {
|
|
25
|
+
state.rootPageData = { ...state.rootPageData, ...action.payload };
|
|
26
|
+
},
|
|
27
|
+
setParentPageId: (state, action) => {
|
|
28
|
+
state.parentPageId = action.payload;
|
|
29
|
+
},
|
|
30
|
+
setIsPageEditable: (state, action) => {
|
|
31
|
+
state.isPageEditable = action.payload;
|
|
32
|
+
},
|
|
33
|
+
setCardIdOfPage: (state, action) => {
|
|
34
|
+
state.cardIdOfPage = action.payload;
|
|
35
|
+
},
|
|
36
|
+
setIsSavePageData: (state, action) => {
|
|
37
|
+
state.isSavePageData = action.payload;
|
|
38
|
+
},
|
|
39
|
+
setCurrentPageInsightData: (state, action) => {
|
|
40
|
+
state.currentPageInsightData = { ...state.currentPageInsightData, ...action.payload };
|
|
41
|
+
},
|
|
42
|
+
setSelectedFiltersAndLayout: (state, action) => {
|
|
43
|
+
state.selectedFiltersAndLayout = { ...state.selectedFiltersAndLayout, ...action.payload };
|
|
44
|
+
},
|
|
45
|
+
setCurrentFilterValues: (state, action) => {
|
|
46
|
+
state.currentFilterValues = { ...state.currentFilterValues, ...action.payload };
|
|
47
|
+
},
|
|
48
|
+
setPassedFilterValues: (state, action) => {
|
|
49
|
+
state.passedFilterValues = { ...state.passedFilterValues, ...action.payload };
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const dashboardInitialState = {
|
|
2
|
+
dashboardData: { dashboardCode: '', mainPageCode: '', pageCodes: [] },
|
|
3
|
+
breadCrumbsStack: [],
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export const dashboardReducers = {
|
|
7
|
+
setDashboardData: (state, action) => {
|
|
8
|
+
state.dashboardData = { ...state.dashboardData, ...action.payload };
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
setBreadCrumbsStack: (state, action) => {
|
|
12
|
+
state.breadCrumbsStack = action.payload;
|
|
13
|
+
},
|
|
14
|
+
};
|
|
File without changes
|