From daa3c4e9a26ddeab1c4a9222f3c1ff11db7a750f Mon Sep 17 00:00:00 2001 From: efrilm Date: Thu, 25 Sep 2025 23:45:49 +0700 Subject: [PATCH] Payment Method Report --- .../report/financial/payment-method/page.tsx | 18 ++++ src/views/apps/report/ReportFinancialList.tsx | 29 +++--- .../ReportPaymentMethodContent.tsx | 98 +++++++++++++++++++ 3 files changed, 133 insertions(+), 12 deletions(-) create mode 100644 src/app/[lang]/(dashboard)/(private)/apps/report/financial/payment-method/page.tsx create mode 100644 src/views/apps/report/financial/payment-method-report/ReportPaymentMethodContent.tsx diff --git a/src/app/[lang]/(dashboard)/(private)/apps/report/financial/payment-method/page.tsx b/src/app/[lang]/(dashboard)/(private)/apps/report/financial/payment-method/page.tsx new file mode 100644 index 0000000..227971c --- /dev/null +++ b/src/app/[lang]/(dashboard)/(private)/apps/report/financial/payment-method/page.tsx @@ -0,0 +1,18 @@ +import ReportTitle from '@/components/report/ReportTitle' +import ReportPaymentMethodContent from '@/views/apps/report/financial/payment-method-report/ReportPaymentMethodContent' +import Grid from '@mui/material/Grid2' + +const SalesProductReportPage = () => { + return ( + + + + + + + + + ) +} + +export default SalesProductReportPage diff --git a/src/views/apps/report/ReportFinancialList.tsx b/src/views/apps/report/ReportFinancialList.tsx index 9c78c5b..b027b01 100644 --- a/src/views/apps/report/ReportFinancialList.tsx +++ b/src/views/apps/report/ReportFinancialList.tsx @@ -11,26 +11,31 @@ const ReportFinancialList: React.FC = () => { const { lang: locale } = useParams() const financialReports = [ - { - title: 'Arus Kas', - iconClass: 'tabler-cash', - link: getLocalizedUrl(`/apps/report/cash-flow`, locale as Locale) - }, + // { + // title: 'Arus Kas', + // iconClass: 'tabler-cash', + // link: getLocalizedUrl(`/apps/report/cash-flow`, locale as Locale) + // }, { title: 'Laba Rugi', iconClass: 'tabler-cash', link: getLocalizedUrl(`/apps/report/profit-loss`, locale as Locale) }, { - title: 'Neraca', + title: 'Metode Pembayaran', iconClass: 'tabler-cash', - link: getLocalizedUrl(`/apps/report/neraca`, locale as Locale) - }, - { - title: 'Ringkasan Eksekutif', - iconClass: 'tabler-cash', - link: getLocalizedUrl(`/apps/report/neraca`, locale as Locale) + link: getLocalizedUrl(`/apps/report/financial/payment-method`, locale as Locale) } + // { + // title: 'Neraca', + // iconClass: 'tabler-cash', + // link: getLocalizedUrl(`/apps/report/neraca`, locale as Locale) + // }, + // { + // title: 'Ringkasan Eksekutif', + // iconClass: 'tabler-cash', + // link: getLocalizedUrl(`/apps/report/neraca`, locale as Locale) + // } ] return ( diff --git a/src/views/apps/report/financial/payment-method-report/ReportPaymentMethodContent.tsx b/src/views/apps/report/financial/payment-method-report/ReportPaymentMethodContent.tsx new file mode 100644 index 0000000..22e6fe9 --- /dev/null +++ b/src/views/apps/report/financial/payment-method-report/ReportPaymentMethodContent.tsx @@ -0,0 +1,98 @@ +'use client' + +import DateRangePicker from '@/components/RangeDatePicker' +import { ReportItemHeader, ReportItemSubheader } from '@/components/report/ReportItem' +import { usePaymentAnalytics } from '@/services/queries/analytics' +import { formatCurrency, formatDateDDMMYYYY } from '@/utils/transform' +import { Button, Card, CardContent } from '@mui/material' +import { useState } from 'react' + +const ReportPaymentMethodContent = () => { + const [startDate, setStartDate] = useState(new Date()) + const [endDate, setEndDate] = useState(new Date()) + + const { data: paymentAnalytics } = usePaymentAnalytics({ + date_from: formatDateDDMMYYYY(startDate!), + date_to: formatDateDDMMYYYY(endDate!) + }) + + return ( + +
+
+ + +
+
+ + +
+ + + + + + + + + + + + {paymentAnalytics?.data?.map((payment, index) => ( + + + + + + + + )) || []} + + + + + + + + + + +
Metode PembayaranTipeJumlah OrderTotal AmountPersentase
{payment.payment_method_name} + + {payment.payment_method_type.toUpperCase()} + + {payment.order_count}{formatCurrency(payment.total_amount)} + {(payment.percentage ?? 0).toFixed(1)}% +
TOTAL{paymentAnalytics?.summary.total_orders ?? 0} + {formatCurrency(paymentAnalytics?.summary.total_amount ?? 0)} +
+
+ +
+
+ ) +} + +export default ReportPaymentMethodContent