add new card in dashboard
This commit is contained in:
@ -23,6 +23,7 @@ import { apiConfig } from '@/config/api.config';
|
||||
import TransactionValue from './blocks/TransactionValue';
|
||||
import TransactionPieChart from './blocks/TransactionPieChart';
|
||||
import MemberActivity from './blocks/MemberActivity';
|
||||
import BankSaldo from './blocks/BankSaldo';
|
||||
|
||||
// sum -> nominal, count-> total
|
||||
type CountType = 'sum' | 'count';
|
||||
@ -57,6 +58,8 @@ const DashboardHomePage = () => {
|
||||
const API_URL = apiConfig.api_dashboard;
|
||||
const { GetData } = useCallApi();
|
||||
|
||||
const API_URL_BANK = apiConfig.service_wallet;
|
||||
|
||||
const [responseStatisticCard, setResponseStatisticCard] = useState<any>(null);
|
||||
|
||||
const fetchData = async () => {
|
||||
@ -64,10 +67,21 @@ const DashboardHomePage = () => {
|
||||
setResponseStatisticCard(res);
|
||||
};
|
||||
|
||||
const [bankaccount, setbankaccount] = useState<any>(null);
|
||||
|
||||
const fetchDataBankAccount = async () => {
|
||||
const res = await GetData(`${API_URL_BANK}/dashboard/balance/account/${getAuth()?.user?.customer?.id}`, {});
|
||||
setbankaccount(res);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
fetchDataBankAccount();
|
||||
}, []);
|
||||
|
||||
const [responseGraphic, setresponseGraphic] = useState<any>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@ -253,8 +267,29 @@ const DashboardHomePage = () => {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="flex space-x-4 mt-5">
|
||||
<BankSaldo
|
||||
title="Emoney Account"
|
||||
balance={bankaccount?.data[0].amount}
|
||||
creditLimit={bankaccount?.data[0].credit_limit}
|
||||
monthlyLimit={bankaccount?.data[0].monthly_limit}
|
||||
/>
|
||||
<BankSaldo
|
||||
title="Point Account"
|
||||
balance={bankaccount?.data[1].amount}
|
||||
creditLimit={bankaccount?.data[1].credit_limit}
|
||||
monthlyLimit={bankaccount?.data[1].monthly_limit}
|
||||
/>
|
||||
{/* <BankSaldo
|
||||
title="Cash In/Out Account"
|
||||
balance={"100"}
|
||||
creditLimit={"100"}
|
||||
monthlyLimit={"100"}
|
||||
/> */}
|
||||
</div>
|
||||
|
||||
{/* Cards */}
|
||||
<div className="flex gap-6 overflow-x-auto pb-2">
|
||||
<div className="flex gap-6 overflow-x-auto pb-2 mt-5">
|
||||
<Card
|
||||
title="Registered Users"
|
||||
total={responseStatisticCard?.data.total_registered ?? 0}
|
||||
|
||||
Reference in New Issue
Block a user