64 lines
3.9 KiB
PHP
64 lines
3.9 KiB
PHP
<?php
|
|
$flashSuccess = flash($session, 'success');
|
|
$flashError = flash($session, 'error');
|
|
$authState = $authState ?? $session->get('auth');
|
|
$tenant = $tenant ?? null;
|
|
$currentPath = current_path();
|
|
$tenantSlug = is_array($tenant) && isset($tenant['slug']) ? (string) $tenant['slug'] : '';
|
|
$tenantRole = is_array($authState) ? (string) ($authState['tenant_role'] ?? '') : '';
|
|
$hasTenantAccess = $tenantSlug !== ''
|
|
&& is_array($authState)
|
|
&& (($authState['tenant_slug'] ?? null) === $tenantSlug);
|
|
$isTenantAdmin = in_array($tenantRole, ['owner', 'admin'], true);
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title><?= e($title ?? $config['name']) ?></title>
|
|
<link rel="stylesheet" href="<?= e(asset_url('app.css')) ?>">
|
|
</head>
|
|
<body class="<?= e($pageClass ?? 'app-shell') ?>">
|
|
<div class="page-backdrop"></div>
|
|
<header class="site-header">
|
|
<div class="shell header-inner">
|
|
<a class="brand" href="<?= e(url('/')) ?>">
|
|
<span class="brand-mark">KK</span>
|
|
<span>
|
|
<strong><?= e($config['name']) ?></strong>
|
|
<small>Mandantenfaehige Kaffeekasse</small>
|
|
</span>
|
|
</a>
|
|
<nav class="top-nav">
|
|
<?php if ($hasTenantAccess): ?>
|
|
<a href="<?= e(tenant_url($tenantSlug)) ?>" class="<?= $currentPath === tenant_path($tenantSlug) ? 'active' : '' ?>">Uebersicht</a>
|
|
<a href="<?= e(tenant_url($tenantSlug, 'bookings')) ?>" class="<?= $currentPath === tenant_path($tenantSlug, 'bookings') ? 'active' : '' ?>">Buchen</a>
|
|
<?php if ($isTenantAdmin): ?>
|
|
<a href="<?= e(tenant_url($tenantSlug, 'members')) ?>" class="<?= $currentPath === tenant_path($tenantSlug, 'members') ? 'active' : '' ?>">Mitglieder</a>
|
|
<a href="<?= e(tenant_url($tenantSlug, 'products')) ?>" class="<?= $currentPath === tenant_path($tenantSlug, 'products') ? 'active' : '' ?>">Produkte</a>
|
|
<a href="<?= e(tenant_url($tenantSlug, 'payments')) ?>" class="<?= $currentPath === tenant_path($tenantSlug, 'payments') ? 'active' : '' ?>">Einzahlungen</a>
|
|
<a href="<?= e(tenant_url($tenantSlug, 'paper-sheets')) ?>" class="<?= $currentPath === tenant_path($tenantSlug, 'paper-sheets') ? 'active' : '' ?>">Papierlisten</a>
|
|
<a href="<?= e(tenant_url($tenantSlug, 'rfid')) ?>" class="<?= $currentPath === tenant_path($tenantSlug, 'rfid') ? 'active' : '' ?>">RFID</a>
|
|
<?php endif; ?>
|
|
<?php elseif ($tenantSlug !== ''): ?>
|
|
<a href="<?= e(url('/')) ?>" class="<?= $currentPath === '/' ? 'active' : '' ?>">Start</a>
|
|
<a href="<?= e(url('/register')) ?>" class="<?= $currentPath === '/register' ? 'active' : '' ?>">Pilot registrieren</a>
|
|
<a href="<?= e(tenant_url($tenantSlug, 'login')) ?>" class="<?= $currentPath === tenant_path($tenantSlug, 'login') ? 'active' : '' ?>">Standort-Login</a>
|
|
<a href="<?= e(url('/admin/login')) ?>" class="<?= str_starts_with($currentPath, '/admin') ? 'active' : '' ?>">Plattform</a>
|
|
<?php else: ?>
|
|
<a href="<?= e(url('/')) ?>" class="<?= $currentPath === '/' ? 'active' : '' ?>">Start</a>
|
|
<a href="<?= e(url('/register')) ?>" class="<?= $currentPath === '/register' ? 'active' : '' ?>">Pilot registrieren</a>
|
|
<a href="<?= e(url('/admin/login')) ?>" class="<?= str_starts_with($currentPath, '/admin') ? 'active' : '' ?>">Plattform</a>
|
|
<?php endif; ?>
|
|
</nav>
|
|
</div>
|
|
</header>
|
|
<main class="shell main-shell">
|
|
<?php if ($flashSuccess): ?>
|
|
<div class="flash flash-success"><?= e((string) $flashSuccess) ?></div>
|
|
<?php endif; ?>
|
|
<?php if ($flashError): ?>
|
|
<div class="flash flash-error"><?= e((string) $flashError) ?></div>
|
|
<?php endif; ?>
|