-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchBycar.php
201 lines (185 loc) · 10.9 KB
/
searchBycar.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>searchBycar</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/bootstrap-table.min.css">
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT"
crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]/dist/bootstrap-table.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/themes/bootstrap-table/bootstrap-table.min.js"></script>
<!--Fontawesome CDN-->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"
integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<!--Custom styles-->
<link rel="stylesheet" type="text/css" href="styles.css">
<script src="searchBycar.js"></script>
</head>
<body>
<div class="container">
<div class="d-flex justify-content-center h-100">
<div class="card" style="width: 90rem;height: 40rem;">
<!-- Header -->
<div class="card-header">
<h3>Admin</h3>
</div>
<div class="card-body">
<form id="filter-form" action="filterBycar.php" method="POST">
<div id="Dropdown-group" class="form-group">
<div class="row">
<!--Search Col-->
<div class="col-sm-3">
<div class="card-header">
<h4>Search by Car Specs</h4>
</div>
<!-- Model Dropdown Box -->
<div class="form-group" >
<select class="custom-select mr-sm-2"
id="model-filter"
style="width: 18rem;">
<option value = "" selected>(Model)</option>
<?php
$connection = mysqli_connect('localhost', 'root', '', 'car_rental_system');
$sql = "SELECT distinct c.model model FROM `car` c ";
$query = mysqli_query($connection, $sql);
while ($row = mysqli_fetch_assoc($query)) {
echo "<option> $row[model] </option>";
}
mysqli_close($connection);
?>
</select>
</div>
<!-- Year Dropdown Box -->
<div class="form-group">
<select class="custom-select mr-sm-2"
id="year-filter"
style="width: 18rem;">
<option value = "" selected>(Year)</option>
<?php
$connection = mysqli_connect('localhost', 'root', '', 'car_rental_system');
$sql = "SELECT distinct c.year `year` FROM `car` c ";
$query = mysqli_query($connection, $sql);
while ($row = mysqli_fetch_assoc($query)) {
echo "<option> $row[year] </option>";
}
mysqli_close($connection);
?>
</select>
</div>
<!-- Color Dropdown Box -->
<div class="form-group">
<select class="custom-select mr-sm-2"
id="color-filter"
style="width: 18rem;">
<option value = "" selected>(Color)</option>
<?php
$connection = mysqli_connect('localhost', 'root', '', 'car_rental_system');
$sql = "SELECT distinct c.color `color` FROM `car` c ";
$query = mysqli_query($connection, $sql);
while ($row = mysqli_fetch_assoc($query)) {
echo "<option> $row[color] </option>";
}
mysqli_close($connection);
?>
</select>
</div>
<!-- Country Dropdown Box -->
<div class="form-group">
<select class="custom-select mr-sm-2"
id="country-filter"
style="width: 18rem;">
<option value = "" selected>(Country)</option>
<?php
$connection = mysqli_connect('localhost', 'root', '', 'car_rental_system');
$sql = "SELECT distinct o.country `country` FROM `car` c NATURAL JOIN office o";
$query = mysqli_query($connection, $sql);
while ($row = mysqli_fetch_assoc($query)) {
echo "<option> $row[country] </option>";
}
mysqli_close($connection);
?>
</select>
</div>
<!-- status Dropdown Box -->
<div class="form-group">
<select class="custom-select mr-sm-2"
id="status-filter"
style="width: 18rem;">
<option value= ""selected>(status)</option>
<option>active</option>
<option>out of service</option>
</select>
</div>
<div class="card-header">
<h4>Duration</h4>
</div>
<div class="input-group form-group" style="width: 18rem;">
<input
id="StartDate"
type="text"
class="form-control input-sm"
placeholder="YYYY-MM-DD(From)">
</div>
<div class="input-group form-group" style="width: 18rem;">
<input
id="EndDate"
type="text"
class="form-control input-sm"
placeholder="YYYY-MM-DD(To)">
</div>
<!--Search Col-->
<div class="card-header">
<h4>Search for a specific car: </h4>
</div>
<div class="input-group form-group" style="width: 18rem;">
<input
id="CarID"
type="text"
class="form-control input-sm"
placeholder="Plate ID">
</div>
<div class="mt-2 form-group">
<input type="submit" value="Search" class="btn float-right login_btn">
</div>
</div>
<!-- Results Col -->
<div class="col">
<div class="card text-white bg-primary mb-4"
style="width: 55rem;height: 30rem;overflow: auto;">
<div class="card-body text-white">
<div class="container-fluid">
<table id="infoTable"
class="text-white table table-fixed table-condensed">
<thead>
<tr>
<th class="col-xs-3">Res ID</th>
<th class="col-xs-3">Customer ID</th>
<th class="col-xs-3">pickDate</th>
<th class="col-xs-3">ReturnDate</th>
<th class="col-xs-3">Car ID</th>
<th class="col-xs-3">Model</th>
<th class="col-xs-6">Year</th>
<th class="col-xs-6">Color</th>
<th class="col-xs-6">Status</th>
<th class="col-xs-6">office-ID</th>
<th class="col-xs-6">Price/Day</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card-footer">
<div class="d-flex justify-content-left links">
<a href="homepage.html">Sign Out</a>
</div>
</div>
</form>
</div>