fix: analytic view

This commit is contained in:
ferdiansyah783
2025-08-10 22:56:04 +07:00
parent 0c95dd5f42
commit b648349ebd
8 changed files with 212 additions and 326 deletions
@@ -5,27 +5,16 @@ import Grid from '@mui/material/Grid2'
// Component Imports
import DistributedBarChartOrder from '@views/dashboards/crm/DistributedBarChartOrder'
import EarningReportsWithTabs from '@views/dashboards/crm/EarningReportsWithTabs'
// Server Action Imports
import Loading from '../../../../../../components/layout/shared/Loading'
import { usePaymentAnalytics } from '../../../../../../services/queries/analytics'
import { PaymentDataItem } from '../../../../../../types/services/analytic'
import PaymentMethodReport from '../../../../../../views/dashboards/payment-methods/PaymentMethodReport'
const DashboardPayment = () => {
const { data, isLoading } = usePaymentAnalytics()
const transformSalesData = (data: PaymentDataItem[]) => {
return [
{
type: 'payment',
avatarIcon: 'tabler-package',
date: data.map((d: PaymentDataItem) => d.payment_method_name),
series: [{ data: data.map((d: PaymentDataItem) => d.total_amount) }]
}
]
}
if (isLoading) return <Loading />
return (
@@ -71,26 +60,8 @@ const DashboardPayment = () => {
/>
</Grid>
<Grid size={{ xs: 12, lg: 12 }}>
<EarningReportsWithTabs data={transformSalesData(data!.data)} />
<PaymentMethodReport payments={data?.data as PaymentDataItem[]} />
</Grid>
{/* <Grid size={{ xs: 12, md: 6, lg: 4 }}>
<RadarSalesChart />
</Grid>
<Grid size={{ xs: 12, md: 6, lg: 4 }}>
<SalesByCountries />
</Grid>
<Grid size={{ xs: 12, md: 6, lg: 4 }}>
<ProjectStatus />
</Grid>
<Grid size={{ xs: 12, md: 6, lg: 4 }}>
<ActiveProjects />
</Grid>
<Grid size={{ xs: 12, md: 6 }}>
<LastTransaction />
</Grid>
<Grid size={{ xs: 12, md: 6 }}>
<ActivityTimeline />
</Grid> */}
</Grid>
)
}