From e159fe9f5707e502bc666776c83d0f3556cdce68 Mon Sep 17 00:00:00 2001 From: Michael Leon Putra Widhi <leonmichael463@gmail.com> Date: Fri, 6 Oct 2023 22:55:59 +0700 Subject: [PATCH] refactor : categorycontroller, feat : splashscreen --- scripts/build-image.sh | 1 - scripts/client/pages/home/index.php | 4 ++-- scripts/client/public/css/globals.css | 19 +++++++++++++------ scripts/{client => }/index.html | 16 +++++++--------- scripts/server/app/constants/response.php | 3 +++ .../app/controllers/CategoryController.php | 2 +- scripts/server/app/models/CategoryModel.php | 2 ++ 7 files changed, 28 insertions(+), 19 deletions(-) delete mode 100644 scripts/build-image.sh rename scripts/{client => }/index.html (53%) diff --git a/scripts/build-image.sh b/scripts/build-image.sh deleted file mode 100644 index ce096ba..0000000 --- a/scripts/build-image.sh +++ /dev/null @@ -1 +0,0 @@ -docker build -t tubes-1:latest . \ No newline at end of file diff --git a/scripts/client/pages/home/index.php b/scripts/client/pages/home/index.php index 5e5fc76..4b3def1 100644 --- a/scripts/client/pages/home/index.php +++ b/scripts/client/pages/home/index.php @@ -14,7 +14,7 @@ </div> <div class="dropdown2"> <input class="filter-price" id="prilast" type="text" placeholder="Select filter price" readonly> - <div class="options" id="categoryFilter"> + <div class="options"> <div onclick="showFilterPrice('< 5K')">< 5K</div> <div onclick="showFilterPrice('5K - 30K')">5K - 30K</div> <div onclick="showFilterPrice('30K - 100K')">30K - 100K</div> @@ -52,7 +52,7 @@ // Function to populate the category dropdown function populateCategoryDropdown() { $.ajax({ - url: 'http://localhost:8000/server/api/categorycontroller/showAllcategories', + url: 'http://localhost:8000/api/CategoryController/showAllcategories', method: 'GET', dataType: 'json', success: function (data) { diff --git a/scripts/client/public/css/globals.css b/scripts/client/public/css/globals.css index 034f2b5..b2900c3 100644 --- a/scripts/client/public/css/globals.css +++ b/scripts/client/public/css/globals.css @@ -29,26 +29,33 @@ a:hover { /* Navbar */ .indexCt { - background-color: var(--black); - min-height: 100vh; + background-color: #33383a; + height: 100vh; + width: 100vw; display: flex; flex-direction: column; flex-wrap: nowrap; align-items: center; justify-content: center; - row-gap: 30px; margin: auto; } .bigText img { - width: 5vw; + width: 15vw; } /* Redirection */ .redirect { + text-align: center; color: white; - font-family: "Arial"; - font-size: 16px; + font-size: 1rem; +} + +.main-title-spl { + text-align: center; + padding-bottom: 1rem; + color: white; + font-size: 4rem; } /* Responsive design */ diff --git a/scripts/client/index.html b/scripts/index.html similarity index 53% rename from scripts/client/index.html rename to scripts/index.html index 18e02a7..f28166d 100644 --- a/scripts/client/index.html +++ b/scripts/index.html @@ -4,17 +4,15 @@ <link rel="icon" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta http-equiv="refresh" content="3;url=http://localhost:8000/pages/home" /> - <link rel="stylesheet" href="css/globals.css"> + <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"> <title>KBL</title> </head> - <body> - <div class="indexCt"> - <a href="http://localhost:8000/pages/home" class="bigText"> - <img src="./assets/logo.png" /> - </a> - <div class="redirect">Redirecting you to Home Page...</div> - </div> - </body> + <body class="indexCt"> + <a href="http://localhost:8000/pages/home" class="bigText"> + <img src="http://localhost:8000/public/images/logo.png" /> + </a> + <div class="main-title-spl">- KBL -</div> + <div class="redirect">Redirecting you to Home Page...</div> </body> </html> \ No newline at end of file diff --git a/scripts/server/app/constants/response.php b/scripts/server/app/constants/response.php index f571203..c51c1fa 100644 --- a/scripts/server/app/constants/response.php +++ b/scripts/server/app/constants/response.php @@ -19,6 +19,9 @@ define('USERNAME_REGISTERED','username_registered'); // PRODUCT API RESPONSE define('PRODUCT_NOT_FOUND','product_not_found'); +// CATEGORY API RESPONSE +define('CATEGORY_NOT_FOUND','category_not_found'); + // TOPUP API RESPONSE define('TOPUP_REQ_NOT_FOUND','topup_req_not_found'); define('TOPUP_HIST_NOT_FOUND','topup_hist_not_found'); diff --git a/scripts/server/app/controllers/CategoryController.php b/scripts/server/app/controllers/CategoryController.php index 4f70354..5fbc4f5 100644 --- a/scripts/server/app/controllers/CategoryController.php +++ b/scripts/server/app/controllers/CategoryController.php @@ -20,7 +20,7 @@ class CategoryController extends Controller { if ($res) { json_response_success($res); } else { - json_response_fail(PRODUCT_NOT_FOUND); + json_response_fail(CATEGORY_NOT_FOUND); } } } \ No newline at end of file diff --git a/scripts/server/app/models/CategoryModel.php b/scripts/server/app/models/CategoryModel.php index 9c49e6a..6662acf 100644 --- a/scripts/server/app/models/CategoryModel.php +++ b/scripts/server/app/models/CategoryModel.php @@ -11,6 +11,8 @@ class CategoryModel { $this->db->query('SELECT * FROM category ORDER BY id'); try { + $this->db->execute(); + // Fetch and return results. return $this->db->resultSet(); } catch (PDOException $e) { return false; -- GitLab