39094-vm/includes/layout.php
Flatlogic Bot f6d1ea8ef2 test
2026-03-10 15:19:21 +00:00

83 lines
3.1 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/app.php';
function render_header(string $title, string $pageDescription = ''): void
{
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
$description = $pageDescription !== '' ? $pageDescription : $projectDescription;
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><?= h($title) ?></title>
<?php if ($description): ?>
<meta name="description" content="<?= h($description) ?>" />
<meta property="og:description" content="<?= h($description) ?>" />
<meta property="twitter:description" content="<?= h($description) ?>" />
<?php endif; ?>
<?php if ($projectImageUrl): ?>
<meta property="og:image" content="<?= h($projectImageUrl) ?>" />
<meta property="twitter:image" content="<?= h($projectImageUrl) ?>" />
<?php endif; ?>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<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>
<div class="app-shell">
<header class="app-header border-bottom">
<div class="container-fluid px-4 py-3 d-flex align-items-center justify-content-between">
<div>
<p class="text-uppercase small text-muted mb-1">Store Ops</p>
<h1 class="h5 mb-0"><?= h($title) ?></h1>
</div>
<nav class="d-flex gap-3 align-items-center">
<a class="nav-link px-0" href="/index.php">Overview</a>
<a class="nav-link px-0" href="/stores.php">Stores</a>
<a class="nav-link px-0" href="/products.php">Products</a>
<a class="nav-link px-0 text-muted" href="#" aria-disabled="true">Orders</a>
</nav>
</div>
</header>
<main class="container-fluid px-4 py-4">
<?php
$flash = flash_get();
if ($flash) {
$type = $flash['type'] === 'error' ? 'danger' : $flash['type'];
?>
<div class="toast-container position-fixed top-0 end-0 p-3">
<div class="toast text-bg-<?= h($type) ?> border-0" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body"><?= h($flash['message']) ?></div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
</div>
<?php
}
}
function render_footer(): void
{
?>
</main>
<footer class="border-top py-3">
<div class="container-fluid px-4 d-flex flex-wrap justify-content-between text-muted small">
<span>UTC <?= h(date('Y-m-d H:i')) ?></span>
<span>Multi-store operations workspace</span>
</div>
</footer>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" defer></script>
<script src="/assets/js/main.js?v=<?= time() ?>" defer></script>
</body>
</html>
<?php
}