@campxdev/shared 0.1.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/.eslintrc.js +34 -0
- package/.prettierrc +10 -0
- package/.storybook/main.js +16 -0
- package/.storybook/preview.js +9 -0
- package/antd.customize.less +73 -0
- package/exports.ts +20 -0
- package/package.json +78 -0
- package/public/dean.JPG +0 -0
- package/public/download.png +0 -0
- package/public/illustrations/bookmark.svg +19 -0
- package/public/illustrations/girl-writing.png +0 -0
- package/public/illustrations/whiteboard.svg +24 -0
- package/public/images/AnimatedUploadFile.gif +0 -0
- package/public/images/doc@2x.png +0 -0
- package/public/images/greenTick.png +0 -0
- package/public/images/jpg.png +0 -0
- package/public/images/paperclip@2x.png +0 -0
- package/public/images/pdf.png +0 -0
- package/public/images/ppt.png +0 -0
- package/public/images/profileImage.jpg +0 -0
- package/public/images/profileImage.png +0 -0
- package/public/index.html +50 -0
- package/public/logo.png +0 -0
- package/public/logo_campx_full.png +0 -0
- package/public/logo_square.svg +21 -0
- package/public/omr_sign.jpg +0 -0
- package/src/App.tsx +35 -0
- package/src/assets/fonts/avenir/Avenir.ttc +0 -0
- package/src/assets/fonts/avenir/index.ts +2 -0
- package/src/assets/fonts/poppins/Poppins-Bold.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-Italic.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-Light.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-LightItalic.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-Medium.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-MediumItalic.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-Regular.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-SemiBold.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-SemiBoldItalic.ttf +0 -0
- package/src/assets/fonts/poppins/index.ts +7 -0
- package/src/assets/images/File bundle-bro.svg +122 -0
- package/src/assets/images/Filebundle.png +0 -0
- package/src/assets/images/NoPart.png +0 -0
- package/src/assets/images/ResultProcess.png +0 -0
- package/src/assets/images/ResultProcess.svg +99 -0
- package/src/assets/images/attachment.svg +1 -0
- package/src/assets/images/avatar.png +0 -0
- package/src/assets/images/index.ts +19 -0
- package/src/assets/images/pdf.png +0 -0
- package/src/assets/images/taskAttachment.png +0 -0
- package/src/assets/images/welcomeimage.jpg +0 -0
- package/src/assets/static_files/External_Marks_Import .xlsx +0 -0
- package/src/assets/static_files/Leads_Sample.xlsx +0 -0
- package/src/assets/static_files/Subject_Topic_Import_Sheet.xlsx +0 -0
- package/src/assets/static_files/admissions_Sample.xlsx +0 -0
- package/src/assets/static_files/barcodes_template.xlsx +0 -0
- package/src/assets/static_files/hostel_rooms_import.xlsx +0 -0
- package/src/assets/static_files/index.ts +24 -0
- package/src/assets/static_files/sample_admissions.xlsx +0 -0
- package/src/assets/static_files/sample_admissions_report.xlsx +0 -0
- package/src/assets/static_files/sample_curriculum_subjects_template.xlsx +0 -0
- package/src/assets/static_files/sample_import_students_new.xlsx +0 -0
- package/src/assets/static_files/sample_internal_marks.xlsx +0 -0
- package/src/assets/static_files/sample_student_subjects_template.xlsx +0 -0
- package/src/components/ActionButton.tsx +28 -0
- package/src/components/Attachment.tsx +26 -0
- package/src/components/AutocompleteSearch/AutocompleteSearch.tsx +57 -0
- package/src/components/AutocompleteSearch/index.tsx +1 -0
- package/src/components/Breadcrumbs.tsx +73 -0
- package/src/components/Card.tsx +97 -0
- package/src/components/CardsGrid.tsx +28 -0
- package/src/components/Chips.tsx +77 -0
- package/src/components/Detail.tsx +15 -0
- package/src/components/DetailsGrid.tsx +52 -0
- package/src/components/DividerHeading.tsx +40 -0
- package/src/components/DrawerWrapper/DialogWrapper.tsx +63 -0
- package/src/components/DrawerWrapper/DrawerTemplate.tsx +53 -0
- package/src/components/DrawerWrapper/DrawerWrapper.tsx +53 -0
- package/src/components/DropDownButton.tsx +184 -0
- package/src/components/ErrorBoundary.js +45 -0
- package/src/components/ErrorBox.tsx +42 -0
- package/src/components/FloatingContainer.tsx +26 -0
- package/src/components/FullCalendar/Actions.tsx +162 -0
- package/src/components/FullCalendar/FullCalendarWrapper.tsx +54 -0
- package/src/components/HookForm/AutoCompleteSearch.tsx +143 -0
- package/src/components/HookForm/DatePicker.tsx +65 -0
- package/src/components/HookForm/DateTimePicker.tsx +70 -0
- package/src/components/HookForm/FormLabel.tsx +14 -0
- package/src/components/HookForm/MultiCheckbox.tsx +82 -0
- package/src/components/HookForm/MultiSelect.tsx +100 -0
- package/src/components/HookForm/RadioGroup.tsx +113 -0
- package/src/components/HookForm/SingleCheckbox.tsx +46 -0
- package/src/components/HookForm/SingleSelect.tsx +93 -0
- package/src/components/HookForm/TextField.tsx +74 -0
- package/src/components/HookForm/TimePicker.tsx +82 -0
- package/src/components/HookForm/index.ts +23 -0
- package/src/components/IconButtons/IconButtons.tsx +137 -0
- package/src/components/IconButtons/Icons.tsx +269 -0
- package/src/components/IconButtons/assets/edit.svg +4 -0
- package/src/components/IconButtons/assets/eye.svg +6 -0
- package/src/components/IconButtons/assets/trash.svg +7 -0
- package/src/components/IconButtons/index.tsx +8 -0
- package/src/components/IconLabel.tsx +37 -0
- package/src/components/Image/Image.tsx +43 -0
- package/src/components/Image/broken-image.png +0 -0
- package/src/components/Image/index.tsx +1 -0
- package/src/components/ImageUpload.tsx +98 -0
- package/src/components/Input/AutoCompleteSearch.tsx +143 -0
- package/src/components/Input/DatePicker.tsx +60 -0
- package/src/components/Input/DateRangePicker.tsx +131 -0
- package/src/components/Input/DateTimePicker.tsx +70 -0
- package/src/components/Input/FormLabel.tsx +14 -0
- package/src/components/Input/MultiCheckbox.tsx +79 -0
- package/src/components/Input/MultiSelect.tsx +52 -0
- package/src/components/Input/RadioGroup.tsx +55 -0
- package/src/components/Input/SingleCheckbox.tsx +23 -0
- package/src/components/Input/SingleSelect.tsx +139 -0
- package/src/components/Input/TextField.tsx +50 -0
- package/src/components/Input/TimePicker.tsx +82 -0
- package/src/components/Input/index.ts +26 -0
- package/src/components/JsonPreview/JsonPreview.tsx +7 -0
- package/src/components/JsonPreview/index.tsx +1 -0
- package/src/components/LabelValue/LabelValue.tsx +21 -0
- package/src/components/LabelValue/index.tsx +1 -0
- package/src/components/Layout/ChangePassword.tsx +49 -0
- package/src/components/Layout/Header/AppHeader.tsx +150 -0
- package/src/components/Layout/Header/CogWheelMenu.tsx +35 -0
- package/src/components/Layout/Header/FreshDeskHelpButton.tsx +19 -0
- package/src/components/Layout/Header/MainAppHeader.tsx +6 -0
- package/src/components/Layout/Header/Notification.tsx +13 -0
- package/src/components/Layout/Header/UserBox.tsx +51 -0
- package/src/components/Layout/Header/applications.tsx +39 -0
- package/src/components/Layout/Header/icons.tsx +57 -0
- package/src/components/Layout/Header/index.tsx +1 -0
- package/src/components/Layout/Header/styles.tsx +48 -0
- package/src/components/LinearProgress/LinearProgress.tsx +27 -0
- package/src/components/LinearProgress/index.tsx +1 -0
- package/src/components/MediaRow/MediaRow.tsx +69 -0
- package/src/components/MediaRow/index.tsx +1 -0
- package/src/components/MenuButton.tsx +105 -0
- package/src/components/ModalButtons/DialogButton.tsx +84 -0
- package/src/components/ModalButtons/DrawerButton.tsx +89 -0
- package/src/components/ModalButtons/index.tsx +4 -0
- package/src/components/NoDataIllustration/NoDataIllustration.tsx +32 -0
- package/src/components/NoDataIllustration/index.tsx +1 -0
- package/src/components/PageContent.tsx +14 -0
- package/src/components/PageHeader.tsx +52 -0
- package/src/components/PopupConfirm/ConfirmContextProvider.tsx +22 -0
- package/src/components/PopupConfirm/PopupConfirm.tsx +33 -0
- package/src/components/PopupConfirm/index.tsx +1 -0
- package/src/components/PopupConfirm/useConfirm.ts +47 -0
- package/src/components/Row/Row.tsx +24 -0
- package/src/components/Row/index.tsx +1 -0
- package/src/components/SearchBar/SearchBar.tsx +53 -0
- package/src/components/SearchBar/index.tsx +1 -0
- package/src/components/Spinner.tsx +18 -0
- package/src/components/StepsHeader/StepsHeader.tsx +115 -0
- package/src/components/StepsHeader/index.tsx +1 -0
- package/src/components/Styled/OutlinedIconButton.tsx +7 -0
- package/src/components/Styled/index.tsx +1 -0
- package/src/components/StyledTableContainer.tsx +33 -0
- package/src/components/Swiper/Swiper.tsx +39 -0
- package/src/components/Swiper/index.tsx +1 -0
- package/src/components/SwitchButton/SwitchButton.tsx +41 -0
- package/src/components/SwitchButton/index.tsx +1 -0
- package/src/components/TableComponent/BatchActionsHeader.tsx +58 -0
- package/src/components/TableComponent/Icons/index.tsx +50 -0
- package/src/components/TableComponent/ReactTable.tsx +293 -0
- package/src/components/TableComponent/RenderTableBody.tsx +65 -0
- package/src/components/TableComponent/TableFooter/TableFooter.tsx +102 -0
- package/src/components/TableComponent/TableFooter/index.tsx +1 -0
- package/src/components/TableComponent/TableFooter/styles.tsx +28 -0
- package/src/components/TableComponent/index.tsx +219 -0
- package/src/components/TableComponent/no-data-illu.svg +1 -0
- package/src/components/TableComponent/react-table-config.d.ts +129 -0
- package/src/components/TableComponent/styles.tsx +173 -0
- package/src/components/TableComponent/types.ts +57 -0
- package/src/components/Tabs/Tabs.tsx +52 -0
- package/src/components/Tabs/TabsContainer.tsx +50 -0
- package/src/components/Tabs/index.tsx +1 -0
- package/src/components/Tabs/styles.tsx +55 -0
- package/src/components/ToastContainer/ToastContainer.tsx +42 -0
- package/src/components/ToastContainer/index.tsx +1 -0
- package/src/components/UploadButton/UploadButton.tsx +98 -0
- package/src/components/UploadButton/index.tsx +1 -0
- package/src/components/UploadButton/types.ts +14 -0
- package/src/components/UploadDocument/UploadDocument.tsx +108 -0
- package/src/components/UploadDocument/index.tsx +1 -0
- package/src/components/UploadFileDialog/UploadFileDialog.tsx +240 -0
- package/src/components/UploadFileDialog/index.tsx +1 -0
- package/src/components/index.ts +59 -0
- package/src/config/axios.ts +138 -0
- package/src/constants/UIConstants.ts +97 -0
- package/src/constants/formValidations.ts +6 -0
- package/src/constants/index.ts +4 -0
- package/src/constants/permissions.ts +67 -0
- package/src/constants/validateMessages.ts +12 -0
- package/src/contexts/Providers.tsx +24 -0
- package/src/contexts/QueryClientProvider.tsx +22 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useFetch.ts +53 -0
- package/src/hooks/useRouter.ts +31 -0
- package/src/index.tsx +9 -0
- package/src/layouts/ComponentsLayout.tsx +3 -0
- package/src/pages/LoginPage/LoginPage.tsx +166 -0
- package/src/pages/LoginPage/index.ts +1 -0
- package/src/pages/LoginPage/styles.tsx +121 -0
- package/src/pages/index.ts +4 -0
- package/src/permissions/PageWithPermission.tsx +58 -0
- package/src/permissions/PermissionDeniedPage.tsx +23 -0
- package/src/permissions/PermissionsStore.ts +289 -0
- package/src/permissions/ValidateAccess.tsx +18 -0
- package/src/permissions/index.ts +3 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/shared-state/AssetsStore.ts +15 -0
- package/src/shared-state/UserStore.ts +13 -0
- package/src/shared-state/index.ts +3 -0
- package/src/stories/Button.stories.tsx +41 -0
- package/src/stories/Button.tsx +48 -0
- package/src/stories/Header.stories.tsx +25 -0
- package/src/stories/Header.tsx +56 -0
- package/src/stories/Introduction.stories.mdx +211 -0
- package/src/stories/Page.stories.tsx +26 -0
- package/src/stories/Page.tsx +73 -0
- package/src/stories/TextField.stories.tsx +18 -0
- package/src/stories/TextField.tsx +49 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +69 -0
- package/src/theme/App.less +3 -0
- package/src/theme/MuiThemeProvider.tsx +11 -0
- package/src/theme/customCssBaseline.ts +78 -0
- package/src/theme/index.css +75 -0
- package/src/theme/muiTheme.ts +516 -0
- package/src/theme/theme.d.ts +75 -0
- package/src/utils/alphabet.ts +23 -0
- package/src/utils/arrayPadEnd.ts +3 -0
- package/src/utils/formatCurrency.ts +9 -0
- package/src/utils/getUrlParams.ts +5 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/ordinalSuffixOf.ts +14 -0
- package/src/utils/romanize.ts +40 -0
- package/src/utils/withRouteWrapper.tsx +25 -0
- package/src/utils/withSuspense.tsx +6 -0
- package/styled-components.tsx +60 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Alert as MuiAlert, styled } from '@mui/material'
|
|
2
|
+
import _ from 'lodash'
|
|
3
|
+
import { ReactNode } from 'react'
|
|
4
|
+
|
|
5
|
+
export default function ErrorBox({
|
|
6
|
+
err,
|
|
7
|
+
extra,
|
|
8
|
+
}: {
|
|
9
|
+
err: any
|
|
10
|
+
extra?: string | ReactNode
|
|
11
|
+
}) {
|
|
12
|
+
if (!err) {
|
|
13
|
+
return null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (err.response) {
|
|
17
|
+
if (err.response.status == 401) {
|
|
18
|
+
return (
|
|
19
|
+
<Alert severity={'error'}>
|
|
20
|
+
{_.get(err, 'response.data.message', 'Server error!')} {extra}
|
|
21
|
+
</Alert>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
if (err.response.status == 422) {
|
|
25
|
+
return (
|
|
26
|
+
<Alert severity={'error'}>
|
|
27
|
+
{_.get(err, 'response.data.message', 'Server error!')} {extra}
|
|
28
|
+
</Alert>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Alert severity={'error'}>
|
|
34
|
+
{'Unknown Error'} {extra}
|
|
35
|
+
</Alert>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const Alert = styled(MuiAlert)(({}) => ({
|
|
41
|
+
marginTop: '20px',
|
|
42
|
+
}))
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Box, styled } from '@mui/material'
|
|
2
|
+
export const StyledFooter = styled(Box)<{
|
|
3
|
+
show: boolean
|
|
4
|
+
}>`
|
|
5
|
+
position: fixed;
|
|
6
|
+
background: #fff;
|
|
7
|
+
bottom: ${(props) => (props.show ? '0' : '-70px')};
|
|
8
|
+
right: 16px;
|
|
9
|
+
width: calc(100% - 236px);
|
|
10
|
+
height: 64px;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: 1.5rem;
|
|
15
|
+
padding: 1rem;
|
|
16
|
+
transition: bottom 400ms ease-in-out;
|
|
17
|
+
box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
|
|
18
|
+
`
|
|
19
|
+
function FloatingContainer({ children, show }) {
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<StyledFooter show={show}>{children}</StyledFooter>
|
|
23
|
+
</>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
export default FloatingContainer
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { ElementType, FC, ReactNode } from 'react'
|
|
2
|
+
import { format } from 'date-fns'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
import { Grid, IconButton, Tooltip, Typography } from '@mui/material'
|
|
5
|
+
|
|
6
|
+
import ViewAgendaTwoToneIcon from '@mui/icons-material/ViewAgendaTwoTone'
|
|
7
|
+
|
|
8
|
+
import ViewDayTwoToneIcon from '@mui/icons-material/ViewDayTwoTone'
|
|
9
|
+
import CalendarViewMonthTwoToneIcon from '@mui/icons-material/CalendarViewMonthTwoTone'
|
|
10
|
+
import ViewWeekTwoToneIcon from '@mui/icons-material/ViewWeekTwoTone'
|
|
11
|
+
import TodayTwoToneIcon from '@mui/icons-material/TodayTwoTone'
|
|
12
|
+
import ArrowForwardTwoToneIcon from '@mui/icons-material/ArrowForwardTwoTone'
|
|
13
|
+
import ArrowBackTwoToneIcon from '@mui/icons-material/ArrowBackTwoTone'
|
|
14
|
+
|
|
15
|
+
export type View = 'dayGridMonth' | 'timeGridWeek' | 'timeGridDay' | 'listWeek'
|
|
16
|
+
|
|
17
|
+
interface ActionsProps {
|
|
18
|
+
children?: ReactNode
|
|
19
|
+
className?: string
|
|
20
|
+
date: Date
|
|
21
|
+
onNext?: () => void
|
|
22
|
+
onPrevious?: () => void
|
|
23
|
+
onToday?: () => void
|
|
24
|
+
handleCreateEvent?: () => void
|
|
25
|
+
changeView?: (view: View) => void
|
|
26
|
+
view: View
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface ViewOption {
|
|
30
|
+
label: string
|
|
31
|
+
value: View
|
|
32
|
+
icon: ElementType
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const viewOptions: ViewOption[] = [
|
|
36
|
+
{
|
|
37
|
+
label: 'Month',
|
|
38
|
+
value: 'dayGridMonth',
|
|
39
|
+
icon: CalendarViewMonthTwoToneIcon,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: 'Week',
|
|
43
|
+
value: 'timeGridWeek',
|
|
44
|
+
icon: ViewWeekTwoToneIcon,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: 'Day',
|
|
48
|
+
value: 'timeGridDay',
|
|
49
|
+
icon: ViewDayTwoToneIcon,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: 'Agenda',
|
|
53
|
+
value: 'listWeek',
|
|
54
|
+
icon: ViewAgendaTwoToneIcon,
|
|
55
|
+
},
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
const Actions: FC<ActionsProps> = ({
|
|
59
|
+
date,
|
|
60
|
+
onNext,
|
|
61
|
+
onPrevious,
|
|
62
|
+
onToday,
|
|
63
|
+
changeView,
|
|
64
|
+
view,
|
|
65
|
+
}) => {
|
|
66
|
+
return (
|
|
67
|
+
<Grid
|
|
68
|
+
container
|
|
69
|
+
spacing={3}
|
|
70
|
+
alignItems="center"
|
|
71
|
+
justifyContent="space-between"
|
|
72
|
+
marginBottom={'20px'}
|
|
73
|
+
>
|
|
74
|
+
<Grid item>
|
|
75
|
+
{/* <Tooltip arrow placement="top" title={'Previous Day'}>
|
|
76
|
+
<IconButton color="primary" onClick={onPrevious}>
|
|
77
|
+
<ArrowBackTwoToneIcon />
|
|
78
|
+
</IconButton>
|
|
79
|
+
</Tooltip>
|
|
80
|
+
<Tooltip arrow placement="top" title={'Today'}>
|
|
81
|
+
<IconButton
|
|
82
|
+
color="primary"
|
|
83
|
+
sx={{
|
|
84
|
+
mx: 1,
|
|
85
|
+
}}
|
|
86
|
+
onClick={onToday}
|
|
87
|
+
>
|
|
88
|
+
<TodayTwoToneIcon />
|
|
89
|
+
</IconButton>
|
|
90
|
+
</Tooltip>
|
|
91
|
+
<Tooltip arrow placement="top" title={'Next Day'}>
|
|
92
|
+
<IconButton color="primary" onClick={onNext}>
|
|
93
|
+
<ArrowForwardTwoToneIcon />
|
|
94
|
+
</IconButton>
|
|
95
|
+
</Tooltip> */}
|
|
96
|
+
</Grid>
|
|
97
|
+
<Grid
|
|
98
|
+
item
|
|
99
|
+
sx={{
|
|
100
|
+
display: { xs: 'none', sm: 'inline-block' },
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
<Typography variant="h3" color="text.primary">
|
|
104
|
+
{format(date, 'MMMM yyyy')}
|
|
105
|
+
</Typography>
|
|
106
|
+
</Grid>
|
|
107
|
+
<Grid
|
|
108
|
+
item
|
|
109
|
+
sx={{
|
|
110
|
+
display: { xs: 'none', sm: 'inline-block' },
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
{viewOptions.map((viewOption) => {
|
|
114
|
+
const Icon = viewOption.icon
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<Tooltip
|
|
118
|
+
key={viewOption.value}
|
|
119
|
+
arrow
|
|
120
|
+
placement="top"
|
|
121
|
+
title={viewOption.label}
|
|
122
|
+
>
|
|
123
|
+
<IconButton
|
|
124
|
+
color={viewOption.value === view ? 'primary' : 'secondary'}
|
|
125
|
+
onClick={() => changeView(viewOption.value)}
|
|
126
|
+
>
|
|
127
|
+
<Icon />
|
|
128
|
+
</IconButton>
|
|
129
|
+
</Tooltip>
|
|
130
|
+
)
|
|
131
|
+
})}
|
|
132
|
+
</Grid>
|
|
133
|
+
</Grid>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
Actions.propTypes = {
|
|
138
|
+
children: PropTypes.node,
|
|
139
|
+
className: PropTypes.string,
|
|
140
|
+
date: PropTypes.instanceOf(Date).isRequired,
|
|
141
|
+
onNext: PropTypes.func,
|
|
142
|
+
onPrevious: PropTypes.func,
|
|
143
|
+
onToday: PropTypes.func,
|
|
144
|
+
handleCreateEvent: PropTypes.func,
|
|
145
|
+
changeView: PropTypes.func,
|
|
146
|
+
view: PropTypes.oneOf([
|
|
147
|
+
'dayGridMonth',
|
|
148
|
+
'timeGridWeek',
|
|
149
|
+
'timeGridDay',
|
|
150
|
+
'listWeek',
|
|
151
|
+
]),
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
Actions.defaultProps = {
|
|
155
|
+
onNext: () => {},
|
|
156
|
+
onPrevious: () => {},
|
|
157
|
+
onToday: () => {},
|
|
158
|
+
handleCreateEvent: () => {},
|
|
159
|
+
changeView: () => {},
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export default Actions
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { alpha, Box, styled } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
export const FullCalendarWrapper = styled(Box)(({ theme }) => ({
|
|
4
|
+
'& colgroup': {
|
|
5
|
+
'& col': {
|
|
6
|
+
minWidth: '120px',
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
'.fc .fc-timegrid-axis-cushion': {
|
|
10
|
+
maxWidth: 'unset',
|
|
11
|
+
},
|
|
12
|
+
'.fc .fc-timegrid-axis-frame': {
|
|
13
|
+
justifyContent: 'flex-start',
|
|
14
|
+
},
|
|
15
|
+
'.fc-direction-ltr .fc-timegrid-slot-label-frame': {
|
|
16
|
+
textAlign: 'left',
|
|
17
|
+
},
|
|
18
|
+
'.fc .fc-timegrid-divider': {
|
|
19
|
+
padding: 0,
|
|
20
|
+
},
|
|
21
|
+
'.fc .fc-timegrid-slot-minor': {
|
|
22
|
+
borderTop: 'none',
|
|
23
|
+
},
|
|
24
|
+
'& thead': {
|
|
25
|
+
'& th': {
|
|
26
|
+
verticalAlign: 'bottom',
|
|
27
|
+
},
|
|
28
|
+
height: '60px',
|
|
29
|
+
'& *': {
|
|
30
|
+
color: theme.palette.secondary.main,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
'& .fc .fc-timegrid-slot': {
|
|
34
|
+
height: '84px',
|
|
35
|
+
},
|
|
36
|
+
'& .fc-v-event, & .fc-h-event': {
|
|
37
|
+
border: 'none',
|
|
38
|
+
padding: '2px 5px',
|
|
39
|
+
},
|
|
40
|
+
'& .fc .fc-timegrid-col.fc-day-today': {
|
|
41
|
+
backgroundColor: 'white',
|
|
42
|
+
},
|
|
43
|
+
'& .fc-daygrid-day-top': {
|
|
44
|
+
'& a': {
|
|
45
|
+
color: theme.palette.text.primary,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
'& .fc-day-disabled': {
|
|
49
|
+
background: 'rgba(0, 0, 0, 0.02)',
|
|
50
|
+
},
|
|
51
|
+
'& .fc-daygrid-event .fc-event-time': {
|
|
52
|
+
display: 'none',
|
|
53
|
+
},
|
|
54
|
+
}))
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Autocomplete,
|
|
3
|
+
Box,
|
|
4
|
+
CircularProgress,
|
|
5
|
+
TextField,
|
|
6
|
+
Typography,
|
|
7
|
+
} from '@mui/material'
|
|
8
|
+
import { Controller } from 'react-hook-form'
|
|
9
|
+
import FormLabel from './FormLabel'
|
|
10
|
+
|
|
11
|
+
type Option = {
|
|
12
|
+
value: string | any
|
|
13
|
+
label: string | any
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface MultiSelectProps {
|
|
17
|
+
control?: any
|
|
18
|
+
label: string
|
|
19
|
+
name: string
|
|
20
|
+
options: { value: string | any; label: string | any }[]
|
|
21
|
+
placeholder?: string
|
|
22
|
+
hookForm?: boolean
|
|
23
|
+
loading?: boolean
|
|
24
|
+
[key: string]: any
|
|
25
|
+
multiple?: boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default function FormAutoCompleteSearch({
|
|
29
|
+
control,
|
|
30
|
+
name,
|
|
31
|
+
options,
|
|
32
|
+
label,
|
|
33
|
+
loading, // pass this variable when options are from an async operation
|
|
34
|
+
hookForm = true,
|
|
35
|
+
multiple = false,
|
|
36
|
+
...props
|
|
37
|
+
}: MultiSelectProps) {
|
|
38
|
+
if (!hookForm) {
|
|
39
|
+
return (
|
|
40
|
+
<Autocomplete
|
|
41
|
+
multiple={multiple}
|
|
42
|
+
value={props.value}
|
|
43
|
+
fullWidth
|
|
44
|
+
onChange={(e, value) => {
|
|
45
|
+
props.onChange(value)
|
|
46
|
+
}}
|
|
47
|
+
options={options || []}
|
|
48
|
+
getOptionLabel={(option: Option) => option?.label || ''}
|
|
49
|
+
renderInput={(params) => (
|
|
50
|
+
<TextField
|
|
51
|
+
variant="outlined"
|
|
52
|
+
label={<FormLabel label={label} required={props.required} />}
|
|
53
|
+
{...params}
|
|
54
|
+
/>
|
|
55
|
+
)}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Controller
|
|
63
|
+
control={control}
|
|
64
|
+
name={name}
|
|
65
|
+
render={({ field, fieldState: { error } }) => (
|
|
66
|
+
<Box>
|
|
67
|
+
<Autocomplete
|
|
68
|
+
multiple={multiple}
|
|
69
|
+
loading={loading}
|
|
70
|
+
value={field.value}
|
|
71
|
+
fullWidth
|
|
72
|
+
onChange={(e, value) => {
|
|
73
|
+
field.onChange(value)
|
|
74
|
+
}}
|
|
75
|
+
options={options || []}
|
|
76
|
+
getOptionLabel={(option: Option) => option?.label || ''}
|
|
77
|
+
renderInput={(params) => (
|
|
78
|
+
<TextField
|
|
79
|
+
error={Boolean(error)}
|
|
80
|
+
variant="outlined"
|
|
81
|
+
label={<FormLabel label={label} required={props.required} />}
|
|
82
|
+
InputProps={{
|
|
83
|
+
...params.InputProps,
|
|
84
|
+
endAdornment: (
|
|
85
|
+
<>
|
|
86
|
+
{loading ? (
|
|
87
|
+
<CircularProgress color="inherit" size={20} />
|
|
88
|
+
) : null}
|
|
89
|
+
{params.InputProps.endAdornment}
|
|
90
|
+
</>
|
|
91
|
+
),
|
|
92
|
+
}}
|
|
93
|
+
{...params}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
/>
|
|
97
|
+
{error && (
|
|
98
|
+
<Typography
|
|
99
|
+
fontSize={12}
|
|
100
|
+
sx={{
|
|
101
|
+
paddingLeft: '2px',
|
|
102
|
+
marginTop: '2px',
|
|
103
|
+
}}
|
|
104
|
+
color="error"
|
|
105
|
+
>
|
|
106
|
+
{error?.message}
|
|
107
|
+
</Typography>
|
|
108
|
+
)}
|
|
109
|
+
</Box>
|
|
110
|
+
)}
|
|
111
|
+
/>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function MyAutoComplete({
|
|
116
|
+
value,
|
|
117
|
+
onChange,
|
|
118
|
+
options,
|
|
119
|
+
label,
|
|
120
|
+
loading,
|
|
121
|
+
...props
|
|
122
|
+
}) {
|
|
123
|
+
return (
|
|
124
|
+
<Autocomplete
|
|
125
|
+
loading={loading}
|
|
126
|
+
value={value}
|
|
127
|
+
fullWidth
|
|
128
|
+
freeSolo
|
|
129
|
+
onChange={(e, value) => {
|
|
130
|
+
onChange(value.value)
|
|
131
|
+
}}
|
|
132
|
+
options={options || []}
|
|
133
|
+
getOptionLabel={(option: Option) => option?.label || ''}
|
|
134
|
+
renderInput={(params) => (
|
|
135
|
+
<TextField
|
|
136
|
+
{...params}
|
|
137
|
+
variant="outlined"
|
|
138
|
+
label={<FormLabel label={label} required={props.required} />}
|
|
139
|
+
/>
|
|
140
|
+
)}
|
|
141
|
+
/>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Box, TextField, Typography } from '@mui/material'
|
|
2
|
+
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers'
|
|
3
|
+
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment'
|
|
4
|
+
import { Controller } from 'react-hook-form'
|
|
5
|
+
import FormLabel from './FormLabel'
|
|
6
|
+
interface Props {
|
|
7
|
+
label?: string
|
|
8
|
+
name: string
|
|
9
|
+
size?: 'small' | 'medium'
|
|
10
|
+
control: any
|
|
11
|
+
minDate?: any
|
|
12
|
+
maxDate?: any
|
|
13
|
+
required?: boolean
|
|
14
|
+
}
|
|
15
|
+
export default function FormDatePicker(props: Props) {
|
|
16
|
+
const {
|
|
17
|
+
name,
|
|
18
|
+
size = 'small',
|
|
19
|
+
control,
|
|
20
|
+
label = '',
|
|
21
|
+
minDate,
|
|
22
|
+
maxDate,
|
|
23
|
+
required = false,
|
|
24
|
+
} = props
|
|
25
|
+
return (
|
|
26
|
+
<LocalizationProvider dateAdapter={AdapterMoment}>
|
|
27
|
+
<Controller
|
|
28
|
+
name={name}
|
|
29
|
+
control={control}
|
|
30
|
+
render={({ field, fieldState: { error } }) => (
|
|
31
|
+
<Box>
|
|
32
|
+
<DatePicker
|
|
33
|
+
label={<FormLabel label={label} required={required} />}
|
|
34
|
+
mask="__/__/____"
|
|
35
|
+
inputFormat="DD/MM/yyyy"
|
|
36
|
+
value={field.value ?? null}
|
|
37
|
+
onChange={field.onChange}
|
|
38
|
+
minDate={minDate}
|
|
39
|
+
maxDate={maxDate}
|
|
40
|
+
renderInput={(params) => (
|
|
41
|
+
<TextField
|
|
42
|
+
fullWidth
|
|
43
|
+
size={size}
|
|
44
|
+
{...params}
|
|
45
|
+
error={Boolean(error)}
|
|
46
|
+
onBlur={field.onBlur}
|
|
47
|
+
/>
|
|
48
|
+
)}
|
|
49
|
+
/>
|
|
50
|
+
{error && (
|
|
51
|
+
<Typography
|
|
52
|
+
variant="caption"
|
|
53
|
+
component={'div'}
|
|
54
|
+
sx={{ pl: '2px' }}
|
|
55
|
+
color="rgb(211, 47, 47)"
|
|
56
|
+
>
|
|
57
|
+
{error.message}
|
|
58
|
+
</Typography>
|
|
59
|
+
)}
|
|
60
|
+
</Box>
|
|
61
|
+
)}
|
|
62
|
+
/>
|
|
63
|
+
</LocalizationProvider>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { InputAdornment, TextField, Typography } from '@mui/material'
|
|
2
|
+
import { DateTimePicker, LocalizationProvider } from '@mui/x-date-pickers'
|
|
3
|
+
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment'
|
|
4
|
+
import { Controller } from 'react-hook-form'
|
|
5
|
+
import DateRangeIcon from '@mui/icons-material/DateRange'
|
|
6
|
+
interface Props {
|
|
7
|
+
label?: string
|
|
8
|
+
name: string
|
|
9
|
+
size?: 'small' | 'medium'
|
|
10
|
+
control: any
|
|
11
|
+
required?: boolean
|
|
12
|
+
minDate?: any
|
|
13
|
+
}
|
|
14
|
+
export default function FormDateTimePicker(props: Props) {
|
|
15
|
+
const { name, size = 'small', control, label = '', required, minDate } = props
|
|
16
|
+
return (
|
|
17
|
+
<LocalizationProvider dateAdapter={AdapterMoment}>
|
|
18
|
+
<Controller
|
|
19
|
+
name={name}
|
|
20
|
+
control={control}
|
|
21
|
+
render={({ field, fieldState: { error } }) => (
|
|
22
|
+
<>
|
|
23
|
+
<DateTimePicker
|
|
24
|
+
label={
|
|
25
|
+
<>
|
|
26
|
+
{label}
|
|
27
|
+
{required && (
|
|
28
|
+
<Typography fontSize={14} component={'span'} color="error">
|
|
29
|
+
{' *'}
|
|
30
|
+
</Typography>
|
|
31
|
+
)}
|
|
32
|
+
</>
|
|
33
|
+
}
|
|
34
|
+
minDate={minDate && minDate}
|
|
35
|
+
mask="__/__/____ __:__ _M"
|
|
36
|
+
inputFormat="DD/MM/yyyy hh:mm a"
|
|
37
|
+
value={field.value || null}
|
|
38
|
+
onChange={field.onChange}
|
|
39
|
+
InputProps={{
|
|
40
|
+
endAdornment: (
|
|
41
|
+
<InputAdornment position="end">
|
|
42
|
+
<DateRangeIcon />
|
|
43
|
+
</InputAdornment>
|
|
44
|
+
),
|
|
45
|
+
}}
|
|
46
|
+
renderInput={(params) => (
|
|
47
|
+
<TextField
|
|
48
|
+
fullWidth
|
|
49
|
+
size={size}
|
|
50
|
+
{...params}
|
|
51
|
+
error={Boolean(error)}
|
|
52
|
+
onBlur={field.onBlur}
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
/>
|
|
56
|
+
{error && (
|
|
57
|
+
<Typography
|
|
58
|
+
variant="caption"
|
|
59
|
+
sx={{ pl: '2px' }}
|
|
60
|
+
color="rgb(211, 47, 47)"
|
|
61
|
+
>
|
|
62
|
+
{error.message}
|
|
63
|
+
</Typography>
|
|
64
|
+
)}
|
|
65
|
+
</>
|
|
66
|
+
)}
|
|
67
|
+
/>
|
|
68
|
+
</LocalizationProvider>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Typography } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
export default function FormLabel({ label, required }) {
|
|
4
|
+
return (
|
|
5
|
+
<>
|
|
6
|
+
{label}
|
|
7
|
+
{required && (
|
|
8
|
+
<Typography fontSize={14} component={'span'} color="error">
|
|
9
|
+
{' *'}
|
|
10
|
+
</Typography>
|
|
11
|
+
)}
|
|
12
|
+
</>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Checkbox,
|
|
3
|
+
FormControl,
|
|
4
|
+
FormControlLabel,
|
|
5
|
+
FormGroup,
|
|
6
|
+
Typography,
|
|
7
|
+
} from '@mui/material'
|
|
8
|
+
import { Controller } from 'react-hook-form'
|
|
9
|
+
import FormLabel from './FormLabel'
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
label?: string
|
|
13
|
+
name: string
|
|
14
|
+
size?: 'small' | 'medium'
|
|
15
|
+
control: any
|
|
16
|
+
options: Array<{ label: string; value: string }>
|
|
17
|
+
required?: boolean
|
|
18
|
+
row?: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default function FormMultiCheckbox(props: Props) {
|
|
22
|
+
const {
|
|
23
|
+
name,
|
|
24
|
+
size = 'small',
|
|
25
|
+
control,
|
|
26
|
+
label = '',
|
|
27
|
+
options = [],
|
|
28
|
+
required = false,
|
|
29
|
+
row = true,
|
|
30
|
+
} = props
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Controller
|
|
34
|
+
name={name}
|
|
35
|
+
control={control}
|
|
36
|
+
render={({ field, fieldState: { error } }) => (
|
|
37
|
+
<>
|
|
38
|
+
<Typography variant="subtitle1">
|
|
39
|
+
{label}
|
|
40
|
+
{required && <span style={{ color: 'red' }}>{' *'}</span>}
|
|
41
|
+
</Typography>
|
|
42
|
+
<FormControl size={size} fullWidth>
|
|
43
|
+
<FormGroup row={row} sx={{ flexWrap: 'wrap' }}>
|
|
44
|
+
{options?.map((item, index) => (
|
|
45
|
+
<FormControlLabel
|
|
46
|
+
name={name}
|
|
47
|
+
key={index}
|
|
48
|
+
control={
|
|
49
|
+
<Checkbox
|
|
50
|
+
size="small"
|
|
51
|
+
checked={field?.value
|
|
52
|
+
?.map((item: any) => item?.value)
|
|
53
|
+
?.includes(item?.value)}
|
|
54
|
+
onChange={(e) => {
|
|
55
|
+
let value = field.value || []
|
|
56
|
+
if (e.target.checked) {
|
|
57
|
+
let newValue = [...value, item]
|
|
58
|
+
field.onChange(newValue)
|
|
59
|
+
} else {
|
|
60
|
+
let filteredValue = value.filter(
|
|
61
|
+
(opt: any) => opt?.value !== item.value,
|
|
62
|
+
)
|
|
63
|
+
field.onChange(filteredValue)
|
|
64
|
+
}
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
}
|
|
68
|
+
label={item.label}
|
|
69
|
+
/>
|
|
70
|
+
))}
|
|
71
|
+
</FormGroup>
|
|
72
|
+
</FormControl>
|
|
73
|
+
{error && (
|
|
74
|
+
<Typography variant="caption" color="error" sx={{ pl: '2px' }}>
|
|
75
|
+
{error.message}
|
|
76
|
+
</Typography>
|
|
77
|
+
)}
|
|
78
|
+
</>
|
|
79
|
+
)}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|