109 lines
4.9 KiB
PHP
109 lines
4.9 KiB
PHP
<?php
|
|
require_once __DIR__ . '/app.php';
|
|
|
|
function render_header(string $title, string $active = ''): void
|
|
{
|
|
global $lang, $dir;
|
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
|
$toggleLang = $lang === 'ar' ? 'en' : 'ar';
|
|
$toggleLabel = $lang === 'ar' ? 'EN' : 'AR';
|
|
?>
|
|
<!doctype html>
|
|
<html lang="<?= e($lang) ?>" dir="<?= e($dir) ?>">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title><?= e($title) ?></title>
|
|
<?php if ($projectDescription): ?>
|
|
<meta name="description" content="<?= e($projectDescription) ?>" />
|
|
<meta property="og:description" content="<?= e($projectDescription) ?>" />
|
|
<meta property="twitter:description" content="<?= e($projectDescription) ?>" />
|
|
<?php endif; ?>
|
|
<?php if ($projectImageUrl): ?>
|
|
<meta property="og:image" content="<?= e($projectImageUrl) ?>" />
|
|
<meta property="twitter:image" content="<?= e($projectImageUrl) ?>" />
|
|
<?php endif; ?>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="/assets/css/custom.css?v=<?= time() ?>">
|
|
</head>
|
|
<body class="app-body">
|
|
<nav class="navbar navbar-expand-lg navbar-light bg-white border-bottom sticky-top">
|
|
<div class="container">
|
|
<a class="navbar-brand fw-semibold" href="<?= e(url_with_lang('index.php')) ?>">
|
|
<?= e(t('app_name')) ?>
|
|
</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNav">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="mainNav">
|
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
|
<li class="nav-item">
|
|
<a class="nav-link <?= $active === 'home' ? 'active' : '' ?>" href="<?= e(url_with_lang('index.php')) ?>">
|
|
<?= e(t('nav_home')) ?>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link <?= $active === 'shipper' ? 'active' : '' ?>" href="<?= e(url_with_lang('shipper_dashboard.php')) ?>">
|
|
<?= e(t('nav_shipper')) ?>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link <?= $active === 'owner' ? 'active' : '' ?>" href="<?= e(url_with_lang('truck_owner_dashboard.php')) ?>">
|
|
<?= e(t('nav_owner')) ?>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link <?= $active === 'admin' ? 'active' : '' ?>" href="<?= e(url_with_lang('admin_dashboard.php')) ?>">
|
|
<?= e(t('nav_admin')) ?>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
<a class="btn btn-sm btn-outline-dark" href="<?= e(current_url_with_lang($toggleLang)) ?>">
|
|
<?= e($toggleLabel) ?>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<main class="container py-4">
|
|
<?php
|
|
}
|
|
|
|
function render_footer(): void
|
|
{
|
|
?>
|
|
</main>
|
|
<footer class="border-top py-3">
|
|
<div class="container d-flex flex-column flex-md-row justify-content-between align-items-center small text-muted">
|
|
<span><?= e(t('footer_note')) ?></span>
|
|
<span><?= e(date('Y-m-d H:i')) ?> UTC</span>
|
|
</div>
|
|
</footer>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="/assets/js/main.js?v=<?= time() ?>"></script>
|
|
</body>
|
|
</html>
|
|
<?php
|
|
}
|
|
|
|
function render_admin_sidebar(string $active = 'dashboard'): void
|
|
{
|
|
$items = [
|
|
'dashboard' => ['label' => 'Dashboard', 'href' => url_with_lang('admin_dashboard.php')],
|
|
'locations' => ['label' => 'Locations', 'href' => url_with_lang('admin_manage_locations.php')],
|
|
'register' => ['label' => 'User Registration', 'href' => url_with_lang('register.php')],
|
|
];
|
|
?>
|
|
<aside class="admin-sidebar panel p-3">
|
|
<h2 class="h6 mb-3">Admin Panel</h2>
|
|
<nav class="nav flex-column gap-1">
|
|
<?php foreach ($items as $key => $item): ?>
|
|
<a class="admin-nav-link <?= $active === $key ? 'active' : '' ?>" href="<?= e($item['href']) ?>">
|
|
<?= e($item['label']) ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</nav>
|
|
</aside>
|
|
<?php
|
|
}
|