Repository navigation
Expand file tree
/
Copy pathpayment.html
More file actions
407 lines (359 loc) · 14.6 KB
/
Copy pathpayment.html
File metadata and controls
407 lines (359 loc) · 14.6 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
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<title>Checkout Payment</title>
<style>
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
border: 0;
box-shadow: none !important;
text-shadow: none !important;
outline: none;
}
:root {
--bg-main: #F4F5F7;
--bg-card: #FFFFFF;
--border-subtle: #E2E5EC;
--border-strong: #111318;
--text-primary: #111318;
--text-muted: #5E6470;
--accent-pink: #D81B60;
--accent-pink-soft: #FCE4EC;
}
body {
font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background-color: var(--bg-main);
color: var(--text-primary);
line-height: 1.6;
padding: 40px 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.a {
background: var(--bg-card);
border: 1px solid var(--border-subtle);
padding: 32px;
max-width: 480px;
width: 100%;
}
.b {
font-size: 0.85rem;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--text-primary);
margin-bottom: 12px;
margin-top: 24px;
padding-bottom: 8px;
border-bottom: 1px solid var(--border-subtle);
}
label {
display: block;
font-size: 0.82rem;
font-weight: 600;
margin-bottom: 6px;
color: var(--text-muted);
}
input, select, textarea {
width: 100%;
padding: 10px 12px;
border: 1px solid var(--border-subtle);
border-radius: 2px;
font-size: 0.95rem;
background-color: var(--bg-main);
color: var(--text-primary);
font-family: inherit;
}
input:focus, select:focus, textarea:focus {
border-color: var(--border-strong);
background-color: var(--bg-card);
}
textarea {
resize: vertical;
height: 80px;
}
.c {
border: 1px solid var(--border-subtle);
padding: 16px;
background: var(--bg-main);
margin-bottom: 16px;
}
.d {
font-weight: 700;
font-size: 0.85rem;
margin-bottom: 12px;
}
.e {
border: 1px solid var(--border-subtle);
background: var(--bg-card);
margin-bottom: 12px;
}
.f {
position: relative;
border-bottom: 1px solid var(--border-subtle);
}
.f input {
border: none;
background: transparent;
}
.g {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
display: flex;
gap: 6px;
font-size: 10px;
font-weight: 700;
color: var(--text-muted);
}
.h {
display: flex;
}
.h input {
border: none;
background: transparent;
width: 50%;
}
.h input:first-child {
border-right: 1px solid var(--border-subtle);
}
.k {
width: 100%;
background-color: #111318;
color: #FFFFFF;
padding: 14px;
border: none;
border-radius: 2px;
font-size: 0.88rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.05em;
cursor: pointer;
margin-top: 24px;
transition: background 0.15s ease;
}
.k:hover {
background-color: var(--accent-pink);
}
.m {
display: none;
text-align: center;
padding: 40px 0;
}
.m h1 {
font-size: 1.5rem;
margin-bottom: 12px;
}
.m p {
color: var(--text-muted);
}
</style>
</head>
<body>
<div class="a">
<form id="payment-form" onsubmit="handlePayment(event)">
<div class="b" style="margin-top: 0;">Contact information</div>
<div style="margin-bottom: 20px;">
<label for="email">Email</label>
<input type="email" id="email" placeholder="email@example.com" required>
</div>
<div class="b">Delivery Address</div>
<div style="margin-bottom: 20px;">
<label for="address">Full Address</label>
<textarea id="address" placeholder="House/Flat No., Street, Area, City, Pincode" required></textarea>
</div>
<div class="b">Select your cycle</div>
<div id="cycle-image-container" style="margin-bottom: 15px; text-align: center; display: none;">
<img id="cycle-preview-img" src="" alt="Cycle Preview" style="width: 100%; max-height: 180px; object-fit: contain; border: 1px solid var(--border-subtle); padding: 8px; background: #fff;">
</div>
<div style="margin-bottom: 20px;">
<label for="cycle-select">Choose cycle type</label>
<select id="cycle-select" onchange="updatePrice()" required>
<option value="" disabled selected>Select an option</option>
<option value="MTB">MTB ST20</option>
<option value="ST100">ST100</option>
<option value="ST50">ROCKRIDER MTB (ST50)</option>
<option value="ST200">ROCKRIDER MTB (ST 200)</option>
<option value="ST30">ROCKRIDER MTB (ST30)</option>
<option value="HYBRID">RIVERSIDE 500</option>
<option value="RIVERSIDE 120">RIVERSIDE 120</option>
<option value="RODIE">RODIE RC 120</option>
<option value="FIXIE">FIXIE RC 150</option>
<option value="ENDURANCE">ENDURANCE EXPL 40</option>
<option value="EXPL 10">ROCKRIDER EXPL 10</option>
<option value="VAN RYSEL RCR-R PRO">VAN RYSEL RCR-R PRO</option>
</select>
</div>
<div class="b">Payment Amount</div>
<div style="margin-bottom: 20px;">
<label for="amount">Amount (₹)</label>
<input type="text" id="amount" placeholder="Amount will appear here" readonly required>
</div>
<div class="b">Payment method</div>
<div style="margin-bottom: 15px;">
<label for="payment-method-select">Choose Payment Method</label>
<select id="payment-method-select" onchange="togglePaymentMethod()" required>
<option value="card" selected>Card</option>
<option value="cod">Cash on Delivery (COD)</option>
</select>
</div>
<div class="c" id="card-fields">
<div class="d">Card</div>
<label>Card information</label>
<div class="e">
<div class="f">
<input type="text" class="card-input" placeholder="1234 1234 1234 1234" maxlength="19" oninput="this.value = this.value.replace(/[^0-9\s]/g, '')" required>
<div class="g">
<span>VISA</span>
<span>MC</span>
<span>AMEX</span>
</div>
</div>
<div class="h">
<input type="text" class="card-input" placeholder="MM / YY" maxlength="7" required>
<input type="text" class="card-input" placeholder="CVC" maxlength="4" oninput="this.value = this.value.replace(/\D/g, '')" required>
</div>
</div>
<div style="margin-bottom: 12px;">
<label>Cardholder name</label>
<input type="text" class="card-input" placeholder="Full name on card" required>
</div>
<div>
<label>Country or region</label>
<select>
<option value="IN">India</option>
<option value="US">United States</option>
<option value="GB">United Kingdom</option>
<option value="CA">Canada</option>
<option value="AU">Australia</option>
</select>
</div>
</div>
<div id="cod-fields" style="display: none; padding: 16px; border: 1px solid var(--border-subtle); background: var(--bg-card); margin-bottom: 15px;">
<p style="margin: 0; color: var(--text-muted); font-size: 0.9rem;">Pay with cash upon delivery of your item.</p>
</div>
<button type="submit" class="k" id="submit-btn">Pay</button>
</form>
<div id="message-screen" class="m">
<h1 id="status-heading">Processing Payment...</h1>
<p id="status-text">Please wait while we process your secure payment.</p>
</div>
</div>
<script>
function updatePrice() {
const cycle = document.getElementById('cycle-select').value;
const amountInput = document.getElementById('amount');
const previewContainer = document.getElementById('cycle-image-container');
const previewImg = document.getElementById('cycle-preview-img');
const prices = {
"MTB": "28,999",
"ST100": "19,999",
"ST50": "15,999",
"ST200": "16,999",
"ST30": "19,999",
"HYBRID": "98,999",
"RIVERSIDE 120": "99,999",
"RODIE": "39,999",
"FIXIE": "99,999",
"ENDURANCE": "48,999",
"EXPL 10": "24,999",
"VAN RYSEL RCR-R PRO": "5,99,999"
};
const images = {
"MTB": "img5.png",
"ST100": "img50.png",
"ST50": "img70.png",
"ST200": "img80.png",
"ST30": "img90.png",
"HYBRID": "img9.png",
"RIVERSIDE 120": "img30.png",
"RODIE": "img6.png",
"FIXIE": "img8.png",
"ENDURANCE": "img7.png",
"EXPL 10": "img40.png",
"VAN RYSEL RCR-R PRO": "img60.png"
};
if (prices[cycle] !== undefined) {
amountInput.value = prices[cycle];
}
if (images[cycle]) {
previewImg.src = images[cycle];
previewContainer.style.display = 'block';
} else {
previewContainer.style.display = 'none';
}
}
function togglePaymentMethod() {
const method = document.getElementById('payment-method-select').value;
const cardFields = document.getElementById('card-fields');
const codFields = document.getElementById('cod-fields');
const cardInputs = document.querySelectorAll('.card-input');
const submitBtn = document.getElementById('submit-btn');
if (method === 'cod') {
cardFields.style.display = 'none';
codFields.style.display = 'block';
submitBtn.innerText = 'Place Order';
cardInputs.forEach(input => input.removeAttribute('required'));
} else {
cardFields.style.display = 'block';
codFields.style.display = 'none';
submitBtn.innerText = 'Pay';
cardInputs.forEach(input => input.setAttribute('required', 'required'));
}
}
function handlePayment(event) {
event.preventDefault();
const email = document.getElementById('email').value;
const address = document.getElementById('address').value;
const cycle = document.getElementById('cycle-select').value;
const amount = document.getElementById('amount').value;
const paymentMethod = document.getElementById('payment-method-select').value;
const now = new Date();
const newOrder = {
email: email,
address: address,
cycle: cycle,
amount: amount,
paymentMethod: paymentMethod === 'cod' ? 'Cash on Delivery' : 'Card',
date: now.toLocaleDateString(),
time: now.toLocaleTimeString()
};
const existingOrders = JSON.parse(localStorage.getItem('ordersList')) || [];
existingOrders.push(newOrder);
localStorage.setItem('ordersList', JSON.stringify(existingOrders));
document.getElementById('payment-form').style.display = 'none';
const messageScreen = document.getElementById('message-screen');
const heading = document.getElementById('status-heading');
const text = document.getElementById('status-text');
messageScreen.style.display = 'block';
if (paymentMethod === 'cod') {
heading.innerText = "Order Placed!";
text.innerText = "Redirecting to your order summary...";
setTimeout(() => {
window.location.href = "oder.html";
}, 1500);
} else {
heading.innerText = "Processing Payment...";
text.innerText = "Please wait while we process your secure payment.";
setTimeout(() => {
heading.innerText = "Payment Done!";
text.innerText = "Redirecting to your order summary...";
setTimeout(() => {
window.location.href = "oder.html";
}, 2000);
}, 3000);
}
}
</script>
</body>
</html>