@argusoft/medplat-app-shell 1.0.5 → 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,109 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, { lazy, Suspense, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
import { Button } from '@mui/material';
|
|
5
|
+
import Grid from '@mui/material/Grid2';
|
|
6
|
+
|
|
7
|
+
import { useTranslateProvider } from '@/common/languageTranslator/TranslationContext';
|
|
8
|
+
import { getWebTasksBasketDetails } from '@/common/services/Webtasks';
|
|
9
|
+
import useTrackEvent from '@/hooks/useTrackEvent';
|
|
10
|
+
const LocationSelectionComponent = lazy(
|
|
11
|
+
() => import('@/views/feature-components/LocationDirective/LocationDirectiveV2')
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const WebtasksFilterForm = ({
|
|
15
|
+
handleOverlayState,
|
|
16
|
+
setWebTasksData,
|
|
17
|
+
selectedWidgetData,
|
|
18
|
+
locations,
|
|
19
|
+
setLocations,
|
|
20
|
+
setSelectedLocation,
|
|
21
|
+
selectedLocation,
|
|
22
|
+
}) => {
|
|
23
|
+
const trackEvent = useTrackEvent();
|
|
24
|
+
|
|
25
|
+
const { translate } = useTranslateProvider();
|
|
26
|
+
|
|
27
|
+
const loadInitialData = async () => {};
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
loadInitialData();
|
|
31
|
+
}, []);
|
|
32
|
+
|
|
33
|
+
const handleSubmit = async () => {
|
|
34
|
+
try {
|
|
35
|
+
const searchObject = {
|
|
36
|
+
limit: 100,
|
|
37
|
+
offset: 0,
|
|
38
|
+
taskTypeId: selectedWidgetData.id,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const selectedLocationId = selectedLocation?.finalSelected?.optionSelected?.id;
|
|
42
|
+
if (selectedLocationId) {
|
|
43
|
+
searchObject['locationId'] = selectedLocationId;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
trackEvent('filter', {
|
|
47
|
+
filter_type: ['location', 'task'],
|
|
48
|
+
...searchObject,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const { data: filteredWebtasksList } = await getWebTasksBasketDetails(searchObject);
|
|
52
|
+
|
|
53
|
+
setWebTasksData(
|
|
54
|
+
filteredWebtasksList.map((data, index) => {
|
|
55
|
+
return { index: index + 1, ...data.details };
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
handleOverlayState();
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error(error);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Grid className="text-[1rem] p-4">
|
|
66
|
+
<Suspense>
|
|
67
|
+
<LocationSelectionComponent
|
|
68
|
+
selectedLocation={selectedLocation}
|
|
69
|
+
setSelectedLocation={setSelectedLocation}
|
|
70
|
+
templateType="inline"
|
|
71
|
+
locations={locations}
|
|
72
|
+
setLocations={setLocations}
|
|
73
|
+
fetchAccordingToUserAoi={true}
|
|
74
|
+
/>
|
|
75
|
+
</Suspense>
|
|
76
|
+
|
|
77
|
+
<Grid container spacing={1} marginTop={1} justifyContent="flex-end">
|
|
78
|
+
<Grid item>
|
|
79
|
+
<Button
|
|
80
|
+
data-testid={`webtaskfilterform-close-button`}
|
|
81
|
+
variant="contained"
|
|
82
|
+
color="secondary"
|
|
83
|
+
onClick={() => handleOverlayState()}
|
|
84
|
+
>
|
|
85
|
+
{translate('Cancel')}
|
|
86
|
+
</Button>
|
|
87
|
+
</Grid>
|
|
88
|
+
|
|
89
|
+
<Grid item>
|
|
90
|
+
<Button data-testid={`webtaskfilterform-search-button`} variant="contained" onClick={() => handleSubmit()}>
|
|
91
|
+
{translate('Search')}
|
|
92
|
+
</Button>
|
|
93
|
+
</Grid>
|
|
94
|
+
</Grid>
|
|
95
|
+
</Grid>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default WebtasksFilterForm;
|
|
100
|
+
|
|
101
|
+
WebtasksFilterForm.propTypes = {
|
|
102
|
+
handleOverlayState: PropTypes.any,
|
|
103
|
+
setWebTasksData: PropTypes.any,
|
|
104
|
+
selectedWidgetData: PropTypes.any,
|
|
105
|
+
locations: PropTypes.any,
|
|
106
|
+
setLocations: PropTypes.any,
|
|
107
|
+
setSelectedLocation: PropTypes.func,
|
|
108
|
+
selectedLocation: PropTypes.any,
|
|
109
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { Box, IconButton, Tooltip, Typography } from '@mui/material';
|
|
2
|
+
import { useTheme } from '@mui/material/styles';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import { useTranslateProvider } from '@/common/languageTranslator/TranslationContext';
|
|
6
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
7
|
+
import { faArrowLeft, faArrowRight } from '@fortawesome/free-solid-svg-icons';
|
|
8
|
+
|
|
9
|
+
const WidgetCard = ({
|
|
10
|
+
hidden,
|
|
11
|
+
widgetData,
|
|
12
|
+
onArrowClick,
|
|
13
|
+
onClick,
|
|
14
|
+
dataTestId = 'Widget-Card',
|
|
15
|
+
showIcon = true,
|
|
16
|
+
isSelected = false,
|
|
17
|
+
}) => {
|
|
18
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
19
|
+
const { count, name, colorCode: color, lastModified } = widgetData;
|
|
20
|
+
|
|
21
|
+
const { translate } = useTranslateProvider();
|
|
22
|
+
const theme = useTheme();
|
|
23
|
+
const isDark = theme.palette.mode === 'dark';
|
|
24
|
+
|
|
25
|
+
const formattedDate =
|
|
26
|
+
lastModified && !isNaN(Number(lastModified))
|
|
27
|
+
? new Date(Number(lastModified)).toLocaleString('en-IN', {
|
|
28
|
+
day: '2-digit',
|
|
29
|
+
month: 'short',
|
|
30
|
+
year: 'numeric',
|
|
31
|
+
hour: '2-digit',
|
|
32
|
+
minute: '2-digit',
|
|
33
|
+
})
|
|
34
|
+
: lastModified;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Box
|
|
38
|
+
className="rounded-[10px] p-[1px] cursor-pointer transition-all duration-200 bg-transparent group"
|
|
39
|
+
sx={{
|
|
40
|
+
border: isSelected
|
|
41
|
+
? '2px solid var(--color-primary)'
|
|
42
|
+
: isHovered
|
|
43
|
+
? `2px solid ${isDark ? '#8B949E' : '#5A6A7D'}`
|
|
44
|
+
: '2px solid transparent',
|
|
45
|
+
}}
|
|
46
|
+
onMouseEnter={() => setIsHovered(true)}
|
|
47
|
+
onMouseLeave={() => setIsHovered(false)}
|
|
48
|
+
onClick={onClick}
|
|
49
|
+
data-testid={dataTestId}
|
|
50
|
+
>
|
|
51
|
+
<Box
|
|
52
|
+
className="flex items-center rounded-lg h-[80px] py-2 border px-3 shadow-sm relative overflow-hidden"
|
|
53
|
+
sx={{
|
|
54
|
+
backgroundColor: isDark ? theme.palette.background.paper : '#ffffff !important',
|
|
55
|
+
borderColor: isHovered
|
|
56
|
+
? isDark
|
|
57
|
+
? 'rgba(255, 255, 255, 0.2)'
|
|
58
|
+
: '#8B949E'
|
|
59
|
+
: isDark
|
|
60
|
+
? 'rgba(255, 255, 255, 0.1)'
|
|
61
|
+
: '#E5E7EB',
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{/* Left colored square */}
|
|
65
|
+
<Box
|
|
66
|
+
style={{ backgroundColor: color || '#243A50' }}
|
|
67
|
+
className="shrink-0 flex justify-center items-center text-white rounded-md w-[54px] h-[54px] px-2"
|
|
68
|
+
>
|
|
69
|
+
<Typography
|
|
70
|
+
data-testid={`widgetcard-notification-count-input`}
|
|
71
|
+
variant="body2"
|
|
72
|
+
fontWeight="bold"
|
|
73
|
+
className="text-[15px] "
|
|
74
|
+
>
|
|
75
|
+
{count > 9999 ? '9999+' : count}
|
|
76
|
+
</Typography>
|
|
77
|
+
</Box>
|
|
78
|
+
|
|
79
|
+
{/* Text Section */}
|
|
80
|
+
<Box className="flex-1 flex flex-col justify-center ml-3 mr-1 overflow-hidden">
|
|
81
|
+
<Tooltip title={translate(name)} arrow placement="top">
|
|
82
|
+
<Typography
|
|
83
|
+
data-testid={`widgetcard-notification-name-input`}
|
|
84
|
+
variant="body2"
|
|
85
|
+
sx={{
|
|
86
|
+
fontWeight: 500,
|
|
87
|
+
color: isDark ? theme.palette.text.primary : '#243A50',
|
|
88
|
+
width: '100%',
|
|
89
|
+
overflow: 'hidden',
|
|
90
|
+
textOverflow: 'ellipsis',
|
|
91
|
+
display: '-webkit-box',
|
|
92
|
+
WebkitLineClamp: lastModified ? 2 : 3,
|
|
93
|
+
WebkitBoxOrient: 'vertical',
|
|
94
|
+
}}
|
|
95
|
+
className="text-[14px] leading-snug"
|
|
96
|
+
>
|
|
97
|
+
{translate(name)}
|
|
98
|
+
</Typography>
|
|
99
|
+
</Tooltip>
|
|
100
|
+
{lastModified && (
|
|
101
|
+
<Typography
|
|
102
|
+
variant="caption"
|
|
103
|
+
sx={{
|
|
104
|
+
color: isDark ? theme.palette.text.secondary : '#8d8f91ff',
|
|
105
|
+
fontSize: '0.65rem',
|
|
106
|
+
mt: 0.25,
|
|
107
|
+
fontWeight: 600,
|
|
108
|
+
fontStyle: 'italic',
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
Updated at : {formattedDate}
|
|
112
|
+
</Typography>
|
|
113
|
+
)}
|
|
114
|
+
</Box>
|
|
115
|
+
|
|
116
|
+
{/* Arrow Icon on Hover */}
|
|
117
|
+
{showIcon && (
|
|
118
|
+
<Box className="w-8 flex justify-center items-center opacity-0 group-hover:opacity-100 transition-opacity absolute right-1">
|
|
119
|
+
<IconButton
|
|
120
|
+
onClick={(event) => {
|
|
121
|
+
event.stopPropagation();
|
|
122
|
+
if (onArrowClick) onArrowClick();
|
|
123
|
+
}}
|
|
124
|
+
size="small"
|
|
125
|
+
data-testid={`widgetcard-arrow-button`}
|
|
126
|
+
sx={{ backgroundColor: isDark ? 'rgba(255,255,255,0.08)' : '#F3F4F6' }}
|
|
127
|
+
>
|
|
128
|
+
{hidden ? (
|
|
129
|
+
<FontAwesomeIcon
|
|
130
|
+
icon={faArrowLeft}
|
|
131
|
+
data-testid={`widgetcard-arrowback-button`}
|
|
132
|
+
size="xs"
|
|
133
|
+
className={isDark ? 'text-gray-300' : 'text-gray-600'}
|
|
134
|
+
/>
|
|
135
|
+
) : (
|
|
136
|
+
<FontAwesomeIcon
|
|
137
|
+
icon={faArrowRight}
|
|
138
|
+
data-testid={`widgetcard-arrowforward-button`}
|
|
139
|
+
size="xs"
|
|
140
|
+
className={isDark ? 'text-gray-300' : 'text-gray-600'}
|
|
141
|
+
/>
|
|
142
|
+
)}
|
|
143
|
+
</IconButton>
|
|
144
|
+
</Box>
|
|
145
|
+
)}
|
|
146
|
+
</Box>
|
|
147
|
+
</Box>
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export default WidgetCard;
|
|
152
|
+
|
|
153
|
+
WidgetCard.propTypes = {
|
|
154
|
+
widgetData: PropTypes.any,
|
|
155
|
+
onArrowClick: PropTypes.any,
|
|
156
|
+
onClick: PropTypes.any,
|
|
157
|
+
hidden: PropTypes.bool,
|
|
158
|
+
isSelected: PropTypes.bool,
|
|
159
|
+
dataTestId: PropTypes.any,
|
|
160
|
+
showIcon: PropTypes.any,
|
|
161
|
+
};
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
TableContainer,
|
|
4
|
+
Paper,
|
|
5
|
+
Modal,
|
|
6
|
+
Table,
|
|
7
|
+
TableHead,
|
|
8
|
+
TableRow,
|
|
9
|
+
TableCell,
|
|
10
|
+
TableBody,
|
|
11
|
+
Select,
|
|
12
|
+
MenuItem,
|
|
13
|
+
TextField,
|
|
14
|
+
Divider,
|
|
15
|
+
Button,
|
|
16
|
+
Stack,
|
|
17
|
+
Typography,
|
|
18
|
+
} from '@mui/material';
|
|
19
|
+
import PropTypes from 'prop-types';
|
|
20
|
+
import { getWebTasksAction, saveAction } from '@/common/services/Webtasks';
|
|
21
|
+
import Grid from '@mui/material/Grid2';
|
|
22
|
+
import { showToast } from '@/common/toaster/toaster';
|
|
23
|
+
import { useTranslateProvider } from '@/common/languageTranslator/TranslationContext';
|
|
24
|
+
import SafeHtml from '@/common/SafeHtml.jsx';
|
|
25
|
+
|
|
26
|
+
const ActionModal = ({ open, onClose, selectedTask = {}, ...props }) => {
|
|
27
|
+
const [currentTask, setCurrentTask] = useState(selectedTask);
|
|
28
|
+
const [actionOptions, setActionOptions] = useState([]);
|
|
29
|
+
const { translate } = useTranslateProvider();
|
|
30
|
+
|
|
31
|
+
const onSave = async () => {
|
|
32
|
+
await saveAction([currentTask]);
|
|
33
|
+
onClose(true);
|
|
34
|
+
};
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (selectedTask) {
|
|
37
|
+
fetchTaskDetails(selectedTask.taskId);
|
|
38
|
+
}
|
|
39
|
+
}, [selectedTask]);
|
|
40
|
+
|
|
41
|
+
const fetchTaskDetails = async (taskId) => {
|
|
42
|
+
try {
|
|
43
|
+
const { data: response } = await getWebTasksAction({ taskId });
|
|
44
|
+
|
|
45
|
+
setCurrentTask(selectedTask || response.selected[0].webTasks[0]);
|
|
46
|
+
setActionOptions(response.selected[0].webTasks[0].actions);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error('Unable to retrieve task action details', error);
|
|
49
|
+
showToast({ type: 'error', message: 'Unable to retrieve task action details' });
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const handleActionChange = (task, action) => {
|
|
54
|
+
const { isOtherDetailsRequired, actionKey } = action;
|
|
55
|
+
const updatedTask = { ...task, action, selectedAction: actionKey, isOtherDetailsRequired };
|
|
56
|
+
setCurrentTask(updatedTask);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handleOtherDetailsChange = (task, otherDetail) => {
|
|
60
|
+
const updatedTask = { ...task, otherDetail, isOtherDetails: true };
|
|
61
|
+
setCurrentTask(updatedTask);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const headerCellStyle = {
|
|
65
|
+
borderRight: '0.1px solid var(--color-gray3)',
|
|
66
|
+
borderBottom: '0.1px solid var(--color-gray3)',
|
|
67
|
+
minWidth: '80px',
|
|
68
|
+
fontWeight: 'bold',
|
|
69
|
+
backgroundColor: 'var(--color-background)',
|
|
70
|
+
color: 'var(--color-text)',
|
|
71
|
+
fontSize: 14,
|
|
72
|
+
padding: '12px',
|
|
73
|
+
cursor: 'pointer',
|
|
74
|
+
whiteSpace: 'nowrap',
|
|
75
|
+
top: 0,
|
|
76
|
+
position: 'sticky',
|
|
77
|
+
zIndex: 1, // Helps to keep header above scrollable content
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const bodyCellStyle = {
|
|
81
|
+
borderBottom: '0.1px solid var(--color-gray3)',
|
|
82
|
+
borderRight: '0.1px solid var(--color-gray3)',
|
|
83
|
+
backgroundColor: 'var(--color-background2)',
|
|
84
|
+
color: 'var(--color-text)',
|
|
85
|
+
padding: '10px',
|
|
86
|
+
fontSize: 13,
|
|
87
|
+
maxWidth: 400,
|
|
88
|
+
height: 50,
|
|
89
|
+
wordWrap: 'break-word',
|
|
90
|
+
whiteSpace: 'normal',
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const rowStyle = (index) => ({
|
|
94
|
+
backgroundColor: index % 2 === 0 ? 'var(--color-background2)' : 'var(--color-background)',
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
if (!actionOptions.length) return null;
|
|
98
|
+
return (
|
|
99
|
+
<Modal
|
|
100
|
+
open={open}
|
|
101
|
+
onClose={onClose}
|
|
102
|
+
sx={{
|
|
103
|
+
'& .MuiBackdrop-root': {
|
|
104
|
+
backgroundColor: 'rgba(0, 0, 0, 0.4)',
|
|
105
|
+
},
|
|
106
|
+
}}
|
|
107
|
+
{...props}
|
|
108
|
+
>
|
|
109
|
+
<Grid
|
|
110
|
+
container
|
|
111
|
+
sx={{
|
|
112
|
+
position: 'absolute',
|
|
113
|
+
top: '50%',
|
|
114
|
+
left: '50%',
|
|
115
|
+
transform: 'translate(-50%, -50%)',
|
|
116
|
+
bgcolor: 'var(--color-background2)',
|
|
117
|
+
boxShadow: 24,
|
|
118
|
+
width: '70vw',
|
|
119
|
+
maxWidth: '80vw',
|
|
120
|
+
display: 'flex',
|
|
121
|
+
flexDirection: 'column',
|
|
122
|
+
outline: 'none',
|
|
123
|
+
borderRadius: '4px',
|
|
124
|
+
overflow: 'hidden',
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
<Grid className="justify-between flex items-center flex-row p-2.5 px-5 border-b">
|
|
128
|
+
<Typography variant="body1" className="font-medium text-lg text-customBlue">
|
|
129
|
+
{translate('Perform Action')}
|
|
130
|
+
</Typography>
|
|
131
|
+
</Grid>
|
|
132
|
+
<Divider />
|
|
133
|
+
<Grid className="justify-between flex items-center flex-row border-b border-gray-300 p-[3px_8px]">
|
|
134
|
+
<Typography data-testid="actionmodal-task-title" variant="body2" className="font-bold">
|
|
135
|
+
{currentTask?.title}
|
|
136
|
+
</Typography>
|
|
137
|
+
</Grid>
|
|
138
|
+
|
|
139
|
+
<Grid className="justify-between flex items-center flex-row border-b border-gray-300 p-[3px_8px] w-full">
|
|
140
|
+
<TableContainer
|
|
141
|
+
component={Paper}
|
|
142
|
+
sx={{
|
|
143
|
+
maxWidth: '100%',
|
|
144
|
+
overflowX: 'auto', // This enables the horizontal scrollbar
|
|
145
|
+
maxHeight: '60vh', // Keeps the table from getting too tall
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
<Table size="small" aria-label="task details table">
|
|
149
|
+
<TableHead>
|
|
150
|
+
<TableRow>
|
|
151
|
+
<TableCell key="#" style={headerCellStyle}>
|
|
152
|
+
#
|
|
153
|
+
</TableCell>
|
|
154
|
+
|
|
155
|
+
{Object.keys(selectedTask?.details)?.map((data, index) => (
|
|
156
|
+
<TableCell data-testid={`actionmodal-task-header-${index}`} key={index + 1} style={headerCellStyle}>
|
|
157
|
+
{data}
|
|
158
|
+
</TableCell>
|
|
159
|
+
))}
|
|
160
|
+
<TableCell style={headerCellStyle} data-testid={`actionmodal-task-header-action`}>
|
|
161
|
+
{translate('Actions')}
|
|
162
|
+
</TableCell>
|
|
163
|
+
<TableCell style={headerCellStyle} data-testid={`actionmodal-task-header-otherDetails`}>
|
|
164
|
+
{translate('Other Details')}
|
|
165
|
+
</TableCell>
|
|
166
|
+
</TableRow>
|
|
167
|
+
</TableHead>
|
|
168
|
+
<TableBody>
|
|
169
|
+
<TableRow style={rowStyle(1)}>
|
|
170
|
+
<TableCell style={bodyCellStyle}> 1 </TableCell>
|
|
171
|
+
{Object.values(selectedTask.details).map((detail, index) => (
|
|
172
|
+
<TableCell data-testid={`actionmodal-task-data-${index}`} key={index + 1} style={bodyCellStyle}>
|
|
173
|
+
<div className="w-48 h-full flex justify-center items-center">
|
|
174
|
+
<div dangerouslySetInnerHTML={{ __html: detail }} />
|
|
175
|
+
</div>
|
|
176
|
+
</TableCell>
|
|
177
|
+
))}
|
|
178
|
+
|
|
179
|
+
<TableCell width="250px" style={bodyCellStyle}>
|
|
180
|
+
{currentTask.isActionRequired ? (
|
|
181
|
+
<Select
|
|
182
|
+
size="small"
|
|
183
|
+
value={currentTask.action || 'select'}
|
|
184
|
+
onChange={(e) => handleActionChange(currentTask, e.target.value)}
|
|
185
|
+
fullWidths
|
|
186
|
+
className="w-[150]"
|
|
187
|
+
data-testid={`actionmodal-task-action-select`}
|
|
188
|
+
>
|
|
189
|
+
<MenuItem value="select">--Select--</MenuItem>
|
|
190
|
+
{actionOptions.map((action, idx) => (
|
|
191
|
+
<MenuItem
|
|
192
|
+
data-testid={`actionmodal-action-select-option-${idx}`}
|
|
193
|
+
key={idx + 1}
|
|
194
|
+
value={action}
|
|
195
|
+
>
|
|
196
|
+
{action.displayText}
|
|
197
|
+
</MenuItem>
|
|
198
|
+
))}
|
|
199
|
+
</Select>
|
|
200
|
+
) : (
|
|
201
|
+
<Typography data-testid={`actionmodal-no-action`} variant="body2" className="w-[150]">
|
|
202
|
+
{translate('No Action Required')}
|
|
203
|
+
</Typography>
|
|
204
|
+
)}
|
|
205
|
+
</TableCell>
|
|
206
|
+
<TableCell style={bodyCellStyle}>
|
|
207
|
+
{currentTask.isOtherDetailsRequired ? (
|
|
208
|
+
<TextField
|
|
209
|
+
multiline
|
|
210
|
+
maxRows={3}
|
|
211
|
+
fullWidth
|
|
212
|
+
className="w-[150]"
|
|
213
|
+
size="small"
|
|
214
|
+
maxWidth
|
|
215
|
+
value={currentTask.otherDetail || ''}
|
|
216
|
+
onChange={(e) => handleOtherDetailsChange(currentTask, e.target.value)}
|
|
217
|
+
data-testid={`actionmodal-otherdetails-input`}
|
|
218
|
+
/>
|
|
219
|
+
) : (
|
|
220
|
+
<Typography data-testid={`actionmodal-no-otherdetails`} variant="body2" className="w-[150px]">
|
|
221
|
+
{translate('Not Required')}
|
|
222
|
+
</Typography>
|
|
223
|
+
)}
|
|
224
|
+
</TableCell>
|
|
225
|
+
</TableRow>
|
|
226
|
+
</TableBody>
|
|
227
|
+
</Table>
|
|
228
|
+
</TableContainer>
|
|
229
|
+
</Grid>
|
|
230
|
+
<Stack direction="row" spacing={2} justifyContent="flex-end" mt={1} mb={1} paddingRight={1}>
|
|
231
|
+
<Button
|
|
232
|
+
data-testid={`actionmodal-close-button`}
|
|
233
|
+
variant="contained"
|
|
234
|
+
size="small"
|
|
235
|
+
color="secondary"
|
|
236
|
+
onClick={() => onClose()}
|
|
237
|
+
>
|
|
238
|
+
<Typography variant="caption">Close</Typography>
|
|
239
|
+
</Button>
|
|
240
|
+
<Button
|
|
241
|
+
data-testid={`actionmodal-save-button`}
|
|
242
|
+
variant="contained"
|
|
243
|
+
size="small"
|
|
244
|
+
onClick={onSave}
|
|
245
|
+
color="primary"
|
|
246
|
+
>
|
|
247
|
+
<Typography variant="caption"> {translate('Save')} </Typography>
|
|
248
|
+
</Button>
|
|
249
|
+
</Stack>
|
|
250
|
+
</Grid>
|
|
251
|
+
</Modal>
|
|
252
|
+
);
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export default ActionModal;
|
|
256
|
+
|
|
257
|
+
ActionModal.propTypes = {
|
|
258
|
+
open: PropTypes.any,
|
|
259
|
+
onClose: PropTypes.any,
|
|
260
|
+
selectedTask: PropTypes.any,
|
|
261
|
+
onSave: PropTypes.any,
|
|
262
|
+
ActionExecutable: PropTypes.any,
|
|
263
|
+
};
|