@campxdev/shared 1.11.6 → 1.11.7-0.alpha-22

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 (112) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/exports.ts +4 -0
  3. package/package.json +17 -9
  4. package/src/assets/images/X.png +0 -0
  5. package/src/assets/images/active_devices.svg +3 -0
  6. package/src/assets/images/animation.gif +0 -0
  7. package/src/assets/images/change_password.svg +6 -0
  8. package/src/assets/images/clog_wheel.svg +6 -0
  9. package/src/assets/images/index.ts +28 -3
  10. package/src/assets/images/location.svg +6 -0
  11. package/src/assets/images/logout_icon.svg +6 -0
  12. package/src/assets/images/lottery.svg +22 -0
  13. package/src/assets/images/mobile.svg +7 -0
  14. package/src/assets/images/no_devices.svg +734 -0
  15. package/src/assets/images/notifications.svg +3 -0
  16. package/src/assets/images/profile.svg +6 -0
  17. package/src/assets/images/web.svg +13 -0
  18. package/src/components/ActiveDevices/ActiveDevices.tsx +60 -0
  19. package/src/components/ActiveDevices/DeviceInformationCard.tsx +97 -0
  20. package/src/components/ActiveDevices/index.ts +1 -0
  21. package/src/components/ActivityLog/ActivityLog.tsx +268 -0
  22. package/src/components/ActivityLog/Styles.tsx +35 -0
  23. package/src/components/ActivityLog/index.ts +1 -0
  24. package/src/components/ApplicationProfile/ApplicationProfile.tsx +1 -0
  25. package/src/components/ApplicationProfile/UserProfileRelation.tsx +4 -1
  26. package/src/components/DatabaseConfiguration/DatabaseConfiguration.tsx +28 -0
  27. package/src/components/DatabaseConfiguration/DatabaseConfigurationForm.tsx +87 -0
  28. package/src/components/DatabaseConfiguration/components/AddConnectionDrawerButton.tsx +30 -0
  29. package/src/components/DatabaseConfiguration/components/ConnectionCard.tsx +79 -0
  30. package/src/components/DatabaseConfiguration/index.ts +5 -0
  31. package/src/components/DatabaseConfiguration/service.ts +6 -0
  32. package/src/components/DatabaseConfiguration/styles.ts +30 -0
  33. package/src/components/DrawerWrapper/DialogTemplate.tsx +58 -0
  34. package/src/components/DrawerWrapper/DrawerWrapper.tsx +23 -7
  35. package/src/components/DrawerWrapper/ErrorTemplate.tsx +77 -0
  36. package/src/components/ErrorModal.tsx +88 -0
  37. package/src/components/ErrorModalWrapper/ErrorModalTemplate.tsx +118 -0
  38. package/src/components/ErrorModalWrapper/ErrorModalWrapper.tsx +76 -0
  39. package/src/components/FilterComponents/SearchBar.tsx +5 -2
  40. package/src/components/Form/Form.tsx +4 -1
  41. package/src/components/HookForm/AutoCompleteSearch.tsx +3 -0
  42. package/src/components/HookForm/MultiSelect.tsx +1 -0
  43. package/src/components/HookForm/SingleSelect.tsx +2 -2
  44. package/src/components/ImageUpload.tsx +4 -1
  45. package/src/components/Input/MultiSelect.tsx +1 -0
  46. package/src/components/Input/SearchSingleSelect.tsx +1 -1
  47. package/src/components/Input/SingleSelect.tsx +7 -7
  48. package/src/components/Institutions/InsititutionsDialog.tsx +2 -2
  49. package/src/components/Layout/Header/AppHeader.tsx +23 -6
  50. package/src/components/Layout/Header/HeaderActions/CogWheelMenu.tsx +2 -2
  51. package/src/components/Layout/Header/HeaderActions/HeaderActions.tsx +41 -16
  52. package/src/components/Layout/Header/HeaderActions/UserBox.tsx +48 -6
  53. package/src/components/Layout/Header/applications.ts +43 -30
  54. package/src/components/Layout/LayoutWrapper.tsx +82 -4
  55. package/src/components/Layout/SideNav.tsx +42 -9
  56. package/src/components/LoginForm.tsx +53 -1
  57. package/src/components/MongoCharts/MongoDashboard.tsx +146 -0
  58. package/src/components/MongoCharts/index.tsx +1 -0
  59. package/src/components/MyProfile/MyProfile.tsx +1 -1
  60. package/src/components/ReportHeader.tsx +2 -2
  61. package/src/components/Selectors/ClassRoomSelector.tsx +2 -2
  62. package/src/components/Selectors/CourseSelector.tsx +2 -2
  63. package/src/components/Selectors/DepartmentSelector.tsx +2 -2
  64. package/src/components/Selectors/ExamGroupSelector.tsx +19 -10
  65. package/src/components/Selectors/FacultySelector.tsx +2 -2
  66. package/src/components/Selectors/FeeTypeSelector.tsx +2 -2
  67. package/src/components/Selectors/FormSelectors/FormClassRoomSelector.tsx +2 -2
  68. package/src/components/Selectors/FormSelectors/FormCourseSelector.tsx +2 -2
  69. package/src/components/Selectors/FormSelectors/FormDepartmentSelector.tsx +2 -2
  70. package/src/components/Selectors/FormSelectors/FormExamGroupSelector.tsx +2 -2
  71. package/src/components/Selectors/FormSelectors/FormFacultySelector.tsx +2 -2
  72. package/src/components/Selectors/FormSelectors/FormFeeTypeSelector.tsx +2 -2
  73. package/src/components/Selectors/FormSelectors/FormProgramSelector.tsx +2 -2
  74. package/src/components/Selectors/FormSelectors/FormQuotaSelector.tsx +3 -3
  75. package/src/components/Selectors/FormSelectors/FormSemesterSelector.tsx +2 -2
  76. package/src/components/Selectors/FormSelectors/MultiSelect/MultiFacultySelector.tsx +2 -2
  77. package/src/components/Selectors/FormSelectors/MultiSelect/MultiFeeTypeSelector.tsx +2 -2
  78. package/src/components/Selectors/FormSelectors/MultiSelect/MultiProgramSelector.tsx +2 -2
  79. package/src/components/Selectors/FormSelectors/MultiSelect/MultiQuotaSelector.tsx +2 -2
  80. package/src/components/Selectors/ProgramSelector.tsx +3 -3
  81. package/src/components/Selectors/QuotaSelector.tsx +3 -3
  82. package/src/components/Selectors/SemesterSelector.tsx +2 -2
  83. package/src/components/SignatureFooter.tsx +35 -0
  84. package/src/components/SwitchButton.tsx +6 -1
  85. package/src/components/Tables/2DTable/Table.tsx +20 -23
  86. package/src/components/Tables/BasicTable/Table.tsx +22 -13
  87. package/src/components/Tables/BasicTable/TableFooter.tsx +35 -9
  88. package/src/components/Tables/BasicTable/styles.ts +1 -1
  89. package/src/components/Tables/ReactTable/ReactTable.tsx +42 -8
  90. package/src/components/Tables/common/types.ts +1 -0
  91. package/src/components/Tabs/TabsContainer.tsx +5 -5
  92. package/src/components/Tabs/styles.tsx +1 -0
  93. package/src/components/ToastContainer/ToastContainer.tsx +2 -3
  94. package/src/components/UploadButton/UploadButton.tsx +3 -1
  95. package/src/components/UploadButton/types.ts +2 -2
  96. package/src/components/UploadDocument.tsx +3 -0
  97. package/src/components/UploadFileDialog/UploadFileDialog.tsx +20 -9
  98. package/src/components/index.ts +5 -0
  99. package/src/config/axios.ts +5 -19
  100. package/src/constants/UIConstants.ts +65 -2
  101. package/src/constants/isDevelopment.ts +0 -1
  102. package/src/contexts/Providers.tsx +5 -43
  103. package/src/hooks/useAuth.ts +7 -0
  104. package/src/layouts/Components/styles.tsx +25 -7
  105. package/src/permissions/PermissionsStore.ts +658 -55
  106. package/src/permissions/ValidateAccess.tsx +37 -8
  107. package/src/shared-state/PermissionsStore.ts +779 -85
  108. package/src/theme/theme.d.ts +69 -35
  109. package/src/utils/debounce.ts +11 -0
  110. package/src/utils/getUrlParams.ts +13 -0
  111. package/src/utils/index.ts +6 -3
  112. package/src/utils/logout.ts +4 -8
