diff --git a/src/pages/transaction/topup/TransactionTopup.tsx b/src/pages/transaction/topup/TransactionTopup.tsx
index 9552360..a05fb95 100644
--- a/src/pages/transaction/topup/TransactionTopup.tsx
+++ b/src/pages/transaction/topup/TransactionTopup.tsx
@@ -4,24 +4,46 @@ import { Breadcrumbs, Link } from '@mui/material';
import { Helmet } from 'react-helmet';
import { Input } from '@/components/ui/input';
import { Button } from '@/components/ui/button';
-import { useState } from 'react';
+import { useState, useEffect } from 'react';
import { useCallApi } from '@/hooks';
import { apiConfig } from '@/config/api.config';
import { toast } from 'sonner';
+import { getAuth } from '@/auth';
const TransactionTopup = () => {
const [form, setForm] = useState({
topupAmount: '',
pin: ''
});
+
+ const [wallets, setWallets] = useState([]);
const { GetData, PostData } = useCallApi();
+ const parsedUser = getAuth()?.user;
const API_URL = apiConfig.transaction;
+ const API_URL_WALLET = apiConfig.service_wallet
+
+ useEffect(() => {
+ const fetchWallets = async () => {
+ try {
+ const response = await GetData(`${API_URL_WALLET}/dashboard/balance/account/${parsedUser.customer.id}`, {});
+ if (response?.status === true) {
+ setWallets(response.data || []);
+ } else {
+ toast.warning(response?.message || 'Failed to fetch wallet data');
+ }
+ } catch (error) {
+ toast.warning('Failed to fetch wallet data');
+ }
+ };
+
+ fetchWallets();
+ }, []);
const handleSubmit = async (e: any) => {
e.preventDefault();
console.log('Submitted Data:', form);
- if (form.pin == '' || form.topupAmount) {
+ if (form.pin == '' || form.topupAmount == '') {
toast.warning('Please fill in all required fields.')
return
}
@@ -60,6 +82,20 @@ const TransactionTopup = () => {
Topup
+ {/* Wallet Section */}
+
+
Your Wallets
+
+ {wallets.map((wallet: any) => (
+
+
{wallet.wallet}
+
+ {new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(wallet.amount)}
+
+
+ ))}
+
+
diff --git a/src/routing/AppRoutingSetup.tsx b/src/routing/AppRoutingSetup.tsx
index 786cd1e..fbb889e 100644
--- a/src/routing/AppRoutingSetup.tsx
+++ b/src/routing/AppRoutingSetup.tsx
@@ -42,9 +42,10 @@ import WalletRuleMaster from '@/pages/master/walletRule/WalletRuleMaster';
import WalletHistory from '@/pages/wallet/wallet-history/WalletHistory';
import WalletMaster from '@/pages/master/wallet/WalletMaster';
import CurrencyMaster from '@/pages/master/currency/CurrencyMaster';
+import FeedbackMemberMaster from '@/pages/members/feedback-member/FeedbackMember';
// DISBURSEMENT
-import HistoryTransactionDisbursement from '@/pages/disbursement/history-transaction/HistoryTransaction'
+import HistoryTransactionDisbursement from '@/pages/disbursement/history-transaction/HistoryTransaction';
// DISBURSEMENT
const AppRoutingSetup = (): ReactElement => {
@@ -84,6 +85,7 @@ const AppRoutingSetup = (): ReactElement => {
} />
} />
} />
+ } />
} />
@@ -98,8 +100,8 @@ const AppRoutingSetup = (): ReactElement => {
} />
} />
- } />
- } />
+ } />
+ } />
} />
} />
} />
@@ -112,9 +114,11 @@ const AppRoutingSetup = (): ReactElement => {
/>
{/* DISBURSEMENT */}
- } />
+ }
+ />
{/* DISBURSEMENT */}
-
} />