-
Notifications
You must be signed in to change notification settings - Fork 0
/
payment.html
265 lines (237 loc) · 8.55 KB
/
payment.html
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!DOCTYPE html>
<html>
<head>
<title>Payment Method</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<style>
.container {
margin-top: 50px;
text-align: center;
}
.payment-details {
display: none;
margin-top: 30px;
}
.payment-details h3 {
color: #007bff;
margin-bottom: 20px;
}
.form-group label {
font-weight: bold;
}
.modal-content {
background-color: #f8f9fa;
}
.modal-body {
color: #212529;
}
.btn-primary {
background-color: #007bff;
border-color: #007bff;
}
.btn-primary:hover {
background-color: #0069d9;
border-color: #0062cc;
}
#submitButton {
position: relative;
}
#submitButton.loading::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 1em;
height: 1em;
border: 2px solid #fff;
border-radius: 50%;
border-top-color: transparent;
animation: spin 0.6s linear infinite;
}
@keyframes spin {
0% {
transform: translate(-50%, -50%) rotate(0deg);
}
100% {
transform: translate(-50%, -50%) rotate(360deg);
}
}
</style>
</head>
<body>
<div class="container">
<h1 class="mt-5">Payment Method</h1>
<form id="paymentForm" onsubmit="submitForm(event)">
<div class="form-group">
<label for="paymentMethod">Payment Method</label>
<select id="paymentMethod" name="paymentMethod" class="form-control" required>
<option value="">Select Payment Method</option>
<option value="gcash">GCash</option>
<option value="bank">Bank Account</option>
<option value="creditCard">Credit Card</option>
<option value="paypal">PayPal</option>
<option value="maybank">Maya</option>
<!-- Add more payment methods here -->
</select>
</div>
<div id="gcashDetails" class="payment-details">
<h3>GCash Details</h3>
<p>Provide your GCash details:</p>
<div class="form-group">
<label for="gcashNumber">GCash Number</label>
<input type="text" id="gcashNumber" name="gcashNumber" class="form-control">
</div>
</div>
<div id="bankDetails" class="payment-details">
<h3>Bank Account Details</h3>
<p>Provide your bank account details:</p>
<div class="form-group">
<label for="bankName">Bank Name</label>
<input type="text" id="bankName" name="bankName" class="form-control">
</div>
<div class="form-group">
<label for="accountNumber">Account Number</label>
<input type="text" id="accountNumber" name="accountNumber" class="form-control">
</div>
</div>
<div id="creditCardDetails" class="payment-details">
<h3>Credit Card Details</h3>
<p>Provide your credit card details:</p>
<div class="form-group">
<label for="cardNumber">Card Number</label>
<input type="text" id="cardNumber" name="cardNumber" class="form-control">
</div>
<div class="form-group">
<label for="expiryDate">Expiry Date</label>
<input type="text" id="expiryDate" name="expiryDate" class="form-control">
</div>
<div class="form-group">
<label for="cvv">CVV</label>
<input type="text" id="cvv" name="cvv" class="form-control">
</div>
<div class="form-group">
<label for="name">Cardholder Name</label>
<input type="text" id="name" name="name" class="form-control">
</div>
</div>
<div id="paypalDetails" class="payment-details">
<h3>PayPal Details</h3>
<p>Provide your PayPal details:</p>
<div class="form-group">
<label for="paypalEmail">PayPal Email</label>
<input type="email" id="paypalEmail" name="paypalEmail" class="form-control">
</div>
<div class="form-group">
<label for="billingAddress">Billing Address</label>
<input type="text" id="billingAddress" name="billingAddress" class="form-control">
</div>
<div class="form-group">
<label for="paymentAmount">Payment Amount</label>
<input type="number" id="paymentAmount" name="paymentAmount" class="form-control" step="0.01">
</div>
<div class="form-group">
<label for="itemDescription">Item Description</label>
<input type="text" id="itemDescription" name="itemDescription" class="form-control">
</div>
<div class="form-group">
<label for="currency">Currency</label>
<select id="currency" name="currency" class="form-control">
<option value="USD">USD</option>
<option value="EUR">EUR</option>
<option value="GBP">GBP</option>
<option value="PHP">PHP</option>
</select>
</div>
</div>
<div id="maybankDetails" class="payment-details">
<h3>MayA bank Details</h3>
<p>Provide your Maya details:</p>
<div class="form-group">
<label for="maybankAccount">Maya Account</label>
<input type="text" id="maybankAccount" name="maybankAccount" class="form-control">
</div>
</div>
<button id="submitButton" type="submit" class="btn btn-primary mt-3">Submit</button>
</form>
</div>
<!-- Success Modal -->
<div class="modal fade" id="successModal" tabindex="-1" role="dialog" aria-labelledby="successModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="successModalLabel">Checkout Successful</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Your checkout has been completed successfully.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="goToCart()">Go to Cart</button>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
function submitForm(event) {
event.preventDefault();
// Check if the selected form is filled up
var selectedMethod = $('#paymentMethod').val();
var isFormFilled = false;
switch (selectedMethod) {
case 'gcash':
isFormFilled = $('#gcashNumber').val() !== '';
break;
case 'bank':
isFormFilled = ($('#bankName').val() !== '' && $('#accountNumber').val() !== '');
break;
case 'creditCard':
isFormFilled = ($('#cardNumber').val() !== '' && $('#expiryDate').val() !== '' && $('#cvv').val() !== '' && $('#name').val() !== '');
break;
case 'paypal':
isFormFilled = $('#paypalEmail').val() !== '';
break;
case 'maybank':
isFormFilled = $('#maybankAccount').val() !== '';
break;
}
// Show alert if the form is not filled up
if (!isFormFilled) {
alert('Please fill up the form.');
return;
}
// Disable the submit button to prevent multiple clicks
var submitButton = document.getElementById('submitButton');
submitButton.disabled = true;
// Add the loading class to the submit button
submitButton.classList.add('loading');
// Simulate an asynchronous operation
setTimeout(function() {
// Enable the submit button
submitButton.disabled = false;
// Remove the loading class from the submit button
submitButton.classList.remove('loading');
// Perform form submission tasks here
// Show success modal
$('#successModal').modal('show');
}, 2000);
}
function goToCart() {
// Reload the page to go back to the cart
window.location.href = 'cart.html';
}
$(document).ready(function() {
$('#paymentMethod').change(function() {
var selectedMethod = $(this).val();
$('.payment-details').hide();
$('#' + selectedMethod + 'Details').show();
});
});
</script>
</body>
</html>