diff --git a/scripts/client/pages/home/index.php b/scripts/client/pages/home/index.php index 4b3def1862b6d05fe2e1296ba4766d16454e7c34..179443631e9fe32a46d4f2eba4da542dffdf5017 100644 --- a/scripts/client/pages/home/index.php +++ b/scripts/client/pages/home/index.php @@ -35,7 +35,7 @@ </div> </div> </div> - <div class="listTitle">Showing 14 items...</div> + <div class="listTitle">Showing <input class="numsie" type="text" id="numsofObj" value="" placeholder="0" readonly> items...</div> <div id="queryResultProduct" class="queryResultProduct"></div> <div class="pagination" id="pagenumProduct"></div> </div> diff --git a/scripts/client/public/css/pages/product.css b/scripts/client/public/css/pages/product.css index de1eef05b38754fbdf97c3cd948dfaabf493221c..81534f77b5f4bbdb0d7e55a55a62173fee7bb14c 100644 --- a/scripts/client/public/css/pages/product.css +++ b/scripts/client/public/css/pages/product.css @@ -8,6 +8,26 @@ row-gap: 0.25vh; } +#numsofObj { + background-color: inherit; + font-size: 1.5rem; + width: 1.7rem; + color: white; + border: none; + justify-items: center; + text-align: center; +} + +#numsofObj::placeholder { + background-color: inherit; + font-size: 1.5rem; + width: 1.7rem; + color: white; + border: none; + justify-items: center; + text-align: center; +} + .productMenu { width: 100%; display: flex; @@ -38,6 +58,8 @@ font-size: 1.5rem; align-items: center; margin-bottom: 1.5rem; + display: inline; + white-space: nowrap; } @media only screen and (max-width: 768px) { diff --git a/scripts/client/public/js/login.js b/scripts/client/public/js/login.js index 96f4ef3d736eb93b1546d19d5f8d35cf7debe187..689a8bbccfaac8978a5e31320d5cecbe941abcca 100644 --- a/scripts/client/public/js/login.js +++ b/scripts/client/public/js/login.js @@ -10,10 +10,10 @@ document.getElementById('login-form').addEventListener('submit', function(event) console.log(this.responseText); if (this.responseText == "Login successful.") { alert("Login success!"); - window.location.href = "http://localhost:8000/client/pages/home"; + window.location.href = "http://localhost:8000/pages/home"; } else { alert("Invalid username or password. Please try again."); - window.location.href = "http://localhost:8000/client/pages/login"; + window.location.href = "http://localhost:8000/pages/login"; } } }; diff --git a/scripts/client/public/js/product.js b/scripts/client/public/js/product.js index 7bc9a7ac0251870287ef3bb08df841238d7a0b6d..541c5f46c2091f9e921cc590821af227b835aab0 100644 --- a/scripts/client/public/js/product.js +++ b/scripts/client/public/js/product.js @@ -81,7 +81,9 @@ function selectProduct(numPage) { let res = JSON.parse(this.responseText); currentPageProduct = numPage; if (res['status']) { + console.log(res['data']['total']); products = res['data']; + document.querySelector("#numsofObj").value = String(res['data']['total']); totalPageProduct = res['data']['pages']; clearProduct(); appendData(products['products'], "queryResultProduct"); diff --git a/scripts/client/public/js/signup.js b/scripts/client/public/js/signup.js index 311930a3f46c220533713505c92f77a54dff45b7..eb0d007cfccf27ae6e9683ac751b598076651eb7 100644 --- a/scripts/client/public/js/signup.js +++ b/scripts/client/public/js/signup.js @@ -52,10 +52,10 @@ document.getElementById('register-form').addEventListener('submit', function(eve console.log(res); if (res["status"]) { alert("Account created!"); - window.location.href = "http://localhost:8000/client/pages/login"; + window.location.href = "http://localhost:8000/pages/login"; } else { alert("Username already exists! Failed to create account!"); - window.location.href = "http://localhost:8000/client/pages/signup" + window.location.href = "http://localhost:8000/pages/signup" } } }; diff --git a/scripts/index.html b/scripts/index.html index f28166d930278f4cbdaeef864ee09926a438d2de..51686ca81fff816569ee9c3416800602432b4d04 100644 --- a/scripts/index.html +++ b/scripts/index.html @@ -1,8 +1,7 @@ <!DOCTYPE HTML5> <head> <meta charset="utf-8" /> - <link rel="icon" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> + <link rel="icon" type="image/png" href="http://localhost:8000/public/images/logo.png"> <meta http-equiv="refresh" content="3;url=http://localhost:8000/pages/home" /> <link rel="stylesheet" href="http://localhost:8000/public/css/globals.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> diff --git a/scripts/server/app/controllers/ProductController.php b/scripts/server/app/controllers/ProductController.php index 804148b502f5789260f3cfc4e196f822b339df0f..4f39c3c470195a629a81900ebab7b113593bee39 100644 --- a/scripts/server/app/controllers/ProductController.php +++ b/scripts/server/app/controllers/ProductController.php @@ -196,7 +196,7 @@ class ProductController extends Controller { // Pagination if ($res) { - json_response_success(array("products" => $res, "pages" => ceil($total/$limit_page))); + json_response_success(array("products" => $res, "pages" => ceil($total/$limit_page), "total" => $total)); } else { json_response_fail(PRODUCT_NOT_FOUND); }