-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
454 lines (388 loc) · 15.5 KB
/
index.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
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<title>Track&Train</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/jquery-ui.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/datafile.js"></script>
<script type="text/javascript" src="js/jspdf.debug.js"></script>
<script type="text/javascript" src="js/jspdf.min.js"></script>
<link href="css/bootstrap.min.css" rel="stylesheet"></link>
<link rel="stylesheet" href="css/styling.css" /> <!-- CUSTOM CSS -->
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
console.log(jsonObject.start);
console.log(jsonObject.start.stations);
$('#travelDate').datepicker();
for(i=0;i<jsonObject.start.stations.length;i++){
$('#sourceStation')
.append($("<option></option>")
.attr("value",i)
.text(jsonObject.start.stations[i]));
$('#Destination')
.append($("<option></option>")
.attr("value",i)
.text(jsonObject.start.stations[i]));
}
/*var doc = new jsPDF();
var specialElementHandlers = {
'#editor': function (element, renderer) {
return true;
}
};
$('#cmd').click(function () {
doc.fromHTML($('#ticketRow').html(), 15, 15, {
'width': 170,
'elementHandlers': specialElementHandlers
});
doc.save('sample-file.pdf');
});
*/
});
var sourceStationValue;
var destinationStationValue;
var travellDateValue;
var classCompartmentValue;
function generateFareFunction(){
sourceStationValue = $('#sourceStation').val();
destinationStationValue = $('#Destination').val();
travellDateValue = $('#travelDate').val();
classCompartmentValue = $('#sel1').val();
if(sourceStationValue == "" || destinationStationValue == "" || travellDateValue == ""){
}
else if(sourceStationValue == destinationStationValue){
alert('Source and Destination must be different');
}else{
$('#bookTicketButton').show();
$('#resetButton').show();
$('#generateFare').hide();
var key = sourceStationValue + '-' + destinationStationValue + '-' + classCompartmentValue;
console.log(sourceStationValue);
console.log(destinationStationValue);
console.log(classCompartmentValue);
console.log(key);
console.log(jsonObject.fare[key]);
var fareMoney = jsonObject.fare[key];
document.getElementById('fareVal').innerHTML = 'Rs ' + fareMoney ;
}
}
function showTicket(){
$('#ticketRow').show();
document.getElementById('detailSourceStation').innerHTML = $("#sourceStation option:selected").text();
document.getElementById('detaildestinationStation').innerHTML = $("#Destination option:selected").text();
document.getElementById('detailDateTime').innerHTML = travellDateValue ;
document.getElementById('detailclass').innerHTML = $("#sel1 option:selected").text();
$('#fareRow').hide();
}
function generatePDF(){
$('#cmd').hide();
window.print();
}
</script>
<nav class="navbar navbar-default">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="javascript:void(0);"><span class="glyphicon glyphicon-phone" aria-hidden="true"></span>1 - 555 - 555 - 555</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1" style="border:none;">
<ul class="nav navbar-nav navbar-right">
<li data-toggle="modal" data-target="#myModalNorm"><a href="#">Signup</a></li>
<li data-toggle="modal" data-target="#myModalHorizontal"><a href="#">Login</a></li>
</ul>
<!-- Modal -->
<div class="modal fade" id="myModalHorizontal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close"
data-dismiss="modal">
<span aria-hidden="true">×</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
Login
</h4>
</div>
<!-- Modal Body -->
<div class="modal-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="col-sm-2 control-label"
for="inputEmail3">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control"
id="inputEmail3" placeholder="Email"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"
for="inputPassword3" >Password</label>
<div class="col-sm-10">
<input type="password" class="form-control"
id="inputPassword3" placeholder="Password"/>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox"/>Remember me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Sign in</button>
</div>
</div>
</form>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">
Close
</button>
</div>
</div>
</div>
</div> <!-- login modal end -->
<!-- Modal -->
<div class="modal fade" id="myModalNorm" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close"
data-dismiss="modal">
<span aria-hidden="true">×</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
Signup
</h4>
</div>
<!-- Modal Body -->
<div class="modal-body">
<form role="form">
<div class="form-group">
<label for="exampleInputusername">Username</label>
<input type="text" class="form-control"
id="exampleInputusername" placeholder="Enter Username"/>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control"
id="exampleInputEmail1" placeholder="Enter email"/>
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control"
id="exampleInputPassword1" placeholder="Password"/>
</div>
<div class="checkbox">
<label>
<input type="checkbox"/> Agree
</label>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">
Close
</button>
</div>
</div>
</div>
</div> <!-- Signup Modal End -->
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<nav class="navbar navbar-inverse navbar2">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">
<img class="img-responsive" alt="Brand" src="img/log.png">
</a>
</div>
</div>
</nav>
<div class="container-fluid bgimage" style="background:url(img/station.jpg) no-repeat center; background-size:cover;height:650px;">
<div class="row" id="fareRow" >
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-0"> <!-- first extra col -->
</div >
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12" style="background-color:rgba(255,255,255,0.3);margin-top: 8%;padding-top:6px"> <!-- booking box -->
<form onsubmit="return false;">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<p class="travelling">Travelling Route</p>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
<select id="sourceStation" class="form-control" required>
<option value="">Source Station</option>
</select>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-0">
</div>
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
<!--<input type="text" class="form-control" id="to" placeholder="Destination"> -->
<select id="Destination" class="form-control" required>
<option value="">Destination Station</option>
</select>
</div>
</div>
<div class="row" style="margin-top:7px;">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<p class="travelling">Travelling Date</p>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
<input id="travelDate" placeholder="Journey Date..." class="form-control" name="travellingdate" required>
</div>
</div>
<div class="row" style="margin-top:7px;">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<p class="travelling">Class</p>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
<select class="form-control" id="sel1" required>
<option value="0">General</option>
<option value="1">SL</option>
<option value="2">AC3</option>
<option value="3">AC2</option>
<option value="4">AC1</option>
</select>
</div>
</div>
<div class="row" style="margin-top:7px;text-align:center;">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<button type="submit" disabled="disabled" class="btn btn-primary" id="fareVal" style="background-color:rgba(51,122,183,0.65);"><b>Fare</b></button>
</div>
</div>
<div class="row" style="margin-top:22px;text-align:center;padding-bottom:22px;">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<button type="submit" class="btn btn-primary" onclick=" generateFareFunction(); " id="generateFare">Generate Fare</button>
<!-- <a href="javascript:void(0);" onclick=" generateFareFunction(); " class="btn btn-primary" id="generateFare" >Generate Fare </a> -->
<button type="submit" class="btn btn-danger" id="resetButton" style="display:none;" onClick="window.location.reload()">Reset</button>
<button type="submit" onclick="showTicket();" class="btn btn-success" id="bookTicketButton" style="display:none;">Book Ticket</button>
</div>
</div>
</form>
</div> <!-- booking box END -->
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-0"> <!-- third extra col -->
</div>
</div>
<div class="row" id="ticketRow" style="display:none;"> <!-- booked ticket box -->
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-2">
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-8" style="background:url(img/ticketbg1.PNG) no-repeat center; background-size:cover; margin-top:5%;height:320px;">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 uppannel">
<h3 style="color:white;text-align:right">TICKET<span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span></h3>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 midpannel">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" id="imagesize" src="img/barcode1.gif" alt="barcode" />
</div>
<div class="col-lg-9 col-md-9 col-sm-9 col-xs-9" id="pading" style="padding-top:5px; line-height: 1.234;">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<p class="ticketsummary"><b>Source Station</b></p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<p class="ticketsummary" id="detailSourceStation"></p>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<p class="ticketsummary"><b>Destination Station</b></p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<p class="ticketsummary" id="detaildestinationStation"></p>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<p class="ticketsummary"><b>Travelling Date</b></p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<p class="ticketsummary" id="detailDateTime"></p>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<p class="ticketsummary"><b>Class</b></p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<p class="ticketsummary" id="detailclass"></p>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<p class="ticketsummary"><b>Booking Status</b></p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<p class="ticketsummary"><b>Confirmed</b></p>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-6 col-xs-6" style="padding-bottom: 15px;">
<button type="submit" class="btn btn-danger" onclick="generatePDF();" id="cmd">Print Ticket</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 lowerpannel">
</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-2">
</div>
</div>
<div id="editor"></div>
</div>
<nav class="navbar navbar-default footer" >
<div class="container ">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<p><div class="footercontent">© Copyright 2016 by Kamlesh Tilwani | All rights reserved.</div></p>
</div>
</div>
</div>
</div>
</nav>
</body>
</html>