@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.
Files changed (263) hide show
  1. package/package.json +139 -141
  2. package/src/GlobalErrorBoundary.jsx +31 -0
  3. package/src/SilentErrorFallback.jsx +68 -0
  4. package/src/TrackingProviderWrapper.jsx +40 -0
  5. package/src/_tests_/__mocks__/MockTranslationProvider.jsx +21 -0
  6. package/src/_tests_/__mocks__/ckeditor.js +45 -0
  7. package/src/_tests_/__mocks__/fileMock.js +1 -0
  8. package/src/_tests_/__mocks__/useranalytics.js +5 -0
  9. package/src/_tests_/views/components/Dashboard/DashboardUI.test.jsx +137 -0
  10. package/src/_tests_/views/components/Dashboard/DashboardUIMock.js +877 -0
  11. package/src/_tests_/views/components/ForgotPassword/ForgotPassword.test.jsx +314 -0
  12. package/src/_tests_/views/components/LocationDirective/LocationDirective.test.jsx.disable +229 -0
  13. package/src/_tests_/views/components/LocationDirective/mockLocationDirective.js +810 -0
  14. package/src/_tests_/views/components/LocationType/MockLocationType.js +42259 -0
  15. package/src/_tests_/views/components/LocationType/addlocationtype.test.jsx.disable +276 -0
  16. package/src/_tests_/views/components/LocationType/editlocationtype.test.jsx.disable +262 -0
  17. package/src/_tests_/views/components/LocationType/locationtype.test.jsx.disable +148 -0
  18. package/src/_tests_/views/components/Profile/UpdateProfileModalData.js +4396 -0
  19. package/src/_tests_/views/components/Profile/updateprofilemodal.test.jsx +282 -0
  20. package/src/_tests_/views/components/SideBar/MockSideBar.js +1379 -0
  21. package/src/_tests_/views/components/SideBar/SideBar.test.jsx +98 -0
  22. package/src/_tests_/views/components/SystemConfig/ManageSystemConfig/AddManageSystemConfig.test.jsx.disable +164 -0
  23. package/src/_tests_/views/components/SystemConfig/ManageSystemConfig/UpdateManageSystemConfig.test.jsx.disable +157 -0
  24. package/src/_tests_/views/components/SystemConfig/MockSystemConfig.js +1280 -0
  25. package/src/_tests_/views/components/SystemConfig/SystemConfig.test.jsx.disable +165 -0
  26. package/src/_tests_/views/components/login/Login.test.jsx +276 -0
  27. package/src/_tests_/views/components/login/MockAuthorise.js +2414 -0
  28. package/src/_tests_/views/components/login/ServiceResponse.js +595 -0
  29. package/src/_tests_/views/components/user/MockManageUser.js +7965 -0
  30. package/src/_tests_/views/components/user/manageuser.test.jsx.disable +989 -0
  31. package/src/_tests_/views/components/user/mockUsersData.js +582 -0
  32. package/src/assets/img/OASISLogin.png +0 -0
  33. package/src/assets/img/bahaarNew.png +0 -0
  34. package/src/assets/img/dnhdd4K.png +0 -0
  35. package/src/assets/img/govtofup.png +0 -0
  36. package/src/assets/img/sewarural4K.png +0 -0
  37. package/src/assets/img/techo4K.png +0 -0
  38. package/src/assets/img/up4K.png +0 -0
  39. package/src/common/HolidayList.jsx +573 -0
  40. package/src/common/MalaciaousInputUtil.js +23 -0
  41. package/src/common/SafeHtml.jsx +17 -0
  42. package/src/common/VersionManager.jsx +109 -0
  43. package/src/common/constants/PerformanceDashboard.js +514 -0
  44. package/src/common/constants/app.constant.js +781 -0
  45. package/src/common/constants/cccVerificationConstants.js +18 -0
  46. package/src/common/constants/fhsrConstant.js +33 -0
  47. package/src/common/constants/gvk-verification.constant.js +76 -0
  48. package/src/common/constants/search.constant.js +23 -0
  49. package/src/common/constants/teleconsulatationConstant.jsx +1339 -0
  50. package/src/common/directives/SearchTemplate.jsx +784 -0
  51. package/src/common/directives/SearchTemplate.scss +14 -0
  52. package/src/common/dynamicView/DynamicView.jsx +353 -0
  53. package/src/common/dynamicView/InputFieldComponent.jsx +1501 -0
  54. package/src/common/dynamicView/InputViewComponent.jsx +298 -0
  55. package/src/common/dynamicView/InputViewComponent.scss +15 -0
  56. package/src/common/env.js +5 -0
  57. package/src/common/filters/locationNameFilter.js +26 -0
  58. package/src/common/fontAwesomeIcons/FontAwesomeIcons.jsx +27 -0
  59. package/src/common/fontAwesomeIcons/FontAwesomeIconsNames.js +1968 -0
  60. package/src/common/fontPreferences/fontSizeProvider.jsx +34 -0
  61. package/src/common/fontPreferences/fontSizeSelector.jsx +116 -0
  62. package/src/common/getAssignedFeature/getAssignedFeature.js +32 -0
  63. package/src/common/interceptors/AxiosInterceptor.js +216 -0
  64. package/src/common/languageTranslator/TranslationContext.js +5 -0
  65. package/src/common/languageTranslator/TranslationProvider.jsx +24 -0
  66. package/src/common/languageTranslator/i18n.js +49 -0
  67. package/src/common/services/AuthenticateService.js +116 -0
  68. package/src/common/services/DownloadFile.js +35 -0
  69. package/src/common/services/ForgotPassword.js +18 -0
  70. package/src/common/services/FormConfiguratorService.js +195 -0
  71. package/src/common/services/GlobalApis.js +84 -0
  72. package/src/common/services/InterceptorNavigationService.js +17 -0
  73. package/src/common/services/LocationService.js +65 -0
  74. package/src/common/services/LocationType.js +11 -0
  75. package/src/common/services/QueryBuilder.js +36 -0
  76. package/src/common/services/Roles.js +28 -0
  77. package/src/common/services/SyncWithServer.js +15 -0
  78. package/src/common/services/SystemConfig.js +15 -0
  79. package/src/common/services/TranslationService.js +70 -0
  80. package/src/common/services/TwoFactorService.js +7 -0
  81. package/src/common/services/Users.js +91 -0
  82. package/src/common/services/Webtasks.js +27 -0
  83. package/src/common/services/util/Convert-pad-data-to-API-format.jsx +167 -0
  84. package/src/common/services/util/Convert-to-UI-format.jsx +82 -0
  85. package/src/common/services/util/EmptyPrescriptionPadData.jsx +11 -0
  86. package/src/common/services/util/GeneralUtil.js +456 -0
  87. package/src/common/services/util/Prescription-pad-util.js +339 -0
  88. package/src/common/services/util/PrescriptionPadData.js +67 -0
  89. package/src/common/services/util/PrescriptionpadCommonUtil.js +96 -0
  90. package/src/common/services/util/ReportFieldUtil.jsx +398 -0
  91. package/src/common/services/util/WebSocketContext.jsx +261 -0
  92. package/src/common/syncWithServer/SyncWithServerDialog.jsx +170 -0
  93. package/src/common/syncWithServer/SyncWithServerDialogSkeleton.jsx +67 -0
  94. package/src/common/tests/CustomWrapper.jsx +49 -0
  95. package/src/common/tests/TranslationWrapper.jsx +38 -0
  96. package/src/common/themeProvider/ColorInputs.jsx +97 -0
  97. package/src/common/themeProvider/EditableColorInput.jsx +128 -0
  98. package/src/common/themeProvider/ThemeEditor.jsx +319 -0
  99. package/src/common/themeProvider/ThemeProvider.jsx +210 -0
  100. package/src/common/themeProvider/themeConfig.js +558 -0
  101. package/src/common/toaster/toaster.jsx +30 -0
  102. package/src/firebaseConfig.js +24 -0
  103. package/src/global.scss +221 -0
  104. package/src/hooks/.gitkeep +0 -0
  105. package/src/hooks/useAESEncryption.js +56 -0
  106. package/src/hooks/useCaching.js +43 -0
  107. package/src/hooks/useDebounce.js +34 -0
  108. package/src/hooks/useDebounceFn.js +50 -0
  109. package/src/hooks/useDownloadPdf.js +358 -0
  110. package/src/hooks/useDownloadXlsx.js +55 -0
  111. package/src/hooks/useListValueFieldValues.js +30 -0
  112. package/src/hooks/useLocationHierarchies.js +63 -0
  113. package/src/hooks/useLocationHierarchyTranslate.js +16 -0
  114. package/src/hooks/useOnline.js +27 -0
  115. package/src/hooks/usePagination.js +63 -0
  116. package/src/hooks/useRefreshToken.js +87 -0
  117. package/src/hooks/useScript.js +25 -0
  118. package/src/hooks/useStopwatch.js +75 -0
  119. package/src/hooks/useTrackEvent.js +22 -0
  120. package/src/hooks/useWebAudioRecorder.js +115 -0
  121. package/src/layout/LoaderComponet.jsx +22 -0
  122. package/src/layout/LoaderContext.jsx +29 -0
  123. package/src/layout/mainLayout/AdaptiveZoom.jsx +27 -0
  124. package/src/layout/mainLayout/Chatbot.jsx +243 -0
  125. package/src/layout/mainLayout/Layout.jsx +445 -0
  126. package/src/layout/mainLayout/Profile/UpdateProfileModal.jsx +684 -0
  127. package/src/layout/mainLayout/header/LogoutModal.jsx +131 -0
  128. package/src/layout/mainLayout/header/Navbar.jsx +1677 -0
  129. package/src/layout/mainLayout/header/Navbar.scss +4 -0
  130. package/src/layout/mainLayout/header/index.js +0 -0
  131. package/src/layout/mainLayout/sidebar/SideBar.jsx +1402 -0
  132. package/src/layout/mainLayout/sidebar/Sidebar.css +159 -0
  133. package/src/layout/mainLayout/sidebar/index.js +0 -0
  134. package/src/logo.svg +1 -0
  135. package/src/reportWebVitals.js +13 -0
  136. package/src/setupFirebaseMessaging.js +28 -0
  137. package/src/setupTests.js +8 -0
  138. package/src/store/actions/AuthenticationActions.js +0 -0
  139. package/src/store/actions/ReportsActions.js +0 -0
  140. package/src/store/actions/TranslationAction.js +0 -0
  141. package/src/store/index.js +8 -0
  142. package/src/store/reducer.js +46 -0
  143. package/src/store/reducers/AuthenticationReducer.js +50 -0
  144. package/src/store/reducers/CalendarEventReducer.js +41 -0
  145. package/src/store/reducers/ConditionClipboardReducer.js +45 -0
  146. package/src/store/reducers/FeatureReducer.js +27 -0
  147. package/src/store/reducers/FormConfiguratorReducer.js +38 -0
  148. package/src/store/reducers/LoadingReducer.js +20 -0
  149. package/src/store/reducers/MembersAuthenticationReducer.js +28 -0
  150. package/src/store/reducers/PrescriptionPadReducer.js +329 -0
  151. package/src/store/reducers/QuestionaireReducer.js +29 -0
  152. package/src/store/reducers/ReportsReducer.js +24 -0
  153. package/src/store/reducers/SkeletonReducer.js +20 -0
  154. package/src/store/reducers/ThemeReducer.js +106 -0
  155. package/src/store/reducers/TranslationReducer.js +126 -0
  156. package/src/store/reducers/dashboardEditorSlice.js +77 -0
  157. package/src/store/reducers/districtHealthDashboardSlice.js +58 -0
  158. package/src/store/reducers/immunizationSlice.js +234 -0
  159. package/src/store/slices/dashboardPagesSlice.js +51 -0
  160. package/src/utils/.gitkeep +0 -0
  161. package/src/utils/FormConstants.js +2629 -0
  162. package/src/utils/GujaratTopoChart.jsx +483 -0
  163. package/src/utils/UUIDgenerator.js +8 -0
  164. package/src/utils/appointment-utils/appointment-utils.js +123 -0
  165. package/src/utils/feature.js +42 -0
  166. package/src/utils/getThemeColor.js +12 -0
  167. package/src/utils/localStorageHelper.js +11 -0
  168. package/src/utils/notifications/enable-push-notifications.js +27 -0
  169. package/src/utils/resolveAppliedStyle.js +11 -0
  170. package/src/utils/themeConfigs.js +1483 -0
  171. package/src/views/custom-components/.gitkeep +0 -0
  172. package/src/views/custom-components/AgIconButton/RIf.jsx +14 -0
  173. package/src/views/custom-components/AgIconButton/button.jsx +108 -0
  174. package/src/views/custom-components/AgIconButton/waterDrop.jsx +95 -0
  175. package/src/views/custom-components/AgIconButton/waterDrop.scss +37 -0
  176. package/src/views/custom-components/AlertPlaceholder.jsx +32 -0
  177. package/src/views/custom-components/AllFaIconsSelector.jsx +56 -0
  178. package/src/views/custom-components/CkEditor/CkEditor.js +102 -0
  179. package/src/views/custom-components/CustomAccordion.jsx +72 -0
  180. package/src/views/custom-components/CustomActionIcons.jsx +118 -0
  181. package/src/views/custom-components/CustomAutoComplete.jsx +188 -0
  182. package/src/views/custom-components/CustomCheckBox.jsx +60 -0
  183. package/src/views/custom-components/CustomConfirmationModal.jsx +118 -0
  184. package/src/views/custom-components/CustomCountrySelect.jsx +129 -0
  185. package/src/views/custom-components/CustomDatePicker.jsx +122 -0
  186. package/src/views/custom-components/CustomDropdown.jsx +191 -0
  187. package/src/views/custom-components/CustomFileUpload.jsx +387 -0
  188. package/src/views/custom-components/CustomFullCalendar.jsx +514 -0
  189. package/src/views/custom-components/CustomInfiniteScroll.jsx +126 -0
  190. package/src/views/custom-components/CustomRadioComponent.jsx +65 -0
  191. package/src/views/custom-components/CustomStatsComponent.jsx +114 -0
  192. package/src/views/custom-components/CustomSvgUpload.jsx +170 -0
  193. package/src/views/custom-components/CustomSwitch.jsx +37 -0
  194. package/src/views/custom-components/CustomTabPanel.jsx +19 -0
  195. package/src/views/custom-components/CustomTextArea.jsx +62 -0
  196. package/src/views/custom-components/CustomTextArea.scss +27 -0
  197. package/src/views/custom-components/CustomTextField.jsx +116 -0
  198. package/src/views/custom-components/CustomToggleSwitch.jsx +138 -0
  199. package/src/views/custom-components/CustomTooltip.jsx +51 -0
  200. package/src/views/custom-components/CustomZoomImage.jsx +134 -0
  201. package/src/views/custom-components/CustomizedTable/CustomizedTableV2.jsx +1407 -0
  202. package/src/views/custom-components/CustomizedTable/VirtualizeTableBody.jsx +295 -0
  203. package/src/views/custom-components/CustomizedTable/helper.jsx +159 -0
  204. package/src/views/custom-components/CustomizedTable.jsx +532 -0
  205. package/src/views/custom-components/EditInputField.jsx +174 -0
  206. package/src/views/custom-components/FieldDescription.jsx +22 -0
  207. package/src/views/custom-components/FileDisplayComponent.jsx +138 -0
  208. package/src/views/custom-components/FormItem.jsx +53 -0
  209. package/src/views/custom-components/GenericChart.jsx +80 -0
  210. package/src/views/custom-components/InfoBadge.jsx +60 -0
  211. package/src/views/custom-components/PostgresEditor.jsx +801 -0
  212. package/src/views/custom-components/ResizableEditAutocompleteField.jsx +249 -0
  213. package/src/views/custom-components/ResizableEditInputField.jsx +215 -0
  214. package/src/views/custom-components/ResizeableEditSelectField.jsx +197 -0
  215. package/src/views/custom-components/SideOverlay.jsx +113 -0
  216. package/src/views/custom-components/SideOverlay.scss +42 -0
  217. package/src/views/custom-components/calendar.scss +571 -0
  218. package/src/views/feature-components/.gitkeep +0 -0
  219. package/src/views/feature-components/Dashboard/DashboardUI.jsx +1043 -0
  220. package/src/views/feature-components/Dashboard/DhnddModal/AshaDataQualityVerificationModal.jsx +278 -0
  221. package/src/views/feature-components/Dashboard/PinFeatureModal.jsx +143 -0
  222. package/src/views/feature-components/Dashboard/QuickLinks.jsx +163 -0
  223. package/src/views/feature-components/Dashboard/Taskbar.jsx +56 -0
  224. package/src/views/feature-components/Dashboard/WebtasksFilterForm.jsx +109 -0
  225. package/src/views/feature-components/Dashboard/WidgetCard.jsx +161 -0
  226. package/src/views/feature-components/Dashboard/actionModal.jsx +263 -0
  227. package/src/views/feature-components/Dashboard/ekavachModal/HealthWorkerIncorrectDetailsModal.jsx +332 -0
  228. package/src/views/feature-components/Dashboard/ekavachModal/MoMaternalDeathVerifcationModal.jsx +275 -0
  229. package/src/views/feature-components/Dashboard/ekavachModal/MoVerficationForChildScreeningMoadal.jsx +566 -0
  230. package/src/views/feature-components/FeatureUsageAnalytics/FeatureUsageAnalytics.jsx +989 -0
  231. package/src/views/feature-components/Features/NewServerManagement.jsx +217 -0
  232. package/src/views/feature-components/Features/ServerManagement.scss +120 -0
  233. package/src/views/feature-components/ForgotPassword/ForgotPassword.jsx +226 -0
  234. package/src/views/feature-components/LocationDirective/LocationDirective.jsx +992 -0
  235. package/src/views/feature-components/LocationDirective/LocationDirectiveV2.jsx +909 -0
  236. package/src/views/feature-components/NotFound.jsx +66 -0
  237. package/src/views/feature-components/Onboarding/Onboarding.jsx +1400 -0
  238. package/src/views/feature-components/Skeletons.js +115 -0
  239. package/src/views/feature-components/Unauthorized.jsx +48 -0
  240. package/src/views/feature-components/VerifyRoute.jsx +88 -0
  241. package/src/views/feature-components/YearlyRecap/YearlyRecap.jsx +357 -0
  242. package/src/views/feature-components/YearlyRecap/components/RecapSlide.jsx +183 -0
  243. package/src/views/feature-components/YearlyRecap/languageTranslator/TranslationContext.js +5 -0
  244. package/src/views/feature-components/YearlyRecap/languageTranslator/TranslationProvider.jsx +26 -0
  245. package/src/views/feature-components/YearlyRecap/languageTranslator/i18n.js +46 -0
  246. package/src/views/feature-components/YearlyRecap/languageTranslator/translations.json +167 -0
  247. package/src/views/feature-components/YearlyRecap/slides/IntroSlide.jsx +233 -0
  248. package/src/views/feature-components/YearlyRecap/slides/MaternalHealthSlide.jsx +146 -0
  249. package/src/views/feature-components/YearlyRecap/slides/MetricSlide.jsx +227 -0
  250. package/src/views/feature-components/YearlyRecap/slides/OutroSlide.jsx +701 -0
  251. package/src/views/feature-components/YearlyRecap/slides/ReachSlide.jsx +273 -0
  252. package/src/views/feature-components/login/Login.jsx +840 -0
  253. package/src/views/feature-components/login/Login.scss +154 -0
  254. package/src/views/feature-components/login/LoginConfigurator.jsx +1149 -0
  255. package/src/views/feature-components/login/TwoFactorSetupModal.jsx +411 -0
  256. package/src/views/feature-components/login/simplifyMenu.js +45 -0
  257. package/src/views/feature-components/system-config/ManageSystemConfigs.jsx +284 -0
  258. package/src/views/feature-components/system-config/SystemConfig.jsx +299 -0
  259. package/src/views/feature-components/users/ChangePasswordModal.jsx +243 -0
  260. package/src/views/feature-components/users/PasswordField.jsx +56 -0
  261. package/dist/index.css +0 -1
  262. package/dist/index.js +0 -32001
  263. package/dist/index.js.map +0 -1
