-
Notifications
You must be signed in to change notification settings - Fork 5
/
booking.php
265 lines (233 loc) · 11.2 KB
/
booking.php
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>
<?php
include('session_customer.php');
if(!isset($_SESSION['login_customer'])){
session_destroy();
header("location: customerlogin.php");
}
?>
<title>Book Car </title>
<head>
<script type="text/javascript" src="assets/ajs/angular.min.js"> </script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato">
<link rel="shortcut icon" type="image/png" href="assets/img/P.png.png">
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/fonts/font-awesome.min.css">
<link rel="stylesheet" href="assets/w3css/w3.css">
<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/custom.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/clientpage.css" />
</head>
<body ng-app="">
<!-- Navigation -->
<!-- Navigation -->
<nav class="navbar navbar-custom navbar-fixed-top" role="navigation" style="color: black">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse">
<i class="fa fa-bars"></i>
</button>
<a class="navbar-brand page-scroll" href="index.php">
PATNA CAR RENTAL </a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<?php
if(isset($_SESSION['login_client'])){
?>
<div class="collapse navbar-collapse navbar-right navbar-main-collapse">
<ul class="nav navbar-nav">
<li>
<a href="index.php">Home</a>
</li>
<li>
<a href="#"><span class="glyphicon glyphicon-user"></span> Welcome <?php echo $_SESSION['login_client']; ?></a>
</li>
<li>
<ul class="nav navbar-nav navbar-right">
<li><a href="#" class="dropdown-toggle active" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-user"></span> Control Panel <span class="caret"></span> </a>
<ul class="dropdown-menu">
<li> <a href="entercar.php">Add Car</a></li>
<li> <a href="enterdriver.php"> Add Driver</a></li>
<li> <a href="clientview.php">View</a></li>
</ul>
</li>
</ul>
</li>
<li>
<a href="logout.php"><span class="glyphicon glyphicon-log-out"></span> Logout</a>
</li>
</ul>
</div>
<?php
}
else if (isset($_SESSION['login_customer'])){
?>
<div class="collapse navbar-collapse navbar-right navbar-main-collapse">
<ul class="nav navbar-nav">
<li>
<a href="index.php">Home</a>
</li>
<li>
<a href="#"><span class="glyphicon glyphicon-user"></span> Welcome <?php echo $_SESSION['login_customer']; ?></a>
</li>
<ul class="nav navbar-nav">
<li><a href="#" class="dropdown-toggle active" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Garagge <span class="caret"></span> </a>
<ul class="dropdown-menu">
<li> <a href="prereturncar.php">Return Now</a></li>
<li> <a href="mybookings.php"> My Bookings</a></li>
</ul>
</li>
</ul>
<li>
<a href="logout.php"><span class="glyphicon glyphicon-log-out"></span> Logout</a>
</li>
</ul>
</div>
<?php
}
else {
?>
<div class="collapse navbar-collapse navbar-right navbar-main-collapse">
<ul class="nav navbar-nav">
<li>
<a href="index.php">Home</a>
</li>
<li>
<a href="clientlogin.php">Client</a>
</li>
<li>
<a href="customerlogin.php">Customer</a>
</li>
<li>
<a href="#"> FAQ </a>
</li>
</ul>
</div>
<?php }
?>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<div class="container" style="margin-top: 65px;" >
<div class="col-md-7" style="float: none; margin: 0 auto;">
<div class="form-area">
<form role="form" action="bookingconfirm.php" method="POST">
<br style="clear: both">
<h2 style="margin-bottom: 25px; text-align: center; font-size: 30px;"> Rent your dream car here </h2><br>
<?php
$car_id = $_GET["id"];
$sql1 = "SELECT * FROM cars WHERE car_id = '$car_id'";
$result1 = mysqli_query($conn, $sql1);
if(mysqli_num_rows($result1)){
while($row1 = mysqli_fetch_assoc($result1)){
$car_name = $row1["car_name"];
$car_nameplate = $row1["car_nameplate"];
$ac_price = $row1["ac_price"];
$non_ac_price = $row1["non_ac_price"];
$ac_price_per_day = $row1["ac_price_per_day"];
$non_ac_price_per_day = $row1["non_ac_price_per_day"];
}
}
?>
<!-- <div class="form-group"> -->
<h5> Car: <?php echo($car_name);?></h5>
<!-- </div> -->
<!-- <div class="form-group"> -->
<h5> Vehicle Number: <?php echo($car_nameplate);?></h5>
<!-- </div> -->
<!-- <div class="form-group"> -->
<?php $today = date("Y-m-d") ?>
<label><h5>Start Date:</h5></label>
<input type="date" name="rent_start_date" min="<?php echo($today);?>" required="">
<label><h5>End Date:</h5></label>
<input type="date" name="rent_end_date" min="<?php echo($today);?>" required="">
<!-- </div> -->
<h5> Choose your car type:
<input onclick="reveal()" type="radio" name="radio" value="ac" ng-model="myVar"> AC
<input onclick="reveal()" type="radio" name="radio" value="non_ac" ng-model="myVar"> Non-AC
<div ng-switch="myVar">
<div ng-switch-default>
<!-- <div class="form-group"> -->
<h5>Fare: <h5>
<!-- </div> -->
</div>
<div ng-switch-when="ac">
<!-- <div class="form-group"> -->
<h5>Fare: <?php echo("₹" . $ac_price . "/km and ₹" . $ac_price_per_day . "/day");?><h5>
<!-- </div> -->
</div>
<div ng-switch-when="non_ac">
<!-- <div class="form-group"> -->
<h5>Fare: <?php echo("₹" . $non_ac_price . "/km and ₹" . $non_ac_price_per_day . "/day");?><h5>
<!-- </div> -->
</div>
</div>
<h5> Choose charge type:
<input onclick="reveal()" type="radio" name="radio1" value="km"> per km(s)
<input onclick="reveal()" type="radio" name="radio1" value="days"> per day(s)
<br><br>
<!-- <form class="form-group"> -->
Choose a driver:
<select name="driver_id_from_dropdown" ng-model="myVar1">
<?php
$sql2 = "SELECT * FROM driver d WHERE d.driver_availability = 'yes' AND d.client_username IN (SELECT cc.client_username FROM clientcars cc WHERE cc.car_id = '$car_id')";
$result2 = mysqli_query($conn, $sql2);
if(mysqli_num_rows($result2) > 0){
while($row2 = mysqli_fetch_assoc($result2)){
$driver_id = $row2["driver_id"];
$driver_name = $row2["driver_name"];
$driver_gender = $row2["driver_gender"];
$driver_phone = $row2["driver_phone"];
?>
<option value="<?php echo($driver_id); ?>"><?php echo($driver_name); ?>
<?php }}
else{
?>
Sorry! No Drivers are currently available, try again later...
<?php
}
?>
</select>
<!-- </form> -->
<div ng-switch="myVar1">
<?php
$sql3 = "SELECT * FROM driver d WHERE d.driver_availability = 'yes' AND d.client_username IN (SELECT cc.client_username FROM clientcars cc WHERE cc.car_id = '$car_id')";
$result3 = mysqli_query($conn, $sql3);
if(mysqli_num_rows($result3) > 0){
while($row3 = mysqli_fetch_assoc($result3)){
$driver_id = $row3["driver_id"];
$driver_name = $row3["driver_name"];
$driver_gender = $row3["driver_gender"];
$driver_phone = $row3["driver_phone"];
?>
<div ng-switch-when="<?php echo($driver_id); ?>">
<h5>Driver Name: <?php echo($driver_name); ?></h5>
<p>Gender: <?php echo($driver_gender); ?> </p>
<p>Contact: <?php echo($driver_phone); ?> </p>
</div>
<?php }} ?>
</div>
<input type="hidden" name="hidden_carid" value="<?php echo $car_id; ?>">
<input type="submit"name="submit" value="Book Now" class="btn btn-success pull-right">
</form>
</div>
<div class="col-md-12" style="float: none; margin: 0 auto; text-align: center;">
<h6><strong>Kindly Note:</strong> You will be charged <span class="text-danger">₹200/-</span> for each day after the due date.</h6>
</div>
</div>
</body>
<footer class="site-footer">
<div class="container">
<hr>
<div class="row">
<div class="col-sm-6">
<h5>© 2018 Patna Car Rental</h5>
</div>
</div>
</div>
</footer>
</html>