@campxdev/shared 1.7.8 → 1.7.10
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/package.json +1 -1
- package/src/components/ChangePassword.tsx +2 -2
- package/src/components/LoginForm.tsx +124 -33
- package/src/components/ResetPassword.tsx +107 -0
- package/src/components/{TableComponent → Tables/BasicTable}/Table.tsx +13 -12
- package/src/components/{TableComponent/TableFooter → Tables/BasicTable}/TableFooter.tsx +2 -20
- package/src/components/{TableComponent → Tables/BasicTable}/index.tsx +0 -0
- package/src/components/{TableComponent → Tables/ReactTable}/BatchActionsHeader.tsx +2 -2
- package/src/components/{TableComponent → Tables/ReactTable}/ReactTable.tsx +5 -5
- package/src/components/{TableComponent → Tables/ReactTable}/RenderTableBody.tsx +4 -23
- package/src/components/Tables/ReactTable/index.tsx +1 -0
- package/src/components/{TableComponent → Tables/ReactTable}/react-table-config.d.ts +0 -0
- package/src/components/Tables/common/NoRecordsFound.tsx +27 -0
- package/src/components/Tables/common/TableStats.tsx +22 -0
- package/src/components/{TableComponent/Icons/index.tsx → Tables/common/icons.tsx} +0 -0
- package/src/components/{TableComponent → Tables/common}/no-data-illu.svg +0 -0
- package/src/components/{TableComponent → Tables/common}/styles.tsx +0 -0
- package/src/components/{TableComponent → Tables/common}/types.ts +0 -0
- package/src/components/index.ts +5 -3
- package/src/components/TableComponent/TableFooter/index.tsx +0 -1
- package/src/components/TableComponent/TableFooter/styles.tsx +0 -28
package/package.json
CHANGED
|
@@ -30,8 +30,8 @@ function ChangePassword({ close }) {
|
|
|
30
30
|
try {
|
|
31
31
|
await axios.post(
|
|
32
32
|
isDevelopment
|
|
33
|
-
? 'https://
|
|
34
|
-
: 'https://
|
|
33
|
+
? 'https://api.campx.dev/auth-server/auth/change-password'
|
|
34
|
+
: 'https://api.campx.in/auth-server/auth/change-password',
|
|
35
35
|
{
|
|
36
36
|
oldPassword,
|
|
37
37
|
newPassword,
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { Visibility, VisibilityOff } from '@mui/icons-material'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Alert,
|
|
4
|
+
Box,
|
|
5
|
+
Button,
|
|
6
|
+
IconButton,
|
|
7
|
+
InputAdornment,
|
|
8
|
+
Stack,
|
|
9
|
+
Typography,
|
|
10
|
+
styled,
|
|
11
|
+
} from '@mui/material'
|
|
3
12
|
import axiosBase from 'axios'
|
|
4
13
|
import Cookies from 'js-cookie'
|
|
5
|
-
import { useState } from 'react'
|
|
14
|
+
import { useEffect, useState } from 'react'
|
|
6
15
|
import { useForm } from 'react-hook-form'
|
|
7
16
|
import ActionButton from './ActionButton'
|
|
8
17
|
import { FormTextField } from './HookForm'
|
|
18
|
+
import axios from '../config/axios'
|
|
19
|
+
import ResetPassword from './ResetPassword'
|
|
20
|
+
import { Link } from 'react-router-dom'
|
|
9
21
|
|
|
10
22
|
export function LoginForm({ loginUrl }: { loginUrl?: string }) {
|
|
11
23
|
const [showPassword, setShowPassword] = useState(false)
|
|
24
|
+
const [forgotMail, setForgotMail] = useState(null)
|
|
25
|
+
const [forgotPassword, setForgotPassword] = useState(true)
|
|
26
|
+
const [resetPassword, setResetPassword] = useState(false)
|
|
12
27
|
const { handleSubmit, control } = useForm()
|
|
13
28
|
const [error, setError] = useState('')
|
|
14
29
|
|
|
@@ -30,44 +45,115 @@ export function LoginForm({ loginUrl }: { loginUrl?: string }) {
|
|
|
30
45
|
}
|
|
31
46
|
}
|
|
32
47
|
|
|
48
|
+
const [mailSent, setMailSent] = useState(false)
|
|
49
|
+
|
|
50
|
+
async function handleSendMail() {
|
|
51
|
+
try {
|
|
52
|
+
await axios
|
|
53
|
+
.get(
|
|
54
|
+
`https://api.campx.dev/auth-server/auth/forgot-password?email=${forgotMail}`,
|
|
55
|
+
)
|
|
56
|
+
.then((res) => {
|
|
57
|
+
setForgotMail(null)
|
|
58
|
+
setMailSent(true)
|
|
59
|
+
setError(null)
|
|
60
|
+
})
|
|
61
|
+
} catch (err) {
|
|
62
|
+
setError(err.response.data.message ?? 'Server Error')
|
|
63
|
+
setMailSent(false)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const restLink = window.location.pathname.split('/')[1]
|
|
69
|
+
if (restLink == 'reset-password') {
|
|
70
|
+
setResetPassword(true)
|
|
71
|
+
}
|
|
72
|
+
}, [])
|
|
73
|
+
|
|
33
74
|
return (
|
|
34
75
|
<>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<
|
|
76
|
+
{resetPassword ? (
|
|
77
|
+
<>
|
|
78
|
+
<ResetPassword />
|
|
79
|
+
</>
|
|
80
|
+
) : forgotPassword ? (
|
|
81
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
82
|
+
<Stack gap={'30px'} sx={{ display: resetPassword ? 'none' : 'flex' }}>
|
|
83
|
+
<Box>
|
|
84
|
+
<FormTextField
|
|
85
|
+
control={control}
|
|
86
|
+
name="username"
|
|
87
|
+
label="User ID"
|
|
88
|
+
required
|
|
89
|
+
/>
|
|
90
|
+
</Box>
|
|
91
|
+
<Box>
|
|
92
|
+
<FormTextField
|
|
93
|
+
control={control}
|
|
94
|
+
name="password"
|
|
95
|
+
label="Password"
|
|
96
|
+
type={showPassword ? 'text' : 'password'}
|
|
97
|
+
required
|
|
98
|
+
InputProps={{
|
|
99
|
+
endAdornment: (
|
|
100
|
+
<InputAdornment position="end">
|
|
101
|
+
<IconButton
|
|
102
|
+
size="small"
|
|
103
|
+
aria-label="toggle password visibility"
|
|
104
|
+
onClick={() => setShowPassword((prev) => !prev)}
|
|
105
|
+
edge="end"
|
|
106
|
+
>
|
|
107
|
+
{showPassword ? <VisibilityOff /> : <Visibility />}
|
|
108
|
+
</IconButton>
|
|
109
|
+
</InputAdornment>
|
|
110
|
+
),
|
|
111
|
+
}}
|
|
112
|
+
/>
|
|
113
|
+
</Box>
|
|
114
|
+
<ActionButton type="submit">Login</ActionButton>
|
|
115
|
+
<Typography
|
|
116
|
+
variant="h6"
|
|
117
|
+
align="right"
|
|
118
|
+
onClick={() => setForgotPassword(false)}
|
|
119
|
+
>
|
|
120
|
+
<StyledLink to="/">Forgot Password</StyledLink>
|
|
121
|
+
</Typography>
|
|
122
|
+
</Stack>
|
|
123
|
+
</form>
|
|
124
|
+
) : (
|
|
125
|
+
<>
|
|
126
|
+
<Stack gap={'30px'}>
|
|
38
127
|
<FormTextField
|
|
39
128
|
control={control}
|
|
40
|
-
name="
|
|
41
|
-
label="
|
|
129
|
+
name="email"
|
|
130
|
+
label="Email"
|
|
42
131
|
required
|
|
132
|
+
onChange={(e) => setForgotMail(e.target.value)}
|
|
43
133
|
/>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
InputProps={{
|
|
53
|
-
endAdornment: (
|
|
54
|
-
<InputAdornment position="end">
|
|
55
|
-
<IconButton
|
|
56
|
-
size="small"
|
|
57
|
-
aria-label="toggle password visibility"
|
|
58
|
-
onClick={() => setShowPassword((prev) => !prev)}
|
|
59
|
-
edge="end"
|
|
60
|
-
>
|
|
61
|
-
{showPassword ? <VisibilityOff /> : <Visibility />}
|
|
62
|
-
</IconButton>
|
|
63
|
-
</InputAdornment>
|
|
64
|
-
),
|
|
134
|
+
<Button onClick={() => handleSendMail()}>Send Email</Button>
|
|
135
|
+
|
|
136
|
+
<Typography
|
|
137
|
+
variant="subtitle2"
|
|
138
|
+
onClick={() => {
|
|
139
|
+
setForgotPassword(true)
|
|
140
|
+
setError('')
|
|
141
|
+
setMailSent(false)
|
|
65
142
|
}}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
143
|
+
align="right"
|
|
144
|
+
>
|
|
145
|
+
<StyledLink to="/">Login here</StyledLink>
|
|
146
|
+
</Typography>
|
|
147
|
+
|
|
148
|
+
{mailSent && (
|
|
149
|
+
<Alert severity="success">
|
|
150
|
+
Reset password link has been sent to your email.
|
|
151
|
+
</Alert>
|
|
152
|
+
)}
|
|
153
|
+
</Stack>
|
|
154
|
+
</>
|
|
155
|
+
)}
|
|
156
|
+
|
|
71
157
|
{error && (
|
|
72
158
|
<Alert severity="error" sx={{ marginTop: '20px' }}>
|
|
73
159
|
{error}
|
|
@@ -77,4 +163,9 @@ export function LoginForm({ loginUrl }: { loginUrl?: string }) {
|
|
|
77
163
|
)
|
|
78
164
|
}
|
|
79
165
|
|
|
166
|
+
export const StyledLink = styled(Link)({
|
|
167
|
+
textDecoration: 'none',
|
|
168
|
+
color: 'black',
|
|
169
|
+
})
|
|
170
|
+
|
|
80
171
|
export default LoginForm
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { VisibilityOff, Visibility } from '@mui/icons-material'
|
|
2
|
+
import { Stack, InputAdornment, IconButton, Button, Alert } from '@mui/material'
|
|
3
|
+
import React, { useState } from 'react'
|
|
4
|
+
import { FormTextField } from './HookForm'
|
|
5
|
+
import axios from '../config/axios'
|
|
6
|
+
import { useForm } from 'react-hook-form'
|
|
7
|
+
import { useNavigate } from 'react-router-dom'
|
|
8
|
+
import { toast } from 'react-toastify'
|
|
9
|
+
|
|
10
|
+
function ResetPassword() {
|
|
11
|
+
const searchParams = new URLSearchParams(document.location.search)
|
|
12
|
+
const { handleSubmit, control } = useForm()
|
|
13
|
+
const navigate = useNavigate()
|
|
14
|
+
const [error, setError] = useState('')
|
|
15
|
+
const [showPassword, setShowPassword] = useState(false)
|
|
16
|
+
const [showConfirmPassword, setShowConfirmPassword] = useState(false)
|
|
17
|
+
|
|
18
|
+
async function handleResetPassword(values) {
|
|
19
|
+
const token = searchParams.get('token')
|
|
20
|
+
values.token = token
|
|
21
|
+
|
|
22
|
+
if (values.newPassword == values.confirmNewPassword) {
|
|
23
|
+
try {
|
|
24
|
+
await axios
|
|
25
|
+
.post(`https://api.campx.dev/auth-server/auth/reset-password`, values)
|
|
26
|
+
.then((res) => {
|
|
27
|
+
navigate('/login')
|
|
28
|
+
toast.success('Password Changed Successfully')
|
|
29
|
+
})
|
|
30
|
+
} catch (err) {
|
|
31
|
+
if (
|
|
32
|
+
values.newPassword.length == 0 &&
|
|
33
|
+
values.confirmNewPassword.length == 0
|
|
34
|
+
) {
|
|
35
|
+
setError('Please enter valid password')
|
|
36
|
+
} else if (token == null) {
|
|
37
|
+
setError('Invalid token')
|
|
38
|
+
} else {
|
|
39
|
+
setError(err.response.data.message ?? 'Server Error')
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
setError("New Password and Confirm New password doesn't match")
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<>
|
|
49
|
+
<form onSubmit={handleSubmit(handleResetPassword)}>
|
|
50
|
+
<Stack gap={'30px'}>
|
|
51
|
+
<FormTextField
|
|
52
|
+
control={control}
|
|
53
|
+
name="newPassword"
|
|
54
|
+
label="New Password"
|
|
55
|
+
type={showPassword ? 'text' : 'password'}
|
|
56
|
+
required
|
|
57
|
+
InputProps={{
|
|
58
|
+
endAdornment: (
|
|
59
|
+
<InputAdornment position="end">
|
|
60
|
+
<IconButton
|
|
61
|
+
size="small"
|
|
62
|
+
aria-label="toggle password visibility"
|
|
63
|
+
onClick={() => setShowPassword((prev) => !prev)}
|
|
64
|
+
edge="end"
|
|
65
|
+
>
|
|
66
|
+
{showPassword ? <VisibilityOff /> : <Visibility />}
|
|
67
|
+
</IconButton>
|
|
68
|
+
</InputAdornment>
|
|
69
|
+
),
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
|
|
73
|
+
<FormTextField
|
|
74
|
+
control={control}
|
|
75
|
+
name="confirmNewPassword"
|
|
76
|
+
label="Confirm Password"
|
|
77
|
+
type={showConfirmPassword ? 'text' : 'password'}
|
|
78
|
+
required
|
|
79
|
+
InputProps={{
|
|
80
|
+
endAdornment: (
|
|
81
|
+
<InputAdornment position="end">
|
|
82
|
+
<IconButton
|
|
83
|
+
size="small"
|
|
84
|
+
aria-label="toggle password visibility"
|
|
85
|
+
onClick={() => setShowConfirmPassword((prev) => !prev)}
|
|
86
|
+
edge="end"
|
|
87
|
+
>
|
|
88
|
+
{showPassword ? <VisibilityOff /> : <Visibility />}
|
|
89
|
+
</IconButton>
|
|
90
|
+
</InputAdornment>
|
|
91
|
+
),
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<Button type="submit">Reset Password</Button>
|
|
96
|
+
</Stack>
|
|
97
|
+
</form>
|
|
98
|
+
{error && (
|
|
99
|
+
<Alert severity="error" sx={{ marginTop: '20px' }}>
|
|
100
|
+
{error}
|
|
101
|
+
</Alert>
|
|
102
|
+
)}
|
|
103
|
+
</>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export default ResetPassword
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
TableContainer,
|
|
11
11
|
TableHead,
|
|
12
12
|
TableRow,
|
|
13
|
-
Typography,
|
|
14
13
|
} from '@mui/material'
|
|
15
14
|
import _ from 'lodash'
|
|
16
15
|
import { useEffect, useState } from 'react'
|
|
17
|
-
import Spinner from '
|
|
18
|
-
import { SortAscIcon, SortDescIcon, SortIcon } from '
|
|
16
|
+
import Spinner from '../../Spinner'
|
|
17
|
+
import { SortAscIcon, SortDescIcon, SortIcon } from '../common/icons'
|
|
18
|
+
import NoRecordsFound from '../common/NoRecordsFound'
|
|
19
19
|
import TableFooter from './TableFooter'
|
|
20
20
|
|
|
21
21
|
export interface ColumnProps {
|
|
@@ -88,7 +88,7 @@ export default function Table({
|
|
|
88
88
|
}, [sort])
|
|
89
89
|
|
|
90
90
|
return (
|
|
91
|
-
<
|
|
91
|
+
<StyledTableContainer>
|
|
92
92
|
<>
|
|
93
93
|
<MuiTable>
|
|
94
94
|
<TableHead>
|
|
@@ -156,13 +156,9 @@ export default function Table({
|
|
|
156
156
|
))}
|
|
157
157
|
</TableBody>
|
|
158
158
|
) : (
|
|
159
|
-
|
|
160
|
-
{
|
|
161
|
-
|
|
162
|
-
No Records Found !..
|
|
163
|
-
</Typography>
|
|
164
|
-
)}
|
|
165
|
-
</Box>
|
|
159
|
+
<>
|
|
160
|
+
<NoRecordsFound colLength={columns?.length} />
|
|
161
|
+
</>
|
|
166
162
|
)}
|
|
167
163
|
</>
|
|
168
164
|
) : (
|
|
@@ -181,10 +177,15 @@ export default function Table({
|
|
|
181
177
|
/>
|
|
182
178
|
)}
|
|
183
179
|
</>
|
|
184
|
-
</
|
|
180
|
+
</StyledTableContainer>
|
|
185
181
|
)
|
|
186
182
|
}
|
|
187
183
|
|
|
184
|
+
const StyledTableContainer = styled(TableContainer)(({ theme }) => ({
|
|
185
|
+
width: '100%',
|
|
186
|
+
overflowX: 'auto',
|
|
187
|
+
}))
|
|
188
|
+
|
|
188
189
|
const StyledTableRow = styled(TableRow, {
|
|
189
190
|
shouldForwardProp: (prop) => prop !== 'canRowClick',
|
|
190
191
|
})<{ canRowClick: boolean }>(({ canRowClick }) => ({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Box, Typography } from '@mui/material'
|
|
2
2
|
import DropDownButton from '../../DropDownButton/DropDownButton'
|
|
3
|
-
import { StyledPagination, StyledTableFooter } from '../styles'
|
|
3
|
+
import { StyledPagination, StyledTableFooter } from '../common/styles'
|
|
4
|
+
import TableStats from '../common/TableStats'
|
|
4
5
|
|
|
5
6
|
interface TableFooterProps {
|
|
6
7
|
totalCount: number
|
|
@@ -39,25 +40,6 @@ export default function TableFooter({
|
|
|
39
40
|
)
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
export const TableStats = ({
|
|
43
|
-
limit,
|
|
44
|
-
totalCount,
|
|
45
|
-
page,
|
|
46
|
-
}: {
|
|
47
|
-
limit: number
|
|
48
|
-
page: number
|
|
49
|
-
totalCount: number
|
|
50
|
-
}) => {
|
|
51
|
-
const pageStart = (page - 1) * limit + 1
|
|
52
|
-
const pageEnd = page * limit <= totalCount ? page * limit : totalCount
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<Box>
|
|
56
|
-
<Typography variant="subtitle1">{`${pageStart} - ${pageEnd} of ${totalCount}`}</Typography>
|
|
57
|
-
</Box>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
43
|
const LimitField = ({ handlePageLimit, limit }) => {
|
|
62
44
|
return (
|
|
63
45
|
<Box>
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Box, Typography } from '@mui/material'
|
|
2
|
-
import DropDownButton from '
|
|
2
|
+
import DropDownButton from '../../DropDownButton'
|
|
3
3
|
import {
|
|
4
4
|
StyledActionIconButton,
|
|
5
5
|
StyledActionsRow,
|
|
6
6
|
StyledTableActionsHeader,
|
|
7
|
-
} from '
|
|
7
|
+
} from '../common/styles'
|
|
8
8
|
|
|
9
9
|
export default function BatchActionsHeader({
|
|
10
10
|
selectedRowIds,
|
|
@@ -14,16 +14,16 @@ import {
|
|
|
14
14
|
import { useEffect, useMemo, useState } from 'react'
|
|
15
15
|
import { usePagination, useRowSelect, useTable } from 'react-table'
|
|
16
16
|
import BatchActionsHeader from './BatchActionsHeader'
|
|
17
|
-
import { SortAscIcon, SortDescIcon, SortIcon } from '
|
|
17
|
+
import { SortAscIcon, SortDescIcon, SortIcon } from '../common/icons'
|
|
18
18
|
import { RenderTableBody } from './RenderTableBody'
|
|
19
19
|
import {
|
|
20
20
|
StyledLimitBox,
|
|
21
21
|
StyledLimitMenu,
|
|
22
22
|
StyledPagination,
|
|
23
23
|
StyledTableFooter,
|
|
24
|
-
} from '
|
|
25
|
-
import {
|
|
26
|
-
import
|
|
24
|
+
} from '../common/styles'
|
|
25
|
+
import { ColumnProps, Sort, TableProps } from '../common/types'
|
|
26
|
+
import TableStats from '../common/TableStats'
|
|
27
27
|
|
|
28
28
|
type ReactTableCell = {
|
|
29
29
|
Header: any
|
|
@@ -73,7 +73,7 @@ const getTableCol = (headerItem: ColumnProps) => {
|
|
|
73
73
|
return col
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export default function
|
|
76
|
+
export default function ReactTable({
|
|
77
77
|
columns,
|
|
78
78
|
dataSource,
|
|
79
79
|
loading,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box, TableBody, TableCell, Typography } from '@mui/material'
|
|
2
|
-
import Spinner from '
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import Spinner from '../../Spinner'
|
|
3
|
+
import { StyledTableRow } from '../common/styles'
|
|
4
|
+
import NoRecordsFound from '../common/NoRecordsFound'
|
|
5
5
|
|
|
6
6
|
export const RenderTableBody = ({
|
|
7
7
|
getTableBodyProps,
|
|
@@ -19,26 +19,7 @@ export const RenderTableBody = ({
|
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
if (!loading && rows?.length < 1)
|
|
22
|
-
return
|
|
23
|
-
<TableCell colSpan={colLength}>
|
|
24
|
-
<Box
|
|
25
|
-
sx={{
|
|
26
|
-
display: 'flex',
|
|
27
|
-
flexDirection: 'column',
|
|
28
|
-
alignItems: 'center',
|
|
29
|
-
justifyContent: 'center',
|
|
30
|
-
}}
|
|
31
|
-
>
|
|
32
|
-
<img
|
|
33
|
-
style={{ width: '200px', height: 'auto', textAlign: 'center' }}
|
|
34
|
-
src={noDataImage}
|
|
35
|
-
/>
|
|
36
|
-
<Typography variant="h6" align="center">
|
|
37
|
-
No Records Found
|
|
38
|
-
</Typography>
|
|
39
|
-
</Box>
|
|
40
|
-
</TableCell>
|
|
41
|
-
)
|
|
22
|
+
return <NoRecordsFound colLength={colLength} />
|
|
42
23
|
|
|
43
24
|
return (
|
|
44
25
|
<TableBody {...getTableBodyProps()}>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ReactTable'
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Box, TableCell, Typography } from '@mui/material'
|
|
2
|
+
import noDataImage from './no-data-illu.svg'
|
|
3
|
+
|
|
4
|
+
const NoRecordsFound = ({ colLength }) => {
|
|
5
|
+
return (
|
|
6
|
+
<TableCell colSpan={colLength}>
|
|
7
|
+
<Box
|
|
8
|
+
sx={{
|
|
9
|
+
display: 'flex',
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
<img
|
|
16
|
+
style={{ width: '200px', height: 'auto', textAlign: 'center' }}
|
|
17
|
+
src={noDataImage}
|
|
18
|
+
/>
|
|
19
|
+
<Typography variant="h6" align="center">
|
|
20
|
+
No Records Found
|
|
21
|
+
</Typography>
|
|
22
|
+
</Box>
|
|
23
|
+
</TableCell>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default NoRecordsFound
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Box, Typography } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
const TableStats = ({
|
|
4
|
+
limit,
|
|
5
|
+
totalCount,
|
|
6
|
+
page,
|
|
7
|
+
}: {
|
|
8
|
+
limit: number
|
|
9
|
+
page: number
|
|
10
|
+
totalCount: number
|
|
11
|
+
}) => {
|
|
12
|
+
const pageStart = (page - 1) * limit + 1
|
|
13
|
+
const pageEnd = page * limit <= totalCount ? page * limit : totalCount
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Box>
|
|
17
|
+
<Typography variant="subtitle1">{`${pageStart} - ${pageEnd} of ${totalCount}`}</Typography>
|
|
18
|
+
</Box>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default TableStats
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/components/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { Table as StyledTable } from './Table'
|
|
|
14
14
|
import ErrorBoundary from './ErrorBoundary'
|
|
15
15
|
import FullScreenLoader from './FullScreenLoader'
|
|
16
16
|
import LoginForm from './LoginForm'
|
|
17
|
+
import ResetPassword from './ResetPassword'
|
|
17
18
|
import { SideMenuHeader } from './Layout/SideMenuHeader'
|
|
18
19
|
import SideNav from './Layout/SideNav'
|
|
19
20
|
import { ListItemButton } from './ListItemButton'
|
|
@@ -37,7 +38,7 @@ export { default as PageHeader } from './PageHeader'
|
|
|
37
38
|
export { PageContent } from './PageContent'
|
|
38
39
|
export { default as ActionButton } from './ActionButton'
|
|
39
40
|
export { default as Breadcrumbs } from './Breadcrumbs'
|
|
40
|
-
export { default as Table } from './
|
|
41
|
+
export { default as Table } from './Tables/BasicTable'
|
|
41
42
|
export { default as Spinner } from './Spinner'
|
|
42
43
|
export { default as AutocompleteSearch } from './AutocompleteSearch'
|
|
43
44
|
export { default as JsonPreview } from './JsonPreview'
|
|
@@ -51,8 +52,8 @@ export { default as ToastContainer } from './ToastContainer'
|
|
|
51
52
|
export { default as Card } from './Card'
|
|
52
53
|
export { default as CardsGrid } from './CardsGrid'
|
|
53
54
|
export { default as DividerHeading } from './DividerHeading'
|
|
54
|
-
export { default as ReactTable } from './
|
|
55
|
-
export { default as TableFooter } from './
|
|
55
|
+
export { default as ReactTable } from './Tables/ReactTable'
|
|
56
|
+
export { default as TableFooter } from './Tables/BasicTable/TableFooter'
|
|
56
57
|
export { default as DropDownButton } from './DropDownButton'
|
|
57
58
|
export { default as useConfirm } from './PopupConfirm/useConfirm'
|
|
58
59
|
|
|
@@ -74,6 +75,7 @@ export {
|
|
|
74
75
|
ErrorBoundary,
|
|
75
76
|
FullScreenLoader,
|
|
76
77
|
LoginForm,
|
|
78
|
+
ResetPassword,
|
|
77
79
|
SideMenuHeader,
|
|
78
80
|
ListItemButton,
|
|
79
81
|
LayoutWrapper,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './TableFooter'
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Box, Pagination, styled } from '@mui/material'
|
|
2
|
-
|
|
3
|
-
export const StyledTableStats = styled(Box)(({}) => ({}))
|
|
4
|
-
|
|
5
|
-
export const StyledTableFooter = styled(Box)(({ theme }) => ({
|
|
6
|
-
paddingTop: '1rem',
|
|
7
|
-
width: '100%',
|
|
8
|
-
display: 'flex',
|
|
9
|
-
justifyContent: 'space-between',
|
|
10
|
-
alignItems: 'center',
|
|
11
|
-
}))
|
|
12
|
-
|
|
13
|
-
export const StyledPagination = styled(Pagination)(({ theme }) => ({
|
|
14
|
-
'& .MuiPaginationItem-root': {
|
|
15
|
-
border: 'none',
|
|
16
|
-
background: theme.palette.secondary.dark,
|
|
17
|
-
},
|
|
18
|
-
'& .MuiPaginationItem-previousNext': {
|
|
19
|
-
border: theme.borders.grayLight,
|
|
20
|
-
background: theme.palette.common.white,
|
|
21
|
-
},
|
|
22
|
-
'& .Mui-selected': {
|
|
23
|
-
border: `2px solid ${theme.palette.common.yellow}`,
|
|
24
|
-
},
|
|
25
|
-
'& .MuiPaginationItem-ellipsis': {
|
|
26
|
-
background: theme.palette.common.white,
|
|
27
|
-
},
|
|
28
|
-
}))
|