-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.php
278 lines (271 loc) · 17.6 KB
/
index.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
266
267
268
269
270
271
272
273
274
275
276
277
278
<?php
require_once 'admin/server/CarDAO.php';
require_once 'admin/server/DiagramDAO.php';
require_once 'admin/server/AdvanceSearchDAO.php';
require_once 'admin/server/model/Paging.php';
$v = new CarDAO();
$d = new DiagramDAO();
$s = new AdvanceSearchDAO();
$numberOfCars = $v->countAllCars();
$p = new Paging();
define('RECORDS_PER_PAGE', 2);
$p->setRecordsPerPage(RECORDS_PER_PAGE);
$p->setPageQueryStr('page');
$p->setStartingRow($p->getPageRowNumber());
$rowCarField = $v->getCarsLimitByRecPerPage($p->getStartingRow(), $p->getRecordsPerPage());
$carObjSearchResult = $s->getSearchInputResult('search-car');
//print_r($carObjSearchResult);
?>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Primary Meta Tags -->
<title>AutoExpress - Raymart De Guzman</title>
<meta name="title" content="AutoExpress - Raymart De Guzman">
<meta name="description" content="AutoExpress a car dealership app built for both car dealer and car buyer. A car dealer manages the car being viewed on the website by adding, updating, deleting and uploading photos of a car. On the other hand, a car buyer can search for the vehicle he or she desired on the website. If the buyer finds the desired vehicle he or she can contact the seller to get more information of the vehicle. A car buyer can also calculate their monthly or bi-weekly payment.">
<meta name="keywords" content="Raymart De Guzman, tramyardg.co.nf, tramyardg, PHP, car dealership, software engineer, car dealer, car buyer, AutoExpress.co.nf">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:title" content="AutoExpress.co.nf - Raymart De Guzman">
<meta property="og:description" content="AutoExpress a car dealership app built for both car dealer and car buyer. A car dealer manages the car being viewed on the website by adding, updating, deleting and uploading photos of a car. On the other hand, a car buyer can search for the vehicle he or she desired on the website. If the buyer finds the desired vehicle he or she can contact the seller to get more information of the vehicle. A car buyer can also calculate their monthly or bi-weekly payment.">
<meta property="og:image" content="https://raw.githubusercontent.com/tramyardg/autoexpress/master/image/homePage.PNG"/>
<link rel="apple-touch-icon" sizes="180x180" href="image/favicon_package_v0.16/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="image/favicon_package_v0.16/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="image/favicon_package_v0.16/favicon-16x16.png">
<link rel="manifest" href="image/favicon_package_v0.16/site.webmanifest">
<link rel="mask-icon" href="image/favicon_package_v0.16/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<link href="css/style.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" rel="stylesheet" >
</head>
<body>
<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v4.0"></script>
<div class="container_custom">
<?php include 'template/header.php'; ?>
<?php include 'template/advance-search.php'; ?>
<div class="content">
<div class="content-car-section">
<?php $hideIndexResult = empty($carObjSearchResult) ? "visible" : "hidden"; ?>
<table id="inventory-vehicle-table" class="<?php echo $hideIndexResult; ?>" >
<thead><tr><th></th></tr></thead>
<tbody>
<?php while($row = $rowCarField->fetch()) { ?>
<tr>
<td>
<div class="divTable" id="car-item-<?php ?>">
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableCell">
<div class="row car-images" >
<?php
// first if stmt: uses placeholder.com as placeholder for car with no images
// second if stmt: no badge for car that has no images
$currSearchCarImg = $d->getPhotosBy_CarId($row['vehicleId']);
if ($d->countAllPhotosByCarId($row['vehicleId']) == "0")
$h = "https://via.placeholder.com/272x150/36383D/FFFFFF/?text=Sample image here";
else
$h = $currSearchCarImg[0]->getFullImgSrc();
?>
<img style="width: 240px; height: 150px" src="<?php echo $h; ?>">
<?php if (!empty($d->countAllPhotosByCarId($row['vehicleId']))) { ?>
<span class="badge">
<?php echo $d->countAllPhotosByCarId($row['vehicleId']); ?>
</span>
<?php } ?>
</div>
</div>
<div class="divTableCell">
<div class="feature_links">
<a href="#" class="calculate-payment-link" data-toggle="modal"
data-target="#calculatePaymentModal" data-price="<?php echo $row['price']; ?>" >
<p><i class="fa fa-calculator" aria-hidden="true"></i> Estimate payment</p>
</a>
<a href="#" title="Refer this car" data-toggle="modal" data-target="#referACarModal">
<p><i class="fa fa-share" aria-hidden="true"></i> Vehicle Referral</p>
</a>
<a href="<?php echo 'details.php?carId='.$row['vehicleId']; ?>" title="View more details">
<p><i class="fa fa-plus" aria-hidden="true"></i> More Details</p>
</a>
<?php
$shareHref = ($_SERVER['SERVER_NAME'] == 'localhost') ?
"http://localhost/autoexpress/details.php?carId=".$row['vehicleId'] :
"http://autoexpress.c1.biz/details.php?carId=".$row['vehicleId'];
?>
<div class="fb-share-button" data-href="<?php echo $shareHref; ?>" data-layout="button" data-size="small"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fautoexpress.co.nf%2Fdetails.php%3FcarId%3D2&src=sdkpreparse" class="fb-xfbml-parse-ignore">Share</a></div>
</div>
</div>
<div class="divTableCell">
<div class="car_info">
<p>
<span class="car-title"><?php echo $row['vehicleTitle']; ?> - </span>
<span class="price-style">$<?php echo $row['price']; ?></span>
</p>
<p><span class="availability"><?php echo $row['status']; ?></span></p>
<p>
<span class="mileage"><?php echo $row['mileage']; ?> km</span> |
<span class="transmission"><?php echo $row['transmission']; ?></span> |
<span class="drivetrain"><?php echo $row['drivetrain']; ?></span>
</p>
</div>
</div>
</div>
</div>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<nav aria-label="Page navigation example" class="<?php echo $hideIndexResult; ?>">
<ul class="pagination">
<?php if($numberOfCars > $p->getRecordsPerPage()) { ?>
<?php if($p->getPrev() >= 0) { ?>
<li class="page-item"><a href="index.php?page=<?php echo $p->getPrev(); ?>">Previous</a></li>
<?php } ?>
<?php $pageNumber = 1; ?>
<?php for($i = 0; $i < $numberOfCars; $i = $i + $p->getRecordsPerPage()) { ?>
<?php if($i != $p->getStartingRow()) { ?>
<li class="page-item"><a href="index.php?page=<?php echo $i; ?>"><?php echo $pageNumber; ?></a></li>
<?php } else { ?>
<li class="page-item active"><a href="index.php?page=<?php echo $i; ?>"><?php echo $pageNumber; ?></a></li>
<?php } ?>
<?php $pageNumber = $pageNumber + 1; ?>
<?php } ?>
<?php if($p->getNext() < $numberOfCars) { ?>
<li class="page-item"><a href="index.php?page=<?php echo $p->getNext(); ?>">Next</a></li>
<?php } ?>
<?php } ?>
</ul>
</nav>
<?php if(!empty($carObjSearchResult)) { ?>
<table id="search-result-vehicle-table">
<thead>
<tr>
<th>
<?php echo $s->getResultFoundMessage(); ?>
</th>
</tr>
</thead>
<tbody>
<?php while($rowSearchResult = $carObjSearchResult->fetch()) { ?>
<tr>
<td>
<div class="divTable" id="car-item-<?php ?>">
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableCell">
<div class="row car-images" >
<?php
// first if stmt: use 'place hold' it as image if this car has no images
// second if stmt: no badge for car that has no images
$currSearchCarImg = $d->getPhotosBy_CarId($rowSearchResult['vehicleId']);
if($d->countAllPhotosByCarId($rowSearchResult['vehicleId']) == "0") {
$h = "https://via.placeholder.com/272x150/36383D/FFFFFF/?text=Sample image here";
} else {
$h = $currSearchCarImg[0]->getDiagram();
}
?>
<img style="width: 240px; height: 150px" src="<?php echo $h; ?>">
<span class="badge">
<?php
if(!empty($d->countAllPhotosByCarId($rowSearchResult['vehicleId']))) {
echo $d->countAllPhotosByCarId($rowSearchResult['vehicleId']);
}
?>
</span>
</div>
</div>
<div class="divTableCell">
<div class="feature_links">
<a href="#" class="calculate-payment-link" data-toggle="modal"
data-target="#calculatePaymentModal" data-price="<?php echo $rowSearchResult['price']; ?>" >
<p><i class="fa fa-calculator" aria-hidden="true"></i> Estimate payment</p>
</a>
<a href="#" title="Refer this car" data-toggle="modal" data-target="#referACarModal">
<p><i class="fa fa-share" aria-hidden="true"></i> Vehicle Referral</p>
</a>
<a href="<?php echo 'details.php?carId='.$rowSearchResult['vehicleId']; ?>" title="View more details">
<p><i class="fa fa-plus" aria-hidden="true"></i> More Details</p>
</a>
</div>
</div>
<div class="divTableCell">
<div class="car_info">
<p>
<span class="car-title"><?php echo $rowSearchResult['vehicleTitle'] ?> - </span>
<span class="price-style">$<?php echo $rowSearchResult['price']; ?></span>
</p>
<p><span class="availability"><?php echo $rowSearchResult['status']; ?></span></p>
<p>
<span class="mileage"><?php echo $rowSearchResult['mileage']; ?> km</span> |
<span class="transmission"><?php echo $rowSearchResult['transmission']; ?></span> |
<span class="drivetrain"><?php echo $rowSearchResult['drivetrain']; ?></span>
</p>
</div>
</div>
</div>
</div>
</div>
</td>
</tr>
<?php } // end while ?>
</tbody>
</table>
<?php } // end if ?>
</div>
<?php include 'template/payment-modal.php'; ?>
<?php include 'template/referral-modal.php'; ?>
</div>
<?php include 'template/footer.php'; ?>
</div>
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/features.js"></script>
<script>
$(document).ready(function () {
PaymentCalculator.init();
VehicleReferral.init();
var searchResultVehicleTableExists = document.getElementById("search-result-vehicle-table");
if(document.body.contains(searchResultVehicleTableExists)) {
$('#search-result-vehicle-table').DataTable({
"pageLength": 1,
"lengthChange": false,
searching: false,
"ordering": false
});
}
});
function selectCarMakeFn(selectedMake) {
var modelsSelect = $(selectedMake).parent().next().find('#searchModel');
modelsSelect.empty();
var selectVal = $(selectedMake).val();
modelsSelect.append('<option selected value="%">Select model</option>');
$.ajax({
type: "GET",
url: "admin/js/data/models.json",
dataType: "json",
success: function (json) {
for (var key in json) {
if (json.hasOwnProperty(key)) {
if(selectVal === json[key].title) {
var modelsObj = json[key].models;
Object.keys(modelsObj).forEach(function(key) {
var h = '<option value="'+modelsObj[key].value+'" title="'+modelsObj[key].title+'">'+modelsObj[key].value+'</option>';
modelsSelect.append(h);
});
break;
}
}
}
}
});
}
</script>
</body>
</html>