From 4f1232c0675632c8125ec901bf777ac4381ab7fb Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 15 Mar 2026 10:24:41 +0000 Subject: [PATCH] Autosave: 20260315-102441 --- includes/pages/cities.php | 335 +++++++++++++++++++++++- includes/pages/departments.php | 336 +++++++++++++++++++++++- includes/pages/drugs_groups.php | 173 ++++++++++++- includes/pages/employees.php | 440 ++++++++++++++++++++++++++++++-- includes/pages/insurance.php | 272 +++++++++++++++++++- includes/pages/nurses.php | 381 +++++++++++++++++++++++++-- includes/pages/positions.php | 330 +++++++++++++++++++++++- includes/pages/test_groups.php | 267 ++++++++++++++++++- includes/pages/xray_groups.php | 267 ++++++++++++++++++- includes/pages/xray_tests.php | 378 +++++++++++++++++++++++++-- 10 files changed, 3074 insertions(+), 105 deletions(-) diff --git a/includes/pages/cities.php b/includes/pages/cities.php index 90bf2a8..ca33d18 100644 --- a/includes/pages/cities.php +++ b/includes/pages/cities.php @@ -1,16 +1,146 @@ query($query); +$search_name = $_GET['name'] ?? ''; +$page = isset($_GET['page']) && is_numeric($_GET['page']) ? (int)$_GET['page'] : 1; +$limit = 10; +$offset = ($page - 1) * $limit; + +$where = "WHERE 1=1"; +$params = []; + +if ($search_name) { + $where .= " AND (name_en LIKE ? OR name_ar LIKE ?)"; + $params[] = "%$search_name%"; + $params[] = "%$search_name%"; +} + +// Count Total +$countQuery = "SELECT COUNT(*) FROM cities $where"; +$stmt = $db->prepare($countQuery); +$stmt->execute($params); +$totalCities = $stmt->fetchColumn(); +$totalPages = ceil($totalCities / $limit); + +// Fetch Data +$query = "SELECT * FROM cities $where ORDER BY id DESC LIMIT $limit OFFSET $offset"; +$stmt = $db->prepare($query); +$stmt->execute($params); $cities = $stmt->fetchAll(); + +// --- AJAX HANDLER --- +if (isset($_GET['ajax_search'])) { + ob_start(); + if (empty($cities)): + ?> + + + + + + + + + + + + + +
+ + +
+ + + + 1): ?> +
+
+ - +
+ +
+ $table_html, 'pagination' => $pagination_html]); + exit; +} ?>

-
+ +
+
+
+
+
+ + +
+
+
+ +
+
+
+
+
@@ -23,12 +153,12 @@ $cities = $stmt->fetchAll(); - + - No cities found. + @@ -57,5 +187,200 @@ $cities = $stmt->fetchAll();
+ + +
+ 1): ?> +
+
+ - +
+ +
+ +
+ + + + + + + + \ No newline at end of file diff --git a/includes/pages/departments.php b/includes/pages/departments.php index 975fbc9..bdb3085 100644 --- a/includes/pages/departments.php +++ b/includes/pages/departments.php @@ -1,16 +1,146 @@ query($query); +$search_name = $_GET['name'] ?? ''; +$page = isset($_GET['page']) && is_numeric($_GET['page']) ? (int)$_GET['page'] : 1; +$limit = 10; +$offset = ($page - 1) * $limit; + +$where = "WHERE 1=1"; +$params = []; + +if ($search_name) { + $where .= " AND (name_en LIKE ? OR name_ar LIKE ?)"; + $params[] = "%$search_name%"; + $params[] = "%$search_name%"; +} + +// Count Total +$countQuery = "SELECT COUNT(*) FROM departments $where"; +$stmt = $db->prepare($countQuery); +$stmt->execute($params); +$totalDepartments = $stmt->fetchColumn(); +$totalPages = ceil($totalDepartments / $limit); + +// Fetch Data +$query = "SELECT * FROM departments $where ORDER BY id DESC LIMIT $limit OFFSET $offset"; +$stmt = $db->prepare($query); +$stmt->execute($params); $departments = $stmt->fetchAll(); + +// --- AJAX HANDLER --- +if (isset($_GET['ajax_search'])) { + ob_start(); + if (empty($departments)): + ?> + + + + + + + + + + + + + +
+ + +
+ + + + 1): ?> +
+
+ - +
+ +
+ $table_html, 'pagination' => $pagination_html]); + exit; +} ?>

