-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
127 lines (117 loc) · 5.17 KB
/
Copy pathindex.html
File metadata and controls
127 lines (117 loc) · 5.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<title>Bangladesh eBank</title>
</head>
<body>
<div class="main container">
<!-- Login Area -->
<div id="login-area">
<div id="login-form" class="shadow">
<h3 class="text-center">Welcome to Bangladesh eBank</h3>
<br>
<input type="text" class="form-control" id="user-name" placeholder="Enter your Email">
<br>
<input type="password" id="password" class="form-control" placeholder="Enter your Password">
<br>
<button class="btn bg-success" id="login-btn">Log in</button>
</div>
<br>
<div class="alert alert-danger text-center" id="alert">
<strong>Incorrect username / password!</strong>
</div>
<p class="text-center">Username: admin<br>Password: admin</p>
</div>
<!-- Transaction Area -->
<div id="transaction-area">
<h3 class="text-center">Welcome to Bangladesh eBank</h3>
<br>
<div class="row">
<div class="col-md-4">
<div class="deposit">
<h4>Deposit</h4>
<h2>$ <span id="current-deposit">00</span></h2>
</div>
</div>
<div class="col-md-4">
<div class="withdraw">
<h4>Withdraw</h4>
<h2>$ <span id="currentWithdraw">00</span></h2>
</div>
</div>
<div class="col-md-4">
<div class="balance">
<h4>Balance</h4>
<h2>$ <span id="balance">1000</span></h2>
</div>
</div>
</div>
<br>
<!-- Enter Transaction -->
<div class="row">
<div class="col-md-6">
<div class="input-deposit shadow">
<h3>Deposit</h3>
<input type="text" class="form-control" id="deposit-amount" placeholder="Enter Deposit amount">
<br>
<button class="btn bg-success" id="deposit-btn">Deposit</button>
</div>
</div>
<div class="col-md-6">
<div class="input-withdraw shadow">
<h3>Withdraw</h3>
<input type="text" id="withdrawAmount" class="form-control" id="" placeholder="Enter withdraw amount">
<br>
<button id="withdrawBtn" class="btn bg-success">Withdraw</button>
</div>
</div>
</div>
</div>
</div>
<script>
// Login Area
const logIn = document.getElementById('login-btn');
logIn.addEventListener('click', function() {
const userName = document.getElementById('user-name').value;
const password = document.getElementById('password').value;
if (userName && password === "admin") {
const loginForm = document.getElementById('login-area');
loginForm.style.display = "none";
const transaction = document.getElementById('transaction-area');
transaction.style.display = "block";
} else {
const alert = document.getElementById('alert');
alert.style.display = 'block'
}
})
// Transaction Ara
const depositBtn = document.getElementById('deposit-btn');
depositBtn.addEventListener('click', function() {
const depositAmount = document.getElementById('deposit-amount').value;
const depositNumber = parseFloat(depositAmount);
spanTextUpdate('current-deposit', depositNumber);
spanTextUpdate('balance', depositNumber);
document.getElementById('deposit-amount').value = "";
})
// Deposit Handler
function spanTextUpdate(id, depositNumber) {
const current = document.getElementById(id).innerText;
const currentNumber = parseFloat(current);
const total = depositNumber + currentNumber;
document.getElementById(id).innerText = total;
}
// withdraw
const withdrawBtn = document.getElementById('withdrawBtn');
withdrawBtn.addEventListener('click', function() {
const withdrawAmount = document.getElementById('withdrawAmount').value;
const withdrawAmountNum = parseFloat(withdrawAmount);
spanTextUpdate('currentWithdraw', withdrawAmountNum);
spanTextUpdate('balance', -1 * withdrawAmountNum);
})
</script>
</body>
</html>