Commit 5ecbf0b9 authored by Wildan Dicky Alnatara's avatar Wildan Dicky Alnatara

fixing history controller

parent 9b0a2abf
...@@ -20,7 +20,22 @@ class historyController { ...@@ -20,7 +20,22 @@ class historyController {
$conn = connect_to_mysql(); $conn = connect_to_mysql();
$arrResult = array(); $arrResult = array();
if ($conn != null) { if ($conn != null) {
$sql_query = "SELECT * FROM book_order JOIN books ON book_id=books.ID where user_Id=$userId ORDER BY tanggal DESC"; // $sql_query = "SELECT * FROM book_order JOIN books ON book_id=books.ID where user_Id=$userId ORDER BY tanggal DESC";
$sql_query = "
SELECT
*,
(CASE
WHEN EXISTS (SELECT * FROM review where Nomor_Order=order_id) THEN TRUE
ELSE FALSE
END) as reviewed
FROM
book_order
JOIN
books
ON
book_id=books.ID
where user_Id=$userId ORDER BY tanggal DESC, Nomor_Order DESC
";
$result = $conn->query($sql_query); $result = $conn->query($sql_query);
if ($result != NULL){ if ($result != NULL){
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
......
...@@ -76,8 +76,8 @@ class historyView { ...@@ -76,8 +76,8 @@ class historyView {
</div> </div>
<div id="right-most-column-history-item"> <div id="right-most-column-history-item">
<div class="flex-container align-items-flex-end add-flex-direction-column "> <div class="flex-container align-items-flex-end add-flex-direction-column ">
<div class="font-weight-bold gray-text">'.$data['date'].'</div> <div class="font-weight-bold text-size-20 gray-text">'.$data['date'].'</div>
<div class="font-weight-bold gray-text">Nomor Order #'.$data['orderNumber'].'</div> <div class="font-weight-bold text-size-20 gray-text">Nomor Order #'.$data['orderNumber'].'</div>
</div> </div>
</div> </div>
</div> </div>
......
Markdown is supported
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