This commit is contained in:
wayanrivan
2025-05-10 20:00:26 +07:00
parent 9e7c7fe4de
commit 93a391dbb7
2 changed files with 9 additions and 3 deletions

View File

@ -234,6 +234,12 @@ const DashboardHomePage = () => {
</div> </div>
); );
const number: number = responseStatisticCard?.data.total_cash_in ?? 0;
const formattedNumber: number = parseFloat(number.toFixed(2));
const numbercashout: number = responseStatisticCard?.data.total_cash_out ?? 0;
const formattedNumbercashout: number = parseFloat(number.toFixed(2));
return ( return (
<> <>
<Helmet> <Helmet>
@ -266,14 +272,14 @@ const DashboardHomePage = () => {
/> />
<Card <Card
title="Total Cash-in" title="Total Cash-in"
total={parseFloat((responseStatisticCard?.data.total_cash_in ?? 0).toFixed(2)) ?? 0} total={formattedNumber.toFixed(2)} // now a number: 972.80
growth={parseFloat((responseStatisticCard?.data?.cash_in_last_week.percent ?? 0).toFixed(2)) ?? 0} growth={parseFloat((responseStatisticCard?.data?.cash_in_last_week.percent ?? 0).toFixed(2)) ?? 0}
surplus={responseStatisticCard?.data.cash_in_last_week.surplus ?? false} surplus={responseStatisticCard?.data.cash_in_last_week.surplus ?? false}
icon="test" icon="test"
/> />
<Card <Card
title="Total Cash-out" title="Total Cash-out"
total={parseFloat((responseStatisticCard?.data.out ?? 0).toFixed(2)) ?? 0} total={formattedNumbercashout.toFixed(2)} // now a number: 972.80
growth={parseFloat((responseStatisticCard?.data?.cash_out_last_week.percent ?? 0).toFixed(2)) ?? 0} growth={parseFloat((responseStatisticCard?.data?.cash_out_last_week.percent ?? 0).toFixed(2)) ?? 0}
surplus={responseStatisticCard?.data.cash_out_last_week.surplus ?? false} surplus={responseStatisticCard?.data.cash_out_last_week.surplus ?? false}
icon="test" icon="test"

View File

@ -19,7 +19,7 @@ const Card = ({ title, total, growth, surplus, icon }: CardDataProduct) => {
<div className="flex justify-between"> <div className="flex justify-between">
<div className="flex flex-col w-full"> <div className="flex flex-col w-full">
<span className="text-sm font-normal text-gray-600 mb-5">{title}</span> <span className="text-sm font-normal text-gray-600 mb-5">{title}</span>
<span className="text-3xl font-semibold text-gray-900 mb-0">{total.toFixed(2)}</span> <span className="text-3xl font-semibold text-gray-900 mb-0">{total}</span>
<span <span
className={`text-sm font-semibold mt-2 flex items-center gap-1 ${growth === 0 ? 'text-primary' : surplus ? 'text-green-500' : 'text-red-500' className={`text-sm font-semibold mt-2 flex items-center gap-1 ${growth === 0 ? 'text-primary' : surplus ? 'text-green-500' : 'text-red-500'
}`} }`}