import Box from '@mui/material/Box'; import type { CardProps } from '@mui/material/Card'; import Card from '@mui/material/Card'; import { alpha as hexAlpha, useTheme } from '@mui/material/styles'; import type { ChartOptions } from 'src/components/chart'; import { Chart, useChart } from 'src/components/chart'; import { Iconify } from 'src/components/iconify'; import { SvgColor } from 'src/components/svg-color'; import { CONFIG } from 'src/global-config'; import { fCurrency, fPercent } from 'src/utils/format-number'; // ---------------------------------------------------------------------- type Props = CardProps & { total: number; title: string; percent: number; chart: { colors?: string[]; categories: string[]; series: { data: number[]; }[]; options?: ChartOptions; }; }; export function BookingTotalIncomes({ title, total, percent, chart, sx, ...other }: Props) { const theme = useTheme(); const chartColors = chart.colors ?? [hexAlpha(theme.palette.primary.lighter, 0.64)]; const chartOptions = useChart({ chart: { sparkline: { enabled: true } }, colors: chartColors, stroke: { width: 3 }, grid: { padding: { top: 6, left: 6, right: 6, bottom: 6, }, }, xaxis: { categories: chart.categories }, tooltip: { y: { formatter: (value: number) => fCurrency(value), title: { formatter: () => '' } }, }, markers: { strokeColors: theme.vars.palette.primary.darker, }, ...chart.options, }); const renderTrending = () => ( = 0 ? 'eva:trending-up-fill' : 'eva:trending-down-fill'} /> {percent > 0 && '+'} {fPercent(percent)} last month ); return ( ({ p: 3, borderRadius: 2, boxShadow: 'none', color: 'primary.lighter', bgcolor: 'primary.darker', }), ...(Array.isArray(sx) ? sx : [sx]), ]} {...other} > {title} {fCurrency(total)} {renderTrending()} ); }