diff --git a/css/default_style.css b/css/default_style.css index 37be8b575bdd34cac07b7443dfe64f0fba2d0982..cb3a7d17278c8478e0388e35b364ebb71be185f4 100755 --- a/css/default_style.css +++ b/css/default_style.css @@ -98,9 +98,10 @@ a:hover { } .profile_pict_frame { - width: 100px; - height: 100px; + width: 90px; + height: 90px; overflow: auto; + border: 5px solid #333333; border-radius: 50%; margin-left: auto; margin-right: auto; @@ -110,4 +111,4 @@ a:hover { margin: 0 auto; height: 100%; width: 100%; -} \ No newline at end of file +} diff --git a/css/history.css b/css/history.css index 62d0ac3baefc07ec0cb431950db38ff8f673f80d..f54827c6fdfbcd9f1c89eff19daaa8b8f9816154 100755 --- a/css/history.css +++ b/css/history.css @@ -1,7 +1,6 @@ .history_container { margin-top: 10%; height: 79%; - border: 1px solid red; /*OJO LALI HAPUS IKI*/ } .history_container .subheader { @@ -31,7 +30,6 @@ font-family: calibri; position: relative;; - border: 0.5px solid black; display: block; text-decoration: none; @@ -48,15 +46,13 @@ table.history_table { margin-top: 5px; - border: 1px solid blue; /*OJO LALI HAPUS IKI*/ width: 100%; - border: 1px solid purple; padding: 0; border-collapse: collapse; } table.history_table p { - margin: 0; + margin: 5px 0; padding: 0; font-style: "Lucida Console", Monaco, monospace; } @@ -89,12 +85,11 @@ p.history_comment { } table.history_table th, td { - border: 1px solid purple; - padding: 5px; + padding: 0 5px; border-collapse: collapse; } -p.history_table td { +table.history_table tr td.order_data { vertical-align: top; } @@ -105,4 +100,22 @@ img.history_pict { display: inline; margin: 0; +} + +button.hide_hist_button { + margin: 0; + color: white; + background-color: red; + font-size: 9px; + margin-bottom: 45px; +} + +.checked { + color:orange +} + +.yellow_score { + font-size: 20px; + color: orange; + vertical-align: middle; } \ No newline at end of file diff --git a/css/profile.css b/css/profile.css index e343acb4e8ae7430161d21940b539dc62bb74fe8..9b23357ebccc65dd8f9a9846ee1d704c6ec78d08 100755 --- a/css/profile.css +++ b/css/profile.css @@ -10,6 +10,7 @@ } .edit_profile_button a { text-decoration: none; + color: #f9880e; } .profile_info_container { text-align: center; @@ -21,9 +22,12 @@ .profile_data_container { height: 100px; } +.username_display { + margin-top: 10px; + margin-bottom: 10px; +} .profile_data_container p { - margin-top: 0px; - margin-bottom: 0px; + margin: 0px; padding: 0px; } .prefloc_container { @@ -39,6 +43,7 @@ } .edit_prefloc_button a { text-decoration: none; + color: #f9880e; } .edit_profile_container { margin-top: 10%; diff --git a/history/driver_history.html b/history/driver_history.html deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/history/driver_history.php b/history/driver_history.php index d1e4a056aa85944398e99ddf15f82175ed8a7471..16f0e00afdd826ec44d20d2e3ad8f8e86502b31e 100644 --- a/history/driver_history.php +++ b/history/driver_history.php @@ -25,6 +25,9 @@ </div> <div class="menu_container"> <?php include'../template/menu.php';?> + <script type="text/javascript"> + document.getElementById("history_link").setAttribute("class", "menu menu_active"); + </script> </div> <div class="history_container"> <div class="subheader"> @@ -61,17 +64,20 @@ $driver_query=mysqli_query($con,"SELECT username FROM user WHERE user_id='".$row['cust_id']."'") or die(mysqli_error()); $driver_row=mysqli_fetch_assoc($driver_query); $driver_name=$driver_row['username']; + $given_score=(int)$row['score']; + echo "<tr> <td> - <img class='history_pict' src='../profile/getProfilePict.php?id=".$row['cust_id']."' + <img class='history_pict' src='../profile/getProfilePict.php?id=".$row['cust_id']."'> + <button class='hide_hist_button' type='button' value='hide' onclick='hide_row(this)'>Hide</button> </td> - <td> + <td class='order_data'> <p class='history_date'>".$row['date']."</p> <p class='history_username'>".$driver_name."</p> <p class='history_loc'>".$row['pick_city']." - ".$row['dest_city']."</p> - <p class='history_rating'>rating ".$row['score']."</p> - <p class='history_comment'>You commented:</p> + <p class='history_rating'>gave <span class='yellow_score'>  ".$given_score." </span> stars for this order</p> + <p class='history_comment'>and left comment:</p> <p class='history_comment' style='margin-left: 30px;'>".$row['comment']."</p> </td> </tr>"; @@ -85,4 +91,6 @@ </div> </div> </body> -</html> \ No newline at end of file +</html> + +<script type="text/javascript" src="hide_history.js"></script> \ No newline at end of file diff --git a/history/hide_history.js b/history/hide_history.js new file mode 100644 index 0000000000000000000000000000000000000000..13ad2f0eab422aaaff00c740cd8b4fa8a30e3d29 --- /dev/null +++ b/history/hide_history.js @@ -0,0 +1,4 @@ +function hide_row(o) { + var p = o.parentNode.parentNode; + p.parentNode.removeChild(p); +} \ No newline at end of file diff --git a/history/history.html b/history/history.html deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/history/order_history.html b/history/order_history.html deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/history/transaction_history.php b/history/transaction_history.php index 9be4a6d8871de85b61c668da0461ce722d77ee81..068d2cea11b42bcbcf380a96e1042f1a75738172 100644 --- a/history/transaction_history.php +++ b/history/transaction_history.php @@ -2,9 +2,13 @@ <html> <head> <title>transaction history</title> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="../css/default_style.css"> <link rel="stylesheet" type="text/css" href="../css/history.css"> <link rel="stylesheet" type="text/css" href="../css/header.css"> + <script type="text/javascript" src="hide_history.js"> + </script> +} </head> <body> <div class="frame"> @@ -25,6 +29,9 @@ </div> <div class="menu_container"> <?php include'../template/menu.php';?> + <script> + document.getElementById("history_link").setAttribute("class", "menu menu_active"); + </script> </div> <div class="history_container"> <div class="subheader"> @@ -63,13 +70,21 @@ echo "<tr> <td> - <img class='history_pict' src='../profile/getProfilePict.php?id=".$row['driver_id']."' + <img class='history_pict' src='../profile/getProfilePict.php?id=".$row['driver_id']."'> + <button class='hide_hist_button' type='button' value='hide' onclick='hide_row(this)'>Hide</button> </td> - <td> + <td class='order_data'> <p class='history_date'>".$row['date']."</p> <p class='history_username'>".$driver_name."</p> <p class='history_loc'>".$row['pick_city']." - ".$row['dest_city']."</p> - <p class='history_rating'>rating ".$row['score']."</p> + <p class='history_rating'>You rated: "; + + for ($i = 0; $i < $row['score']; $i++) { + echo "<span class='fa fa-star checked'></span>"; + } + + echo + "</p> <p class='history_comment'>You commented:</p> <p class='history_comment' style='margin-left: 30px;'>".$row['comment']."</p> </td> @@ -85,3 +100,5 @@ </div> </body> </html> + +<script type="text/javascript" src="hide_history.js"></script> \ No newline at end of file diff --git a/order/order.php b/order/order.php index 61be8def71f6080ec2d807719dcb862878f6da8c..fa2ec3f671b5e19cda5356ad4a3360bb12108e1a 100644 --- a/order/order.php +++ b/order/order.php @@ -1,3 +1,3 @@ <?php header('Location : select_location.php') -?> \ No newline at end of file +?> diff --git a/order/select_driver.php b/order/select_driver.php index 2474db5b0cab07180d58cae7ff156dcd686a78d5..0a936e2e1bccec6b68d12f925a9d7f7738ce398a 100644 --- a/order/select_driver.php +++ b/order/select_driver.php @@ -27,23 +27,42 @@ $ppoint = $_POST['picking_point']; $dest = $_POST['destination']; $prefdrv = $_POST['preferred_driver']; + echo $prefdrv; function ShowPrefDrv($prefdrv, $con) { if (!(is_null($prefdrv))) { - $pdQuery = mysqli_query($con, "SELECT * FROM driver RIGHT OUTER JOIN (SELECT user_id FROM user WHERE name='" . $prefdrv . "') AS usert ON user_id = driver_id;") or die(mysqli_error($con)); - - $row = mysqli_fetch_assoc($pdQuery); - + $pdQuery = mysqli_query($con, "SELECT * FROM driver RIGHT OUTER JOIN (SELECT * FROM user WHERE name='" . $prefdrv . "') AS usert ON user_id = driver_id") or die(mysqli_error($con)); + while ($row = mysqli_fetch_assoc($pdQuery)) { + $driver_id = $row['driver_id']; + $driver_name = $row['username']; + $driver_votes = $row['votes']; + $driver_rating = ($driver_votes == 0) ? 0 : $row['total_score']/$row['votes']; + echo + " + <table id='tbl_pref_driver'> + <tr> + <td> + <img class='history_pict' src='../profile/getProfilePict.php?id=".$driver_id."' + </td> + <td> + <p class='driver_username'>".$driver_name."</p> + <p class='driver_rating'>★".$driver_rating." (".$driver_votes." votes)</p> + <div class='button green' onclick=''> + I CHOOSE YOU + </div> + </td> + </tr> + </table> + "; + } } else { echo "<h2>Nothing to display :(</h2>"; } } - ShowPrefDrv($prefdrv, $con); - mysqli_close($con); ?> </div> <div class="menu_container"> @@ -68,15 +87,16 @@ <div class="content" id="select_driver"> <div id="preferred_driver"> <h2>Preferred driver</h2> + <?php ShowPrefDrv($prefdrv, $con) ?> </div> <div id="other_driver"> <h2>Other drivers</h2> </div> - <div id="selected_driver" style="display: none"> - <input type="text" name="selected_driver"> - </div> + <input type="hidden" name="selected_driver"> + <input type="submit" name="submit_select_drv" style="display: none;"> </div> </form> + <?php mysqli_close($con) ?> </div> </body> </html> \ No newline at end of file diff --git a/profile/edit_location.php b/profile/edit_location.php index e8a34d9770b612427a882ee62224858aca1dedef..48d2bcdf1ee64b966c2e56c61ae5e3d12d531bac 100644 --- a/profile/edit_location.php +++ b/profile/edit_location.php @@ -25,6 +25,9 @@ </div> <div class="menu_container"> <?php include'../template/menu.php';?> + <script> + document.getElementById("profile_link").setAttribute("class", "menu menu_active"); + </script> </div> <div class="editloc_container"> <div class="subheader"> diff --git a/profile/edit_profile.php b/profile/edit_profile.php index 58e19a280713f54220ed2a69b9bb8eeb7d5de8e8..fba1b06afef7c661b4a2513495d304150eaa4464 100644 --- a/profile/edit_profile.php +++ b/profile/edit_profile.php @@ -27,6 +27,9 @@ </div> <div class="menu_container"> <?php include'../template/menu.php';?> + <script> + document.getElementById("profile_link").setAttribute("class", "menu menu_active"); + </script> </div> <div class="edit_profile_container"> <div class="subheader"> diff --git a/profile/profile.php b/profile/profile.php index dbc538826ee72cb8c4156ebe9a553f7dbbf41818..8839fe7027ac1ba31235a4ea2844c4cf904b3876 100644 --- a/profile/profile.php +++ b/profile/profile.php @@ -24,6 +24,9 @@ </div> <div class="menu_container"> <?php include'../template/menu.php';?> + <script> + document.getElementById("profile_link").setAttribute("class", "menu menu_active"); + </script> </div> <div class="profile_container"> <div class="subheader"> @@ -36,15 +39,29 @@ </div> <div class="profile_data_container"> <?php - echo "</br><p><strong>".$row['username']."</strong></p>"; + echo "<div class='username_display'><strong>".$row['username']."</strong></div>"; echo "<p>".$row['name']."</p>"; if ($row['status'] == "driver") { - echo "<p>Driver | <span id='driver_rating'>Rating (xxx Votes)</span></p>"; + echo "<p>Driver | <span style='color : #f9880e'>☆<span id='driver_rating'>Rating</span></span> (<span id='driver_votes'>(xxx Votes)</span> votes)</p>"; + $query=mysqli_query($con,"SELECT * FROM driver WHERE driver_id='".$user_id."'") or die(mysqli_error()); + if (mysqli_num_rows($query) != 0) { + $getDriver = mysqli_fetch_assoc($query); + $driver_score = $getDriver['total_score']; + $driver_votes = $getDriver['votes']; + + if ($driver_votes != 0) { + $rating = $driver_score / $driver_votes; + } else { + $rating = 0; + } + echo '<script>document.getElementById("driver_rating").innerHTML = '.$rating.';</script>'; + echo '<script>document.getElementById("driver_votes").innerHTML = '.$driver_votes.';</script>'; + } } else { echo "<p>Non-Driver</p>"; } - echo "<p>".$row['email']."</p>"; - echo "<p>".$row['phone']."</p>"; + echo "<p>✉".$row['email']."</p>"; + echo "<p>â˜".$row['phone']."</p>"; if (isset($row['pict'])) { echo "<script>document.getElementById('profile_pict').src ='getProfilePict.php?id=".$user_id."'</script>"; } diff --git a/profile/updateProfile.php b/profile/updateProfile.php index c5ac6e983c8f711a449e60fd53228d19cb8c6fc2..ba6a09d2b80c596d9ddcdef3e25c60e6e08adaa0 100644 --- a/profile/updateProfile.php +++ b/profile/updateProfile.php @@ -11,14 +11,12 @@ if(isset($_POST['is_driver'])) { $status = 'driver'; - if ($current_stat != "driver") { + $checkRegisteredDriver = mysqli_query($con,"SELECT * FROM driver WHERE driver_id='".$user_id."'") or die(mysql_error($con)); + if ($current_stat != "driver" && mysqli_num_rows($checkRegisteredDriver)==0) { $query = mysqli_query($con,"INSERT INTO driver (driver_id) VALUES ('$user_id')") or die(mysqli_error($con)); } } else { - if ($current_stat == "driver") { - $query = mysqli_query($con,"DELETE FROM driver WHERE driver_id='".$user_id."'") or die(mysqli_error($con)); - } $status = 'customer'; } if (isset($_FILES) && ($_FILES['profile_pictfile']['size'] > 0)) diff --git a/template/menu.php b/template/menu.php index 35d738d480e3156c2368ecea5b657d3f9b5c4ca6..88a34fc0e63e9719826afccdeb2e84a735ebb510 100644 --- a/template/menu.php +++ b/template/menu.php @@ -1,6 +1,6 @@ <?php echo ' - <a href="../order/order.php?id='. $user_id .'" name="order_link"> + <a href="../order/select_location.php?id='. $user_id .'" name="order_link"> <div class="menu" id="order_link"> <h3>ORDER</h3> </div>