@@ -0,0 +1,217 @@
1
+ /**
2
+ * @author Sanya Srivastava <ssrivastava@argusoft.com>
3
+ * @date 2025-04-21 (Monday)
4
+ */
5
+
6
+ import { getAllServer, getAllServerDetails } from '@/common/services/SyncWithServer';
7
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
+ import { faCircleCheck, faCircleXmark, faPen, faPlus } from '@fortawesome/free-solid-svg-icons';
9
+ import { useTheme } from '@mui/material/styles';
10
+ import '@/views/feature-components/Features/ServerManagement.scss';
11
+ import {
12
+ Button,
13
+ Chip,
14
+ IconButton,
15
+ Paper,
16
+ Table,
17
+ TableBody,
18
+ TableCell,
19
+ TableContainer,
20
+ TableHead,
21
+ TableRow,
22
+ Typography,
23
+ } from '@mui/material';
24
+ import Grid from '@mui/material/Grid2';
25
+ import { Box } from '@mui/system';
26
+ import React, { useEffect, useState } from 'react';
27
+ import AddServerModal from './AddServerModal';
28
+
29
+ export default function NewServerManagement() {
30
+ const [allServerList, setAllServerList] = useState([]);
31
+ const [openAddServer, setOpenAddServer] = useState(false);
32
+ const [editServer, setEditServer] = useState(false);
33
+ const [serverData, setServerData] = useState({});
34
+ const [allServerDetails, setAllServerDetails] = useState([]);
35
+ const [reloadPage, setReloadPage] = useState(false);
36
+ const theme = useTheme();
37
+
38
+ useEffect(() => {
39
+ (async () => {
40
+ await fetchServers();
41
+ await fetchAllServerDetails();
42
+ })();
43
+ }, [reloadPage]);
44
+
45
+ const getClassName = (className) => {
46
+ console.log(theme.palette.mode === 'light' ? className : `${className}-dark`);
47
+ return theme.palette.mode === 'light' ? className : `${className}-dark`;
48
+ };
49
+
50
+ const fetchServers = async () => {
51
+ try {
52
+ const response = (await getAllServer()).data;
53
+ if (response) {
54
+ setAllServerList(
55
+ response.map((item) => {
56
+ let obj = { code: item.code, name: item.name };
57
+ return obj;
58
+ })
59
+ );
60
+ }
61
+ } catch (error) {
62
+ console.error('Error fetching servers:', error);
63
+ }
64
+ };
65
+
66
+ const fetchAllServerDetails = async () => {
67
+ try {
68
+ const response = (await getAllServerDetails()).data;
69
+ if (response) {
70
+ response.forEach((item) => {
71
+ let canPull = item.canPullServers ? JSON.parse(item.canPullServers) : [];
72
+ let canPush = item.canPushServers ? JSON.parse(item.canPushServers) : [];
73
+ item.canPullServers = JSON.parse(item.canPullServers);
74
+ item.canPushServers = JSON.parse(item.canPushServers);
75
+ item.pullServersName = canPull.length > 0 ? canPull.map((server) => server.name) : [];
76
+ item.pushServersName = canPush.length > 0 ? canPush.map((server) => server.name) : [];
77
+ });
78
+ setAllServerDetails(response);
79
+ }
80
+ } catch (error) {
81
+ console.error('Error fetching servers:', error);
82
+ }
83
+ };
84
+
85
+ const handleServerEdit = (item) => {
86
+ setEditServer(true);
87
+ setServerData(item);
88
+ setOpenAddServer(true);
89
+ };
90
+
91
+ return (
92
+ <Grid pt={2} sx={{ height: 'calc(100vh)', zoom: '0.9' }}>
93
+ <Box sx={{ p: 3 }} className={getClassName('server-management-wrapper')}>
94
+ <Grid container sx={{ justifyContent: 'space-between', alignItems: 'center', mb: 2 }}>
95
+ <Typography variant="h6" sx={{ fontWeight: 'bold' }}>
96
+ Server Management
97
+ </Typography>
98
+ </Grid>
99
+
100
+ {/* <Box sx={{ }}> */}
101
+ <Grid container sx={{ justifyContent: 'space-between', alignItems: 'center', mb: 2, float: 'right' }}>
102
+ {/* <Grid> */}
103
+ <Button
104
+ size="small"
105
+ variant="contained"
106
+ color="success"
107
+ onClick={() => {
108
+ setOpenAddServer(true);
109
+ }}
110
+ >
111
+ <FontAwesomeIcon icon={faPlus} size="lg" className="mr-1" />
112
+ server
113
+ </Button>
114
+ {/* </Grid> */}
115
+ </Grid>
116
+
117
+ {/* </Box> */}
118
+ <TableContainer
119
+ className={getClassName('server-table')}
120
+ component={Paper}
121
+ elevation={1}
122
+ sx={{ borderRadius: 2, overflowY: 'auto', maxHeight: 'calc(100vh - 200px)' }}
123
+ >
124
+ <Table stickyHeader>
125
+ <TableHead>
126
+ <TableRow>
127
+ <TableCell sx={{ fontWeight: 'bold' }}>Sr. No.</TableCell>
128
+ <TableCell sx={{ fontWeight: 'bold' }}>Name</TableCell>
129
+ <TableCell sx={{ fontWeight: 'bold' }}>Code</TableCell>
130
+ <TableCell sx={{ fontWeight: 'bold' }}>Type</TableCell>
131
+ <TableCell sx={{ fontWeight: 'bold' }}>URL</TableCell>
132
+ <TableCell sx={{ fontWeight: 'bold' }}>Active?</TableCell>
133
+ <TableCell sx={{ fontWeight: 'bold' }}>Can Pull From</TableCell>
134
+ <TableCell sx={{ fontWeight: 'bold' }}>Can Push To</TableCell>
135
+ <TableCell sx={{ fontWeight: 'bold' }}>Modified On</TableCell>
136
+ <TableCell align="center" sx={{ fontWeight: 'bold' }}>
137
+ Actions
138
+ </TableCell>
139
+ </TableRow>
140
+ </TableHead>
141
+ <TableBody>
142
+ {allServerDetails.map((item, index) => (
143
+ <TableRow
144
+ key={index}
145
+ sx={{
146
+ backgroundColor: index % 2 === 0 ? '#fff' : '#f9f9f9',
147
+ '&:hover': { backgroundColor: '#e9f3ff' },
148
+ }}
149
+ >
150
+ <TableCell>{index + 1}</TableCell>
151
+ <TableCell>{item.name}</TableCell>
152
+ <TableCell>{item.code}</TableCell>
153
+ <TableCell>{item.type}</TableCell>
154
+ <TableCell>{item.url}</TableCell>
155
+ <TableCell>
156
+ {item.isActive ? (
157
+ <>
158
+ <FontAwesomeIcon icon={faCircleCheck} className="text-[var(--color-success)]" size="lg" /> Yes
159
+ </>
160
+ ) : (
161
+ <>
162
+ <FontAwesomeIcon icon={faCircleXmark} className="text-[var(--color-error)]" size="lg" /> No
163
+ </>
164
+ )}
165
+ </TableCell>
166
+ <TableCell>
167
+ {Array.isArray(item.pullServersName) && item.pullServersName.length > 0
168
+ ? item.pullServersName.map((server, i) => (
169
+ <Chip key={i} label={server || '-'} color="primary" size="small" sx={{ mr: 0.5, mb: 0.5 }} />
170
+ ))
171
+ : '-'}
172
+ </TableCell>
173
+ <TableCell>
174
+ {Array.isArray(item.pushServersName) && item.pushServersName.length > 0
175
+ ? item.pushServersName.map((server, i) => (
176
+ <Chip key={i} label={server || '-'} color="primary" size="small" sx={{ mr: 0.5, mb: 0.5 }} />
177
+ ))
178
+ : '-'}
179
+ </TableCell>
180
+ <TableCell>{new Date(item.modifiedOn).toUTCString()}</TableCell>
181
+ <TableCell align="center">
182
+ <IconButton
183
+ color="primary"
184
+ onClick={() => {
185
+ handleServerEdit(item);
186
+ }}
187
+ >
188
+ <FontAwesomeIcon icon={faPen} size="sm" />
189
+ </IconButton>
190
+ </TableCell>
191
+ </TableRow>
192
+ ))}
193
+ {allServerDetails.length === 0 && (
194
+ <TableRow>
195
+ <TableCell colSpan={4} align="center" sx={{ py: 4, color: 'gray' }}>
196
+ No server found.
197
+ </TableCell>
198
+ </TableRow>
199
+ )}
200
+ </TableBody>
201
+ </Table>
202
+ </TableContainer>
203
+ </Box>
204
+ {openAddServer && (
205
+ <AddServerModal
206
+ openAddServer={openAddServer}
207
+ openAddServerFunc={setOpenAddServer}
208
+ allServerList={allServerList}
209
+ reloadPageFunc={setReloadPage}
210
+ editServer={editServer}
211
+ editServerFunc={setEditServer}
212
+ serverData={serverData}
213
+ />
214
+ )}
215
+ </Grid>
216
+ );
217
+ }
@@ -0,0 +1,120 @@
1
+ .server-management-wrapper {
2
+ background-color: #f7f7f7;
3
+ color: #111;
4
+
5
+ &-dark {
6
+ // background-color: #121212;
7
+ color: #fdfbfb;
8
+
9
+ .MuiPaper-root {
10
+ background-color: #1e1e1e;
11
+ }
12
+
13
+ .MuiTableCell-root {
14
+ color: #ddd;
15
+ }
16
+
17
+ .MuiTableRow-root:hover {
18
+ background-color: #0e0d0d !important;
19
+ }
20
+
21
+ .MuiButton-root {
22
+ background-color: 'success';
23
+
24
+ &:hover {
25
+ background-color: #2f6131;
26
+ }
27
+ }
28
+ }
29
+ }
30
+
31
+ .server-table-dark {
32
+ background-color: #1c1c1c;
33
+
34
+ .MuiTableCell-root {
35
+ color: #ccc;
36
+ }
37
+
38
+ .MuiTableRow-root:nth-child(even) {
39
+ background-color: #1a1a1a;
40
+ }
41
+
42
+ .MuiTableRow-root:nth-child(odd) {
43
+ background-color: #222;
44
+ }
45
+
46
+ .MuiTableRow-root:hover {
47
+ background-color: #2d2d2d !important;
48
+ }
49
+
50
+ thead.MuiTableHead-root {
51
+ background-color: #423737 !important;
52
+
53
+ th.MuiTableCell-root {
54
+ color: #f0f0f0 !important;
55
+ background-color: #2b2b2b !important;
56
+ }
57
+ }
58
+ }
59
+
60
+ .add-server-dialog-dark {
61
+ .MuiPaper-root {
62
+ background-color: #2a2a2a;
63
+ color: #f1f1f1;
64
+
65
+ .MuiTypography-root {
66
+ color: #ffffff;
67
+ }
68
+
69
+ .MuiInputBase-root,
70
+ .MuiOutlinedInput-root {
71
+ background-color: #3a3a3a;
72
+ color: #f1f1f1;
73
+
74
+ input,
75
+ textarea {
76
+ color: #f1f1f1;
77
+ }
78
+
79
+ fieldset {
80
+ border-color: #555;
81
+ }
82
+ }
83
+
84
+ .MuiAutocomplete-root .MuiInputBase-root {
85
+ background-color: #3a3a3a;
86
+ }
87
+
88
+ .MuiFormControlLabel-label {
89
+ color: #ddd;
90
+ }
91
+
92
+ .MuiDialogTitle-root {
93
+ background-color: #1e1e1e;
94
+ }
95
+
96
+ .MuiButton-contained {
97
+ color: white;
98
+
99
+ &.MuiButton-containedPrimary {
100
+ background-color: #1976d2;
101
+
102
+ &:hover {
103
+ background-color: #125a9e;
104
+ }
105
+ }
106
+
107
+ &.MuiButton-containedSuccess {
108
+ background-color: #8e5f38;
109
+
110
+ &:hover {
111
+ background-color: #2e7d32;
112
+ }
113
+ }
114
+ }
115
+
116
+ .text-red-500 {
117
+ color: #f87171;
118
+ }
119
+ }
120
+ }
@@ -0,0 +1,226 @@
1
+ import medplatLogo from '@/assets/img/medplat-highres.png';
2
+ import CustomTextField from '@/views/custom-components/CustomTextField';
3
+ import { yupResolver } from '@hookform/resolvers/yup';
4
+ import { Button, Typography } from '@mui/material';
5
+ import { Box } from '@mui/system';
6
+ import React, { Suspense, useEffect, useState } from 'react';
7
+ import * as Yup from 'yup';
8
+ import Grid from '@mui/material/Grid2';
9
+
10
+ import { forgotPasswordGenerateOTP, forgotPasswordVerifyOTP } from '@/common/services/ForgotPassword.js';
11
+ import { showToast } from '@/common/toaster/toaster';
12
+ import { useForm } from 'react-hook-form';
13
+ import { useTranslateProvider } from '@/common/languageTranslator/TranslationContext';
14
+
15
+ const ForgotPassword = () => {
16
+ const { translate } = useTranslateProvider();
17
+ const ForgotPasswordSchema = Yup.object().shape({
18
+ username: Yup.string().required('Username is required'),
19
+ });
20
+ const [currentValidationSchema, setCurrentValidationSchema] = useState(ForgotPasswordSchema);
21
+ const [submitType, setSubmitType] = useState('');
22
+ const [noOfAttempts, setNoOfAttempts] = useState(0);
23
+
24
+ const [timer, setTimer] = useState(null); // Initial countdown value
25
+ const [isDisabled, setIsDisabled] = useState(true);
26
+
27
+ const [mobileNumber, setMobileNumber] = useState(null);
28
+ const {
29
+ control,
30
+ handleSubmit,
31
+ getValues,
32
+ setValue,
33
+ formState: { errors },
34
+ } = useForm({
35
+ defaultValues: {
36
+ username: '',
37
+ },
38
+ resolver: yupResolver(currentValidationSchema),
39
+ mode: 'onChange', // Trigger validation on change
40
+ });
41
+
42
+ useEffect(() => {
43
+ let interval;
44
+ if (isDisabled && timer > 0) {
45
+ // Start the countdown if the button is disabled and timer > 0
46
+ interval = setInterval(() => {
47
+ setTimer((prevTimer) => prevTimer - 1);
48
+ }, 1000);
49
+ } else if (timer === 0) {
50
+ // Re-enable the button when the timer reaches 0
51
+ setIsDisabled(false);
52
+ clearInterval(interval);
53
+ }
54
+
55
+ return () => clearInterval(interval); // Clean up the interval on component unmount
56
+ }, [isDisabled, timer]);
57
+
58
+ const generateOTP = async ({ username }) => {
59
+ try {
60
+ setValue('otp', '');
61
+ const response = await forgotPasswordGenerateOTP({ username }).catch((error) => {
62
+ showToast({ message: `${error.response.data.message}`, type: 'error' });
63
+ });
64
+ if (response && response.status === 200) {
65
+ setMobileNumber(response.data);
66
+ const schema = ForgotPasswordSchema.shape({
67
+ otp: Yup.string()
68
+ .required('OTP is required')
69
+ .length(4, 'OTP should be of 4 digits') // Enforce exact length
70
+ .matches(/^\d{4}$/, 'OTP must contain only numbers'), // Enforce numbers only
71
+ });
72
+ setCurrentValidationSchema(schema);
73
+ setTimer(30); // Reset the timer
74
+ setIsDisabled(true); // Disable the button again
75
+ }
76
+ } catch (error) {
77
+ console.error(error);
78
+ }
79
+ };
80
+
81
+ const verifyOTP = async ({ otp, username }) => {
82
+ try {
83
+ setNoOfAttempts((prev) => +prev + 1);
84
+ await forgotPasswordVerifyOTP({
85
+ noOfAttempts,
86
+ otp,
87
+ username,
88
+ });
89
+ } catch (error) {
90
+ showToast({ message: `${error.response.data.message}`, type: 'error' });
91
+ }
92
+ };
93
+
94
+ const handleResend = () => {
95
+ showToast({ message: `OTP Resent to ${mobileNumber}`, type: 'success' });
96
+ generateOTP({ username: getValues('username') });
97
+ setTimer(30); // Reset the timer
98
+ setIsDisabled(true); // Disable the button again
99
+ };
100
+ const getOTP = async (values) => {
101
+ const { username, otp } = values;
102
+ if (submitType === 'getOTP') {
103
+ await generateOTP({ username });
104
+ } else if (submitType === 'verifyOTP') {
105
+ await verifyOTP({ username, otp });
106
+ }
107
+ };
108
+
109
+ return (
110
+ <Suspense fallback={<div>Loading...</div>}>
111
+ <Grid
112
+ data-testid="forgot-pssword-form"
113
+ component="form"
114
+ onSubmit={handleSubmit(getOTP)}
115
+ className="flex justify-center"
116
+ container
117
+ >
118
+ <Grid
119
+ size={{ xs: 12, sm: 6, md: 4, lg: 4, xl: 3 }}
120
+ sx={{
121
+ paddingTop: 8,
122
+ display: 'flex',
123
+ flexDirection: 'column',
124
+ alignItems: 'center',
125
+ }}
126
+ >
127
+ <img src={medplatLogo} style={{ height: '70px' }} alt="medplat-logo" data-testid="login-logo" />
128
+ <Box className="p-2.5 px-5 flex border-b">
129
+ <Typography variant="body1" className="font-medium text-lg text-customBlue">
130
+ {translate("FORGOT PASSWORD")}
131
+ </Typography>
132
+ </Box>
133
+
134
+ {mobileNumber && (
135
+ <Typography
136
+ variant="body2"
137
+ sx={{
138
+ fontSize: '0.75rem', // Adjust font size (optional)
139
+ whiteSpace: 'nowrap',
140
+ }}
141
+ >
142
+ Please enter OTP received on Mobile Number: {mobileNumber}
143
+ </Typography>
144
+ )}
145
+ <Box sx={{ width: '80%', mt: 2 }}>
146
+ <CustomTextField
147
+ control={control}
148
+ id="username"
149
+ name="username"
150
+ placeholder="Username"
151
+ inputProps={{ 'data-testid': 'username' }}
152
+ errors={errors}
153
+ disabled={mobileNumber}
154
+ size="small"
155
+ className="3xl:[&_input]:h-8"
156
+ dataTestId="forgot-password-username-textfield"
157
+ autoComplete="off"
158
+ />
159
+ </Box>
160
+ {mobileNumber && (
161
+ <Box sx={{ mt: 2, width: '80%' }}>
162
+ <CustomTextField
163
+ control={control}
164
+ id="otp"
165
+ name="otp"
166
+ inputProps={{
167
+ maxLength: 4, // Restrict maximum length
168
+ inputMode: 'numeric', // Ensure numeric keyboard on mobile
169
+ pattern: '[0-9]*', // Only allow numeric input
170
+ }}
171
+ errors={errors}
172
+ placeholder="Enter OTP"
173
+ size="small"
174
+ className="3xl:[&_input]:h-8"
175
+ dataTestId="forgot-password-otp-textfield"
176
+ autoComplete="off"
177
+ />
178
+ </Box>
179
+ )}
180
+
181
+ {isDisabled && mobileNumber ? (
182
+ <p style={{ color: 'blue' }}>Resend OTP in {timer} seconds</p>
183
+ ) : (
184
+ mobileNumber && (
185
+ <button
186
+ type="button"
187
+ style={{
188
+ color: 'blue',
189
+ cursor: 'pointer',
190
+ background: 'none',
191
+ border: 'none',
192
+ }}
193
+ onClick={handleResend}
194
+ >
195
+ {translate("Resend OTP")}
196
+ </button>
197
+ )
198
+ )}
199
+ {!mobileNumber ? (
200
+ <Button
201
+ type="submit"
202
+ variant="contained"
203
+ sx={{ mt: 2, mb: 2, width: '80%' }}
204
+ onClick={() => setSubmitType('getOTP')}
205
+ data-testid="forgot-password-get-otp-button"
206
+ >
207
+ {translate("Get OTP")}
208
+ </Button>
209
+ ) : (
210
+ <Button
211
+ type="submit"
212
+ variant="contained"
213
+ sx={{ mb: 2, width: '80%' }}
214
+ onClick={() => setSubmitType('verifyOTP')}
215
+ data-testid="forgot-password-verify-otp-button"
216
+ >
217
+ {translate("Submit")}
218
+ </Button>
219
+ )}
220
+ </Grid>
221
+ </Grid>
222
+ </Suspense>
223
+ );
224
+ };
225
+
226
+ export default ForgotPassword;