@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,188 @@
1
+ import React from 'react';
2
+ import { Autocomplete, Chip, FormControl, TextField } from '@mui/material';
3
+ import PropTypes from 'prop-types';
4
+ import { Controller } from 'react-hook-form';
5
+ import { Box } from '@mui/system';
6
+ import { faXmark } from '@fortawesome/free-solid-svg-icons';
7
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
+ import { Virtuoso } from 'react-virtuoso';
9
+
10
+ const VirtualListbox = React.forwardRef(function VirtualListbox(props, ref) {
11
+ const { children, ...other } = props;
12
+ const itemData = React.Children.toArray(children);
13
+
14
+ return (
15
+ <div ref={ref} {...other}>
16
+ <Virtuoso
17
+ style={{ height: 300, width: '100%' }}
18
+ data={itemData}
19
+ itemContent={(index) => itemData[index]}
20
+ />
21
+ </div>
22
+ );
23
+ });
24
+
25
+ export default function CustomAutocomplete({
26
+ options,
27
+ onInputChange,
28
+ onChange,
29
+ control,
30
+ // errors,
31
+ rules,
32
+ name,
33
+ size = 'small',
34
+ checkEquality = 'id', // Used to check equality of options to disable already selected options
35
+ getOptionLabel,
36
+ singleSelect = false,
37
+ dataTestId,
38
+ placeholder,
39
+ isVirtualized = false,
40
+ ...props
41
+ }) {
42
+ // const error = get(errors, name);
43
+ return (
44
+ <Controller
45
+ name={name}
46
+ control={control}
47
+ rules={rules}
48
+ render={({ field, fieldState: { error } }) => (
49
+ <FormControl fullWidth error={!!error} data-testid={dataTestId}>
50
+ <Autocomplete
51
+ {...field}
52
+ options={options || []}
53
+ multiple={!singleSelect}
54
+ disableClearable
55
+ size={size}
56
+ // value={value}
57
+ value={field.value || (singleSelect ? null : [])}
58
+ isOptionEqualToValue={(option, value) => option?.[checkEquality] === value?.[checkEquality]}
59
+ slots={{
60
+ listbox: isVirtualized ? VirtualListbox : undefined,
61
+ }}
62
+ renderInput={(params) => (
63
+ <TextField
64
+ {...params}
65
+ size={size}
66
+ placeholder={
67
+ placeholder?.trim() ? placeholder : singleSelect ? 'Select an option' : 'Select some options'
68
+ }
69
+ error={!!error}
70
+ sx={{
71
+ '& .MuiOutlinedInput-root': {
72
+ // backgroundColor: '#F8FAFC',
73
+ fontSize: 'inherit',
74
+ paddingLeft: 'initial',
75
+ paddingTop: 'initial',
76
+ paddingBottom: 'initial',
77
+ '& input': {
78
+ padding: '8.5px 14px',
79
+ },
80
+ },
81
+ }}
82
+ />
83
+ )}
84
+ getOptionLabel={getOptionLabel}
85
+ renderOption={(props, option, { selected }) => {
86
+ const isDisabled =
87
+ !singleSelect &&
88
+ field?.value?.some((selected) => selected?.[checkEquality] === option?.[checkEquality]);
89
+ return (
90
+ <Box
91
+ component="li"
92
+ {...props}
93
+ key={option[checkEquality]}
94
+ data-testid={`option-${option[checkEquality]}`}
95
+ sx={{
96
+ fontSize: '14px',
97
+ pointerEvents: isDisabled ? 'none' : 'auto',
98
+ borderRadius: '16px',
99
+ mx: 1,
100
+ my: 0.5,
101
+ px: 2,
102
+ py: 1,
103
+ cursor: isDisabled ? 'not-allowed' : 'pointer',
104
+ ...isVirtualized && {
105
+ '&:hover': {
106
+ backgroundColor: isDisabled
107
+ ? 'transparent'
108
+ : (theme) => theme.palette.action.hover,
109
+ },
110
+ backgroundColor: selected
111
+ ? (theme) => theme.palette.action.selected
112
+ : 'transparent',
113
+ '&.Mui-focused': {
114
+ backgroundColor: (theme) => theme.palette.action.hover,
115
+ }
116
+ },
117
+ }}
118
+ >
119
+ {getOptionLabel(option)}
120
+ </Box>
121
+ );
122
+ }}
123
+ renderTags={(value, getTagProps) =>
124
+ value?.map((option, index) => (
125
+ <Chip
126
+ size={size}
127
+ key={option?.[checkEquality]}
128
+ label={getOptionLabel(option)}
129
+ {...getTagProps({ index })}
130
+ deleteIcon={<FontAwesomeIcon icon={faXmark} className="text-white mr-2" />}
131
+ sx={{
132
+ backgroundColor: (theme) => theme.palette.primary.main,
133
+ color: 'white',
134
+ '& .MuiChip-deleteIcon path': {
135
+ fill: 'white',
136
+ },
137
+ }}
138
+ />
139
+ ))
140
+ }
141
+ slotProps={{
142
+ paper: {
143
+ sx: {
144
+ boxShadow: '0px 2px 10px rgba(0, 0, 0, 0.1)',
145
+ border: '1px solid #E0E0E0',
146
+ my: 1,
147
+ },
148
+ },
149
+ }}
150
+ onInputChange={onInputChange}
151
+ onChange={(e, val) => {
152
+ const removedOption =
153
+ Array.isArray(field?.value) && field?.value?.length > val?.length
154
+ ? field?.value.find((selected) => !val?.includes(selected))
155
+ : null;
156
+ const newValue = singleSelect ? (() => (Array.isArray(val) ? val[0] : val))() : val;
157
+ field.onChange(newValue);
158
+ onChange?.(e, newValue, removedOption);
159
+ }}
160
+ {...props}
161
+ />
162
+ {error && (
163
+ <p data-testid="custom-error-message" className="error-helper-text">
164
+ {error?.message}
165
+ </p>
166
+ )}
167
+ </FormControl>
168
+ )}
169
+ />
170
+ );
171
+ }
172
+
173
+ CustomAutocomplete.propTypes = {
174
+ control: PropTypes.any,
175
+ value: PropTypes.any,
176
+ options: PropTypes.any,
177
+ onChange: PropTypes.any,
178
+ rules: PropTypes.any,
179
+ name: PropTypes.any,
180
+ getOptionLabel: PropTypes.any,
181
+ checkEquality: PropTypes.any,
182
+ onInputChange: PropTypes.any,
183
+ singleSelect: PropTypes.any,
184
+ dataTestId: PropTypes.any,
185
+ size: PropTypes.any,
186
+ placeholder: PropTypes.any,
187
+ isVirtualized: PropTypes.bool,
188
+ };
@@ -0,0 +1,60 @@
1
+ import { Checkbox, FormControl, FormControlLabel } from '@mui/material';
2
+ import React, { forwardRef } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { Controller, get } from 'react-hook-form';
5
+ import { useTranslateProvider } from '@/common/languageTranslator/TranslationContext';
6
+
7
+ const CustomCheckBox = forwardRef(
8
+ ({ name, label, control, onChange, rules = {}, errors, labelSizeInRem, isFullWidth = true, ...props }, ref) => {
9
+ const error = get(errors, name);
10
+ const { translate } = useTranslateProvider();
11
+
12
+ return (
13
+ <FormControl fullWidth={isFullWidth}>
14
+ <Controller
15
+ name={name}
16
+ rules={rules}
17
+ control={control}
18
+ render={({ field }) => (
19
+ <FormControlLabel
20
+ control={
21
+ <Checkbox
22
+ {...field}
23
+ ref={ref}
24
+ checked={Boolean(field.value)}
25
+ onChange={(e) => {
26
+ field.onChange(e.target.checked);
27
+ onChange?.(e.target.checked);
28
+ }}
29
+ {...props}
30
+ />
31
+ }
32
+ label={typeof label === 'string' ? translate(label) : label}
33
+ sx={{
34
+ '& .MuiFormControlLabel-label': {
35
+ fontSize: labelSizeInRem || '12px',
36
+ },
37
+ }}
38
+ />
39
+ )}
40
+ />
41
+ {error && <p className="error-helper-text">{error?.message}</p>}
42
+ </FormControl>
43
+ );
44
+ }
45
+ );
46
+
47
+ CustomCheckBox.displayName = 'CustomCheckBox';
48
+
49
+ CustomCheckBox.propTypes = {
50
+ name: PropTypes.any,
51
+ label: PropTypes.any,
52
+ control: PropTypes.any,
53
+ onChange: PropTypes.any,
54
+ errors: PropTypes.any,
55
+ isFullWidth: PropTypes.any,
56
+ labelSizeInRem: PropTypes.any,
57
+ rules: PropTypes.any,
58
+ };
59
+
60
+ export default CustomCheckBox;
@@ -0,0 +1,118 @@
1
+ import { Box, Button, Fade, IconButton, Modal, Stack, Typography } from '@mui/material';
2
+ import Grid from '@mui/material/Grid2';
3
+ import PropTypes from 'prop-types';
4
+ import React from 'react';
5
+
6
+ import { useTranslateProvider } from '@/common/languageTranslator/TranslationContext';
7
+ import { faXmark } from '@fortawesome/free-solid-svg-icons';
8
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
9
+
10
+ const CustomConfirmationModal = ({
11
+ open,
12
+ handleClose,
13
+ handleClick,
14
+ handleNoClick = null,
15
+ title,
16
+ position = 'center',
17
+ description,
18
+ ActionExecutable = true,
19
+ dataTestId,
20
+ ...props
21
+ }) => {
22
+ const handleProps = { ...props };
23
+ const { translate } = useTranslateProvider();
24
+ return (
25
+ <Modal
26
+ open={open}
27
+ onClose={handleClose}
28
+ closeAfterTransition
29
+ sx={{
30
+ display: 'flex',
31
+ justifyContent: 'center',
32
+ alignItems: position, // Align at top
33
+ mt: 2, // MUI spacing for top margin
34
+ '& .MuiBackdrop-root': {
35
+ backgroundColor: 'rgba(0, 0, 0, 0.4)',
36
+ },
37
+ }}
38
+ data-testid={dataTestId}
39
+ {...props}
40
+ >
41
+ <Fade in={open} timeout={300}>
42
+ <Grid
43
+ container
44
+ className={`flex flex-col w-full max-w-[700px] bg-white shadow-lg rounded-md transform transition-all duration-200 ${
45
+ open ? 'translate-y-0 opacity-100' : '-translate-y-4 opacity-0'
46
+ }`}
47
+ >
48
+ <Grid className="flex p-2.5 py-1 border-b justify-between items-center">
49
+ <Typography
50
+ variant="body1"
51
+ className="font-medium text-lg text-customBlue"
52
+ data-testid={`${dataTestId}-title`}
53
+ >
54
+ {translate(title)}
55
+ </Typography>
56
+ <IconButton size="small" onClick={handleClose} data-testid={`${dataTestId}-close-button`}>
57
+ <FontAwesomeIcon icon={faXmark} />
58
+ </IconButton>
59
+ </Grid>
60
+
61
+ <Grid className="border-b border-gray-300 p-2.5">
62
+ <Box
63
+ className="max-h-[450px] w-full overflow-y-auto overflow-x-hidden"
64
+ data-testid={`${dataTestId}-description`}
65
+ >
66
+ <Typography variant="body2">{description}</Typography>
67
+ </Box>
68
+ </Grid>
69
+
70
+ <Grid className=" pb-0.5 pr-2.5">
71
+ <Stack direction="row" spacing={1} justifyContent="flex-end" mt={1} mb={0.5}>
72
+ <Button
73
+ variant="contained"
74
+ size="small"
75
+ color="secondary"
76
+ onClick={handleNoClick ? handleNoClick : handleClose}
77
+ data-testid={`${dataTestId}-no-button`}
78
+ >
79
+ <Typography variant="caption">
80
+ {handleProps?.endTeleconsultationIfNoOneJoined
81
+ ? `${translate('Stay')}`
82
+ : ActionExecutable
83
+ ? `${translate('No')}`
84
+ : `${translate('Close')}`}
85
+ </Typography>
86
+ </Button>
87
+ {ActionExecutable && (
88
+ <Button
89
+ variant="contained"
90
+ size="small"
91
+ color="primary"
92
+ onClick={handleClick}
93
+ data-testid={`${dataTestId}-yes-button`}
94
+ >
95
+ {handleProps?.endTeleconsultationIfNoOneJoined ? translate('Leave') : translate('Yes')}
96
+ </Button>
97
+ )}
98
+ </Stack>
99
+ </Grid>
100
+ </Grid>
101
+ </Fade>
102
+ </Modal>
103
+ );
104
+ };
105
+
106
+ export default CustomConfirmationModal;
107
+
108
+ CustomConfirmationModal.propTypes = {
109
+ open: PropTypes.any,
110
+ handleClose: PropTypes.any,
111
+ handleClick: PropTypes.any,
112
+ title: PropTypes.any,
113
+ description: PropTypes.any,
114
+ ActionExecutable: PropTypes.bool,
115
+ dataTestId: PropTypes.string,
116
+ position: PropTypes.any,
117
+ handleNoClick: PropTypes.any,
118
+ };
@@ -0,0 +1,129 @@
1
+ import React from 'react';
2
+ import { Autocomplete, FormControl, TextField } from '@mui/material';
3
+ import PropTypes from 'prop-types';
4
+ import { Controller, get } from 'react-hook-form';
5
+ import { Box } from '@mui/system';
6
+
7
+ export default function CustomCountrySelect({
8
+ onInputChange,
9
+ onChange,
10
+ control,
11
+ errors,
12
+ name,
13
+ size = 'small',
14
+ dataTestId,
15
+ placeholder,
16
+ ...props
17
+ }) {
18
+ const error = get(errors, name);
19
+ return (
20
+ <FormControl fullWidth error={!!error} data-testid={dataTestId}>
21
+ <Controller
22
+ name={name}
23
+ control={control}
24
+ render={({ field }) => (
25
+ <Autocomplete
26
+ {...field}
27
+ options={countries || []}
28
+ disableClearable
29
+ size={size}
30
+ value={field.value || null}
31
+ getOptionLabel={(option) => option?.phone}
32
+ renderOption={(props, option) => {
33
+ const { key, ...optionProps } = props;
34
+ return (
35
+ <Box key={key} component="li" sx={{ '& > img': { mr: 1, flexShrink: 0 } }} {...optionProps}>
36
+ <img
37
+ loading="lazy"
38
+ width="20"
39
+ srcSet={`https://flagcdn.com/w40/${option?.code?.toLowerCase()}.png`}
40
+ src={`https://flagcdn.com/w20/${option?.code?.toLowerCase()}.png`}
41
+ alt={`${option.code} flag`}
42
+ />
43
+ {option.phone} ({option.code})
44
+ </Box>
45
+ );
46
+ }}
47
+ renderInput={(params) => {
48
+ const selected = field.value;
49
+
50
+ return (
51
+ <TextField
52
+ {...params}
53
+ size={size}
54
+ placeholder={placeholder?.trim() ? placeholder : 'Select a Country'}
55
+ error={!!error}
56
+ slotProps={{
57
+ input: {
58
+ ...params.InputProps, // <-- ADD THIS LINE
59
+ startAdornment: (
60
+ <>
61
+ {selected?.code && (
62
+ <Box sx={{ '& > img': { ml: 1, mr: 1, gap: 1, flexShrink: 0 } }}>
63
+ <img
64
+ loading="lazy"
65
+ width="20"
66
+ srcSet={`https://flagcdn.com/w40/${selected.code?.toLowerCase()}.png`}
67
+ src={`https://flagcdn.com/w20/${selected.code?.toLowerCase()}.png`}
68
+ alt={`${selected.code} flag`}
69
+ />
70
+ </Box>
71
+ )}
72
+ </>
73
+ ),
74
+ endAdornment: <>{params.InputProps?.endAdornment}</>,
75
+ },
76
+ }}
77
+ />
78
+ );
79
+ }}
80
+ slotProps={{
81
+ paper: {
82
+ sx: {
83
+ boxShadow: '0px 2px 10px rgba(0, 0, 0, 0.1)',
84
+ border: '1px solid #E0E0E0',
85
+ },
86
+ },
87
+ }}
88
+ onInputChange={onInputChange}
89
+ onChange={(e, val) => {
90
+ field.onChange(val);
91
+ onChange?.(e, val);
92
+ }}
93
+ {...props}
94
+ />
95
+ )}
96
+ />
97
+ {error && (
98
+ <p data-testid="custom-error-message" className="error-helper-text">
99
+ {error?.message}
100
+ </p>
101
+ )}
102
+ </FormControl>
103
+ );
104
+ }
105
+
106
+ CustomCountrySelect.propTypes = {
107
+ control: PropTypes.any,
108
+ value: PropTypes.any,
109
+ options: PropTypes.any,
110
+ onChange: PropTypes.any,
111
+ errors: PropTypes.any,
112
+ name: PropTypes.any,
113
+ getOptionLabel: PropTypes.any,
114
+ checkEquality: PropTypes.any,
115
+ onInputChange: PropTypes.any,
116
+ singleSelect: PropTypes.any,
117
+ dataTestId: PropTypes.any,
118
+ size: PropTypes.any,
119
+ placeholder: PropTypes.any,
120
+ key: PropTypes.any,
121
+ };
122
+
123
+ const countries = [
124
+ {
125
+ code: 'IN',
126
+ label: 'India',
127
+ phone: '+91',
128
+ },
129
+ ];
@@ -0,0 +1,122 @@
1
+ import { FormControl, FormControlLabel } from '@mui/material';
2
+ import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
3
+ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
4
+ import dayjs from 'dayjs';
5
+ import React from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import { Controller, get } from 'react-hook-form';
8
+ import { useState } from 'react';
9
+ import GeneralUtil from '@/common/services/util/GeneralUtil';
10
+
11
+ export default function CustomDatePicker({
12
+ name,
13
+ control,
14
+ errors = {},
15
+ views = ['year', 'month', 'day'],
16
+ format = 'MM/DD/YYYY',
17
+ rules = {},
18
+ dataTestId,
19
+ prevDataSelection = true,
20
+ onChange,
21
+ ...props
22
+ }) {
23
+ const error = get(errors, name);
24
+ const [open, setOpen] = useState(false);
25
+ const [currentView, setCurrentView] = useState(props.openTo || (views.includes('day') ? 'day' : views[0]));
26
+
27
+ return (
28
+ <FormControl fullWidth className="ml-2.5">
29
+ <Controller
30
+ name={name}
31
+ control={control}
32
+ className="w-full"
33
+ rules={rules}
34
+ render={({ field }) => (
35
+ <FormControlLabel
36
+ control={
37
+ <LocalizationProvider dateAdapter={AdapterDayjs}>
38
+ <DatePicker
39
+ className="w-full"
40
+ format={format}
41
+ views={views}
42
+ minDate={props.minDate || (!prevDataSelection ? dayjs() : undefined)}
43
+ maxDate={props.maxDate}
44
+ open={open}
45
+ onOpen={() => {
46
+ setOpen(true);
47
+ if (props.openTo) {
48
+ setCurrentView(props.openTo);
49
+ } else if (views.includes('day')) {
50
+ setCurrentView('day');
51
+ } else {
52
+ setCurrentView(views[0]);
53
+ }
54
+ }}
55
+ onClose={() => setOpen(false)}
56
+ view={currentView}
57
+ onViewChange={(newView) => setCurrentView(newView)}
58
+ slotProps={{
59
+ textField: {
60
+ ...(!GeneralUtil.isBahaar && { onClick: () => !open && setOpen(true) }),
61
+ size: 'small',
62
+ error: !!error,
63
+ 'data-testid': dataTestId,
64
+ sx: {
65
+ height: 38, // 👈 fixed height in px
66
+ '& .MuiInputBase-root': {
67
+ height: '100%', // Ensures internal input fills container
68
+ },
69
+ },
70
+ },
71
+ }}
72
+ value={field.value ? dayjs(field.value) : null}
73
+ onChange={(date) => {
74
+ const isValid = date === null || date.isValid();
75
+ if (isValid) {
76
+ field.onChange(date);
77
+ onChange?.(date);
78
+ }
79
+ if (currentView === 'year' && views.includes('month')) {
80
+ setCurrentView('month');
81
+ } else if (currentView === 'month' && views.includes('day')) {
82
+ setCurrentView('day');
83
+ } else if (isValid) {
84
+ setOpen(false);
85
+ }
86
+ }}
87
+ data-testid={dataTestId}
88
+ {...props}
89
+ />
90
+ </LocalizationProvider>
91
+ }
92
+ sx={{
93
+ '& .MuiFormControlLabel-label': {
94
+ fontSize: '0.82rem',
95
+ },
96
+ width: '100%',
97
+ }}
98
+ />
99
+ )}
100
+ />
101
+ {error && (
102
+ <p data-testid="custom-error-message" className="error-helper-text">
103
+ {error?.message}
104
+ </p>
105
+ )}
106
+ </FormControl>
107
+ );
108
+ }
109
+
110
+ CustomDatePicker.propTypes = {
111
+ name: PropTypes.string.isRequired,
112
+ control: PropTypes.object.isRequired,
113
+ errors: PropTypes.object,
114
+ views: PropTypes.array,
115
+ dataTestId: PropTypes.string,
116
+ format: PropTypes.string,
117
+ prevDataSelection: PropTypes.any,
118
+ onChange: PropTypes.any,
119
+ rules: PropTypes.any,
120
+ minDate: PropTypes.any,
121
+ maxDate: PropTypes.any,
122
+ };