From 6e60412a1ea57bd9b786b3544ad9d1f61ec7b54d Mon Sep 17 00:00:00 2001
From: Habibi <muhhabibih@gmail.com>
Date: Thu, 25 Oct 2018 00:07:20 +0700
Subject: [PATCH] Finish detail page

---
 app/controller/order/OrderUsecase.php |  1 +
 app/view/bookDetail.php               | 38 +++++++++++++++++------
 app/view/review.php                   |  1 +
 public/static/css/base.css            |  2 +-
 public/static/css/book_detail.css     | 44 +++++++++++++++++++--------
 public/static/css/review.css          |  9 ++++++
 6 files changed, 73 insertions(+), 22 deletions(-)

diff --git a/app/controller/order/OrderUsecase.php b/app/controller/order/OrderUsecase.php
index 2ba2463..1fc3a45 100644
--- a/app/controller/order/OrderUsecase.php
+++ b/app/controller/order/OrderUsecase.php
@@ -16,6 +16,7 @@
             $data = [
                 "orders" => $orders,
             ];
+            
             render('history.php', $data);
         }
 
diff --git a/app/view/bookDetail.php b/app/view/bookDetail.php
index 0a292db..d0e964e 100644
--- a/app/view/bookDetail.php
+++ b/app/view/bookDetail.php
@@ -25,18 +25,38 @@
 			</div>
 		</div>
 		<div class="kanan">
-			<img src="/static/img/contoh_buku.png" class="book-image"><br>
+			<div class="justify-content-center">
+				<img src="/static/img/contoh_buku.png" class="book-image">	
+			</div>
+			<div class="rating-detail justify-content-center">
+				<div class="star-rating">
+					<?php
+						$rating = $books[0]->rating;
+
+						for ($i = 0; $i < 5; $i++) {
+							if ($rating > 0) {
+								echo("<img src=\"/static/img/full_star.png\" class=\"book-rating\">");
+								$rating--;
+							} else {
+								echo("<img src=\"/static/img/starhole.png\" class=\"book-rating\">");
+							}
+						}
+					?>
+				</div>				
+				<?php
+					$rating = $books[0]->rating;
+					echo("
+						<div class=\"rating-number\">
+							<h1>
+								$rating/5.0
+							</h1>
+						</div>")
+				?>	
+			</div>
+			
 		</div>
 	</div>
 
-	<br>
-	<img src="/static/img/starhole.png" class="book-rating">
-	<img src="/static/img/starfull.png" class="book-rating">
-	<img src="/static/img/starfull.png" class="book-rating">
-	<img src="/static/img/starfull.png" class="book-rating">
-	<img src="/static/img/starfull.png" class="book-rating">
-	
-
 	<br><h2 id="subtitle">Order</h2>
 	Jumlah:		
 	<select id="banyak-jumlah">
diff --git a/app/view/review.php b/app/view/review.php
index 2e74c76..041fd78 100644
--- a/app/view/review.php
+++ b/app/view/review.php
@@ -22,6 +22,7 @@
             </h2>
         </div>
         <img 
+            class="book-img"
             src="/static/img/contoh_buku.png"
         />
     </div>
diff --git a/public/static/css/base.css b/public/static/css/base.css
index c7e1e45..8d459c1 100644
--- a/public/static/css/base.css
+++ b/public/static/css/base.css
@@ -5,7 +5,7 @@ body {
 }
 
 .title {
-    font-size: 55px;
+    font-size: 40px;
     color: #f26600;
 }
 
diff --git a/public/static/css/book_detail.css b/public/static/css/book_detail.css
index 01cf011..be4ca30 100644
--- a/public/static/css/book_detail.css
+++ b/public/static/css/book_detail.css
@@ -13,10 +13,7 @@ body {
 }
 
 .kiri {
-	flex-grow: 5;
-}
-
-.kanan {
+	width: 80%;
 	flex-grow: 5;
 }
 
@@ -36,14 +33,6 @@ body {
 	margin-left: 5px;
 }
 
-.book-image {
-	margin-top: 20px;
-	float:right;
-	width:160px;
-	border: 1px solid black;
-	margin-right: 20px;
-}
-
 .submit-button {
 	font-size: 1.5em;
     color: white;
@@ -110,5 +99,36 @@ body {
 
 .book-rating {
 	width: 40px;
+	height: 40px;
+	float: right;
+	margin-top: 10px;
+}
+
+.kanan {
+	display: flex;
+	flex-direction: column;
+}
+
+.book-image {
+	margin-top: 20px;
+	float:right;
+	width:160px;
+	height: 160px;
+	margin-right: 20px;
+}
+
+.rating-number {
 	float: right;
+	display: block;
+	text-align: center;
+}
+
+.rating-detail {
+	display: flex;
+	flex-direction: column;
+}
+
+.star-rating {
+	display: flex;
+	flex-direction: row;
 }
\ No newline at end of file
diff --git a/public/static/css/review.css b/public/static/css/review.css
index 6b509db..33f62de 100644
--- a/public/static/css/review.css
+++ b/public/static/css/review.css
@@ -4,6 +4,10 @@
     padding-right: 40px;
 }
 
+.review-title {
+    width: 70%;
+}
+
 .review-title h1 {
     margin-bottom: 0px;
 }
@@ -27,6 +31,11 @@
     margin-right: 5px;
 }
 
+.book-img {
+    width: 300px;
+    height: 300px;
+}
+
 .review-comment {
     width: 100%;
 }
-- 
GitLab