forked from ankit071105/Ticket-Booking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buy.html
672 lines (573 loc) · 17.8 KB
/
buy.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
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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Buy Tickets</title>
<link rel="shortcut icon" href="images/4.jpeg" type="image/x-icon">
<link rel="stylesheet" href="styles.css">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="footer.css">
<link rel="stylesheet" href="index.css">
<!-- this is for twitter icons -->
<script src="https://kit.fontawesome.com/3d20c433e1.js" crossorigin="anonymous"></script>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
margin: 30px;
}
.ticket-section {
margin-bottom: 30px;
}
.ticket {
border: 1px solid #ccc;
padding: 10px;
margin-bottom: 10px;
background-color: #f9f9f9;
border-radius: 5px;
}
.ticket h3 {
margin-top: 0;
}
.ticket p {
margin: 5px 0;
}
#showTickets:hover {
color: whitesmoke !important;
background: rgb(29, 0, 56);
box-shadow: 7px 8px 8px 1px rgb(253, 238, 238) !important;
}
/* code for bottom to top nav */
#myBtn {
display: none;
position: fixed;
bottom: 20px;
right: 30px;
z-index: 99;
font-size: 18px;
border: none;
outline: none;
background-color: #1fb899;
color: white;
cursor: pointer;
padding: 10px 6px;
border-radius: 4px;
width: 40px !important;
height: 40px !important;
}
#myBtn:hover {
background-color: #4cc6ad;
}
/* code for ticket booking form */
.container {
/* <<<<<<< HEAD */
display: flex;
justify-content: center;
align-items: center;
/* min-height: 100vh; */
flex-wrap: wrap;
margin-top: 10px;
}
.left-section, .right-section {
flex: 1;
padding: 20px;
height: 100%;
}
.left-section {
min-width: 400px;
max-width: 600px;
}
.image-placeholder {
font-size: 20px;
font-weight: bold;
color: black;
text-align: center;
}
.right-section {
min-width: 400px;
background-color: #1fb899;
padding: 40px;
border-radius: 5px;
max-width: 600px;
}
h2 {
text-align: center;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"], select {
padding: 8px;
margin: 5px 0;
border: 1px solid #ccc;
border-radius: 4px;
}
.form-group select{
width: 60%;
}
.submit-btn {
background-color: #ff4d4d;
color: white;
padding: 7px;
width: 100%;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
height: 60px;
}
.submit-btn:hover {
background-color: #e33e3e;
}
.container{
display: flex;
flex-wrap: wrap;
}
.left-section,
.right-section {
flex: 1;
padding: 20px;
height: 100%;
}
.left-section {
min-width: 400px;
max-width: 600px;
}
.image-placeholder {
font-size: 20px;
font-weight: bold;
color: black;
text-align: center;
}
.form-group input,select{
margin: 0 21%;
}
.right-section {
min-width: 400px;
background: linear-gradient(135deg,#ead6ee,#a0f1ea);
padding: 40px;
border-radius: 5px;
max-width: 600px;
transform: scale(0.85);
}
.form-group input{
width: 60%;
}
h2 {
text-align: center;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 15px;
}
label {
display: flex;
margin-bottom: 5px;
font-weight: bold;
justify-content: center;
}
input[type="text"],
select {
padding: 8px;
margin: 5px 21%;
border: 1px solid #ccc;
border-radius: 4px;
}
.submit-btn {
background-color: #ff4d4d;
color: white;
padding: 7px;
width: 60%;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
height: 60px;
margin: auto;
scale: 0.78;
}
.submit-btn:hover {
background-color: #e33e3e;
}
/* code for chatbot button */
#chatbotBtn {
position: fixed;
bottom: 65px;
right: 30px;
z-index: 99;
border: none;
outline: none;
/* background-color: #1fb899; */
background-image: url('./images/bot.jpg');
background-size: cover;
background-position: center;
border: none;
padding: 0;
color: white;
cursor: pointer;
/* padding: 10px 6px; */
width: 50px !important;
height: 50px !important;
border-radius: 100%;
}
.chatbot-container {
display: none;
width: 370px;
max-width: 100%;
position: fixed;
bottom: 75px;
right: 30px;
margin: 50px auto;
padding: 20px;
z-index: 1001;
border-radius: 10px;
box-shadow: #64646f33 0px 7px 29px 0px;
background: #31363F;
}
.chatbot-container.chatbot-show {
display: block;
}
.chatbot-title {
text-align: center;
font-size: 24px;
font-weight: bold;
color: #edf1f3;
}
.chatbot-chat {
height: 250px;
overflow-y: scroll;
margin: 20px 0;
padding: 10px;
border: 2px solid #545250;
border-radius: 5px;
background: #222831;
}
.chatbot-message {
display: flex;
align-items: center;
margin: 10px 0;
}
.chatbot-user {
justify-content: flex-end;
}
.chatbot-bot {
justify-content: flex-start;
}
.chatbot-avatar {
width: 50px;
height: 50px;
border-radius: 50%;
margin: 0 10px;
}
.chatbot-user .chatbot-avatar {
order: 2;
background: url("./images/avatar.jpg");
background-size: cover;
}
.chatbot-bot .chatbot-avatar {
order: 1;
background: url("./images/bot.jpg");
background-size: cover;
}
.chatbot-text {
max-width: 70%;
padding: 10px;
border-radius: 10px;
font-size: 12px;
color: white;
}
.chatbot-user .chatbot-text {
background: #4a4d52;
}
.chatbot-bot .chatbot-text {
background: #8c8c8e;
}
.chatbot-input {
position: relative;
width: 100%;
padding: 10px;
border: 2px solid #cbcbce;
border-radius: 5px;
outline: none;
font-size: 15px;
}
.chatbot-input:focus {
border-color: #8296d0;
color: #1e1f1f;
}
.chatbot-button {
position: absolute;
width: 80px;
border: none;
border-radius: 0%;
padding: 1px;
background: #31363F;
color: white;
font-size: 15px;
font-weight: bold;
cursor: pointer;
margin-top: -1.02rem;
margin-left: -4.1rem;
outline: none;
border-radius: 100%;
}
.chatbot-button i{
font-size: 3rem;
}
.chatbot-button:hover {
box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}
.chatbot-chat::-webkit-scrollbar {
width: 10px;
}
.chatbot-chat::-webkit-scrollbar-thumb {
background: #bcbdc0;
border-radius: 10px;
}
.progress-bar {
position: fixed;
top: 0;
left: 0;
height: 5px;
background: #1fb899; /* You can change this color */
width: 0;
transition: width 0.1s ease-in-out;
z-index: 9999; /* Make sure it's above other content */
}
/* chatbot css end */
</style>
</head>
<body>
<div id="scrollProgressBar" class="progress-bar"></div>
<button onclick="topFunction()" id="myBtn" title="Go to top"><i class="fa fa-arrow-up"
aria-hidden="true"></i></button>
<!--chat bot-->
<button onclick="toggleChatbot()" id="chatbotBtn" title="chat bot"></button>
<div class="chatbot-container" id="chatbot-container">
<div class="chatbot-title">Ticket Bot</div>
<div class="chatbot-chat" id="chatbot-chat"></div>
<input type="text" class="chatbot-input" id="chatbot-input" placeholder="Type your message here...." />
<button class="chatbot-button" id="chatbot-button"><i class="fa-brands fa-telegram"></i></button>
</div>
<header>
<nav class="navbar">
<div class="logo"><img src="./images/4.jpeg"
alt="Ticket Booking Logo" class="logo-image">Ticket Marketplace</div>
<!-- <a href="./index.html" id="logo-href">
<div class="logo">Ticket Marketplace</div>
</a> -->
<ul class="nav-links">
<li><a href="index.html">Home</a></li>
<li><a href="sell.html">Sell Ticket</a></li>
<li><a href="buy.html">Buy Ticket</a></li>
<button id="darkModeToggle" style="width: 40px; height: 40px;">🌙</button>
</ul>
</nav>
</header>
<body>
<div class="container">
<div class="left-section">
<img src="./images/bus.avif" class="bus-img" alt="">
</div>
<div class="right-section">
<h2>Book Your ticket</h2>
<form id="ticketForm">
<div class="form-group">
<label for="name">Name</label>
<input type="text" id="name" name="name" placeholder="Enter your name" required>
</div>
<div class="form-group">
<label for="ticketType">Select ticket type</label>
<select id="ticketType" name="ticketType" required>
<option value="">Select Ticket Type</option>
<option value="Bus">Bus ticket</option>
<option value="Train">Train ticket</option>
</select>
</div>
<div class="form-group">
<label for="journeyDate">Date of Journey</label>
<input type="date" id="journeyDate" min= name="journeyDate" required>
</div>
<script>
const today = new Date();
const yesterday = new Date(today.setDate(today.getDate())).toISOString().split('T')[0];
document.getElementById('journeyDate').setAttribute('min', yesterday);
</script>
<div class="form-group">
<label for="journeyTime">Time of Journey</label>
<input type="time" id="journeyTime" name="journeyTime" required>
</div>
<div class="form-group">
<label for="departure">Departure</label>
<input type = "text" placeholder = "From" required>
</div>
<div class="form-group">
<label for="destination">Destination</label>
<input type = "text" placeholder = "To" required>
</div>
<button type="submit" class="submit-btn">Check Availability</button>
</form>
</div>
</div>
<script>
const tickets = JSON.parse(localStorage.getItem('tickets')) || [];
document.getElementById('showTickets').addEventListener('click', function () {
const ticketType = document.getElementById('ticketType').value;
document.getElementById('busTicketsList').innerHTML = '';
document.getElementById('trainTicketsList').innerHTML = '';
if (ticketType === 'bus') {
displayTickets('bus');
} else if (ticketType === 'train') {
displayTickets('train');
}
});
function displayTickets(type) {
const filteredTickets = tickets.filter(ticket => ticket.type === type);
const ticketList = type === 'bus' ? document.getElementById('busTicketsList') : document.getElementById('trainTicketsList');
if (filteredTickets.length === 0) {
ticketList.innerHTML = `<p>No ${type} tickets available.</p>`;
} else {
filteredTickets.forEach(ticket => {
const ticketElement = document.createElement('div');
ticketElement.classList.add('ticket');
ticketElement.innerHTML = `
<h3>${type === 'bus' ? ticket.busName : 'Train Number: ' + ticket.trainNumber}</h3>
<p><strong>From:</strong> ${ticket.departureStation} <strong>To:</strong> ${ticket.arrivalStation}</p>
<p><strong>Departure Time:</strong> ${ticket.departureTime} on ${ticket.date}</p>
<p><strong>Seat Number:</strong> ${ticket.seatNumber}</p>
<p><strong>Price:</strong> ₹${ticket.buyerPrice}</p>
<button onclick="buyTicket('${ticket.ticketNumber}', '${type}')" aria-label="Buy ticket">Buy Now</button>
`;
ticketList.appendChild(ticketElement);
});
}
}
function buyTicket(ticketNumber, type) {
alert(`You have successfully purchased the ${type} ticket: ${ticketNumber}`);
}
</script>
<!-- footer -->
<footer class="footer-container">
<div class="footer-top">
<!-- Logo and Tagline -->
<div class="footer-logo-section">
<img src="./images/3.jpeg" alt="easyJet holidays logo" class="footer-logo">
<p style="color: #b5fdf4;">Affordable adventures, unforgettable memories—explore with ease.</p>
<p style="color: #dcfffa;" class="follow-us">FOLLOW US ON HERE:</p>
<!-- Social Media Icons -->
<div class="social-icons">
<a href="#"><i class="fab fa-facebook"></i></a>
<a href="#"><i class="fab fa-instagram"></i></a>
<a href="#"><i class="fa-brands fa-x-twitter"></i></a>
<a href="#"><i class="fab fa-linkedin"></i></a>
<a href="#"><i class="fab fa-youtube"></i></a>
</div>
</div>
<!-- Links Sections -->
<div class="footer-links">
<div class="footer-column">
<h4>HELPFUL LINKS</h4>
<ul>
<li><a href="#">Help Centre</a></li>
<li><a href="#">Special Assistance</a></li>
<li><a href="#">Download The App</a></li>
<li><a href="#">Booking Conditions</a></li>
</ul>
</div>
<div class="footer-column">
<h4>ABOUT US</h4>
<ul>
<li><a href="#">Media Center</a></li>
<li><a href="#">Investors</a></li>
<li><a href="#">Modern Slavery Act</a></li>
<li><a href="#">Terms Of Use</a></li>
</ul>
</div>
<div class="footer-column">
<h4>KEEPING SAFE</h4>
<ul>
<li><a href="#">ATOL Protected</a></li>
<li><a href="#">Travel Aware</a></li>
<li><a href="#">FCDO Travel Advice</a></li>
<li><a href="#">ABTA</a></li>
</ul>
</div>
<div class="footer-column">
<h4>FIND US</h4>
<ul>
<li><a href="#">Contact Us</a></li>
<li><a href="#">Group Cookie Notice</a></li>
<li><a href="#">Privacy And Policy</a></li>
<li><a href="#">Sitemap</a></li>
</ul>
</div>
</div>
</div>
<!-- Additional Links Section -->
<div class="footer-bottom">
<ul>
<li><a href="#">Holiday Type</a></li>
<li><a href="#">Holiday Deals</a></li>
<li><a href="#">Popular Counters</a></li>
<!-- <li><a href="#">Flight Only</a></li> -->
<li><a href="tophotels.html">Top Hotels</a></li>
</ul>
</div>
</footer>
<!-- footer end -->
<script>
const darkModeToggle = document.getElementById('darkModeToggle');
const body = document.querySelector('body');
if (darkModeToggle) {
darkModeToggle.addEventListener('click', () => {
document.body.classList.toggle('dark-mode');
if (body.classList.contains('dark-mode')) {
darkModeToggle.innerHTML = "🔆";
}
else {
darkModeToggle.innerHTML = "🌙";
}
});
}
// change icon of the dark/light mode
let mybutton = document.getElementById("myBtn");
window.onscroll = function () { scrollFunction() };
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
// toggle chatbot function
function toggleChatbot() {
const chatbotContainer = document.getElementById("chatbot-container");
chatbotContainer.classList.toggle("chatbot-show");
}
window.addEventListener('scroll', () => {
const scrollProgressBar = document.getElementById('scrollProgressBar');
const totalHeight = document.documentElement.scrollHeight - window.innerHeight;
const progressHeight = (window.scrollY / totalHeight) * 100;
scrollProgressBar.style.width = progressHeight + '%';
});
</script>
<script src="app.js"></script>
<div class="gtranslate_wrapper"></div>
<script>window.gtranslateSettings = {"default_language":"en","detect_browser_language":true,"wrapper_selector":".gtranslate_wrapper"}</script>
<script src="https://cdn.gtranslate.net/widgets/latest/float.js" defer></script>
<script src="chatbot.js"></script>
</body>
</html>