-
+ +
+
+
+
+
+ + +
+
+
+ +
+
+
+
+
@@ -23,12 +153,12 @@ $departments = $stmt->fetchAll(); - + - No departments found. + @@ -57,5 +187,201 @@ $departments = $stmt->fetchAll();
+ + +
+ 1): ?> +
+
+ - +
+ +
+ +
+ + + + + + + + \ No newline at end of file diff --git a/includes/pages/drugs_groups.php b/includes/pages/drugs_groups.php index 1add878..ab3f58b 100644 --- a/includes/pages/drugs_groups.php +++ b/includes/pages/drugs_groups.php @@ -1,13 +1,122 @@ query($query); +// Pagination Logic +$page = isset($_GET['page']) ? (int)$_GET['page'] : 1; +$limit = 10; +$offset = ($page - 1) * $limit; +$search = isset($_GET['search']) ? trim($_GET['search']) : ''; + +$where_clause = ""; +$params = []; + +if ($search) { + $where_clause = "WHERE name_en LIKE ? OR name_ar LIKE ?"; + $params[] = "%$search%"; + $params[] = "%$search%"; +} + +// Total count +$count_query = "SELECT COUNT(*) FROM drugs_groups $where_clause"; +$stmt = $db->prepare($count_query); +$stmt->execute($params); +$total_records = $stmt->fetchColumn(); +$total_pages = ceil($total_records / $limit); + +// Fetch data +$query = "SELECT * FROM drugs_groups $where_clause ORDER BY id DESC LIMIT $limit OFFSET $offset"; +$stmt = $db->prepare($query); +$stmt->execute($params); $groups = $stmt->fetchAll(); + +// Handle AJAX Request +if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') { + ob_start(); +?> + + + + + + + + + + + + + + + + + + + + + + + + + +
#
+ + +
+
+ + +
+
+ + + 1): ?> +
+
+ +
+ +
+ + $html]); + exit; +} ?>

-
- +
@@ -65,12 +155,12 @@ $insurance_companies = $stmt->fetchAll(); - + - No insurance companies found. + @@ -88,5 +178,165 @@ $insurance_companies = $stmt->fetchAll(); + + +
+ 1): ?> +
+
+ - +
+ +
+ +
- \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/includes/pages/nurses.php b/includes/pages/nurses.php index 31160bc..a7eb878 100644 --- a/includes/pages/nurses.php +++ b/includes/pages/nurses.php @@ -1,33 +1,147 @@ prepare($countQuery); +$stmt->execute($params); +$totalNurses = $stmt->fetchColumn(); +$totalPages = ceil($totalNurses / $limit); + +// Fetch Data +$query = " + SELECT n.*, dept.name_$lang as department_name + FROM nurses n + LEFT JOIN departments dept ON n.department_id = dept.id + $where + ORDER BY n.id DESC + LIMIT $limit OFFSET $offset"; + $stmt = $db->prepare($query); $stmt->execute($params); $nurses = $stmt->fetchAll(); + +// --- AJAX HANDLER --- +if (isset($_GET['ajax_search'])) { + ob_start(); + if (empty($nurses)): + ?> + + + + + + + + + + +
+ + + + + + + + +
+
+ + +
+ + +
+ + + + 1): ?> +
+
+ - +
+ +
+ $table_html, 'pagination' => $pagination_html]); + exit; +} ?>

-
@@ -35,15 +149,15 @@ $nurses = $stmt->fetchAll();
-
+
- +
-
- +
@@ -71,12 +185,12 @@ $nurses = $stmt->fetchAll(); - + - No nurses found. + @@ -115,5 +229,240 @@ $nurses = $stmt->fetchAll();
+ + +
+ 1): ?> +
+
+ - +
+ +
+ +
- \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/includes/pages/positions.php b/includes/pages/positions.php index 49fa706..592e643 100644 --- a/includes/pages/positions.php +++ b/includes/pages/positions.php @@ -1,24 +1,126 @@ prepare($countQuery); +$stmt->execute($params); +$totalPositions = $stmt->fetchColumn(); +$totalPages = ceil($totalPositions / $limit); + +// Fetch Data +$query = "SELECT * FROM positions $where ORDER BY id DESC LIMIT $limit OFFSET $offset"; $stmt = $db->prepare($query); $stmt->execute($params); $positions = $stmt->fetchAll(); + +// --- AJAX HANDLER --- +if (isset($_GET['ajax_search'])) { + ob_start(); + if (empty($positions)): + ?> + + + + + + + + + + + + + + +
+ + +
+ + + + 1): ?> +
+
+ - +
+ +
+ $table_html, 'pagination' => $pagination_html]); + exit; +} ?>

-
@@ -26,15 +128,15 @@ $positions = $stmt->fetchAll();
-
+
- +
- +
@@ -53,12 +155,12 @@ $positions = $stmt->fetchAll(); - + - No positions found. + @@ -88,5 +190,213 @@ $positions = $stmt->fetchAll();
+ + +
+ 1): ?> +
+
+ - +
+ +
+ +
- \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/includes/pages/test_groups.php b/includes/pages/test_groups.php index d92b600..4aa1fb0 100644 --- a/includes/pages/test_groups.php +++ b/includes/pages/test_groups.php @@ -1,19 +1,131 @@ query($query); +// Pagination Logic +$page = isset($_GET['page']) ? (int)$_GET['page'] : 1; +$limit = 10; +$offset = ($page - 1) * $limit; +$search = isset($_GET['search']) ? trim($_GET['search']) : ''; + +$where_clause = ""; +$params = []; + +if ($search) { + $where_clause = "WHERE name_en LIKE ? OR name_ar LIKE ?"; + $params[] = "%$search%"; + $params[] = "%$search%"; +} + +// Total count +$count_query = "SELECT COUNT(*) FROM test_groups $where_clause"; +$stmt = $db->prepare($count_query); +$stmt->execute($params); +$total_records = $stmt->fetchColumn(); +$total_pages = ceil($total_records / $limit); + +// Fetch data +$query = "SELECT * FROM test_groups $where_clause ORDER BY id DESC LIMIT $limit OFFSET $offset"; +$stmt = $db->prepare($query); +$stmt->execute($params); $groups = $stmt->fetchAll(); + +// Handle AJAX Request +if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') { + ob_start(); +?> + + + + + + + + + + + + + + + + + + + + + + + + + +
#
+ + +
+
+ + +
+
+ + + 1): ?> +
+
+ +
+ +
+ + $html]); + exit; +} ?>