@@ -1,4 +1,4 @@
1
- import { SelectProps } from '@mui/material'
1
+ import { BaseSelectProps } from '@mui/material'
2
2
  import { useEffect, useState } from 'react'
3
3
  import { Controller } from 'react-hook-form'
4
4
  import axios from '../../../../config/axios'
@@ -13,7 +13,7 @@ type MultiProgramSelectorProps = {
13
13
  allowAll?: boolean
14
14
  error?: boolean
15
15
  helperText?: string
16
- } & SelectProps
16
+ } & BaseSelectProps
17
17
  const MultiFeeTypeSelector = (props: MultiProgramSelectorProps) => {
18
18
  const {
19
19
  control,
@@ -1,4 +1,4 @@
1
- import { SelectProps } from '@mui/material'
1
+ import { BaseSelectProps } from '@mui/material'
2
2
  import { useEffect, useState } from 'react'
3
3
  import { Controller } from 'react-hook-form'
4
4
  import axios from '../../../../config/axios'
@@ -15,7 +15,7 @@ type MultiProgramSelectorProps = {
15
15
  error?: boolean
16
16
  helperText?: string
17
17
  api?: string
18
- } & SelectProps
18
+ } & BaseSelectProps
19
19
  const MultiProgramSelector = (props: MultiProgramSelectorProps) => {
20
20
  const {
21
21
  control,
@@ -1,4 +1,4 @@
1
- import { SelectProps } from '@mui/material'
1
+ import { BaseSelectProps } from '@mui/material'
2
2
  import { useEffect, useState } from 'react'
3
3
  import { Controller } from 'react-hook-form'
4
4
  import axios from '../../../../config/axios'
@@ -15,7 +15,7 @@ type MultiQuotaSelectorProps = {
15
15
  error?: boolean
16
16
  helperText?: string
17
17
  api?: string
18
- } & SelectProps
18
+ } & BaseSelectProps
19
19
  export default function MultiQuotaSelector(props: MultiQuotaSelectorProps) {
20
20
  const {
21
21
  control,
@@ -1,4 +1,4 @@
1
- import { SelectProps } from '@mui/material'
1
+ import { BaseSelectProps } from '@mui/material'
2
2
  import { useEffect, useState } from 'react'
3
3
  import axios from '../../config/axios'
4
4
  import { SingleSelect } from '../Input'
@@ -6,7 +6,7 @@ import { SingleSelect } from '../Input'
6
6
  type ProgramSelectorProps = {
7
7
  name?: string
8
8
  label: string
9
- filters?: { courseId: number }
9
+ filters?: { courseId: number | string }
10
10
  required?: boolean
11
11
  onChange?: (value: any) => void
12
12
  allowAll?: boolean
@@ -14,7 +14,7 @@ type ProgramSelectorProps = {
14
14
  helperText?: string
15
15
  api?: string
16
16
  valueByBranchCode?: boolean
17
- } & SelectProps
17
+ } & BaseSelectProps
18
18
  const ProgramSelector = (props: ProgramSelectorProps) => {
19
19
  const {
20
20
  name,
@@ -1,4 +1,4 @@
1
- import { SelectProps } from '@mui/material'
1
+ import { BaseSelectProps } from '@mui/material'
2
2
  import { useEffect, useState } from 'react'
3
3
  import axios from '../../config/axios'
4
4
  import { SingleSelect } from '../Input'
@@ -6,14 +6,14 @@ import { SingleSelect } from '../Input'
6
6
  type QuotaSelectorProps = {
7
7
  name?: string
8
8
  label: string
9
- filters?: { courseId: number }
9
+ filters?: { courseId: number | string }
10
10
  required?: boolean
11
11
  onChange?: (value: any) => void
12
12
  allowAll?: boolean
13
13
  error?: boolean
14
14
  helperText?: string
15
15
  api?: string
16
- } & SelectProps
16
+ } & BaseSelectProps
17
17
  export default function QuotaSelector(props: QuotaSelectorProps) {
18
18
  const {
19
19
  name,
@@ -1,4 +1,4 @@
1
- import { SelectProps } from '@mui/material'
1
+ import { BaseSelectProps } from '@mui/material'
2
2
  import { useEffect, useState } from 'react'
3
3
  import axios from '../../config/axios'
4
4
  import { SingleSelect } from '../Input'
@@ -13,7 +13,7 @@ type SemesterSelectorProps = {
13
13
  error?: boolean
14
14
  helperText?: string
15
15
  api?: string
16
- } & SelectProps
16
+ } & BaseSelectProps
17
17
  const SemesterSelector = (props: SemesterSelectorProps) => {
18
18
  const {
19
19
  name,
@@ -0,0 +1,35 @@
1
+ import { Box, SxProps, Typography } from '@mui/material'
2
+ import { Variant } from '@mui/material/styles/createTypography'
3
+
4
+ interface ItemProps {
5
+ text: string
6
+ sx?: SxProps
7
+ variant?: Variant
8
+ }
9
+
10
+ interface SignatureFooterProps {
11
+ containerSx?: SxProps
12
+ list: ItemProps[]
13
+ }
14
+
15
+ export default function SignatureFooter({
16
+ containerSx,
17
+ list,
18
+ }: SignatureFooterProps) {
19
+ return (
20
+ <Box
21
+ sx={{
22
+ display: 'flex',
23
+ justifyContent: 'space-around',
24
+ margin: '100px 0px 50px 0px',
25
+ ...containerSx,
26
+ }}
27
+ >
28
+ {list?.map((item, index) => (
29
+ <Typography key={index} sx={item?.sx} variant={item?.variant || 'h1'}>
30
+ {item?.text}
31
+ </Typography>
32
+ ))}
33
+ </Box>
34
+ )
35
+ }
@@ -6,6 +6,7 @@ interface SwicthButtonProps {
6
6
  checked: boolean
7
7
  onChange: (v: any) => void
8
8
  subtitle?: ReactNode
9
+ disabled?: boolean
9
10
  }
10
11
 
11
12
  export default function SwitchButton({
@@ -13,13 +14,17 @@ export default function SwitchButton({
13
14
  checked,
14
15
  onChange,
15
16
  subtitle,
17
+ disabled,
16
18
  }: SwicthButtonProps) {
17
19
  return (
18
20
  <StyledBox>
19
21
  <Box sx={{ display: 'flex', alignItems: 'center', gap: '1rem' }}>
20
- <Typography variant="body1">{label}</Typography>
22
+ <Typography variant="body1" color={disabled ? 'grey' : 'black'}>
23
+ {label}
24
+ </Typography>
21
25
  <Switch
22
26
  checked={checked}
27
+ disabled={disabled}
23
28
  onChange={(e, checked) => onChange(checked)}
24
29
  />
25
30
  </Box>
@@ -127,13 +127,12 @@ export default function Table({
127
127
  totalCount[colIndex] = 'Total'
128
128
  return
129
129
  }
130
-
131
- totalCount[colIndex] += colValue
130
+ totalCount[colIndex] += colValue ? colValue : 0
132
131
  })
133
132
  }
134
133
 
135
134
  const convertToAmount = (data) => {
136
- return data.toLocaleString('en-IN', {
135
+ return data?.toLocaleString('en-IN', {
137
136
  style: 'currency',
138
137
  currency: 'INR',
139
138
  })
@@ -240,29 +239,27 @@ export default function Table({
240
239
 
241
240
  {showTotal && (
242
241
  <StyledTableRow canRowClick={false}>
243
- {columns.map((col, colIndex) => (
244
- <>
245
- <StyledTableCell
246
- key={colIndex}
247
- columnsLength={columns.length}
248
- columnIndex={colIndex + 1}
249
- rowIndex={dataSource.length + 1}
250
- col={col}
251
- isBodyCell
252
- sx={sx}
253
- >
254
- {totalCols.includes(colIndex + 1) ? (
255
- col?.dataType && col?.dataType == 'currency' ? (
242
+ {columns.map((col, colIndex) => {
243
+ return (
244
+ <>
245
+ <StyledTableCell
246
+ key={colIndex}
247
+ columnsLength={columns.length}
248
+ columnIndex={colIndex + 1}
249
+ rowIndex={dataSource.length + 1}
250
+ col={col}
251
+ isBodyCell
252
+ sx={sx}
253
+ >
254
+ {col?.dataType && col?.dataType == 'currency' ? (
256
255
  <>{convertToAmount(totalCount[colIndex])}</>
257
256
  ) : (
258
257
  <>{totalCount[colIndex]}</>
259
- )
260
- ) : (
261
- '---'
262
- )}
263
- </StyledTableCell>
264
- </>
265
- ))}
258
+ )}
259
+ </StyledTableCell>
260
+ </>
261
+ )
262
+ })}
266
263
  </StyledTableRow>
267
264
  )}
268
265
  </TableBody>
@@ -23,7 +23,8 @@ import {
23
23
  type Order = 'asc' | 'desc' | ''
24
24
  type Sort = {}
25
25
  type DataType = 'currency' | 'string' | 'number'
26
- export interface TableColumn {
26
+
27
+ export interface TableColumn<T> {
27
28
  dataIndex: string
28
29
  key: string
29
30
  title: any
@@ -33,11 +34,12 @@ export interface TableColumn {
33
34
  width?: string //pixels
34
35
  dataType?: DataType
35
36
  }
36
- interface TableProps {
37
+
38
+ interface TableProps<T> {
37
39
  showSerialNumber?: boolean
38
- columns: Array<TableColumn>
40
+ columns: Array<TableColumn<T>>
39
41
  rowKey?: string
40
- dataSource?: any[]
42
+ dataSource?: T[]
41
43
  loading?: boolean
42
44
  onRowClick?: (row: any) => void
43
45
  pagination?: {
@@ -46,15 +48,18 @@ interface TableProps {
46
48
  totalCount: number
47
49
  onChange: (v: number) => void
48
50
  onChangeLimit?: (v: number) => void
51
+ handlePageInput?: (v: number) => void
49
52
  }
50
53
  onSort?: (sort: any) => void
51
54
  dense?: boolean
52
55
  showTotal?: boolean
56
+ showNoDataIllustration?: boolean
53
57
  sx?: Record<string, SxProps<Theme>>
54
58
  totalColumns?: number[]
55
59
  showTotalInFirstCellOfTotalRow?: boolean
56
60
  }
57
- export default function Table({
61
+
62
+ export default function Table<T>({
58
63
  showSerialNumber = false,
59
64
  columns,
60
65
  dataSource,
@@ -64,10 +69,11 @@ export default function Table({
64
69
  onSort,
65
70
  dense = false,
66
71
  showTotal = false,
72
+ showNoDataIllustration = true,
67
73
  sx,
68
74
  totalColumns,
69
75
  showTotalInFirstCellOfTotalRow,
70
- }: TableProps) {
76
+ }: TableProps<T>) {
71
77
  const [sort, setSort] = useState<Sort>({})
72
78
  let totalCount = []
73
79
  let totalCols = []
@@ -77,18 +83,18 @@ export default function Table({
77
83
  totalCols = totalColumns ? [...totalColumns] : []
78
84
  }
79
85
 
80
- const handleSortClick = (sortBykey) => {
86
+ const handleSortClick = (sortByKey) => {
81
87
  setSort((prev) => {
82
- if (prev[sortBykey]) {
83
- if (prev[sortBykey] === 'desc') return { ...prev, [sortBykey]: 'asc' }
84
- if (prev[sortBykey] === 'asc') {
85
- delete prev[sortBykey]
88
+ if (prev[sortByKey]) {
89
+ if (prev[sortByKey] === 'desc') return { ...prev, [sortByKey]: 'asc' }
90
+ if (prev[sortByKey] === 'asc') {
91
+ delete prev[sortByKey]
86
92
  return { ...prev }
87
93
  }
88
94
  } else {
89
95
  return {
90
96
  ...prev,
91
- [sortBykey]: 'desc',
97
+ [sortByKey]: 'desc',
92
98
  }
93
99
  }
94
100
  })
@@ -254,7 +260,9 @@ export default function Table({
254
260
  </TableBody>
255
261
  ) : (
256
262
  <>
257
- <NoRecordsFound colLength={columns?.length} />
263
+ {showNoDataIllustration ? (
264
+ <NoRecordsFound colLength={columns?.length} />
265
+ ) : null}
258
266
  </>
259
267
  )}
260
268
  </>
@@ -271,6 +279,7 @@ export default function Table({
271
279
  totalCount={pagination.totalCount ?? 0}
272
280
  handlePagination={pagination.onChange}
273
281
  handlePageLimit={pagination.onChangeLimit}
282
+ handlePageInput={pagination.handlePageInput}
274
283
  />
275
284
  )}
276
285
  </>
@@ -1,7 +1,8 @@
1
- import { Box, Typography } from '@mui/material'
1
+ import { Box, Stack } from '@mui/material'
2
2
  import DropDownButton from '../../DropDownButton/DropDownButton'
3
- import { StyledPagination, StyledTableFooter } from '../common/styles'
3
+ import { TextField } from '../../Input'
4
4
  import TableStats from '../common/TableStats'
5
+ import { StyledPagination, StyledTableFooter } from '../common/styles'
5
6
 
6
7
  interface TableFooterProps {
7
8
  totalCount: number
@@ -9,6 +10,7 @@ interface TableFooterProps {
9
10
  handlePagination: (v: number) => void
10
11
  page: number
11
12
  handlePageLimit?: (v: number) => void
13
+ handlePageInput?: (v: number) => void
12
14
  }
13
15
 
14
16
  export default function TableFooter({
@@ -17,6 +19,7 @@ export default function TableFooter({
17
19
  handlePagination,
18
20
  page,
19
21
  handlePageLimit,
22
+ handlePageInput,
20
23
  }: TableFooterProps) {
21
24
  const onChange = (v: number) => {
22
25
  handlePagination(v)
@@ -24,13 +27,36 @@ export default function TableFooter({
24
27
  return (
25
28
  <StyledTableFooter>
26
29
  <TableStats limit={limit} totalCount={totalCount} page={page} />
27
- <StyledPagination
28
- page={page}
29
- count={Math.ceil(totalCount / limit)}
30
- onChange={(e, v) => onChange(v)}
31
- variant="outlined"
32
- shape="rounded"
33
- />
30
+ <Stack direction={'row'} gap={2} alignItems={'center'}>
31
+ <StyledPagination
32
+ page={page}
33
+ count={Math.ceil(totalCount / limit)}
34
+ onChange={(e, v) => onChange(v)}
35
+ variant="outlined"
36
+ shape="rounded"
37
+ />
38
+
39
+ {handlePageInput && (
40
+ <Box
41
+ sx={{
42
+ '& .MuiBox-root': {
43
+ display: 'flex',
44
+ alignItems: 'center',
45
+ gap: '5px',
46
+ },
47
+ }}
48
+ >
49
+ <TextField
50
+ variant="outlined"
51
+ label={'Page :'}
52
+ size="small"
53
+ value={page}
54
+ onChange={(e) => handlePageInput(Number(e.target.value))}
55
+ sx={{ width: '80px' }}
56
+ />
57
+ </Box>
58
+ )}
59
+ </Stack>
34
60
  {handlePageLimit ? (
35
61
  <LimitField handlePageLimit={handlePageLimit} limit={limit} />
36
62
  ) : (
@@ -100,6 +100,6 @@ const getSxKeys = (rowIndex, columnIndex) => {
100
100
  rowkey: `row:${rowIndex}`,
101
101
  columnKey: `column:${columnIndex}`,
102
102
  cellKey: `row:${rowIndex},column:${columnIndex}`,
103
- allKey: 'Tablecell',
103
+ allKey: 'TableCell',
104
104
  }
105
105
  }
@@ -5,14 +5,17 @@ import {
5
5
  IconButton,
6
6
  ListItemIcon,
7
7
  MenuItem,
8
+ Stack,
8
9
  Table,
9
10
  TableCell,
10
11
  TableHead,
11
12
  TableRow,
13
+ TextField,
12
14
  Typography,
13
15
  } from '@mui/material'
14
- import { useEffect, useMemo, useState } from 'react'
16
+ import { useCallback, useEffect, useMemo, useState } from 'react'
15
17
  import { usePagination, useRowSelect, useTable } from 'react-table'
18
+ import { debounce } from '../../../utils/debounce'
16
19
  import TableStats from '../common/TableStats'
17
20
  import { SortAscIcon, SortDescIcon, SortIcon } from '../common/icons'
18
21
  import {
@@ -140,6 +143,12 @@ export default function ReactTable({
140
143
  hooks.visibleColumns.push((columns) => [selectColumn, ...columns])
141
144
  },
142
145
  )
146
+ const [pageInput, setPageInput] = useState<string>(String(pageIndex + 1))
147
+
148
+ const debouncedHandlePagination = useCallback(
149
+ debounce((e, value) => handlePagination(e, value), 500),
150
+ [],
151
+ )
143
152
 
144
153
  const handleSortClick = (sortBykey) => {
145
154
  setSort((prev) => {
@@ -237,13 +246,38 @@ export default function ReactTable({
237
246
  page={pageIndex + 1}
238
247
  totalCount={pageCount}
239
248
  />
240
- <StyledPagination
241
- variant="outlined"
242
- shape="rounded"
243
- onChange={handlePagination}
244
- count={Math.ceil(pageCount / pageSize)}
245
- page={pageIndex + 1}
246
- />
249
+ <Stack direction={'row'} gap={2} alignItems={'center'}>
250
+ <StyledPagination
251
+ variant="outlined"
252
+ shape="rounded"
253
+ onChange={handlePagination}
254
+ count={Math.ceil(pageCount / pageSize)}
255
+ page={pageIndex + 1}
256
+ />
257
+ {pagination.handlePageInput && (
258
+ <Box
259
+ sx={{
260
+ '& .MuiBox-root': {
261
+ display: 'flex',
262
+ alignItems: 'center',
263
+ gap: '5px',
264
+ },
265
+ }}
266
+ >
267
+ <TextField
268
+ variant="outlined"
269
+ label={'Page :'}
270
+ size="small"
271
+ value={pageInput}
272
+ onChange={(e) => {
273
+ setPageInput(e.target.value)
274
+ debouncedHandlePagination(e, Number(e.target.value))
275
+ }}
276
+ sx={{ width: '80px' }}
277
+ />
278
+ </Box>
279
+ )}
280
+ </Stack>
247
281
  <Limit pageSize={pageSize} setPageSize={setPageSize} />
248
282
  </StyledTableFooter>
249
283
  )}
@@ -25,6 +25,7 @@ export interface TableProps {
25
25
  totalCount: number
26
26
  onChange: (offset: number) => void
27
27
  onChangeLimit?: (v: number) => void
28
+ handlePageInput?: boolean
28
29
  }
29
30
  select?: {
30
31
  enable: boolean
@@ -27,14 +27,14 @@ export default function TabsContainer({
27
27
  tabMobileUnderlineColor,
28
28
  currentTabIndex = 0,
29
29
  }: TabsContainerProps) {
30
- const [currentTab, setCurrentTab] = useState(tabs[currentTabIndex].key)
30
+ const [currentTab, setCurrentTab] = useState(tabs[currentTabIndex]?.key)
31
31
 
32
32
  const handleTabsChange = (_event: ChangeEvent<{}>, value: string): void => {
33
33
  setCurrentTab(value)
34
34
  onTabChange && onTabChange(value)
35
35
  }
36
36
  useEffect(() => {
37
- setCurrentTab(tabs[currentTabIndex].key)
37
+ setCurrentTab(tabs[currentTabIndex]?.key)
38
38
  }, [])
39
39
 
40
40
  return (
@@ -53,9 +53,9 @@ export default function TabsContainer({
53
53
  >
54
54
  {tabs.map((tab) => (
55
55
  <Tab
56
- key={tab.key}
56
+ key={tab?.key}
57
57
  label={tab.label}
58
- value={tab.key}
58
+ value={tab?.key}
59
59
  icon={tab.highlight ? <span>{'.'}</span> : null}
60
60
  iconPosition="end"
61
61
  />
@@ -63,7 +63,7 @@ export default function TabsContainer({
63
63
  </StyledTabs>
64
64
  <StyledComponentWrapper containerVariant={containerVariant}>
65
65
  <ErrorBoundary>
66
- {tabs.find((tab) => tab.key === currentTab)?.component}
66
+ {tabs.find((tab) => tab?.key === currentTab)?.component}
67
67
  </ErrorBoundary>
68
68
  </StyledComponentWrapper>
69
69
  </StyledContainer>
@@ -21,6 +21,7 @@ export const StyledTabs = styled(Tabs)<StyledTabsProps>(
21
21
  minHeight: '60px',
22
22
  ['@media(max-width: 680px)']: {
23
23
  minHeight: '30px',
24
+ paddingTop: '15px',
24
25
  },
25
26
  paddingLeft: '15px',
26
27
  '& .MuiTabs-indicator': {
@@ -1,8 +1,7 @@
1
- import { Done, Close, WarningAmberRounded } from '@mui/icons-material'
1
+ import { Close, Done, WarningAmberRounded } from '@mui/icons-material'
2
2
  import { Box } from '@mui/material'
3
- import { Slide, ToastContainer as ReactToastContainer } from 'react-toastify'
3
+ import { ToastContainer as ReactToastContainer, Slide } from 'react-toastify'
4
4
  import 'react-toastify/dist/ReactToastify.css'
5
- import WarningAmberRoundedIcon from '@mui/icons-material/WarningAmberRounded'
6
5
 
7
6
  export default function ToastContainer() {
8
7
  return (
@@ -4,7 +4,7 @@ import { toast } from 'react-toastify'
4
4
  import axios from '../../config/axios'
5
5
  import { UploadButtonProps } from './types'
6
6
 
7
- const getAccept = (type: UploadButtonProps['type']) => {
7
+ export const getAccept = (type: UploadButtonProps['type']) => {
8
8
  switch (type) {
9
9
  case 'file':
10
10
  return '.xlsx,.xls,.doc, .docx,.ppt, .pptx,.txt,.pdf'
@@ -14,6 +14,8 @@ const getAccept = (type: UploadButtonProps['type']) => {
14
14
  return 'video/*'
15
15
  case 'audio':
16
16
  return 'audio/*'
17
+ case 'excel':
18
+ return '.xlsx,.xls,.csv'
17
19
  }
18
20
  }
19
21
 
@@ -1,7 +1,7 @@
1
1
  import { ReactNode } from 'react'
2
2
 
3
3
  interface Media {
4
- type: 'image' | 'video' | 'audio' | 'file'
4
+ type: 'image' | 'video' | 'audio' | 'file' | 'excel'
5
5
  url: string
6
6
  key: string
7
7
  fileName?: string
@@ -9,7 +9,7 @@ interface Media {
9
9
  mediaObject?: any
10
10
  }
11
11
  interface UploadButtonProps {
12
- type: 'file' | 'image' | 'video' | 'audio'
12
+ type: 'file' | 'image' | 'video' | 'audio' | 'excel'
13
13
  onChange: (res: Media) => void
14
14
  uploadUrl: string
15
15
  onSuccess?: () => void
@@ -11,6 +11,7 @@ export default function UploadDocument({
11
11
  postBody,
12
12
  styleProps,
13
13
  onSuccess,
14
+ onError,
14
15
  width,
15
16
  height,
16
17
  }: {
@@ -19,6 +20,7 @@ export default function UploadDocument({
19
20
  postUrl: string
20
21
  postBody?: object
21
22
  onSuccess?: (res: any) => void
23
+ onError?: (res: any) => void
22
24
  styleProps?: any
23
25
  width?: string
24
26
  height?: string
@@ -44,6 +46,7 @@ export default function UploadDocument({
44
46
  onSuccess(res?.data)
45
47
  })
46
48
  .catch((err) => {
49
+ onError && onError(err)
47
50
  setLoading(false)
48
51
  toast.error('Server Error While Uploading File')
49
52
  })