-
Notifications
You must be signed in to change notification settings - Fork 0
/
pypyt.html
160 lines (152 loc) · 5.85 KB
/
pypyt.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Payment</title>
<style>
body {
font-family: 'Bahnschrift SemiBold', sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f4f8;
}
.container {
background-color: #fff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
padding: 40px;
max-width: 500px;
width: 100%;
}
h2 {
margin-bottom: 20px;
color: #2c3e50;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
color: #34495e;
}
.form-group input,
.form-group select {
width: 100%;
padding: 10px;
border: 1px solid #bdc3c7;
border-radius: 4px;
}
.form-group button {
background-color: #3498db;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
width: 100%;
}
.form-group button:hover {
background-color: #2980b9;
}
.form-group select {
cursor: pointer;
}
.hidden {
display: none;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', () => {
const urlParams = new URLSearchParams(window.location.search);
const totalPrice = urlParams.get('totalPrice');
document.getElementById('amount').value = `$${totalPrice}`;
const paymentMethodSelect = document.getElementById('payment-method');
paymentMethodSelect.addEventListener('change', () => {
const cardDetails = document.getElementById('card-details');
const netBankingDetails = document.getElementById('net-banking-details');
const cashOnDelivery = document.getElementById('cash-on-delivery');
cardDetails.classList.add('hidden');
netBankingDetails.classList.add('hidden');
cashOnDelivery.classList.add('hidden');
if (paymentMethodSelect.value === 'card') {
cardDetails.classList.remove('hidden');
} else if (paymentMethodSelect.value === 'net-banking') {
netBankingDetails.classList.remove('hidden');
} else if (paymentMethodSelect.value === 'cod') {
cashOnDelivery.classList.remove('hidden');
}
});
});
function processPayment() {
const paymentMethod = document.getElementById('payment-method').value;
if (paymentMethod === 'card') {
alert('Payment processed successfully using card!');
} else if (paymentMethod === 'net-banking') {
alert('Payment processed successfully using net banking!');
} else if (paymentMethod === 'cod') {
alert('Order placed successfully! Pay cash on delivery.');
}
window.location.href = 'order_confirmation.html';
}
</script>
</head>
<body>
<div class="container">
<h2>Payment</h2>
<div class="form-group">
<label for="payment-method">Payment Method</label>
<select id="payment-method">
<option value="" disabled selected>Select a payment method</option>
<option value="card">Card</option>
<option value="net-banking">Net Banking</option>
<option value="cod">Cash on Delivery</option>
</select>
</div>
<div id="card-details" class="hidden">
<div class="form-group">
<label for="card-number">Card Number</label>
<input type="text" id="card-number" placeholder="1234 5678 9012 3456" required>
</div>
<div class="form-group">
<label for="expiry-date">Expiry Date</label>
<input type="text" id="expiry-date" placeholder="MM/YY" required>
</div>
<div class="form-group">
<label for="cvv">CVV</label>
<input type="text" id="cvv" placeholder="123" required>
</div>
</div>
<div id="net-banking-details" class="hidden">
<div class="form-group">
<label for="bank-name">Bank Name</label>
<select id="bank-name">
<option value="" disabled selected>Select your bank</option>
<option value="bank1">Bank 1</option>
<option value="bank2">Bank 2</option>
<option value="bank3">Bank 3</option>
</select>
</div>
<div class="form-group">
<label for="account-number">Account Number</label>
<input type="text" id="account-number" placeholder="123456789" required>
</div>
</div>
<div id="cash-on-delivery" class="hidden">
<p>Cash on delivery. Pay when you receive your order.</p>
</div>
<div class="form-group">
<label for="amount">Amount</label>
<input type="text" id="amount" readonly>
</div>
<div class="form-group">
<button type="button" onclick="processPayment()">Pay Now</button>
</div>
</div>
</body>
</html>