@codezee/sixtify-brahma 0.0.0
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/.github/workflows/check-build.yml +41 -0
- package/.github/workflows/deploy-on-npm.yml +43 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +6 -0
- package/.lintstagedrc +5 -0
- package/.prettierignore +12 -0
- package/.prettierrc +22 -0
- package/.vscode/extensions.json +22 -0
- package/.vscode/settings.json +17 -0
- package/README.md +90 -0
- package/apps/docs/.eslintrc.cjs +9 -0
- package/apps/docs/.storybook/main.ts +23 -0
- package/apps/docs/.storybook/manager.ts +6 -0
- package/apps/docs/.storybook/preview.tsx +27 -0
- package/apps/docs/.storybook/theme.ts +8 -0
- package/apps/docs/next-env.d.ts +5 -0
- package/apps/docs/next.config.mjs +4 -0
- package/apps/docs/package.json +43 -0
- package/apps/docs/public/globals.css +26 -0
- package/apps/docs/stories/Actions/Actions.stories.tsx +49 -0
- package/apps/docs/stories/AgGrid/AgGrid.stories.tsx +70 -0
- package/apps/docs/stories/AppBar/AppBar.stories.tsx +39 -0
- package/apps/docs/stories/Breadcrumbs/Breadcrumbs.stories.tsx +37 -0
- package/apps/docs/stories/Button/ButtonGroup.stories.tsx +120 -0
- package/apps/docs/stories/Button/button.stories.tsx +99 -0
- package/apps/docs/stories/Card/AttendanceCard.stories.tsx +36 -0
- package/apps/docs/stories/Card/Card.stories.tsx +39 -0
- package/apps/docs/stories/Charts/PieChart.stories.tsx +265 -0
- package/apps/docs/stories/Chips/Chip.stories.tsx +141 -0
- package/apps/docs/stories/Chips/ChipWithBorder.stories.tsx +18 -0
- package/apps/docs/stories/Chips/FilterPill.stories.tsx +24 -0
- package/apps/docs/stories/Color/Color.stories.tsx +14 -0
- package/apps/docs/stories/Dialog/ButtomDialog.stories.tsx +48 -0
- package/apps/docs/stories/Dialog/DeleteDialog.stories.tsx +32 -0
- package/apps/docs/stories/Dialog/Dialog.stories.tsx +48 -0
- package/apps/docs/stories/Drawer/Drawer.stories.tsx +94 -0
- package/apps/docs/stories/FilterList/FilterList.stories.tsx +88 -0
- package/apps/docs/stories/FilterList/FilterListV2.stories.tsx +92 -0
- package/apps/docs/stories/FormFields/AutoComplete.stories.tsx +90 -0
- package/apps/docs/stories/FormFields/CheckBox.stories.tsx +64 -0
- package/apps/docs/stories/FormFields/DatePicker.stories.tsx +100 -0
- package/apps/docs/stories/FormFields/DateRangePicker.stories.tsx +39 -0
- package/apps/docs/stories/FormFields/DateTimePicker.stories.tsx +39 -0
- package/apps/docs/stories/FormFields/FileUpload.stories.tsx +83 -0
- package/apps/docs/stories/FormFields/ImageUpload.stories.tsx +69 -0
- package/apps/docs/stories/FormFields/ListItemButton.stories.tsx +59 -0
- package/apps/docs/stories/FormFields/PhoneInputField.stories.tsx +84 -0
- package/apps/docs/stories/FormFields/RadioGroupField.stories.tsx +172 -0
- package/apps/docs/stories/FormFields/SearchField.stories.tsx +74 -0
- package/apps/docs/stories/FormFields/TextField.stories.tsx +141 -0
- package/apps/docs/stories/FormFields/TimeField.stories.tsx +84 -0
- package/apps/docs/stories/FormFields/TimePicker.stories.tsx +84 -0
- package/apps/docs/stories/Indicator/Indicator.stories.tsx +33 -0
- package/apps/docs/stories/Indicator/SeverityIndicator.stories.tsx +27 -0
- package/apps/docs/stories/Layouts/FormRow.stories.tsx +45 -0
- package/apps/docs/stories/PadBox/PadBox.stories.tsx +49 -0
- package/apps/docs/stories/Stepper/Stepper.stories.tsx +110 -0
- package/apps/docs/stories/Stepper/StepperV2.stories.tsx +44 -0
- package/apps/docs/stories/Timeline/AttendanceStatus.stories.tsx +29 -0
- package/apps/docs/stories/Timeline/Timeline.stories.tsx +38 -0
- package/apps/docs/stories/Tooltip/Tooltip.stories.tsx +28 -0
- package/apps/docs/stories/UserProfileMenu/UserProfileMenu.stories.tsx +112 -0
- package/apps/docs/tsconfig.json +19 -0
- package/commitlint.config.cjs +6 -0
- package/index.ts +1 -0
- package/package.json +85 -0
- package/packages/eslint-config/README.md +3 -0
- package/packages/eslint-config/library.js +88 -0
- package/packages/eslint-config/next.js +85 -0
- package/packages/eslint-config/package.json +19 -0
- package/packages/eslint-config/react-internal.js +89 -0
- package/packages/shared-components/.eslintrc.js +10 -0
- package/packages/shared-components/package.json +51 -0
- package/packages/shared-components/src/Actions/AddAction.tsx +16 -0
- package/packages/shared-components/src/Actions/CalendarAction.tsx +16 -0
- package/packages/shared-components/src/Actions/ConfigureAction.tsx +16 -0
- package/packages/shared-components/src/Actions/DeleteAction.tsx +16 -0
- package/packages/shared-components/src/Actions/DownloadAction.tsx +16 -0
- package/packages/shared-components/src/Actions/EditAction.tsx +16 -0
- package/packages/shared-components/src/Actions/ExportAction.tsx +16 -0
- package/packages/shared-components/src/Actions/FilterAction.tsx +16 -0
- package/packages/shared-components/src/Actions/HistoryAction.tsx +16 -0
- package/packages/shared-components/src/Actions/ImportAction.tsx +16 -0
- package/packages/shared-components/src/Actions/ViewAction.tsx +16 -0
- package/packages/shared-components/src/Actions/index.ts +11 -0
- package/packages/shared-components/src/AgGrid/ActionCell/ActionCell.tsx +57 -0
- package/packages/shared-components/src/AgGrid/ActionCell/Popover.tsx +32 -0
- package/packages/shared-components/src/AgGrid/AgGrid.tsx +93 -0
- package/packages/shared-components/src/AgGrid/LoadingCell.tsx +5 -0
- package/packages/shared-components/src/AgGrid/index.ts +3 -0
- package/packages/shared-components/src/AppBar/AppBar.styled.tsx +33 -0
- package/packages/shared-components/src/AppBar/AppBar.tsx +20 -0
- package/packages/shared-components/src/AppBar/index.ts +1 -0
- package/packages/shared-components/src/Breadcrumbs/Breadcrumbs.tsx +76 -0
- package/packages/shared-components/src/Breadcrumbs/index.ts +1 -0
- package/packages/shared-components/src/Button/ActionButton.tsx +38 -0
- package/packages/shared-components/src/Button/Button.tsx +19 -0
- package/packages/shared-components/src/Button/ButtonGroup.tsx +37 -0
- package/packages/shared-components/src/Button/index.ts +3 -0
- package/packages/shared-components/src/Card/AttendanceCard.tsx +51 -0
- package/packages/shared-components/src/Card/Card.tsx +34 -0
- package/packages/shared-components/src/Card/CardItem/CardItem.tsx +33 -0
- package/packages/shared-components/src/Card/CardItem/CardItemValue.tsx +98 -0
- package/packages/shared-components/src/Card/CardItem/index.ts +2 -0
- package/packages/shared-components/src/Card/ProfileCard/ProfileCard.tsx +40 -0
- package/packages/shared-components/src/Card/ProfileCard/ProfileCardItem/ProfileCardBody.tsx +53 -0
- package/packages/shared-components/src/Card/ProfileCard/ProfileCardItem/ProfileCardHeader.tsx +94 -0
- package/packages/shared-components/src/Card/index.ts +6 -0
- package/packages/shared-components/src/Charts/PieChart.tsx +81 -0
- package/packages/shared-components/src/Charts/Skeleton.tsx +36 -0
- package/packages/shared-components/src/Charts/index.ts +1 -0
- package/packages/shared-components/src/Chips/Chip.tsx +26 -0
- package/packages/shared-components/src/Chips/ChipWithBorder.tsx +39 -0
- package/packages/shared-components/src/Chips/FilterPill.tsx +47 -0
- package/packages/shared-components/src/Chips/index.ts +3 -0
- package/packages/shared-components/src/Dialog/BottomDialog.styled.tsx +28 -0
- package/packages/shared-components/src/Dialog/BottomDialog.tsx +37 -0
- package/packages/shared-components/src/Dialog/DeleteDialog.tsx +48 -0
- package/packages/shared-components/src/Dialog/Dialog.tsx +61 -0
- package/packages/shared-components/src/Dialog/index.ts +3 -0
- package/packages/shared-components/src/Drawer/Bullet.tsx +12 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerMenuItem.tsx +57 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerMenuItemList.tsx +109 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerSubMenuItemList.tsx +128 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/Popover.tsx +45 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/Popper.tsx +43 -0
- package/packages/shared-components/src/Drawer/Drawer.styled.tsx +63 -0
- package/packages/shared-components/src/Drawer/Drawer.tsx +56 -0
- package/packages/shared-components/src/Drawer/MenuItem.tsx +75 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerCollapse.tsx +13 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItem.tsx +48 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItemList.tsx +232 -0
- package/packages/shared-components/src/Drawer/index.ts +1 -0
- package/packages/shared-components/src/FilterList/DateRangePickerPopUp.tsx +123 -0
- package/packages/shared-components/src/FilterList/FilterList.tsx +180 -0
- package/packages/shared-components/src/FilterList/FilterListV2.tsx +661 -0
- package/packages/shared-components/src/FilterList/FilterPopup.tsx +165 -0
- package/packages/shared-components/src/FilterList/FilterPopupWrapper.tsx +110 -0
- package/packages/shared-components/src/FilterList/FilterTypeWrapper.tsx +60 -0
- package/packages/shared-components/src/FilterList/GetFilterPopupComponent.tsx +76 -0
- package/packages/shared-components/src/FilterList/getFormData.ts +29 -0
- package/packages/shared-components/src/FilterList/index.ts +6 -0
- package/packages/shared-components/src/FormFields/Autocomplete/Autocomplete.tsx +509 -0
- package/packages/shared-components/src/FormFields/Autocomplete/Skeleton.tsx +26 -0
- package/packages/shared-components/src/FormFields/Autocomplete/index.ts +1 -0
- package/packages/shared-components/src/FormFields/CheckBox/CheckBox.styled.tsx +76 -0
- package/packages/shared-components/src/FormFields/CheckBox/CheckBox.tsx +44 -0
- package/packages/shared-components/src/FormFields/CheckBox/Skeleton.tsx +12 -0
- package/packages/shared-components/src/FormFields/CheckBox/index.ts +1 -0
- package/packages/shared-components/src/FormFields/DatePicker/DatePicker.tsx +217 -0
- package/packages/shared-components/src/FormFields/DatePicker/Skeleton.tsx +28 -0
- package/packages/shared-components/src/FormFields/DatePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/DateRangePicker/DateRangePicker.tsx +97 -0
- package/packages/shared-components/src/FormFields/DateRangePicker/Skeleton.tsx +38 -0
- package/packages/shared-components/src/FormFields/DateRangePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/DateTimePicker/DateTimePicker.tsx +253 -0
- package/packages/shared-components/src/FormFields/DateTimePicker/Skeleton.tsx +24 -0
- package/packages/shared-components/src/FormFields/DateTimePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/FileUpload/FileNames.tsx +32 -0
- package/packages/shared-components/src/FormFields/FileUpload/FileUpload.styled.tsx +31 -0
- package/packages/shared-components/src/FormFields/FileUpload/FileUpload.tsx +160 -0
- package/packages/shared-components/src/FormFields/FileUpload/Skeleton.tsx +21 -0
- package/packages/shared-components/src/FormFields/FileUpload/index.ts +2 -0
- package/packages/shared-components/src/FormFields/ImageUpload/ImageUpload.styled.tsx +20 -0
- package/packages/shared-components/src/FormFields/ImageUpload/ImageUpload.tsx +181 -0
- package/packages/shared-components/src/FormFields/ImageUpload/ImageUploadView.tsx +65 -0
- package/packages/shared-components/src/FormFields/ImageUpload/PhotoCaptureDialog.tsx +74 -0
- package/packages/shared-components/src/FormFields/ImageUpload/Skeleton.tsx +31 -0
- package/packages/shared-components/src/FormFields/ImageUpload/index.ts +2 -0
- package/packages/shared-components/src/FormFields/ListItemButton/ListItemButton.styled.tsx +25 -0
- package/packages/shared-components/src/FormFields/ListItemButton/ListItemButton.tsx +52 -0
- package/packages/shared-components/src/FormFields/ListItemButton/index.ts +1 -0
- package/packages/shared-components/src/FormFields/PasswordField/PasswordField.tsx +50 -0
- package/packages/shared-components/src/FormFields/PasswordField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/PhoneInputField/PhoneInputField.tsx +108 -0
- package/packages/shared-components/src/FormFields/PhoneInputField/Skeleton.tsx +31 -0
- package/packages/shared-components/src/FormFields/PhoneInputField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/RadioGroupField/RadioGroupField.tsx +105 -0
- package/packages/shared-components/src/FormFields/RadioGroupField/Skeleton.tsx +26 -0
- package/packages/shared-components/src/FormFields/RadioGroupField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/SearchField/SearchField.tsx +21 -0
- package/packages/shared-components/src/FormFields/SearchField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/Switch/Skeleton.tsx +12 -0
- package/packages/shared-components/src/FormFields/Switch/Switch.tsx +33 -0
- package/packages/shared-components/src/FormFields/Switch/index.ts +1 -0
- package/packages/shared-components/src/FormFields/TextField/Skeleton.tsx +31 -0
- package/packages/shared-components/src/FormFields/TextField/TextField.tsx +167 -0
- package/packages/shared-components/src/FormFields/TextField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/TimeField/Skeleton.tsx +24 -0
- package/packages/shared-components/src/FormFields/TimeField/TimeField.tsx +120 -0
- package/packages/shared-components/src/FormFields/TimeField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/TimePicker/Skeleton.tsx +24 -0
- package/packages/shared-components/src/FormFields/TimePicker/TimePicker.tsx +168 -0
- package/packages/shared-components/src/FormFields/TimePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/index.ts +16 -0
- package/packages/shared-components/src/Indicator/Indicator.tsx +18 -0
- package/packages/shared-components/src/Indicator/SeverityIndicator.tsx +34 -0
- package/packages/shared-components/src/Indicator/index.ts +2 -0
- package/packages/shared-components/src/Layouts/FormContainer.tsx +6 -0
- package/packages/shared-components/src/Layouts/FormGridLayout.tsx +27 -0
- package/packages/shared-components/src/Layouts/FormRow/FormRow.styled.tsx +47 -0
- package/packages/shared-components/src/Layouts/FormRow/FormRow.tsx +20 -0
- package/packages/shared-components/src/Layouts/FormRow/index.ts +1 -0
- package/packages/shared-components/src/Layouts/FormSection.tsx +22 -0
- package/packages/shared-components/src/Layouts/index.ts +4 -0
- package/packages/shared-components/src/Loader/FacebookCircularProgress.tsx +41 -0
- package/packages/shared-components/src/Loader/index.ts +1 -0
- package/packages/shared-components/src/PadBox/PadBox.tsx +21 -0
- package/packages/shared-components/src/PadBox/index.ts +1 -0
- package/packages/shared-components/src/Pagination/Pagination.tsx +42 -0
- package/packages/shared-components/src/Pagination/index.ts +1 -0
- package/packages/shared-components/src/Stepper/Stepper.tsx +88 -0
- package/packages/shared-components/src/Stepper/StepperV2.tsx +115 -0
- package/packages/shared-components/src/Stepper/StepperV3.tsx +72 -0
- package/packages/shared-components/src/Stepper/index.ts +3 -0
- package/packages/shared-components/src/Svgs/AppLogo/AppLogoMedium.tsx +65 -0
- package/packages/shared-components/src/Svgs/AppLogo/AppLogoSmall.tsx +48 -0
- package/packages/shared-components/src/Svgs/ArrowUp.tsx +11 -0
- package/packages/shared-components/src/Svgs/Company/CompanyBanner.tsx +480 -0
- package/packages/shared-components/src/Svgs/Company/index.ts +1 -0
- package/packages/shared-components/src/Svgs/Drawer/SettingIcon.tsx +31 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgBankConfig.tsx +36 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgConfiguration.tsx +16 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgPayroll.tsx +32 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgsEmployees.tsx +25 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgsOrganization.tsx +36 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgsTransaction.tsx +81 -0
- package/packages/shared-components/src/Svgs/Drawer/index.ts +7 -0
- package/packages/shared-components/src/Svgs/FormAction.tsx +118 -0
- package/packages/shared-components/src/Svgs/ImportExcelSuccessIcon.tsx +54 -0
- package/packages/shared-components/src/Svgs/LogoIcon.tsx +74 -0
- package/packages/shared-components/src/Svgs/SvgAdd.tsx +28 -0
- package/packages/shared-components/src/Svgs/SvgCalendar.tsx +89 -0
- package/packages/shared-components/src/Svgs/SvgConfigure.tsx +51 -0
- package/packages/shared-components/src/Svgs/SvgDelete.tsx +55 -0
- package/packages/shared-components/src/Svgs/SvgDownload.tsx +20 -0
- package/packages/shared-components/src/Svgs/SvgEmail.tsx +27 -0
- package/packages/shared-components/src/Svgs/SvgExport.tsx +33 -0
- package/packages/shared-components/src/Svgs/SvgFilterList.tsx +22 -0
- package/packages/shared-components/src/Svgs/SvgImport.tsx +43 -0
- package/packages/shared-components/src/Svgs/SvgNoLogo.tsx +66 -0
- package/packages/shared-components/src/Svgs/SvgNoSign.tsx +28 -0
- package/packages/shared-components/src/Svgs/SvgPhone.tsx +19 -0
- package/packages/shared-components/src/Svgs/SvgProfile.tsx +33 -0
- package/packages/shared-components/src/Svgs/SvgView.tsx +16 -0
- package/packages/shared-components/src/Svgs/SvgsDrop.tsx +44 -0
- package/packages/shared-components/src/Svgs/SvgsEdit.tsx +42 -0
- package/packages/shared-components/src/Svgs/SvgsHistory.tsx +40 -0
- package/packages/shared-components/src/Svgs/SvgsHome.tsx +18 -0
- package/packages/shared-components/src/Svgs/SvgsIndicator.tsx +24 -0
- package/packages/shared-components/src/Svgs/index.ts +18 -0
- package/packages/shared-components/src/Tab/Skeleton.tsx +15 -0
- package/packages/shared-components/src/Tab/Tabs.tsx +64 -0
- package/packages/shared-components/src/Tab/index.ts +1 -0
- package/packages/shared-components/src/Timeline/AttendanceStatus.tsx +56 -0
- package/packages/shared-components/src/Timeline/Timeline.tsx +159 -0
- package/packages/shared-components/src/Timeline/TimelineTrackSegments.tsx +130 -0
- package/packages/shared-components/src/Timeline/index.ts +2 -0
- package/packages/shared-components/src/Toast/Toast.tsx +59 -0
- package/packages/shared-components/src/Toast/ToastBody.tsx +26 -0
- package/packages/shared-components/src/Toast/ToastFooterLink.tsx +19 -0
- package/packages/shared-components/src/Toast/Toaster.styled.tsx +80 -0
- package/packages/shared-components/src/Toast/Toaster.tsx +21 -0
- package/packages/shared-components/src/Toast/index.ts +3 -0
- package/packages/shared-components/src/Toast/toasts.tsx +28 -0
- package/packages/shared-components/src/Toast/types.ts +13 -0
- package/packages/shared-components/src/Tooltip/Tooltip.tsx +36 -0
- package/packages/shared-components/src/Tooltip/index.ts +1 -0
- package/packages/shared-components/src/UserProfileMenu/UserProfileMenu.styled.tsx +42 -0
- package/packages/shared-components/src/UserProfileMenu/UserProfileMenu.tsx +168 -0
- package/packages/shared-components/src/UserProfileMenu/index.ts +1 -0
- package/packages/shared-components/src/index.ts +25 -0
- package/packages/shared-components/src/utils/colorVariant.ts +162 -0
- package/packages/shared-components/src/utils/date.ts +25 -0
- package/packages/shared-components/src/utils/file.ts +22 -0
- package/packages/shared-components/src/utils/index.ts +11 -0
- package/packages/shared-components/src/utils/theme/colorPalette.ts +112 -0
- package/packages/shared-components/src/utils/theme/colorPaletteUI.tsx +44 -0
- package/packages/shared-components/src/utils/theme/paletteDark.ts +10 -0
- package/packages/shared-components/src/utils/theme/paletteLight.ts +31 -0
- package/packages/shared-components/src/utils/theme/theme.ts +297 -0
- package/packages/shared-components/src/utils/theme/types.ts +18 -0
- package/packages/shared-components/src/utils/theme/typography.ts +52 -0
- package/packages/shared-components/src/utils/urlToNestedObject.ts +9 -0
- package/packages/shared-components/tsconfig.json +8 -0
- package/packages/shared-components/tsconfig.lint.json +8 -0
- package/packages/shared-components/webpack/cjs.js +20 -0
- package/packages/shared-components/webpack/common.js +36 -0
- package/packages/typescript-config/base.json +20 -0
- package/packages/typescript-config/nextjs.json +13 -0
- package/packages/typescript-config/package.json +9 -0
- package/packages/typescript-config/react-library.json +8 -0
- package/pnpm-workspace.yaml +3 -0
- package/turbo.json +42 -0
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
/* eslint-disable sonarjs/no-nested-functions */
|
|
2
|
+
/* eslint-disable sonarjs/no-nested-conditional */
|
|
3
|
+
/* eslint-disable sonarjs/function-return-type */
|
|
4
|
+
/* eslint-disable no-use-before-define */
|
|
5
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
6
|
+
import { ExpandMore } from "@mui/icons-material";
|
|
7
|
+
import {
|
|
8
|
+
Accordion,
|
|
9
|
+
AccordionDetails,
|
|
10
|
+
AccordionSummary,
|
|
11
|
+
Box,
|
|
12
|
+
Divider,
|
|
13
|
+
Drawer,
|
|
14
|
+
IconButton,
|
|
15
|
+
Stack,
|
|
16
|
+
Typography,
|
|
17
|
+
useTheme,
|
|
18
|
+
} from "@mui/material";
|
|
19
|
+
import { ClearIcon } from "@mui/x-date-pickers/icons";
|
|
20
|
+
import { isEmpty } from "lodash";
|
|
21
|
+
import { DateTime } from "luxon";
|
|
22
|
+
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
23
|
+
import type { FieldValues } from "react-hook-form";
|
|
24
|
+
import { useForm, useWatch } from "react-hook-form";
|
|
25
|
+
import { z } from "zod";
|
|
26
|
+
import { FilterAction } from "../Actions";
|
|
27
|
+
import { Button } from "../Button";
|
|
28
|
+
import { FilterPill } from "../Chips/FilterPill";
|
|
29
|
+
import { dateFormats } from "../FormFields";
|
|
30
|
+
import { Switch } from "../FormFields/Switch";
|
|
31
|
+
import { PadBox } from "../PadBox";
|
|
32
|
+
import { toasts } from "../Toast";
|
|
33
|
+
import { Tooltip } from "../Tooltip";
|
|
34
|
+
import {
|
|
35
|
+
FilterPopUpDateRangeWrapper,
|
|
36
|
+
FilterPopupWrapper,
|
|
37
|
+
} from "./FilterPopupWrapper";
|
|
38
|
+
import type { FilterListType } from "./FilterTypeWrapper";
|
|
39
|
+
import { getFilterPopupComponent } from "./GetFilterPopupComponent";
|
|
40
|
+
import { getFormValue } from "./getFormData";
|
|
41
|
+
|
|
42
|
+
export type FilterListV2Props = {
|
|
43
|
+
filterListItems: FilterListType[];
|
|
44
|
+
isDisabled?: boolean;
|
|
45
|
+
filterListData?: FieldValues;
|
|
46
|
+
onApply: (data: FieldValues, isPopup?: boolean, key?: string) => void;
|
|
47
|
+
onChange: (data: FieldValues, isPopup: boolean) => void;
|
|
48
|
+
onClear: () => void;
|
|
49
|
+
resetFormBasedOnFields?: string;
|
|
50
|
+
dateKeys?: string[];
|
|
51
|
+
};
|
|
52
|
+
export const FilterListV2 = ({
|
|
53
|
+
filterListItems,
|
|
54
|
+
isDisabled = false,
|
|
55
|
+
filterListData,
|
|
56
|
+
onApply,
|
|
57
|
+
onClear,
|
|
58
|
+
onChange,
|
|
59
|
+
dateKeys,
|
|
60
|
+
}: FilterListV2Props) => {
|
|
61
|
+
const theme = useTheme();
|
|
62
|
+
|
|
63
|
+
const { iron, slate } = theme.palette.app.color;
|
|
64
|
+
|
|
65
|
+
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
|
|
66
|
+
|
|
67
|
+
const filterPopupAnchorElm = useRef<HTMLDivElement | null>(null);
|
|
68
|
+
|
|
69
|
+
const dateRangeAnchorRef = useRef<HTMLDivElement | null>(null);
|
|
70
|
+
|
|
71
|
+
const [openFilterPopup, setOpenFilterPopup] = useState(false);
|
|
72
|
+
|
|
73
|
+
const [datePickerPopup, setDatePickerPopup] = useState(false);
|
|
74
|
+
|
|
75
|
+
const [currentFilter, setCurrentFilter] = useState<null | FilterListType>(
|
|
76
|
+
null
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const [expandedKeys, setExpandedKeys] = useState<string[]>([]);
|
|
80
|
+
|
|
81
|
+
const handleDateRange = (filter: FilterListType) => {
|
|
82
|
+
setCurrentFilter(filter);
|
|
83
|
+
setDatePickerPopup(true);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const defaultValues: FieldValues = useMemo(() => {
|
|
87
|
+
return filterListItems.reduce<FieldValues>((acc, item) => {
|
|
88
|
+
if (item.multiSelect || item.type === "dateRange") {
|
|
89
|
+
acc[item.key] = item.value || null;
|
|
90
|
+
} else if (item.type === "switch") {
|
|
91
|
+
acc[item.key] = item.value || false;
|
|
92
|
+
} else {
|
|
93
|
+
acc[item.key] = item.value || null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return acc;
|
|
97
|
+
}, {});
|
|
98
|
+
}, [filterListData]);
|
|
99
|
+
|
|
100
|
+
const baseSchema = z.object(
|
|
101
|
+
(() => {
|
|
102
|
+
const shape: Record<string, z.ZodTypeAny> = {};
|
|
103
|
+
|
|
104
|
+
filterListItems.forEach((item) => {
|
|
105
|
+
if (item.multiSelect || item.type === "dateRange") {
|
|
106
|
+
shape[item.key] = z.array(z.string()).nullable().optional();
|
|
107
|
+
} else if (item.type === "switch") {
|
|
108
|
+
shape[item.key] = z.boolean().nullable().optional();
|
|
109
|
+
} else {
|
|
110
|
+
shape[item.key] = z.string().nullable().optional();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return shape;
|
|
115
|
+
})()
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const validationSchema = baseSchema.superRefine((data, ctx) => {
|
|
119
|
+
filterListItems.forEach((item) => {
|
|
120
|
+
if (item.required && !data[item.key]?.length) {
|
|
121
|
+
ctx.addIssue({
|
|
122
|
+
path: [item.key],
|
|
123
|
+
message: `${item.label} is required`,
|
|
124
|
+
code: z.ZodIssueCode.custom,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const {
|
|
131
|
+
control,
|
|
132
|
+
handleSubmit,
|
|
133
|
+
setValue,
|
|
134
|
+
reset,
|
|
135
|
+
formState: { errors, dirtyFields },
|
|
136
|
+
watch,
|
|
137
|
+
} = useForm({
|
|
138
|
+
values: defaultValues,
|
|
139
|
+
resolver: zodResolver(validationSchema),
|
|
140
|
+
mode: "all",
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const company_id = watch("company_id");
|
|
144
|
+
|
|
145
|
+
const business_unit_id = watch("business_unit_id");
|
|
146
|
+
|
|
147
|
+
const department_id = watch("department_id");
|
|
148
|
+
|
|
149
|
+
const handleClose = () => {
|
|
150
|
+
setAnchorEl(null);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const handleCloseFilterPopup = () => {
|
|
154
|
+
if (currentFilter?.key) {
|
|
155
|
+
setValue(`${currentFilter?.key}`, filterListData?.[currentFilter.key]);
|
|
156
|
+
}
|
|
157
|
+
setOpenFilterPopup(false);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const handleCloseDatePickerPopup = () => {
|
|
161
|
+
if (currentFilter?.key) {
|
|
162
|
+
setValue(`${currentFilter?.key}`, filterListData?.[currentFilter.key]);
|
|
163
|
+
}
|
|
164
|
+
setDatePickerPopup(false);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const handlerReset = () => {
|
|
168
|
+
reset();
|
|
169
|
+
onClear();
|
|
170
|
+
handleClose();
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
174
|
+
setAnchorEl(event.currentTarget);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const onSubmit = (data: FieldValues) => {
|
|
178
|
+
setOpenFilterPopup(false);
|
|
179
|
+
setCurrentFilter(null);
|
|
180
|
+
|
|
181
|
+
const filteredData = Object.fromEntries(
|
|
182
|
+
Object.entries(data).filter(
|
|
183
|
+
([, value]) => value && !(Array.isArray(value) && !value.length)
|
|
184
|
+
)
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
onApply(filteredData, openFilterPopup, currentFilter?.key);
|
|
188
|
+
|
|
189
|
+
handleClose();
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const handleDateRangeSubmit = () => {
|
|
193
|
+
setDatePickerPopup(false);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const onError = (error: typeof errors) => {
|
|
197
|
+
const errorKeys = Object.keys(error);
|
|
198
|
+
|
|
199
|
+
const tabsToExpand = filterListItems
|
|
200
|
+
.filter((filter) => filter.required && errorKeys.includes(filter.key))
|
|
201
|
+
.map((filter) => filter.key);
|
|
202
|
+
|
|
203
|
+
setExpandedKeys(tabsToExpand);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const getFilterItem = (key: string) => {
|
|
207
|
+
return filterListItems.find((item) => item.key === key);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const handleDelete = (key: string) => {
|
|
211
|
+
const item = getFilterItem(key);
|
|
212
|
+
|
|
213
|
+
if (item?.required) {
|
|
214
|
+
return toasts.error({
|
|
215
|
+
title: "This is a required custom filter field and cannot be removed.",
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
setValue(`${key}`, null);
|
|
220
|
+
|
|
221
|
+
const newData = { ...filterListData };
|
|
222
|
+
|
|
223
|
+
delete newData[key];
|
|
224
|
+
|
|
225
|
+
onApply(newData, true, key);
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const formData = useWatch({ control });
|
|
229
|
+
|
|
230
|
+
const currentFilterValue = currentFilter?.key
|
|
231
|
+
? currentFilter.key === "switch"
|
|
232
|
+
? watch(currentFilter.key)
|
|
233
|
+
? "true"
|
|
234
|
+
: "false"
|
|
235
|
+
: watch(currentFilter.key)
|
|
236
|
+
: null;
|
|
237
|
+
|
|
238
|
+
useEffect(() => {
|
|
239
|
+
onChange(formData, openFilterPopup);
|
|
240
|
+
}, [formData, onChange]);
|
|
241
|
+
|
|
242
|
+
useMemo(() => {
|
|
243
|
+
if (company_id !== filterListData?.company_id && !openFilterPopup) {
|
|
244
|
+
filterListItems.forEach((item) => {
|
|
245
|
+
setValue(`${item.key}`, null);
|
|
246
|
+
});
|
|
247
|
+
setValue("company_id", company_id);
|
|
248
|
+
}
|
|
249
|
+
}, [company_id]);
|
|
250
|
+
|
|
251
|
+
useMemo(() => {
|
|
252
|
+
if (
|
|
253
|
+
business_unit_id !== filterListData?.business_unit_id &&
|
|
254
|
+
!openFilterPopup
|
|
255
|
+
) {
|
|
256
|
+
setValue("business_unit_location_id", null);
|
|
257
|
+
}
|
|
258
|
+
}, [business_unit_id]);
|
|
259
|
+
|
|
260
|
+
useMemo(() => {
|
|
261
|
+
if (department_id !== filterListData?.department_id && !openFilterPopup) {
|
|
262
|
+
setValue("sub_department_id", null);
|
|
263
|
+
}
|
|
264
|
+
}, [department_id]);
|
|
265
|
+
|
|
266
|
+
const open = Boolean(anchorEl);
|
|
267
|
+
|
|
268
|
+
const shouldFormSubmit = useMemo(() => {
|
|
269
|
+
return (
|
|
270
|
+
isEmpty(dirtyFields) ||
|
|
271
|
+
Object.keys(formData).every((key) => !formData[key])
|
|
272
|
+
);
|
|
273
|
+
}, [formData, dirtyFields]);
|
|
274
|
+
|
|
275
|
+
const renderChips = (data: FieldValues) => {
|
|
276
|
+
return Object.entries(data).map(([key, value]) => {
|
|
277
|
+
if (typeof value !== "boolean" && !value) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const item = getFilterItem(key);
|
|
282
|
+
|
|
283
|
+
const keyValue =
|
|
284
|
+
item &&
|
|
285
|
+
getFormValue(
|
|
286
|
+
dateKeys?.includes(item?.key)
|
|
287
|
+
? DateTime.fromISO(value).toFormat(dateFormats.dateWithEuropean)
|
|
288
|
+
: value,
|
|
289
|
+
item
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
if (typeof value !== "boolean" && !keyValue) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return (
|
|
297
|
+
<FilterPill
|
|
298
|
+
ref={filterPopupAnchorElm}
|
|
299
|
+
key={key}
|
|
300
|
+
label={
|
|
301
|
+
<Tooltip
|
|
302
|
+
// eslint-disable-next-line sonarjs/no-base-to-string
|
|
303
|
+
toolTipLabel={`${keyValue}`}
|
|
304
|
+
// eslint-disable-next-line sonarjs/no-base-to-string
|
|
305
|
+
>{`${item?.label}: ${keyValue}`}</Tooltip>
|
|
306
|
+
}
|
|
307
|
+
onDelete={() => handleDelete(key)}
|
|
308
|
+
onClick={(e: { currentTarget: HTMLDivElement | null }) => {
|
|
309
|
+
setOpenFilterPopup(true);
|
|
310
|
+
filterPopupAnchorElm.current = e.currentTarget;
|
|
311
|
+
|
|
312
|
+
const item = getFilterItem(key);
|
|
313
|
+
|
|
314
|
+
if (item) {
|
|
315
|
+
setCurrentFilter(item);
|
|
316
|
+
}
|
|
317
|
+
}}
|
|
318
|
+
/>
|
|
319
|
+
);
|
|
320
|
+
});
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
return (
|
|
324
|
+
<Box sx={{ flexGrow: 1 }}>
|
|
325
|
+
<Stack
|
|
326
|
+
direction="row"
|
|
327
|
+
spacing={1}
|
|
328
|
+
alignItems="flex-start"
|
|
329
|
+
justifyContent="space-between"
|
|
330
|
+
>
|
|
331
|
+
<Stack
|
|
332
|
+
direction="row"
|
|
333
|
+
alignItems="flex-start"
|
|
334
|
+
sx={{
|
|
335
|
+
maxWidth: {
|
|
336
|
+
xs: "40vw",
|
|
337
|
+
md: "45vw",
|
|
338
|
+
lg: "57vw",
|
|
339
|
+
},
|
|
340
|
+
}}
|
|
341
|
+
>
|
|
342
|
+
{filterListData &&
|
|
343
|
+
Object.values(filterListData).some((value) => value) && (
|
|
344
|
+
<>
|
|
345
|
+
<Typography
|
|
346
|
+
variant="body1"
|
|
347
|
+
sx={{
|
|
348
|
+
minWidth: "60px",
|
|
349
|
+
marginTop: "8px",
|
|
350
|
+
}}
|
|
351
|
+
>
|
|
352
|
+
Filters:
|
|
353
|
+
</Typography>
|
|
354
|
+
|
|
355
|
+
<Stack
|
|
356
|
+
direction="row"
|
|
357
|
+
gap="5px"
|
|
358
|
+
marginTop="3px"
|
|
359
|
+
alignItems="center"
|
|
360
|
+
sx={{ flexWrap: "wrap", maxWidth: "100%" }}
|
|
361
|
+
>
|
|
362
|
+
{renderChips(filterListData)}
|
|
363
|
+
</Stack>
|
|
364
|
+
</>
|
|
365
|
+
)}
|
|
366
|
+
</Stack>
|
|
367
|
+
|
|
368
|
+
<Stack direction="row">
|
|
369
|
+
{filterListData &&
|
|
370
|
+
Object.values(filterListData).some((value) => value) && (
|
|
371
|
+
<Button onClick={() => handlerReset()} variant="text">
|
|
372
|
+
Clear Filter
|
|
373
|
+
</Button>
|
|
374
|
+
)}
|
|
375
|
+
|
|
376
|
+
{!isDisabled && <FilterAction onClick={handleClick} />}
|
|
377
|
+
</Stack>
|
|
378
|
+
</Stack>
|
|
379
|
+
<form
|
|
380
|
+
onSubmit={(e) => {
|
|
381
|
+
e.preventDefault();
|
|
382
|
+
|
|
383
|
+
if (!shouldFormSubmit) {
|
|
384
|
+
handleSubmit((data) => {
|
|
385
|
+
onSubmit(data);
|
|
386
|
+
}, onError)();
|
|
387
|
+
}
|
|
388
|
+
}}
|
|
389
|
+
onKeyDown={(e) => {
|
|
390
|
+
if (e.key === "Enter") {
|
|
391
|
+
e.preventDefault();
|
|
392
|
+
|
|
393
|
+
if (!shouldFormSubmit) {
|
|
394
|
+
handleSubmit((data) => {
|
|
395
|
+
onSubmit(data);
|
|
396
|
+
}, onError)();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}}
|
|
400
|
+
>
|
|
401
|
+
<Drawer
|
|
402
|
+
open={open}
|
|
403
|
+
onClose={(_event, reason) => {
|
|
404
|
+
if (reason === "backdropClick") {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
handleClose();
|
|
408
|
+
}}
|
|
409
|
+
anchor="right"
|
|
410
|
+
sx={{
|
|
411
|
+
zIndex: theme.zIndex.drawer + 2,
|
|
412
|
+
"& .MuiPaper-root": {
|
|
413
|
+
width: "350px",
|
|
414
|
+
},
|
|
415
|
+
}}
|
|
416
|
+
>
|
|
417
|
+
<Stack
|
|
418
|
+
alignItems="flex-end"
|
|
419
|
+
sx={{
|
|
420
|
+
background: iron[600],
|
|
421
|
+
}}
|
|
422
|
+
>
|
|
423
|
+
<PadBox padding={{ padding: "10px 30px" }}>
|
|
424
|
+
<Stack
|
|
425
|
+
direction="row"
|
|
426
|
+
justifyContent="space-between"
|
|
427
|
+
width="100%"
|
|
428
|
+
alignItems="center"
|
|
429
|
+
>
|
|
430
|
+
<Typography variant="h6">Filter</Typography>
|
|
431
|
+
|
|
432
|
+
<IconButton
|
|
433
|
+
onClick={() => {
|
|
434
|
+
reset();
|
|
435
|
+
handleClose();
|
|
436
|
+
}}
|
|
437
|
+
>
|
|
438
|
+
<ClearIcon />
|
|
439
|
+
</IconButton>
|
|
440
|
+
</Stack>
|
|
441
|
+
</PadBox>
|
|
442
|
+
|
|
443
|
+
<Divider sx={{ width: "100%" }} />
|
|
444
|
+
</Stack>
|
|
445
|
+
|
|
446
|
+
<Stack flexGrow={1} sx={{ overflowX: "hidden" }}>
|
|
447
|
+
{filterListItems.map((filter) =>
|
|
448
|
+
filter.type === "switch" ? (
|
|
449
|
+
<Stack
|
|
450
|
+
key={filter.key}
|
|
451
|
+
direction="row"
|
|
452
|
+
justifyContent="space-between"
|
|
453
|
+
alignItems="center"
|
|
454
|
+
width="80%"
|
|
455
|
+
sx={{ padding: "10px 5px 10px 20px ", margin: "auto" }}
|
|
456
|
+
>
|
|
457
|
+
<Typography variant="body2">{filter.label}</Typography>
|
|
458
|
+
|
|
459
|
+
<Switch control={control} name={filter.key} />
|
|
460
|
+
</Stack>
|
|
461
|
+
) : (
|
|
462
|
+
<Accordion
|
|
463
|
+
defaultExpanded={!!filterListData?.[filter.key]}
|
|
464
|
+
disabled={filter.isDisabled}
|
|
465
|
+
key={filter.key}
|
|
466
|
+
expanded={expandedKeys.includes(filter.key)}
|
|
467
|
+
onChange={() => {
|
|
468
|
+
setExpandedKeys((prev) =>
|
|
469
|
+
prev.includes(filter.key)
|
|
470
|
+
? prev.filter((k) => k !== filter.key)
|
|
471
|
+
: [...prev, filter.key]
|
|
472
|
+
);
|
|
473
|
+
}}
|
|
474
|
+
sx={{
|
|
475
|
+
"&.MuiAccordion-root.Mui-expanded": {
|
|
476
|
+
margin: "0 !important",
|
|
477
|
+
},
|
|
478
|
+
}}
|
|
479
|
+
>
|
|
480
|
+
<AccordionSummary
|
|
481
|
+
expandIcon={<ExpandMore />}
|
|
482
|
+
aria-controls="panel1a-content"
|
|
483
|
+
id="panel1a-header"
|
|
484
|
+
sx={{
|
|
485
|
+
flexDirection: "row-reverse",
|
|
486
|
+
"& MuiAccordionSummary-root.Mui-expanded": {
|
|
487
|
+
marginRight: "10px",
|
|
488
|
+
transform: "rotate(-90deg)",
|
|
489
|
+
},
|
|
490
|
+
"&.Mui-expanded": {
|
|
491
|
+
minHeight: "40px",
|
|
492
|
+
paddingY: "5px",
|
|
493
|
+
},
|
|
494
|
+
"& .MuiAccordionSummary-content.Mui-expanded": {
|
|
495
|
+
margin: "0px",
|
|
496
|
+
},
|
|
497
|
+
}}
|
|
498
|
+
>
|
|
499
|
+
<Stack
|
|
500
|
+
direction="row"
|
|
501
|
+
justifyContent="space-between"
|
|
502
|
+
alignItems="center"
|
|
503
|
+
width="90%"
|
|
504
|
+
>
|
|
505
|
+
<Stack direction="row" alignItems="center" gap="5px">
|
|
506
|
+
<Typography variant="body2">{filter.label}</Typography>
|
|
507
|
+
|
|
508
|
+
{filter.required && (
|
|
509
|
+
<Typography color="error">*</Typography>
|
|
510
|
+
)}
|
|
511
|
+
</Stack>
|
|
512
|
+
|
|
513
|
+
<Typography variant="body2">{filter.menuInfo}</Typography>
|
|
514
|
+
</Stack>
|
|
515
|
+
</AccordionSummary>
|
|
516
|
+
<AccordionDetails
|
|
517
|
+
sx={{
|
|
518
|
+
background: slate[600],
|
|
519
|
+
borderRadius: "5px",
|
|
520
|
+
padding: "0px",
|
|
521
|
+
}}
|
|
522
|
+
>
|
|
523
|
+
<PadBox
|
|
524
|
+
padding={{
|
|
525
|
+
paddingLeft: "15px",
|
|
526
|
+
paddingY: "5px",
|
|
527
|
+
paddingRight: "15px",
|
|
528
|
+
}}
|
|
529
|
+
>
|
|
530
|
+
{filter.type === "dateRange" ? (
|
|
531
|
+
<Stack
|
|
532
|
+
direction="row"
|
|
533
|
+
alignItems="center"
|
|
534
|
+
gap="10px"
|
|
535
|
+
onClick={(e) => {
|
|
536
|
+
handleDateRange(filter);
|
|
537
|
+
dateRangeAnchorRef.current = e.currentTarget;
|
|
538
|
+
}}
|
|
539
|
+
>
|
|
540
|
+
<Box
|
|
541
|
+
sx={{
|
|
542
|
+
border: "1px solid black",
|
|
543
|
+
borderRadius: "5px",
|
|
544
|
+
width: "150px",
|
|
545
|
+
p: 1,
|
|
546
|
+
}}
|
|
547
|
+
>
|
|
548
|
+
<Typography variant="body2">
|
|
549
|
+
{Array.isArray(watch(filter.key)) &&
|
|
550
|
+
watch(filter.key)[0]
|
|
551
|
+
? DateTime.fromISO(
|
|
552
|
+
watch(filter.key)[0]
|
|
553
|
+
).toFormat(dateFormats.dateWithEuropean)
|
|
554
|
+
: "Start Date"}
|
|
555
|
+
</Typography>
|
|
556
|
+
</Box>
|
|
557
|
+
|
|
558
|
+
<Typography>~</Typography>
|
|
559
|
+
|
|
560
|
+
<Box
|
|
561
|
+
sx={{
|
|
562
|
+
border: "1px solid black",
|
|
563
|
+
borderRadius: "5px",
|
|
564
|
+
width: "150px",
|
|
565
|
+
p: 1,
|
|
566
|
+
}}
|
|
567
|
+
>
|
|
568
|
+
<Typography variant="body2">
|
|
569
|
+
{Array.isArray(watch(filter.key)) &&
|
|
570
|
+
watch(filter.key)[1]
|
|
571
|
+
? DateTime.fromISO(
|
|
572
|
+
watch(filter.key)[1]
|
|
573
|
+
).toFormat(dateFormats.dateWithEuropean)
|
|
574
|
+
: "End Date"}
|
|
575
|
+
</Typography>
|
|
576
|
+
</Box>
|
|
577
|
+
</Stack>
|
|
578
|
+
) : (
|
|
579
|
+
<Box>
|
|
580
|
+
{
|
|
581
|
+
getFilterPopupComponent(filter, control, errors)[
|
|
582
|
+
filter.type
|
|
583
|
+
]
|
|
584
|
+
}
|
|
585
|
+
</Box>
|
|
586
|
+
)}
|
|
587
|
+
</PadBox>
|
|
588
|
+
</AccordionDetails>
|
|
589
|
+
</Accordion>
|
|
590
|
+
)
|
|
591
|
+
)}
|
|
592
|
+
</Stack>
|
|
593
|
+
|
|
594
|
+
<Divider
|
|
595
|
+
sx={{ width: "100%", position: "absolute", bottom: "70px" }}
|
|
596
|
+
/>
|
|
597
|
+
<Stack height="70px">
|
|
598
|
+
<PadBox padding={{ padding: "10px" }}>
|
|
599
|
+
<Stack
|
|
600
|
+
direction="row"
|
|
601
|
+
gap="10px"
|
|
602
|
+
sx={{ position: "absolute", bottom: "15px" }}
|
|
603
|
+
>
|
|
604
|
+
<Button
|
|
605
|
+
type="submit"
|
|
606
|
+
disabled={shouldFormSubmit}
|
|
607
|
+
variant="contained"
|
|
608
|
+
onClick={() => {
|
|
609
|
+
handleSubmit(onSubmit, onError)();
|
|
610
|
+
}}
|
|
611
|
+
>
|
|
612
|
+
Apply
|
|
613
|
+
</Button>
|
|
614
|
+
<Button
|
|
615
|
+
type="button"
|
|
616
|
+
onClick={() => handlerReset()}
|
|
617
|
+
disabled={Object.keys(formData).every(
|
|
618
|
+
(key) => !formData[key]
|
|
619
|
+
)}
|
|
620
|
+
variant="outlined"
|
|
621
|
+
>
|
|
622
|
+
Reset
|
|
623
|
+
</Button>
|
|
624
|
+
</Stack>
|
|
625
|
+
</PadBox>
|
|
626
|
+
</Stack>
|
|
627
|
+
</Drawer>
|
|
628
|
+
</form>
|
|
629
|
+
|
|
630
|
+
{currentFilter && (
|
|
631
|
+
<FilterPopupWrapper
|
|
632
|
+
open={openFilterPopup}
|
|
633
|
+
onClose={handleCloseFilterPopup}
|
|
634
|
+
onApply={() => {
|
|
635
|
+
handleSubmit(onSubmit)();
|
|
636
|
+
}}
|
|
637
|
+
control={control}
|
|
638
|
+
errors={errors}
|
|
639
|
+
reset={reset}
|
|
640
|
+
anchorEl={filterPopupAnchorElm.current}
|
|
641
|
+
filterItem={currentFilter}
|
|
642
|
+
currentFilterValue={currentFilterValue}
|
|
643
|
+
/>
|
|
644
|
+
)}
|
|
645
|
+
|
|
646
|
+
{currentFilter && (
|
|
647
|
+
<FilterPopUpDateRangeWrapper
|
|
648
|
+
open={datePickerPopup}
|
|
649
|
+
onClose={handleCloseDatePickerPopup}
|
|
650
|
+
onApply={() => {
|
|
651
|
+
handleDateRangeSubmit();
|
|
652
|
+
}}
|
|
653
|
+
control={control}
|
|
654
|
+
errors={errors}
|
|
655
|
+
anchorEl={dateRangeAnchorRef.current}
|
|
656
|
+
filterItem={currentFilter}
|
|
657
|
+
/>
|
|
658
|
+
)}
|
|
659
|
+
</Box>
|
|
660
|
+
);
|
|
661
|
+
};
|