From f2eb142dec69d9e65f6d5534f18bb887e2a580e1 Mon Sep 17 00:00:00 2001 From: efrilm Date: Thu, 11 Sep 2025 18:20:40 +0700 Subject: [PATCH] Report Profit Loss --- .../apps/report/profit-loss/page.tsx | 22 ++++ .../HorizontalWithSubtitle.tsx | 2 +- src/components/report/ReportItem.tsx | 7 +- .../profit-loss/ReportProfitLossCard.tsx | 98 +++++++++++++++ .../profit-loss/ReportProfitLossContent.tsx | 117 ++++++++++++++++++ 5 files changed, 242 insertions(+), 4 deletions(-) create mode 100644 src/app/[lang]/(dashboard)/(private)/apps/report/profit-loss/page.tsx create mode 100644 src/views/apps/report/profit-loss/ReportProfitLossCard.tsx create mode 100644 src/views/apps/report/profit-loss/ReportProfitLossContent.tsx diff --git a/src/app/[lang]/(dashboard)/(private)/apps/report/profit-loss/page.tsx b/src/app/[lang]/(dashboard)/(private)/apps/report/profit-loss/page.tsx new file mode 100644 index 0000000..93c519a --- /dev/null +++ b/src/app/[lang]/(dashboard)/(private)/apps/report/profit-loss/page.tsx @@ -0,0 +1,22 @@ +import ReportTitle from '@/components/report/ReportTitle' +import ReportProfitLossCard from '@/views/apps/report/profit-loss/ReportProfitLossCard' +import ReportProfitLossContent from '@/views/apps/report/profit-loss/ReportProfitLossContent' +import Grid from '@mui/material/Grid2' + +const ProfiltLossPage = () => { + return ( + + + + + + + + + + + + ) +} + +export default ProfiltLossPage diff --git a/src/components/card-statistics/HorizontalWithSubtitle.tsx b/src/components/card-statistics/HorizontalWithSubtitle.tsx index af663b5..2797957 100644 --- a/src/components/card-statistics/HorizontalWithSubtitle.tsx +++ b/src/components/card-statistics/HorizontalWithSubtitle.tsx @@ -32,7 +32,7 @@ const HorizontalWithSubtitle = (props: UserDataType) => {
{title}
- {stats} + {stats} {`(${trend === 'negative' ? '-' : '+'}${trendNumber})`} diff --git a/src/components/report/ReportItem.tsx b/src/components/report/ReportItem.tsx index bfa61ec..42c570f 100644 --- a/src/components/report/ReportItem.tsx +++ b/src/components/report/ReportItem.tsx @@ -4,7 +4,8 @@ import { Box, Typography, Paper } from '@mui/material' // Types type ReportItemHeaderProps = { title: string - date: string + date?: string + amount?: number } type ReportItemSubheaderProps = { @@ -34,14 +35,14 @@ const formatCurrency = (amount: number) => { } // ReportItemHeader Component -export const ReportItemHeader: React.FC = ({ title, date }) => { +export const ReportItemHeader: React.FC = ({ title, date, amount }) => { return ( {title} - {date} + {amount ? formatCurrency(amount) : date} ) diff --git a/src/views/apps/report/profit-loss/ReportProfitLossCard.tsx b/src/views/apps/report/profit-loss/ReportProfitLossCard.tsx new file mode 100644 index 0000000..a114637 --- /dev/null +++ b/src/views/apps/report/profit-loss/ReportProfitLossCard.tsx @@ -0,0 +1,98 @@ +// MUI Imports +import Grid from '@mui/material/Grid2' + +// Type Imports +import type { UserDataType } from '@components/card-statistics/HorizontalWithSubtitle' + +// Component Imports +import HorizontalWithSubtitle from '@components/card-statistics/HorizontalWithSubtitle' + +// Vars +const data: UserDataType[] = [ + { + title: 'Pendapatan', + stats: '29.004.775', + avatarIcon: 'tabler-trending-down', + avatarColor: 'error', + trend: 'negative', + trendNumber: '48,8%', + subtitle: 'vs Bulan Lalu' + }, + { + title: 'Margin Laba Bersih', + stats: '38%', + avatarIcon: 'tabler-gauge', + avatarColor: 'success', + trend: 'positive', + trendNumber: 'Bulan Ini', + subtitle: 'Bulan Ini' + }, + { + title: 'Laba Kotor', + stats: '21.076.389', + avatarIcon: 'tabler-trending-down', + avatarColor: 'error', + trend: 'negative', + trendNumber: '43,5%', + subtitle: 'vs bulan lalu' + }, + { + title: 'Laba Bersih', + stats: '11.111.074', + avatarIcon: 'tabler-trending-down', + avatarColor: 'error', + trend: 'negative', + trendNumber: '36,8%', + subtitle: 'vs bulan lalu' + }, + { + title: 'Margin Laba Kotor', + stats: '73%', + avatarIcon: 'tabler-gauge', + avatarColor: 'success', + trend: 'positive', + trendNumber: 'Bulan Ini', + subtitle: 'Bulan Ini' + }, + { + title: 'Biaya Operasional', + stats: '9.965.315', + avatarIcon: 'tabler-trending-down', + avatarColor: 'error', + trend: 'negative', + trendNumber: '49,4%', + subtitle: 'vs Bulan Lalu' + }, + { + title: 'Rasio Biaya Operasional', + stats: '61,7%', + avatarIcon: 'tabler-gauge', + avatarColor: 'success', + trend: 'positive', + trendNumber: 'Bulan Ini', + subtitle: 'Bulan Ini' + }, + { + title: 'EBITDA', + stats: '11.032.696', + avatarIcon: 'tabler-trending-down', + avatarColor: 'error', + trend: 'negative', + trendNumber: '37,3%', + subtitle: 'vs bulan lalu' + } +] + +const ReportProfitLossCard = () => { + return ( + + {data.map((item, i) => ( + + + + ))} + + ) +} + +export default ReportProfitLossCard diff --git a/src/views/apps/report/profit-loss/ReportProfitLossContent.tsx b/src/views/apps/report/profit-loss/ReportProfitLossContent.tsx new file mode 100644 index 0000000..8bb09ee --- /dev/null +++ b/src/views/apps/report/profit-loss/ReportProfitLossContent.tsx @@ -0,0 +1,117 @@ +'use client' + +import DateRangePicker from '@/components/RangeDatePicker' +import { ReportItem, ReportItemFooter, ReportItemHeader, ReportItemSubheader } from '@/components/report/ReportItem' +import { Button, Card, CardContent, Paper } from '@mui/material' +import { useState } from 'react' + +const ReportProfitLossContent = () => { + const [startDate, setStartDate] = useState(new Date()) + const [endDate, setEndDate] = useState(new Date()) + + return ( + +
+
+ + +
+
+ + + + {}} /> + + {}} + /> + {}} /> + {}} + /> + + + + + {}} /> + {}} /> + + + + + + + + + {}} /> + {}} + /> + {}} /> + {}} + /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} + /> + {}} /> + {}} /> + {}} /> + + + {}} + /> + {}} /> + {}} /> + {}} /> + + + + + +
+ ) +} + +export default ReportProfitLossContent