let currentBalance = 0.
00;
let depositHistory = [];
let withdrawalHistory = [];
function toggleOptions() {
const moneyActions = [Link]('moneyActions');
[Link] = [Link] === 'none' ? 'flex' :
'none';
[Link]('currentBalance').textContent =
[Link](2);
[Link]('historySection').[Link] = 'none'; // Hide
history when options are shown
}
function refreshBalance() {
alert('Balance refreshed!');
[Link]('currentBalance').textContent =
[Link](2);
}
function showDepositOptions() {
[Link]('depositOptions').[Link] = 'block';
[Link]('historySection').[Link] = 'none'; // Hide
history when showing deposit options
}
function selectAmount(amount) {
[Link]('amount').value = amount;
}
function showDepositForm() {
const depositAmount = [Link]('amount').value;
if (depositAmount) {
[Link]('depositForm').[Link] = 'block';
[Link]('depositForm').[Link]('show-form');
[Link]('depositOptions').[Link] = 'none'; // Hide
deposit options
} else {
alert('Please select an amount.');
}
}
function submitDeposit() {
const name = [Link]('name').value;
const accountNumber = [Link]('accountNumber').value;
const paymentMethod = [Link]('paymentMethod').value;
const amount = parseFloat([Link]('amount').value);
if (amount > 0) {
currentBalance += amount;
[Link]({ name, accountNumber, paymentMethod, amount });
alert('Deposit successful!');
// Update deposit history
updateDepositHistory();
// Reset and hide forms
resetDepositForm();
refreshBalance();
[Link]('historySection').[Link] = 'block'; // Show
history after deposit
} else {
alert('Invalid amount.');
}
}
function resetDepositForm() {
[Link]('depositForm').reset();
[Link]('depositForm').[Link] = 'none';
[Link]('depositOptions').[Link] = 'none'; // Hide
deposit options
}
function showWithdrawalForm() {
[Link]('withdrawalForm').[Link] = 'block';
[Link]('historySection').[Link] = 'none'; // Hide
history when showing withdrawal form
}
function submitWithdrawal() {
const withdrawName = [Link]('withdrawName').value;
const withdrawAccountNumber =
[Link]('withdrawAccountNumber').value;
const withdrawMethod = [Link]('withdrawMethod').value;
const withdrawAmount =
parseFloat([Link]('withdrawAmount').value);
if (withdrawAmount > 0 && withdrawAmount <= currentBalance) {
currentBalance -= withdrawAmount;
[Link]({ withdrawName, withdrawAccountNumber,
withdrawMethod, withdrawAmount });
alert('Withdrawal successful!');
// Update withdrawal history
updateWithdrawalHistory();
// Reset and hide forms
resetWithdrawalForm();
refreshBalance();
[Link]('historySection').[Link] = 'block'; // Show
history after withdrawal
} else {
alert('Invalid withdrawal amount.');
}
}
function resetWithdrawalForm() {
[Link]('withdrawalForm').reset();
[Link]('withdrawalForm').[Link] = 'none';
}
function updateDepositHistory() {
const depositHistoryList = [Link]('depositHistoryList');
[Link] = '';
[Link](entry => {
const listItem = [Link]('li');
[Link] = `Name: ${[Link]}, Amount: ₹${[Link]},
Method: ${[Link]}`;
[Link](listItem);
});
}
function updateWithdrawalHistory() {
const withdrawalHistoryList = [Link]('withdrawalHistoryList');
[Link] = '';
[Link](entry => {
const listItem = [Link]('li');
[Link] = `Name: ${[Link]}, Amount: ₹$
{[Link]}, Method: ${[Link]}`;
[Link](listItem);
});
}
function goBackToMain() {
[Link]('depositForm').[Link] = 'none';
[Link]('withdrawalForm').[Link] = 'none';
[Link]('depositOptions').[Link] = 'none'; // Hide
deposit options
[Link]('historySection').[Link] = 'block'; // Show
history again
}
function filterHistory(type) {
alert(`Filtering ${type} history...`);
}
function exitSite() {
[Link](); // This will work in some browsers
}