@argusoft/medplat-app-shell 1.0.6 → 1.0.7
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/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,14 @@
|
|
|
1
|
+
.error-help-text-searchtemplate {
|
|
2
|
+
color: #5c0606;
|
|
3
|
+
position: absolute;
|
|
4
|
+
padding: 1%;
|
|
5
|
+
padding-left: 3%;
|
|
6
|
+
padding-right: 3%;
|
|
7
|
+
border-radius: 20px;
|
|
8
|
+
right: 3%;
|
|
9
|
+
top: 0%;
|
|
10
|
+
transform: translateY(-50%);
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
background-color: rgb(236, 188, 188);
|
|
13
|
+
font-size: 0.6rem;
|
|
14
|
+
}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useSelector } from 'react-redux';
|
|
4
|
+
import { getAssignedFeature } from '@/common/getAssignedFeature/getAssignedFeature';
|
|
5
|
+
import { showToast } from '@/common/toaster/toaster';
|
|
6
|
+
import SideOverlay from '@/views/custom-components/SideOverlay';
|
|
7
|
+
import InputViewComponent from '@/common/dynamicView/InputViewComponent';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import CustomizedTable from '@/views/custom-components/CustomizedTable/CustomizedTableV2';
|
|
10
|
+
import { useParams } from 'react-router';
|
|
11
|
+
|
|
12
|
+
// import SafeHtml from '@/common/SafeHtml.jsx';
|
|
13
|
+
/**
|
|
14
|
+
* DynamicView component for rendering and managing dynamic data views.
|
|
15
|
+
*
|
|
16
|
+
* @module DynamicView
|
|
17
|
+
* @param {Object} props - The component props.
|
|
18
|
+
* @param {Object} props.config - Configuration object for the component.
|
|
19
|
+
* @param {Object} props.data - Data object to be displayed in the view.
|
|
20
|
+
* @param {Function} props.setData - Function to update the data state.
|
|
21
|
+
* @param {Object} props.navigationstate - Current navigation state.
|
|
22
|
+
* @param {Function} props.locationChange - Callback for location changes.
|
|
23
|
+
* @param {Function} props.fieldChangeCallback - Callback for field changes.
|
|
24
|
+
* @param {Function} props.fieldSelectizeCallback - Callback for selectize field changes.
|
|
25
|
+
* @param {boolean} [props.setDefaultValue=false] - Flag to set default values.
|
|
26
|
+
* @param {string} props.search - Search string for filtering data.
|
|
27
|
+
*
|
|
28
|
+
* @returns {JSX.Element} The rendered component.
|
|
29
|
+
*/
|
|
30
|
+
function DynamicView({
|
|
31
|
+
config,
|
|
32
|
+
data,
|
|
33
|
+
setData,
|
|
34
|
+
navigationstate,
|
|
35
|
+
locationChange,
|
|
36
|
+
fieldChangeCallback,
|
|
37
|
+
fieldSelectizeCallback,
|
|
38
|
+
setDefaultValue = false,
|
|
39
|
+
search,
|
|
40
|
+
isLoading,
|
|
41
|
+
setIsLoading,
|
|
42
|
+
uiLocationId,
|
|
43
|
+
changedUsingUi,
|
|
44
|
+
setFetchUptoLevelLimit,
|
|
45
|
+
pagingService,
|
|
46
|
+
retrieveTableDataByQueryId,
|
|
47
|
+
onDataRendered,
|
|
48
|
+
allDistrictReq,
|
|
49
|
+
setAllDistrictReq,
|
|
50
|
+
allBlockReq,
|
|
51
|
+
setAllBlockReq,
|
|
52
|
+
allPhcReq,
|
|
53
|
+
setAllPhcReq,
|
|
54
|
+
clearPreviousLocation,
|
|
55
|
+
styleConfig,
|
|
56
|
+
callLocationChange,
|
|
57
|
+
setCallLocationChange,
|
|
58
|
+
locationPartSelected,
|
|
59
|
+
showScrollArrows
|
|
60
|
+
}) {
|
|
61
|
+
let { id } = useParams();
|
|
62
|
+
|
|
63
|
+
const [aboveData, setAboveData] = useState('');
|
|
64
|
+
const [belowData, setBelowData] = useState('');
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const htmlData = config?.containers?.tableContainer?.[0]?.htmlData;
|
|
68
|
+
|
|
69
|
+
if (htmlData && htmlData.includes('#table#')) {
|
|
70
|
+
const [above, below] = htmlData.split('#table#');
|
|
71
|
+
setAboveData(above);
|
|
72
|
+
setBelowData(below);
|
|
73
|
+
}
|
|
74
|
+
}, [config?.containers?.tableContainer?.[0]?.htmlData]);
|
|
75
|
+
const [sortedData, setSortedData] = useState(
|
|
76
|
+
data?.tableData?.map((item) => {
|
|
77
|
+
Object.keys(item)?.forEach((key) => {
|
|
78
|
+
const value = item[key];
|
|
79
|
+
item[key] = value || value === 0 || typeof value === 'boolean' ? value : ' ';
|
|
80
|
+
});
|
|
81
|
+
return item;
|
|
82
|
+
}) || []
|
|
83
|
+
);
|
|
84
|
+
const columns = data?.tableToDisplay?.header.map((column) => {
|
|
85
|
+
return { ...column, sortOrder: 'asc' };
|
|
86
|
+
});
|
|
87
|
+
const [headers, setHeaders] = useState(columns);
|
|
88
|
+
const { user, linearMenuItems } = useSelector((state) => state.Authenticate);
|
|
89
|
+
const [isFilterToBeShown, setIsFilterToBeShown] = useState(false);
|
|
90
|
+
const [overlayOpen, setOverlayOpen] = useState(false);
|
|
91
|
+
const [locations, setLocations] = useState([]);
|
|
92
|
+
const [uiLocations, setUiLocations] = useState(null);
|
|
93
|
+
const [selectedLocation, setSelectedLocation] = useState({});
|
|
94
|
+
const [uiSelectedLocation, setUiSelectedLocation] = useState(null);
|
|
95
|
+
const [keepMounted, setKeepMounted] = useState(true);
|
|
96
|
+
const [resetFilter, setResetFilter] = useState(false);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Toggles the state of the overlay component.
|
|
100
|
+
*
|
|
101
|
+
* @function handleOverlayState
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
const resetLocation = () => {
|
|
105
|
+
if (uiLocations && uiSelectedLocation) {
|
|
106
|
+
setLocations(uiLocations);
|
|
107
|
+
setSelectedLocation(uiSelectedLocation);
|
|
108
|
+
setUiLocations(null);
|
|
109
|
+
setUiSelectedLocation(null);
|
|
110
|
+
setTimeout(() => {
|
|
111
|
+
setCallLocationChange(false);
|
|
112
|
+
}, 100);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
setCallLocationChange(false);
|
|
116
|
+
};
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (callLocationChange) {
|
|
119
|
+
resetLocation();
|
|
120
|
+
}
|
|
121
|
+
}, [callLocationChange, uiLocations, uiSelectedLocation, search]);
|
|
122
|
+
const handleOverlayState = ({ search } = {}) => {
|
|
123
|
+
if (search) {
|
|
124
|
+
setUiLocations(null);
|
|
125
|
+
setUiSelectedLocation(null);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
setOverlayOpen(!overlayOpen);
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Handles sorting of the data based on the specified field.
|
|
132
|
+
*
|
|
133
|
+
* @function handleSort
|
|
134
|
+
* @param {string} field - The field name to sort by.
|
|
135
|
+
*/
|
|
136
|
+
const handleSort = (column) => {
|
|
137
|
+
const order = column.sortOrder === 'asc' ? 'desc' : 'asc';
|
|
138
|
+
setHeaders((prev) =>
|
|
139
|
+
prev.map((col) => {
|
|
140
|
+
if (col.field === column.field) {
|
|
141
|
+
return { ...col, sortOrder: order };
|
|
142
|
+
}
|
|
143
|
+
return col;
|
|
144
|
+
})
|
|
145
|
+
);
|
|
146
|
+
const newSortedData = [...sortedData].sort((a, b) => {
|
|
147
|
+
const aValue = a[column.field]?.toString().toLowerCase() || '';
|
|
148
|
+
const bValue = b[column.field]?.toString().toLowerCase() || '';
|
|
149
|
+
|
|
150
|
+
if (order === 'asc') {
|
|
151
|
+
return aValue.localeCompare(bValue);
|
|
152
|
+
} else {
|
|
153
|
+
return bValue.localeCompare(aValue);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
setSortedData(newSortedData);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Renders the input component for dynamic field handling.
|
|
162
|
+
*
|
|
163
|
+
* @function inputComponent
|
|
164
|
+
* @returns {JSX.Element} The rendered input component.
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
setKeepMounted(false);
|
|
169
|
+
setTimeout(() => {
|
|
170
|
+
setKeepMounted(true);
|
|
171
|
+
}, 1000);
|
|
172
|
+
// if (config?.isFilterOpen !== undefined) {
|
|
173
|
+
setTimeout(() => {
|
|
174
|
+
setOverlayOpen(config?.isFilterOpen || false);
|
|
175
|
+
}, 400);
|
|
176
|
+
// }
|
|
177
|
+
}, [id, config?.isFilterOpen]);
|
|
178
|
+
const inputComponent = () => {
|
|
179
|
+
// fieldChangeCallback("date","dfkdjf")
|
|
180
|
+
return (
|
|
181
|
+
<div key={id} id={id}>
|
|
182
|
+
<InputViewComponent
|
|
183
|
+
handleOverlayState={handleOverlayState}
|
|
184
|
+
details={config.containers?.fieldsContainer}
|
|
185
|
+
data={data}
|
|
186
|
+
setData={setData}
|
|
187
|
+
setDefaultValue={setDefaultValue}
|
|
188
|
+
locationChange={locationChange}
|
|
189
|
+
locations={locations}
|
|
190
|
+
setLocations={setLocations}
|
|
191
|
+
fieldChangeCallback={fieldChangeCallback}
|
|
192
|
+
fieldSelectizeCallback={fieldSelectizeCallback}
|
|
193
|
+
search={search}
|
|
194
|
+
isDownloadOffline={!!config.isSupportOffline}
|
|
195
|
+
uiLocationId={uiLocationId}
|
|
196
|
+
changedUsingUi={changedUsingUi}
|
|
197
|
+
setFetchUptoLevelLimit={setFetchUptoLevelLimit}
|
|
198
|
+
allDistrictReq={allDistrictReq}
|
|
199
|
+
setAllDistrictReq={setAllDistrictReq}
|
|
200
|
+
allBlockReq={allBlockReq}
|
|
201
|
+
setAllBlockReq={setAllBlockReq}
|
|
202
|
+
allPhcReq={allPhcReq}
|
|
203
|
+
setAllPhcReq={setAllPhcReq}
|
|
204
|
+
selectedLocation={selectedLocation}
|
|
205
|
+
setSelectedLocation={setSelectedLocation}
|
|
206
|
+
setUiLocations={setUiLocations}
|
|
207
|
+
setUiSelectedLocation={setUiSelectedLocation}
|
|
208
|
+
clearPreviousLocation={clearPreviousLocation}
|
|
209
|
+
resetFilter={resetFilter}
|
|
210
|
+
setResetFilter={setResetFilter}
|
|
211
|
+
locationPartSelected={locationPartSelected}
|
|
212
|
+
/>
|
|
213
|
+
</div>
|
|
214
|
+
);
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Fetches user rights and permissions based on the current navigation state.
|
|
219
|
+
*
|
|
220
|
+
* @function getRights
|
|
221
|
+
* @returns {Promise<void>} A promise that resolves when rights are fetched.
|
|
222
|
+
*/
|
|
223
|
+
const getRights = useCallback(async () => {
|
|
224
|
+
try {
|
|
225
|
+
const res = await getAssignedFeature(navigationstate, linearMenuItems);
|
|
226
|
+
if (res) {
|
|
227
|
+
console.log('res', res);
|
|
228
|
+
}
|
|
229
|
+
} catch (error) {
|
|
230
|
+
console.error(error);
|
|
231
|
+
showToast({ message: 'Error in loading features', type: 'error' });
|
|
232
|
+
}
|
|
233
|
+
}, [navigationstate, linearMenuItems]);
|
|
234
|
+
useEffect(() => {
|
|
235
|
+
if (user) {
|
|
236
|
+
if (navigationstate != null) {
|
|
237
|
+
getRights();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (data?.tableToDisplay?.header) {
|
|
241
|
+
const updatedHeader = data.tableToDisplay.header.map((header) => ({
|
|
242
|
+
...header,
|
|
243
|
+
hide: header?.field?.includes('hidden_'), // Add 'hide' property if fieldName includes 'hidden_'
|
|
244
|
+
}));
|
|
245
|
+
setHeaders(updatedHeader);
|
|
246
|
+
}
|
|
247
|
+
if (config.containers) {
|
|
248
|
+
const isFilterVisible = config?.containers?.fieldsContainer?.some((field) => !field.isHidden);
|
|
249
|
+
setIsFilterToBeShown(isFilterVisible);
|
|
250
|
+
}
|
|
251
|
+
// if (config?.isFilterOpen !== undefined) {
|
|
252
|
+
// // setOverlayOpen(config.isFilterOpen);
|
|
253
|
+
// }
|
|
254
|
+
}, [config, user, navigationstate, getRights]);
|
|
255
|
+
useEffect(() => {
|
|
256
|
+
setSortedData(data?.tableData);
|
|
257
|
+
if (data?.tableToDisplay?.header) {
|
|
258
|
+
const updatedHeader = data.tableToDisplay.header.map((header) => ({
|
|
259
|
+
...header,
|
|
260
|
+
hide: header?.field?.includes('hidden_'), // Add 'hide' property if fieldName includes 'hidden_'
|
|
261
|
+
}));
|
|
262
|
+
setHeaders(updatedHeader);
|
|
263
|
+
}
|
|
264
|
+
if (onDataRendered) {
|
|
265
|
+
onDataRendered();
|
|
266
|
+
}
|
|
267
|
+
}, [data]);
|
|
268
|
+
return (
|
|
269
|
+
<div>
|
|
270
|
+
<div className="mb-4">
|
|
271
|
+
{config.htmlData && aboveData && data.tableToDisplay.body.length > 0 && (
|
|
272
|
+
<div dangerouslySetInnerHTML={{ __html: aboveData }} />
|
|
273
|
+
)}
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
<CustomizedTable
|
|
277
|
+
dataColspan={config?.containers?.tableContainer[0]?.dataColspan}
|
|
278
|
+
colspanData={config.colspanData}
|
|
279
|
+
paginationConfig={{
|
|
280
|
+
pagination: config?.layout === 'dynamicReportWithPagination',
|
|
281
|
+
paginationType: config.layout === 'dynamicReportWithPagination' ? 'infinite-scroll' : 'pagination',
|
|
282
|
+
rowsPerPageInTable: config?.numberOfRecordsPerPage,
|
|
283
|
+
hasMore: !pagingService.allRetrieved,
|
|
284
|
+
loadMore: () =>
|
|
285
|
+
!pagingService.allRetrieved && !pagingService.pagingRetrivalOn && retrieveTableDataByQueryId(),
|
|
286
|
+
}}
|
|
287
|
+
styleConfig={styleConfig}
|
|
288
|
+
columns={headers}
|
|
289
|
+
tableData={sortedData}
|
|
290
|
+
handleSort={handleSort}
|
|
291
|
+
isLoading={isLoading}
|
|
292
|
+
showAllBorders={true}
|
|
293
|
+
showFullContent={true}
|
|
294
|
+
showScrollArrows={showScrollArrows}
|
|
295
|
+
/>
|
|
296
|
+
<div className="mb-2 mt-6">
|
|
297
|
+
{config.htmlData && belowData && data.tableToDisplay.body.length > 0 && (
|
|
298
|
+
<div dangerouslySetInnerHTML={{ __html: belowData }} />
|
|
299
|
+
)}
|
|
300
|
+
</div>
|
|
301
|
+
{isFilterToBeShown && (
|
|
302
|
+
<SideOverlay
|
|
303
|
+
ModalProps={{
|
|
304
|
+
keepMounted: keepMounted,
|
|
305
|
+
}}
|
|
306
|
+
title="Filter"
|
|
307
|
+
FormBody={inputComponent()}
|
|
308
|
+
handleOverlayState={handleOverlayState}
|
|
309
|
+
resetButtonLabel="Reset"
|
|
310
|
+
onResetClick={() => {
|
|
311
|
+
setResetFilter(true);
|
|
312
|
+
}}
|
|
313
|
+
overlayOpen={overlayOpen}
|
|
314
|
+
isForm={false}
|
|
315
|
+
dataTestId="report-view-sideoverlay"
|
|
316
|
+
formProps={{ isLoading, setIsLoading }}
|
|
317
|
+
/>
|
|
318
|
+
)}
|
|
319
|
+
</div>
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
DynamicView.propTypes = {
|
|
323
|
+
config: PropTypes.any, // Adjust the shape according to your actual config object structure
|
|
324
|
+
data: PropTypes.any, // or PropTypes.array, PropTypes.object depending on what data is
|
|
325
|
+
setData: PropTypes.any,
|
|
326
|
+
navigationstate: PropTypes.any, // Adjust according to the actual type
|
|
327
|
+
locationChange: PropTypes.any, // Assuming this is a anytion
|
|
328
|
+
fieldChangeCallback: PropTypes.any, // Assuming this is a anytion
|
|
329
|
+
fieldSelectizeCallback: PropTypes.any, // Assuming this is a function
|
|
330
|
+
setDefaultValue: PropTypes.bool, // Boolean type
|
|
331
|
+
search: PropTypes.any, // Adjust according to the actual type of search
|
|
332
|
+
isLoading: PropTypes.any,
|
|
333
|
+
setIsLoading: PropTypes.any,
|
|
334
|
+
uiLocationId: PropTypes.any,
|
|
335
|
+
changedUsingUi: PropTypes.any,
|
|
336
|
+
setFetchUptoLevelLimit: PropTypes.any,
|
|
337
|
+
pagingService: PropTypes.any,
|
|
338
|
+
retrieveTableDataByQueryId: PropTypes.any,
|
|
339
|
+
allDistrictReq: PropTypes.any,
|
|
340
|
+
setAllDistrictReq: PropTypes.any,
|
|
341
|
+
allBlockReq: PropTypes.any,
|
|
342
|
+
setAllBlockReq: PropTypes.any,
|
|
343
|
+
allPhcReq: PropTypes.any,
|
|
344
|
+
setAllPhcReq: PropTypes.any,
|
|
345
|
+
onDataRendered: PropTypes.any,
|
|
346
|
+
clearPreviousLocation: PropTypes.any,
|
|
347
|
+
styleConfig: PropTypes.any,
|
|
348
|
+
callLocationChange: PropTypes.any,
|
|
349
|
+
setCallLocationChange: PropTypes.any,
|
|
350
|
+
locationPartSelected: PropTypes.any,
|
|
351
|
+
showScrollArrows: PropTypes.any,
|
|
352
|
+
};
|
|
353
|
+
export default DynamicView;
|