New Form Java
New Form Java
00;
let depositHistory = [];
let withdrawalHistory = [];
function toggleOptions() {
const moneyActions = document.getElementById('moneyActions');
moneyActions.style.display = moneyActions.style.display === 'none' ? 'flex' :
'none';
document.getElementById('currentBalance').textContent =
currentBalance.toFixed(2);
document.getElementById('historySection').style.display = 'none'; // Hide
history when options are shown
}
function refreshBalance() {
alert('Balance refreshed!');
document.getElementById('currentBalance').textContent =
currentBalance.toFixed(2);
}
function showDepositOptions() {
document.getElementById('depositOptions').style.display = 'block';
document.getElementById('historySection').style.display = 'none'; // Hide
history when showing deposit options
}
function selectAmount(amount) {
document.getElementById('amount').value = amount;
}
function showDepositForm() {
const depositAmount = document.getElementById('amount').value;
if (depositAmount) {
document.getElementById('depositForm').style.display = 'block';
document.getElementById('depositForm').classList.add('show-form');
document.getElementById('depositOptions').style.display = 'none'; // Hide
deposit options
} else {
alert('Please select an amount.');
}
}
function submitDeposit() {
const name = document.getElementById('name').value;
const accountNumber = document.getElementById('accountNumber').value;
const paymentMethod = document.getElementById('paymentMethod').value;
const amount = parseFloat(document.getElementById('amount').value);
if (amount > 0) {
currentBalance += amount;
depositHistory.push({ name, accountNumber, paymentMethod, amount });
alert('Deposit successful!');
function resetDepositForm() {
document.getElementById('depositForm').reset();
document.getElementById('depositForm').style.display = 'none';
document.getElementById('depositOptions').style.display = 'none'; // Hide
deposit options
}
function showWithdrawalForm() {
document.getElementById('withdrawalForm').style.display = 'block';
document.getElementById('historySection').style.display = 'none'; // Hide
history when showing withdrawal form
}
function submitWithdrawal() {
const withdrawName = document.getElementById('withdrawName').value;
const withdrawAccountNumber =
document.getElementById('withdrawAccountNumber').value;
const withdrawMethod = document.getElementById('withdrawMethod').value;
const withdrawAmount =
parseFloat(document.getElementById('withdrawAmount').value);
function resetWithdrawalForm() {
document.getElementById('withdrawalForm').reset();
document.getElementById('withdrawalForm').style.display = 'none';
}
function updateDepositHistory() {
const depositHistoryList = document.getElementById('depositHistoryList');
depositHistoryList.innerHTML = '';
depositHistory.forEach(entry => {
const listItem = document.createElement('li');
listItem.textContent = `Name: ${entry.name}, Amount: ₹${entry.amount},
Method: ${entry.paymentMethod}`;
depositHistoryList.appendChild(listItem);
});
}
function updateWithdrawalHistory() {
const withdrawalHistoryList = document.getElementById('withdrawalHistoryList');
withdrawalHistoryList.innerHTML = '';
withdrawalHistory.forEach(entry => {
const listItem = document.createElement('li');
listItem.textContent = `Name: ${entry.withdrawName}, Amount: ₹$
{entry.withdrawAmount}, Method: ${entry.withdrawMethod}`;
withdrawalHistoryList.appendChild(listItem);
});
}
function goBackToMain() {
document.getElementById('depositForm').style.display = 'none';
document.getElementById('withdrawalForm').style.display = 'none';
document.getElementById('depositOptions').style.display = 'none'; // Hide
deposit options
document.getElementById('historySection').style.display = 'block'; // Show
history again
}
function filterHistory(type) {
alert(`Filtering ${type} history...`);
}
function exitSite() {
window.close(); // This will work in some browsers
}