diff --git a/scripts/client/public/js/navigation.js b/scripts/client/public/js/navigation.js index 31efff1123728e8cb8014d8baacb89c1a3ad3348..fde676f4a067f962a6ccfc3337741feb6226277c 100644 --- a/scripts/client/public/js/navigation.js +++ b/scripts/client/public/js/navigation.js @@ -6,9 +6,9 @@ function putNavbar(userRole) { { text: "Topup", icon: "topup.png", onClick: "http://localhost:8000/pages/topup" } ], admin: [ - { text: "Edit Product", icon: "edit-product.png", onClick: redirectToAdminProduct }, - { text: "Handle Topup", icon: "topup.png", onClick: redirectToAdminTopUp }, - { text: "Users", icon: "user-manage.png", onClick: redirectToAdminUser } + { text: "Edit Product", icon: "edit-product.png", onClick: "http://localhost:8000/pages/admin-product" }, + { text: "Handle Topup", icon: "topup.png", onClick: "http://localhost:8000/pages/admin-top-up" }, + { text: "Users", icon: "user-manage.png", onClick: "http://localhost:8000/pages/admin-user" } ], guest : [], }; @@ -51,10 +51,6 @@ function redirectToSettings() { window.location.href = "http://localhost:8000/pages/settings"; } -function redirectToAdminProduct() { - window.location.href = "http://localhost:8000/pages/admin-product"; -} - function redirectToCreateProduct() { window.location.href = "http://localhost:8000/pages/admin-product-create"; } @@ -63,18 +59,10 @@ function redirectToEditProduct(id) { window.location.href = "http://localhost:8000/pages/admin-product-edit?id=" + id; } -function redirectToAdminTopUp() { - window.location.href = "http://localhost:8000/pages/admin-top-up"; -} - function redirectToCreateTopUp() { window.location.href = "http://localhost:8000/pages/admin-top-up-create"; } -function redirectToAdminUser() { - window.location.href = "http://localhost:8000/pages/admin-user"; -} - function redirectToCreateUser() { window.location.href = "http://localhost:8000/pages/admin-user-create"; } diff --git a/scripts/server/app/models/ProductModel.php b/scripts/server/app/models/ProductModel.php index 77fb923728a617a7e7c531d17be6e3842ec69a51..20bddfdb38310510dda542b2fe9d22de96b9a44e 100644 --- a/scripts/server/app/models/ProductModel.php +++ b/scripts/server/app/models/ProductModel.php @@ -43,7 +43,7 @@ class ProductModel { product.price, product.stock FROM product - INNER JOIN category ON product.idCategory = category.id + INNER JOIN category ON product.idCategory = category.id WHERE stock > 0 ORDER BY product.name'); return $this->db->resultSet(); @@ -59,7 +59,7 @@ class ProductModel { price, stock FROM product - INNER JOIN category ON product.idCategory = category.id + INNER JOIN category ON product.idCategory = category.id WHERE product.id = :id ORDER BY product.name'); $this->db->bind(':id', (int) $id); @@ -83,7 +83,7 @@ class ProductModel { product.price, product.stock FROM product - INNER JOIN category ON product.idCategory = category.id + INNER JOIN category ON product.idCategory = category.id WHERE product.id = :id ORDER BY product.name'); $this->db->bind(':id', (int) $id); @@ -102,7 +102,8 @@ class ProductModel { product.price, product.stock FROM product - INNER JOIN category ON product.idCategory = category.id + INNER JOIN category ON product.idCategory = category.id + WHERE stock > 0 ORDER BY product.name LIMIT :limit OFFSET :offset');