Skip to content
Snippets Groups Projects
Commit 3ec6c400 authored by Aldrich Valentino Halim's avatar Aldrich Valentino Halim
Browse files

added driver rating in order page

parent 7978189f
1 merge request!42Projekers - 13515051 - Girvandi Ilyas
...@@ -13,8 +13,14 @@ if(isset($_GET['drivername']) && isset($_GET['id'])){ ...@@ -13,8 +13,14 @@ if(isset($_GET['drivername']) && isset($_GET['id'])){
//Process to find the driver //Process to find the driver
while($row = mysqli_fetch_array($result)){ while($row = mysqli_fetch_array($result)){
if($row['name'] == $driverName){ if($row['name'] == $driverName){
$txt = $txt . '<div class="single-driver"><img src="../img/'. $row['image'] .'" /><div class="driver-bio"> //get drier rating
<h2 class="driver-name">'. $row['name'].'</h2><div class="driver-rating"></div></div> $driverStats = mysqli_fetch_array($user->getDriverRating($row['id']));
$driverRating = $driverStats['driverRating'];
$driverVotes = $driverStats['votes'];
$txt = $txt . '<div class="single-driver"><img class="order-driver-image" src="../img/'. $row['image'] .'" /><div class="driver-bio">
<h2 class="driver-name">'. $row['name'].'</h2><div class="driver-rating"><img class="rating-image" src="../img/rating.png" />'.
round($driverRating) . ' ('. $driverVotes .' votes)</div></div>
<div class="button-choose"><div onclick="chooseDriver('. $row['id'] .')">I CHOOSE YOU!</div></div></div>'; <div class="button-choose"><div onclick="chooseDriver('. $row['id'] .')">I CHOOSE YOU!</div></div></div>';
} }
} }
...@@ -28,8 +34,14 @@ if(isset($_GET['drivername']) && isset($_GET['id'])){ ...@@ -28,8 +34,14 @@ if(isset($_GET['drivername']) && isset($_GET['id'])){
$result = $user->getDriverNotId($userId); $result = $user->getDriverNotId($userId);
while($row = mysqli_fetch_array($result)){ while($row = mysqli_fetch_array($result)){
if($row['name'] !== $driverName){ if($row['name'] !== $driverName){
$txt = $txt . '<div class="single-driver"><img src="../img/'. $row['image'] .'" /><div class="driver-bio"> //get drier rating
<h2 class="driver-name">'. $row['name'].'</h2><div class="driver-rating"></div></div> $driverStats = mysqli_fetch_array($user->getDriverRating($row['id']));
$driverRating = $driverStats['driverRating'];
$driverVotes = $driverStats['votes'];
$txt = $txt . '<div class="single-driver"><img class="order-driver-image" src="../img/'. $row['image'] .'" /><div class="driver-bio">
<h2 class="driver-name">'. $row['name'].'</h2><div class="driver-rating"><img class="rating-image" src="../img/rating.png" />'.
round($driverRating) . ' ('. $driverVotes .' votes)</div></div>
<div class="button-choose"><div onclick="chooseDriver('. $row['id'] .')">I CHOOSE YOU!</div></div></div>'; <div class="button-choose"><div onclick="chooseDriver('. $row['id'] .')">I CHOOSE YOU!</div></div></div>';
} }
} }
......
...@@ -79,11 +79,16 @@ ...@@ -79,11 +79,16 @@
margin: 20px 0; margin: 20px 0;
box-sizing: border-box; box-sizing: border-box;
} }
.single-driver img { .order-driver-image {
display: inline-block; display: inline-block;
width: 20%; width: 20%;
vertical-align: top; vertical-align: top;
} }
.rating-image {
display: inline-block;
width: 15px;
margin-right: 5px;
}
.driver-bio { .driver-bio {
display: inline-block; display: inline-block;
width: 49%; width: 49%;
......
img/rating.png

11.6 KiB

0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment