adding data
@ -83,6 +83,15 @@ $cityNameExpr = $lang === 'ar'
|
||||
: "COALESCE(NULLIF(c.name_en, ''), c.name_ar)";
|
||||
|
||||
$countries = db()->query("SELECT id, name_en, name_ar, {$countryNameExprNoAlias} AS display_name FROM countries ORDER BY display_name ASC")->fetchAll();
|
||||
|
||||
// Pagination
|
||||
$page = max(1, (int)($_GET['page'] ?? 1));
|
||||
$limit = 20;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
$total = (int)db()->query("SELECT COUNT(*) FROM cities")->fetchColumn();
|
||||
$totalPages = (int)ceil($total / $limit);
|
||||
|
||||
$cities = db()->query(
|
||||
"SELECT
|
||||
c.id,
|
||||
@ -94,17 +103,15 @@ $cities = db()->query(
|
||||
FROM cities c
|
||||
JOIN countries co ON co.id = c.country_id
|
||||
ORDER BY country_name ASC, city_name ASC
|
||||
LIMIT 200"
|
||||
LIMIT $limit OFFSET $offset"
|
||||
)->fetchAll();
|
||||
|
||||
$editingCity = null;
|
||||
if ($editCityId > 0) {
|
||||
foreach ($cities as $city) {
|
||||
if ((int)$city['id'] === $editCityId) {
|
||||
$editingCity = $city;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Fetch explicitly if editing, as it might not be on the current page
|
||||
$stmt = db()->prepare("SELECT * FROM cities WHERE id = ?");
|
||||
$stmt->execute([$editCityId]);
|
||||
$editingCity = $stmt->fetch();
|
||||
}
|
||||
|
||||
render_header('Manage Cities', 'admin', true);
|
||||
@ -222,6 +229,25 @@ render_header('Manage Cities', 'admin', true);
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php if ($totalPages > 1): ?>
|
||||
<div class="pt-3 border-top d-flex justify-content-between align-items-center">
|
||||
<span class="text-muted small">Showing <?= count($cities) ?> of <?= $total ?> cities</span>
|
||||
<ul class="pagination pagination-sm mb-0">
|
||||
<li class="page-item <?= $page <= 1 ? 'disabled' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $page - 1 ?>">Previous</a>
|
||||
</li>
|
||||
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
||||
<li class="page-item <?= $i === $page ? 'active' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $i ?>"><?= $i ?></a>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
<li class="page-item <?= $page >= $totalPages ? 'disabled' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $page + 1 ?>">Next</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -73,16 +73,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { validate_csrf_token();
|
||||
$countryNameExprNoAlias = $lang === 'ar'
|
||||
? "COALESCE(NULLIF(name_ar, ''), name_en)"
|
||||
: "COALESCE(NULLIF(name_en, ''), name_ar)";
|
||||
$countries = db()->query("SELECT id, name_en, name_ar, {$countryNameExprNoAlias} AS display_name FROM countries ORDER BY display_name ASC")->fetchAll();
|
||||
|
||||
// Pagination
|
||||
$page = max(1, (int)($_GET['page'] ?? 1));
|
||||
$limit = 20;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
$total = (int)db()->query("SELECT COUNT(*) FROM countries")->fetchColumn();
|
||||
$totalPages = (int)ceil($total / $limit);
|
||||
|
||||
$countries = db()->query("SELECT id, name_en, name_ar, {$countryNameExprNoAlias} AS display_name FROM countries ORDER BY display_name ASC LIMIT $limit OFFSET $offset")->fetchAll();
|
||||
|
||||
$editingCountry = null;
|
||||
if ($editCountryId > 0) {
|
||||
foreach ($countries as $country) {
|
||||
if ((int)$country['id'] === $editCountryId) {
|
||||
$editingCountry = $country;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Fetch explicitly if editing
|
||||
$stmt = db()->prepare("SELECT id, name_en, name_ar, {$countryNameExprNoAlias} AS display_name FROM countries WHERE id = ?");
|
||||
$stmt->execute([$editCountryId]);
|
||||
$editingCountry = $stmt->fetch();
|
||||
}
|
||||
|
||||
render_header('Manage Countries', 'admin', true);
|
||||
@ -179,6 +186,25 @@ render_header('Manage Countries', 'admin', true);
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php if ($totalPages > 1): ?>
|
||||
<div class="pt-3 border-top d-flex justify-content-between align-items-center">
|
||||
<span class="text-muted small">Showing <?= count($countries) ?> of <?= $total ?> countries</span>
|
||||
<ul class="pagination pagination-sm mb-0">
|
||||
<li class="page-item <?= $page <= 1 ? 'disabled' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $page - 1 ?>">Previous</a>
|
||||
</li>
|
||||
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
||||
<li class="page-item <?= $i === $page ? 'active' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $i ?>"><?= $i ?></a>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
<li class="page-item <?= $page >= $totalPages ? 'disabled' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $page + 1 ?>">Next</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -89,16 +89,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { validate_csrf_token();
|
||||
}
|
||||
}
|
||||
|
||||
$faqs = db()->query("SELECT * FROM faqs ORDER BY sort_order ASC, id DESC")->fetchAll();
|
||||
// Pagination
|
||||
$page = max(1, (int)($_GET['page'] ?? 1));
|
||||
$limit = 20;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
$total = (int)db()->query("SELECT COUNT(*) FROM faqs")->fetchColumn();
|
||||
$totalPages = (int)ceil($total / $limit);
|
||||
|
||||
$faqs = db()->query("SELECT * FROM faqs ORDER BY sort_order ASC, id DESC LIMIT $limit OFFSET $offset")->fetchAll();
|
||||
|
||||
$editingFaq = null;
|
||||
if ($editFaqId > 0) {
|
||||
foreach ($faqs as $faq) {
|
||||
if ((int)$faq['id'] === $editFaqId) {
|
||||
$editingFaq = $faq;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Fetch specifically if editing
|
||||
$stmt = db()->prepare("SELECT * FROM faqs WHERE id = ?");
|
||||
$stmt->execute([$editFaqId]);
|
||||
$editingFaq = $stmt->fetch();
|
||||
}
|
||||
|
||||
render_header('Manage FAQs', 'admin', true);
|
||||
@ -247,6 +253,25 @@ render_header('Manage FAQs', 'admin', true);
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php if ($totalPages > 1): ?>
|
||||
<div class="px-4 py-3 border-top d-flex justify-content-between align-items-center">
|
||||
<span class="text-muted small">Showing <?= count($faqs) ?> of <?= $total ?> FAQs</span>
|
||||
<ul class="pagination pagination-sm mb-0">
|
||||
<li class="page-item <?= $page <= 1 ? 'disabled' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $page - 1 ?>">Previous</a>
|
||||
</li>
|
||||
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
||||
<li class="page-item <?= $i === $page ? 'active' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $i ?>"><?= $i ?></a>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
<li class="page-item <?= $page >= $totalPages ? 'disabled' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $page + 1 ?>">Next</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -149,7 +149,14 @@ if ($action === 'edit' && $id > 0) {
|
||||
}
|
||||
|
||||
// List View
|
||||
$stmt = db()->query("SELECT * FROM notification_templates ORDER BY event_name ASC");
|
||||
$page = max(1, (int)($_GET['page'] ?? 1));
|
||||
$limit = 20;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
$total = (int)db()->query("SELECT COUNT(*) FROM notification_templates")->fetchColumn();
|
||||
$totalPages = (int)ceil($total / $limit);
|
||||
|
||||
$stmt = db()->query("SELECT * FROM notification_templates ORDER BY event_name ASC LIMIT $limit OFFSET $offset");
|
||||
$templates = $stmt->fetchAll();
|
||||
|
||||
render_header(t('notification_templates'), 'admin', true);
|
||||
@ -195,6 +202,25 @@ render_header(t('notification_templates'), 'admin', true);
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php if ($totalPages > 1): ?>
|
||||
<div class="px-4 py-3 border-top d-flex justify-content-between align-items-center">
|
||||
<span class="text-muted small"><?= e(t('shown')) ?> <?= count($templates) ?> of <?= $total ?> templates</span>
|
||||
<ul class="pagination pagination-sm mb-0">
|
||||
<li class="page-item <?= $page <= 1 ? 'disabled' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $page - 1 ?>">Previous</a>
|
||||
</li>
|
||||
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
||||
<li class="page-item <?= $i === $page ? 'active' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $i ?>"><?= $i ?></a>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
<li class="page-item <?= $page >= $totalPages ? 'disabled' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $page + 1 ?>">Next</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -110,8 +110,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { validate_csrf_token();
|
||||
}
|
||||
}
|
||||
|
||||
// Pagination
|
||||
$page = max(1, (int)($_GET['page'] ?? 1));
|
||||
$limit = 20;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
$total = (int)$pdo->query("SELECT COUNT(*) FROM users WHERE role = 'admin'")->fetchColumn();
|
||||
$totalPages = (int)ceil($total / $limit);
|
||||
|
||||
// Fetch Users
|
||||
$stmtUsers = $pdo->query("SELECT id, email, full_name, created_at FROM users WHERE role = 'admin' ORDER BY created_at DESC");
|
||||
$stmtUsers = $pdo->query("SELECT id, email, full_name, created_at FROM users WHERE role = 'admin' ORDER BY created_at DESC LIMIT $limit OFFSET $offset");
|
||||
$users = $stmtUsers->fetchAll();
|
||||
|
||||
// Fetch Permissions
|
||||
@ -181,6 +189,25 @@ render_header(t('nav_platform_users'), 'platform_users', true);
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php if ($totalPages > 1): ?>
|
||||
<div class="px-4 py-3 border-top d-flex justify-content-between align-items-center">
|
||||
<span class="text-muted small"><?= e(t('shown')) ?> <?= count($users) ?> of <?= $total ?> users</span>
|
||||
<ul class="pagination pagination-sm mb-0">
|
||||
<li class="page-item <?= $page <= 1 ? 'disabled' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $page - 1 ?>">Previous</a>
|
||||
</li>
|
||||
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
||||
<li class="page-item <?= $i === $page ? 'active' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $i ?>"><?= $i ?></a>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
<li class="page-item <?= $page >= $totalPages ? 'disabled' : '' ?>">
|
||||
<a class="page-link" href="?page=<?= $page + 1 ?>">Next</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
1
uploads/trucks/reg_69c222f680ca5.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/reg_69c222f68d477.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/reg_69c222f68f3ca.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/reg_69c222f690c1c.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/reg_69c222f691903.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/reg_69c222f69343f.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/reg_69c222f697e5d.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/reg_69c222f6996d8.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/reg_69c222f69a0ab.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/reg_69c222f69b3a3.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/truck_69c222f680ca4.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/truck_69c222f68d475.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/truck_69c222f68f3c8.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/truck_69c222f690c1b.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/truck_69c222f691901.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/truck_69c222f69343d.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/truck_69c222f697e5b.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/truck_69c222f6996d7.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/truck_69c222f69a0a9.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |
1
uploads/trucks/truck_69c222f69b3a2.jpg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?><svg width='400' height='300' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='#ddd'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='24' fill='#555'>Sample Document</text></svg>
|
||||
|
After Width: | Height: | Size: 300 B |