- +
+
+ + +
+ +
-
+
+ @@ -28,7 +140,7 @@ $groups = $stmt->fetchAll(); @@ -56,6 +168,145 @@ $groups = $stmt->fetchAll();
- No groups found. +
+ + + 1): ?> +
+
+ +
+ +
+
-
\ No newline at end of file +
+ + + + + + + + \ No newline at end of file diff --git a/includes/pages/xray_groups.php b/includes/pages/xray_groups.php index 96d1a9e..df949f7 100644 --- a/includes/pages/xray_groups.php +++ b/includes/pages/xray_groups.php @@ -1,19 +1,131 @@ query($query); +// Pagination Logic +$page = isset($_GET['page']) ? (int)$_GET['page'] : 1; +$limit = 10; +$offset = ($page - 1) * $limit; +$search = isset($_GET['search']) ? trim($_GET['search']) : ''; + +$where_clause = ""; +$params = []; + +if ($search) { + $where_clause = "WHERE name_en LIKE ? OR name_ar LIKE ?"; + $params[] = "%$search%"; + $params[] = "%$search%"; +} + +// Total count +$count_query = "SELECT COUNT(*) FROM xray_groups $where_clause"; +$stmt = $db->prepare($count_query); +$stmt->execute($params); +$total_records = $stmt->fetchColumn(); +$total_pages = ceil($total_records / $limit); + +// Fetch data +$query = "SELECT * FROM xray_groups $where_clause ORDER BY id DESC LIMIT $limit OFFSET $offset"; +$stmt = $db->prepare($query); +$stmt->execute($params); $groups = $stmt->fetchAll(); + +// Handle AJAX Request +if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') { + ob_start(); +?> + + + + + + + + + + + + + + + + + + + + + + + + + +
#
+ + +
+
+ + +
+
+ + + 1): ?> +
+
+ +
+ +
+ + $html]); + exit; +} ?>

- +
+
+ + +
+ +
-
+
+ @@ -28,7 +140,7 @@ $groups = $stmt->fetchAll(); @@ -56,6 +168,145 @@ $groups = $stmt->fetchAll();
- No groups found. +
+ + + 1): ?> +
+
+ +
+ +
+
-
\ No newline at end of file +
+ + + + + + + + \ No newline at end of file diff --git a/includes/pages/xray_tests.php b/includes/pages/xray_tests.php index d709cc9..0725768 100644 --- a/includes/pages/xray_tests.php +++ b/includes/pages/xray_tests.php @@ -1,36 +1,155 @@ prepare($countQuery); +$stmt->execute($params); +$totalTests = $stmt->fetchColumn(); +$totalPages = ceil($totalTests / $limit); + +// Fetch Data +$query = " + SELECT t.*, g.name_$lang as group_name + FROM xray_tests t + LEFT JOIN xray_groups g ON t.group_id = g.id + $where + ORDER BY t.id DESC + LIMIT $limit OFFSET $offset"; + $stmt = $db->prepare($query); $stmt->execute($params); $tests = $stmt->fetchAll(); // Fetch all xray groups for the dropdown $all_xray_groups_list = $db->query("SELECT id, name_$lang as name FROM xray_groups ORDER BY name_$lang ASC")->fetchAll(); + +// --- AJAX HANDLER --- +if (isset($_GET['ajax_search'])) { + ob_start(); + if (empty($tests)): + ?> + + + + + + + + + + + +
+
+ +
+
+
+ +
+
+ + + + + + + + +
+ + +
+ + + + 1): ?> +
+
+ - +
+ +
+ $table_html, 'pagination' => $pagination_html]); + exit; +} ?>

-
@@ -38,15 +157,15 @@ $all_xray_groups_list = $db->query("SELECT id, name_$lang as name FROM xray_grou
-
+
- +
-
- +
@@ -75,7 +194,7 @@ $all_xray_groups_list = $db->query("SELECT id, name_$lang as name FROM xray_grou - + @@ -124,5 +243,234 @@ $all_xray_groups_list = $db->query("SELECT id, name_$lang as name FROM xray_grou
+ + +
+ 1): ?> +
+
+ - +
+ +
+ +
- \ No newline at end of file + + + + + + + + + \ No newline at end of file