Commit e92a58b5 authored by Wildan Dicky Alnatara's avatar Wildan Dicky Alnatara
parents 5a68acfe 89bd9fb8
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
} }
$this->book_rating = round($sum/$count, 1); $this->book_rating = round($sum/$count, 1);
} else { } else {
$this->book_rating = (float) 0; $this->book_rating = 0;
} }
} }
} }
......
...@@ -41,12 +41,12 @@ ...@@ -41,12 +41,12 @@
</div> </div>
<div class="add-flex-direction-column" id="rightbar-pic" align="center"> <div class="add-flex-direction-column" id="rightbar-pic" align="center">
<div class="flex-1"> <div class="flex-1">
<img id="book-pict" src="'.self::showPicture('books','../images/books_picture/default.jpg').'"> <img id="book-pict" src="'.self::showPicture('book', $book_detail['ID']).'">
</div> </div>
<div class="rating-pict">'. <div class="rating-pict">'.
self::drawRating($book_rating). self::drawRating($book_rating).
'</div> '</div>
<div class="text-size-20"><b>'.$book_rating.'/5.0</b></div> <div class="text-size-20"><b>'.self::floatRating($book_rating).'/5.0</b></div>
</div> </div>
</div>'; </div>';
return $str; return $str;
...@@ -67,11 +67,19 @@ ...@@ -67,11 +67,19 @@
return $str . '</div>'; return $str . '</div>';
} }
private function showPicture($obj, $picSrc) { private function showPicture($obj, $input) {
if ($picSrc == NULL) { if ($obj == "book") {
return '../images/'. $obj .'_picture/default.jpg'; if (fileProcessing::isExistBookImage($input)) {
return fileProcessing::getImageBookPathFromRoot($input);
} else {
return '/images/books_picture/default.jpg';
}
} else { } else {
return $picSrc; if (fileProcessing::isExistProfileImage($input)) {
return fileProcessing::getImageProfilePathFromRoot($input);
} else {
return '/images/profiles_picture/default.jpg';
}
} }
} }
...@@ -110,7 +118,7 @@ ...@@ -110,7 +118,7 @@
<div class="flex-container align-items-flex-start"> <div class="flex-container align-items-flex-start">
<div class="flex-1 flex-review-tab"> <div class="flex-1 flex-review-tab">
<div class="reviewer-profile"> <div class="reviewer-profile">
<img id="profile_pict" src="'.self::showPicture('profiles',$review['profile_picture']).'"> <img id="profile_pict" src="'.self::showPicture('user', $review['username']).'">
</div> </div>
<div id="comment-user"> <div id="comment-user">
<div id="reviewer">@'.$review['username'].'</div> <div id="reviewer">@'.$review['username'].'</div>
...@@ -120,7 +128,7 @@ ...@@ -120,7 +128,7 @@
<div class="add-flex-direction-column"> <div class="add-flex-direction-column">
<div> <img id="star-icon" src="../svgIcon/'.self::STAR_FULL_IMG.'"> <div> <img id="star-icon" src="../svgIcon/'.self::STAR_FULL_IMG.'">
</div> </div>
<div class="text-size-20" align="center"><b>'.round($review['rating'], 1).'/5.0</b></div> <div class="text-size-20" align="center"><b>'.self::floatRating($review['rating']).'/5.0</b></div>
</div> </div>
</div>'; </div>';
$str = $str . $str_review; $str = $str . $str_review;
...@@ -143,5 +151,9 @@ ...@@ -143,5 +151,9 @@
} }
return $str; return $str;
} }
private function floatRating($rate) {
return number_format((float)$rate, 1, '.', '');
}
} }
?> ?>
\ No newline at end of file
...@@ -117,7 +117,7 @@ label { ...@@ -117,7 +117,7 @@ label {
.modal-message { .modal-message {
display: flex; display: flex;
height: 15%; height: 10%;
margin-top: 40px; margin-top: 40px;
margin-bottom: 40px; margin-bottom: 40px;
margin-left: 40px; margin-left: 40px;
......
...@@ -66,6 +66,7 @@ input, textarea { ...@@ -66,6 +66,7 @@ input, textarea {
border-width: 2px; border-width: 2px;
border-radius: 5px; border-radius: 5px;
font-family: 'Lucida Sans Regular'; font-family: 'Lucida Sans Regular';
font-size: 20px;
color: orange; color: orange;
font-weight: bold; font-weight: bold;
letter-spacing: 2px; letter-spacing: 2px;
......
...@@ -12,31 +12,19 @@ td { ...@@ -12,31 +12,19 @@ td {
margin-right: 5px; margin-right: 5px;
} }
textarea { #validate_username {
margin-top: 5px;
display: inline-block;
}
.form-input textarea {
width: 100%; width: 100%;
} }
/*Tooltip*/ .form-input input {
.tooltiptext { width: 100%;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
z-index: 1;
top: -5px;
left: 110%;
} }
.tooltiptext::after { a {
content: ""; color: #000000;
position: absolute;
top: 50%;
right: 100%;
margin-top: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent black transparent transparent;
} }
\ No newline at end of file
#textarea-comment { .textarea-comment {
width: 100%; width: 100%;
resize: none;
font-size: 28px; font-size: 28px;
font-family: 'Nunito', sans-serif; font-family: 'Nunito', sans-serif;
padding: 5px; padding: 5px;
margin-block-end: 30px; resize: none;
}
.warning-empty-inputs {
position: relative;
}
.comment-bar {
margin-block-end: 50px;
} }
.fivestar-rating { .fivestar-rating {
......
...@@ -29,4 +29,26 @@ function noHoverStar(starValue) { ...@@ -29,4 +29,26 @@ function noHoverStar(starValue) {
document.getElementById("star"+idx).src = STAR; document.getElementById("star"+idx).src = STAR;
} }
} }
} }
\ No newline at end of file
function IsEmptyCommentBar() {
return document.getElementById('comment').value === "";
}
function trySubmitSearch() {
if (IsEmptyCommentBar()) {
document.getElementById("warning-empty-input").style.display = 'table';
} else {
document.getElementById('book-review').submit();
}
}
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('comment').addEventListener('keypress', function(event) {
if (event.keyCode == 13) {
event.preventDefault();
trySubmitSearch();
}
});
}, false);
\ No newline at end of file
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
return $form; return $form;
} }
function getTable() { function getTable() {
return '<table align="center"> return '<table class="form-input" align="center">
<tr> <tr>
<td>Name</td> <td>Name</td>
<td><input id="name-input" type="text" size="25" name="name"></td> <td><input id="name-input" type="text" size="25" name="name"></td>
...@@ -67,12 +67,12 @@ ...@@ -67,12 +67,12 @@
</tr> </tr>
<tr> <tr>
<td>Password</td> <td>Password</td>
<td><input id="password-input" type="password" size="25" maxlength="16" name="password"> <td><input id="password-input" type="password" size="25" name="password">
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Confirm Password</td> <td>Confirm Password</td>
<td><input id="confpassword-input" type="password" size="25" maxlength="16" name="conf_password"></td> <td><input id="confpassword-input" type="password" size="25" name="conf_password"></td>
</tr> </tr>
<tr> <tr>
<td>Address</td> <td>Address</td>
......
<?php <?php
class reviewFormViewer { class reviewFormViewer {
public static function viewReviewForm($params) { public static function viewReviewForm($params) {
$ordered_book = $params['ordered_book']; $ordered_book = $params['ordered_book'];
...@@ -36,16 +35,24 @@ ...@@ -36,16 +35,24 @@
</div> </div>
<div class="add-flex-direction-column" id="rightbar-pic" align="center"> <div class="add-flex-direction-column" id="rightbar-pic" align="center">
<div class="flex-1"> <div class="flex-1">
<img id="book-pict" src="../images/books_picture/default.jpg"> <img id="book-pict" src="'.self::showPicture($ordered_book['book_id']).'">
</div> </div>
</div> </div>
</div>'; </div>';
return $str; return $str;
} }
private function showPicture($input) {
if (fileProcessing::isExistBookImage($input)) {
return fileProcessing::getImageBookPathFromRoot($input);
} else {
return '/images/books_picture/default.jpg';
}
}
private function showReviewForm($order_id, $book_id) { private function showReviewForm($order_id, $book_id) {
$str = ' $str = '
<form action="review/submit_review.php" method="POST"> <form id="book-review" action="review/submit_review.php" method="POST">
<div class="book-detail"> <div class="book-detail">
<div class="head-title">Add Rating</div> <div class="head-title">Add Rating</div>
<div class="order-select">'. <div class="order-select">'.
...@@ -57,8 +64,9 @@ ...@@ -57,8 +64,9 @@
<div class="head-title">Add Comment</div> <div class="head-title">Add Comment</div>
<div class="flex-review-tab"> <div class="flex-review-tab">
<div class="comment-bar"> <div class="comment-bar">
<textarea id="textarea-comment" name="comment" cols="180" rows="5"></textarea> <textarea id="comment" class="textarea-comment" name="comment" cols="180" rows="5"></textarea>
<p id="warning-empty-input" class="red-theme alert-box text-size-20 add-nunito-font c-round">Input can\'t be empty</p> <span id="warning-empty-input" class="red-theme alert-box text-size-20 add-nunito-font c-round">
Input can\'t be empty</span>
</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