[5d6f37a] | 1 | // @mui
|
---|
| 2 | import { alpha } from '@mui/material/styles';
|
---|
| 3 | import Box from '@mui/material/Box';
|
---|
| 4 | import Stack from '@mui/material/Stack';
|
---|
| 5 | import Typography from '@mui/material/Typography';
|
---|
| 6 | import CircularProgress from '@mui/material/CircularProgress';
|
---|
| 7 | // utils
|
---|
| 8 | import { fShortenNumber, fCurrency } from 'src/utils/format-number';
|
---|
| 9 | // components
|
---|
| 10 | import Iconify from 'src/components/iconify';
|
---|
| 11 |
|
---|
| 12 | // ----------------------------------------------------------------------
|
---|
| 13 |
|
---|
| 14 | interface StatusTotals {
|
---|
| 15 | EUR: number;
|
---|
| 16 | USD: number;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | type Props = {
|
---|
| 20 | icon: string;
|
---|
| 21 | title: string;
|
---|
| 22 | total: number;
|
---|
| 23 | percent: number;
|
---|
| 24 | price: StatusTotals;
|
---|
| 25 | color?: string;
|
---|
| 26 | };
|
---|
| 27 |
|
---|
| 28 | export default function InvoiceAnalytic({ title, total, icon, color, percent, price }: Props) {
|
---|
| 29 | return (
|
---|
| 30 | <Stack
|
---|
| 31 | spacing={2.5}
|
---|
| 32 | direction="row"
|
---|
| 33 | alignItems="center"
|
---|
| 34 | justifyContent="center"
|
---|
| 35 | sx={{ width: 1, minWidth: 200 }}
|
---|
| 36 | >
|
---|
| 37 | <Stack alignItems="center" justifyContent="center" sx={{ position: 'relative' }}>
|
---|
| 38 | <Iconify icon={icon} width={32} sx={{ color, position: 'absolute' }} />
|
---|
| 39 |
|
---|
| 40 | <CircularProgress
|
---|
| 41 | variant="determinate"
|
---|
| 42 | value={percent}
|
---|
| 43 | size={56}
|
---|
| 44 | thickness={2}
|
---|
| 45 | sx={{ color, opacity: 0.48 }}
|
---|
| 46 | />
|
---|
| 47 |
|
---|
| 48 | <CircularProgress
|
---|
| 49 | variant="determinate"
|
---|
| 50 | value={100}
|
---|
| 51 | size={56}
|
---|
| 52 | thickness={3}
|
---|
| 53 | sx={{
|
---|
| 54 | top: 0,
|
---|
| 55 | left: 0,
|
---|
| 56 | opacity: 0.48,
|
---|
| 57 | position: 'absolute',
|
---|
| 58 | color: (theme) => alpha(theme.palette.grey[500], 0.16),
|
---|
| 59 | }}
|
---|
| 60 | />
|
---|
| 61 | </Stack>
|
---|
| 62 |
|
---|
| 63 | <Stack spacing={0.5}>
|
---|
| 64 | <Typography variant="subtitle1">{title}</Typography>
|
---|
| 65 |
|
---|
| 66 | <Box component="span" sx={{ color: 'text.disabled', typography: 'body2' }}>
|
---|
| 67 | {fShortenNumber(total)} invoices
|
---|
| 68 | </Box>
|
---|
| 69 |
|
---|
| 70 | <Typography variant="subtitle2">{fCurrency(price.USD, 'USD')}</Typography>
|
---|
| 71 | <Typography variant="subtitle2">{fCurrency(price.EUR, 'EUR')}</Typography>
|
---|
| 72 | </Stack>
|
---|
| 73 | </Stack>
|
---|
| 74 | );
|
---|
| 75 | }
|
---|