diff --git a/admin/areas.php b/admin/areas.php index 688a9e1..20a5b14 100644 --- a/admin/areas.php +++ b/admin/areas.php @@ -16,12 +16,13 @@ if (isset($_GET['delete'])) { } // Fetch areas with outlet names -$areas = $pdo->query(" - SELECT areas.*, outlets.name as outlet_name +$query = "SELECT areas.*, outlets.name as outlet_name FROM areas LEFT JOIN outlets ON areas.outlet_id = outlets.id - ORDER BY areas.id DESC -")->fetchAll(); + ORDER BY areas.id DESC"; + +$areas_pagination = paginate_query($pdo, $query); +$areas = $areas_pagination['data']; // Fetch outlets for dropdown $outlets = $pdo->query("SELECT id, name FROM outlets ORDER BY name ASC")->fetchAll(); @@ -38,6 +39,10 @@ include 'includes/header.php';
+ +
+ +
@@ -68,6 +73,10 @@ include 'includes/header.php';
+ +
+ +
diff --git a/admin/categories.php b/admin/categories.php index 32ccebe..d5a40f4 100644 --- a/admin/categories.php +++ b/admin/categories.php @@ -3,12 +3,15 @@ require_once __DIR__ . '/../db/config.php'; $pdo = db(); if (isset($_GET['delete'])) { - $pdo->prepare("DELETE FROM categories WHERE id = ?")->execute([$_GET['delete']]); + $id = $_GET['delete']; + $pdo->prepare("DELETE FROM categories WHERE id = ?")->execute([$id]); header("Location: categories.php"); exit; } -$categories = $pdo->query("SELECT * FROM categories ORDER BY sort_order ASC, name ASC")->fetchAll(); +$query = "SELECT * FROM categories ORDER BY sort_order ASC, name ASC"; +$categories_pagination = paginate_query($pdo, $query); +$categories = $categories_pagination['data']; include 'includes/header.php'; ?> @@ -22,6 +25,10 @@ include 'includes/header.php';
+ +
+ +
@@ -65,6 +72,10 @@ include 'includes/header.php';
+ +
+ +
diff --git a/admin/customers.php b/admin/customers.php index 3ef17bd..02dabdc 100644 --- a/admin/customers.php +++ b/admin/customers.php @@ -28,7 +28,9 @@ if (isset($_GET['delete'])) { } // Fetch Customers -$customers = $pdo->query("SELECT * FROM customers ORDER BY id DESC")->fetchAll(); +$query = "SELECT * FROM customers ORDER BY id DESC"; +$customers_pagination = paginate_query($pdo, $query); +$customers = $customers_pagination['data']; include 'includes/header.php'; ?> @@ -44,6 +46,10 @@ include 'includes/header.php';
+ +
+ +
@@ -78,6 +84,10 @@ include 'includes/header.php';
+ +
+ +
diff --git a/admin/includes/header.php b/admin/includes/header.php index bde3348..1cc7abe 100644 --- a/admin/includes/header.php +++ b/admin/includes/header.php @@ -90,6 +90,11 @@ function isActive($page) { Dashboard +