From 366a71317d84f00c15129baf9726e6c853329504 Mon Sep 17 00:00:00 2001 From: freedomfeather <fadlurohmanakmal@rocketmail.com> Date: Fri, 6 Oct 2017 21:52:11 +0700 Subject: [PATCH] Menambah fitur menampilkan tabel preferred location driver --- css/default_style.css | 11 +++++++++ css/history.css | 9 +++++++ css/location.css | 44 +++++++++++++++++++++++++++++++++ css/profile.css | 11 +-------- history/transaction_history.php | 37 +++++++++++++++++++++++++++ profile/edit_location.php | 29 ++++++++++++++++++++-- template/menu.php | 2 +- 7 files changed, 130 insertions(+), 13 deletions(-) create mode 100644 history/transaction_history.php diff --git a/css/default_style.css b/css/default_style.css index 8dca10a5..cf87617f 100755 --- a/css/default_style.css +++ b/css/default_style.css @@ -73,3 +73,14 @@ a:hover { margin-right: auto; } +.subheader { + height: 15%; +} +.title { + float: left; +} +.title h1 { + text-align: left; + margin: 0; +} + diff --git a/css/history.css b/css/history.css index e69de29b..c106793f 100755 --- a/css/history.css +++ b/css/history.css @@ -0,0 +1,9 @@ +.history_container { + margin-top: 10%; + height: 50%; + border: 1px solid red; +} + +.history_container > * { + border: 1px solid red; +} \ No newline at end of file diff --git a/css/location.css b/css/location.css index 5fdc03f6..e2c604f9 100644 --- a/css/location.css +++ b/css/location.css @@ -12,7 +12,51 @@ text-align: left; margin: 0; } +.display_loc_frame { + width: 100%; + min-height: 30%; +} +table { + border-collapse: collapse; + font-size: 1.2em; + table-layout: fixed; + width: 100%; +} + +table, td, th { + border: 1px solid black; +} +th { + text-align:center; +} +tr th:nth-child(1) { + width:10%; + text-align:right; +} +tr th:nth-child(2) { + width:65%; +} +tr th:nth-child(3) { + width:25%; +} +tr td:nth-child(1),td:nth-child(2) { + padding-left: 2%; +} +tr th:nth-child(3) { + +} +.edit_button { + color: #82d800; + float: left; + margin-left: 15%; +} +.delete_button { + color: red; + float: right; + margin-right: 15%; +} .add_loc_frame { + margin-top: 10%; height: 30%; } .add_loc_frame h2 { diff --git a/css/profile.css b/css/profile.css index 313eecee..7f8bf4f1 100755 --- a/css/profile.css +++ b/css/profile.css @@ -2,16 +2,7 @@ margin-top: 10%; height: 50%; } -.subheader { - height: 15%; -} -.title { - float: left; -} -.title h1 { - text-align: left; - margin: 0; -} + .edit_profile_button { float: right; margin-top: 10px; diff --git a/history/transaction_history.php b/history/transaction_history.php new file mode 100644 index 00000000..382bb296 --- /dev/null +++ b/history/transaction_history.php @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> +<head> + <title>transaction history</title> + <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"> +</head> +<body> + <div class="frame"> + <div class="header"> + <?php + $user_id = $_GET['id']; + include '../database/dbconnect.php'; + + $query=mysqli_query($con,"SELECT * FROM user WHERE user_id='".$user_id."'") or die(mysqli_error()); + + if(mysqli_num_rows($query)!=0) + { + $row=mysqli_fetch_assoc($query); + $username = $row['username']; + include("../template/header.php"); + } + mysqli_close($con); + ?> + </div> + <div class="menu_container"> + <?php include'../template/menu.php';?> + </div> + <div class="history_container"> + <div class="subheader"> + <div class="title"><h1>Transaction History</h1></div> + </div> + </div> + </div> +</body> +</html> \ No newline at end of file diff --git a/profile/edit_location.php b/profile/edit_location.php index a7f7f92e..0d25d1d0 100644 --- a/profile/edit_location.php +++ b/profile/edit_location.php @@ -20,7 +20,7 @@ $username = $row['username']; include("../template/header.php"); } - mysqli_close($con); + ?> </div> <div class="menu_container"> @@ -30,8 +30,33 @@ <div class="subheader"> <div class="title"><h1>Edit Preferred Location</h1></div> </div> + <div class="display_loc_frame"> + <table> + <tr> + <th>No</th> + <th>Locations</th> + <th>Actions</th> + </tr> + <?php + $query=mysqli_query($con,"SELECT pref_loc FROM driver_prefloc WHERE driver_id='".$user_id."'") or die(mysqli_error()); + if(mysqli_num_rows($query)!=0) + { + $i = 1; + while($row=mysqli_fetch_assoc($query)) { + echo ' <tr> + <td>'.$i.'</td> + <td>'.$row['pref_loc'].'</td> + <td><div class="edit_button">✎</div><div class="delete_button">✖</div></td> + </tr>'; + $i++; + } + } + ?> + </table> + + </div> <div class="add_loc_frame"> - <h2> Add New Location</h2> + <h2>Add New Location</h2> <form name="add_location" action="updateLocation.php" method="POST"> <input type="text" name="new_location"> <input type="text" id="hidden_userid" name="hidden_userid" style="display: none;"> diff --git a/template/menu.php b/template/menu.php index 076fde02..35d738d4 100644 --- a/template/menu.php +++ b/template/menu.php @@ -5,7 +5,7 @@ <h3>ORDER</h3> </div> </a> - <a href="../history/history.php?id='. $user_id .'" name="history_link"> + <a href="../history/transaction_history.php?id='. $user_id .'" name="history_link"> <div class="menu" id="history_link"> <h3>HISTORY</h3> </div> -- GitLab