baseline
This commit is contained in:
BIN
templates/partials/.DS_Store
vendored
Normal file
BIN
templates/partials/.DS_Store
vendored
Normal file
Binary file not shown.
69
templates/partials/app-aside-icon-bar.phtml
Normal file
69
templates/partials/app-aside-icon-bar.phtml
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
$accountUrl = accountUrl();
|
||||
$user = $_SESSION['user'] ?? [];
|
||||
$accountName = trim((string) (($user['first_name'] ?? '') . ' ' . ($user['last_name'] ?? '')));
|
||||
if ($accountName === '') {
|
||||
$accountName = trim((string) ($user['email'] ?? ''));
|
||||
}
|
||||
$accountTooltip = $accountName !== '' ? $accountName : t('Account');
|
||||
$hasAdminPanel = can('tenants.view') || can('departments.view') || can('users.view')
|
||||
|| can('roles.view') || can('permissions.view') || can('settings.view')
|
||||
|| can('mail_log.view') || can('stats.view');
|
||||
$canViewAddressBook = can('address_book.view');
|
||||
$addressBookUrl = lurl('address-book');
|
||||
?>
|
||||
<aside class="aside-icon-bar" data-aside-storage="app-sidebar-panel">
|
||||
<nav>
|
||||
<ul class="aside-icon-group" role="tablist">
|
||||
<li>
|
||||
<button type="button" id="aside-tab-explorer" data-aside-target="explorer" role="tab"
|
||||
aria-selected="true" aria-controls="aside-panel-explorer" aria-label="<?php e(t('Explorer')); ?>"
|
||||
data-tooltip="<?php e(t('Explorer')); ?>" data-tooltip-pos="right">
|
||||
<i class="bi bi-house"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button type="button" id="aside-tab-search" data-aside-target="search" role="tab" aria-selected="false"
|
||||
aria-controls="aside-panel-search" aria-label="<?php e(t('Search')); ?>"
|
||||
data-tooltip="<?php e(t('Search')); ?>" data-tooltip-pos="right">
|
||||
<i class="bi bi-search"></i>
|
||||
</button>
|
||||
</li>
|
||||
<?php if ($canViewAddressBook): ?>
|
||||
<li>
|
||||
<button type="button" id="aside-tab-people" data-aside-target="people"
|
||||
data-aside-href="<?php e($addressBookUrl); ?>" role="tab" aria-selected="false"
|
||||
aria-controls="aside-panel-people" aria-label="<?php e(t('Address book')); ?>"
|
||||
data-tooltip="<?php e(t('Address book')); ?>" data-tooltip-pos="right">
|
||||
<i class="bi bi-people"></i>
|
||||
</button>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<li>
|
||||
<button type="button" id="aside-tab-files" data-aside-target="files" role="tab" aria-selected="false"
|
||||
aria-controls="aside-panel-files" aria-label="<?php e(t('Files')); ?>"
|
||||
data-tooltip="<?php e(t('Files')); ?>" data-tooltip-pos="right">
|
||||
<i class="bi bi-folder"></i>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<?php if ($hasAdminPanel ?? true): ?>
|
||||
<li>
|
||||
<button type="button" id="aside-tab-admin" data-aside-target="admin" role="tab" aria-selected="false"
|
||||
aria-controls="aside-panel-admin" aria-label="<?php e(t('Admin')); ?>"
|
||||
data-tooltip="<?php e(t('Admin')); ?>" data-tooltip-pos="right">
|
||||
<i class="bi bi-shield-lock"></i>
|
||||
</button>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<li>
|
||||
<a href="<?php e($accountUrl); ?>" aria-label="<?php e(t('Account')); ?>"
|
||||
data-tooltip="<?php e($accountTooltip); ?>" data-tooltip-pos="right"><i
|
||||
class="bi bi-person-circle"></i></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
399
templates/partials/app-aside.phtml
Normal file
399
templates/partials/app-aside.phtml
Normal file
@@ -0,0 +1,399 @@
|
||||
<?php
|
||||
|
||||
use MintyPHP\Service\TenantAvatarService;
|
||||
|
||||
$canViewTenants = can('tenants.view');
|
||||
$canViewDepartments = can('departments.view');
|
||||
$canViewUsers = can('users.view');
|
||||
$canViewRoles = can('roles.view');
|
||||
$canViewPermissions = can('permissions.view');
|
||||
$canViewSettings = can('settings.view');
|
||||
$canViewMailLog = can('mail_log.view');
|
||||
$canViewStats = can('stats.view');
|
||||
$canViewAddressBook = can('address_book.view');
|
||||
$hasOrganization = $canViewTenants || $canViewDepartments || $canViewUsers;
|
||||
$hasUsersSection = $canViewRoles || $canViewPermissions || $canViewSettings;
|
||||
$hasSystemSection = $canViewStats || $canViewMailLog || $canViewSettings;
|
||||
$hasAdminPanel = $hasOrganization || $hasUsersSection || $hasSystemSection;
|
||||
|
||||
// Declarative nav config for admin panel
|
||||
$navSections = [
|
||||
[
|
||||
'label' => '',
|
||||
'visible' => $hasOrganization,
|
||||
'items' => [
|
||||
[
|
||||
'label' => t('Tenants'),
|
||||
'path' => 'admin/tenants',
|
||||
'active' => navActive('admin/tenants', true),
|
||||
'visible' => $canViewTenants,
|
||||
'withTenant' => false,
|
||||
],
|
||||
[
|
||||
'label' => t('Departments'),
|
||||
'path' => 'admin/departments',
|
||||
'active' => navActive('admin/departments', true),
|
||||
'visible' => $canViewDepartments,
|
||||
'withTenant' => true,
|
||||
],
|
||||
[
|
||||
'label' => t('Users'),
|
||||
'path' => 'admin/users',
|
||||
'active' => navActive('admin/users', true),
|
||||
'visible' => $canViewUsers,
|
||||
'withTenant' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => t('Roles & permissions'),
|
||||
'visible' => $hasUsersSection,
|
||||
'items' => [
|
||||
[
|
||||
'label' => t('Roles'),
|
||||
'path' => 'admin/roles',
|
||||
'active' => navActive('admin/roles', true),
|
||||
'visible' => $canViewRoles,
|
||||
'withTenant' => false,
|
||||
],
|
||||
[
|
||||
'label' => t('Permissions'),
|
||||
'path' => 'admin/permissions',
|
||||
'active' => navActive('admin/permissions', true),
|
||||
'visible' => $canViewPermissions,
|
||||
'withTenant' => false,
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => t('System'),
|
||||
'visible' => $hasSystemSection,
|
||||
'items' => [
|
||||
[
|
||||
'label' => t('Statistics'),
|
||||
'path' => 'admin/stats',
|
||||
'active' => navActive('admin/stats', true),
|
||||
'visible' => $canViewStats,
|
||||
'withTenant' => false,
|
||||
],
|
||||
[
|
||||
'label' => t('Mail logs'),
|
||||
'path' => 'admin/mail-log',
|
||||
'active' => navActive('admin/mail-log', true),
|
||||
'visible' => $canViewMailLog,
|
||||
'withTenant' => false,
|
||||
],
|
||||
[
|
||||
'label' => t('Settings'),
|
||||
'path' => 'admin/settings',
|
||||
'active' => navActive('admin/settings', true),
|
||||
'visible' => $canViewSettings,
|
||||
'withTenant' => false,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// Render helper for admin sections
|
||||
$renderNavSection = static function (array $section, string $tenantQueryParam): void {
|
||||
if (empty($section['visible'])) {
|
||||
return;
|
||||
}
|
||||
$items = $section['items'] ?? [];
|
||||
$items = array_values(array_filter($items, static fn ($item) => !empty($item['visible'])));
|
||||
if (!$items) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<?php if (!empty($section['label'])): ?>
|
||||
<small><?php e($section['label']); ?></small>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($items as $item): ?>
|
||||
<?php
|
||||
$href = $item['path'] ?? '';
|
||||
if ($href !== '' && !empty($item['withTenant'])) {
|
||||
$href .= $tenantQueryParam;
|
||||
}
|
||||
$active = $item['active'] ?? ['class' => '', 'aria' => ''];
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php e($href); ?>" class="<?php e($active['class'] ?? ''); ?>" <?php echo $active['aria'] ?? ''; ?>>
|
||||
<?php e($item['label'] ?? ''); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php
|
||||
};
|
||||
|
||||
// Load tenant context from session (no DB calls allowed in templates)
|
||||
$currentTenant = $_SESSION['current_tenant'] ?? null;
|
||||
$currentTenantId = $currentTenant['id'] ?? null;
|
||||
$availableTenants = $_SESSION['available_tenants'] ?? [];
|
||||
|
||||
// Add tenant filter to links when user has multiple tenants
|
||||
$tenantQueryParam = '';
|
||||
if (count($availableTenants) > 1 && !empty($currentTenant['uuid'])) {
|
||||
$tenantQueryParam = '?tenant=' . urlencode($currentTenant['uuid']);
|
||||
}
|
||||
|
||||
// Tenant logo display (without switcher - switcher is now in topbar)
|
||||
$tenantUuid = $currentTenant['uuid'] ?? '';
|
||||
$tenantName = $currentTenant['description'] ?? '';
|
||||
$hasTenantAvatar = $tenantUuid && TenantAvatarService::hasAvatar($tenantUuid);
|
||||
$addressBookUrl = lurl('address-book');
|
||||
$activeAddressTenants = array_filter(array_map('trim', explode(',', (string) ($_GET['tenants'] ?? ''))));
|
||||
$activeAddressDepartments = array_filter(array_map('intval', explode(',', (string) ($_GET['departments'] ?? ''))));
|
||||
$peopleGroups = $_SESSION['available_departments_by_tenant'] ?? [];
|
||||
?>
|
||||
<aside class="app-sidebar" id="app-sidebar">
|
||||
<?php if ($currentTenant): ?>
|
||||
<div class="app-sidebar-tenant-logo">
|
||||
<a href="/">
|
||||
<?php if ($hasTenantAvatar): ?>
|
||||
<img src="admin/tenants/avatar-file?uuid=<?php e($tenantUuid); ?>&size=128" alt="<?php e($tenantName); ?>"
|
||||
title="<?php e($tenantName); ?>">
|
||||
<?php else: ?>
|
||||
<div class="app-sidebar-tenant-name">
|
||||
<i class="bi bi-buildings"></i> <?php e($tenantName); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="app-sidebar-titlebar">
|
||||
<div class="app-sidebar-title" data-aside-title-default="<?php e(t('Explorer')); ?>">
|
||||
<?php e(t('Explorer')); ?>
|
||||
</div>
|
||||
<div class="app-sidebar-tools" data-aside-tools></div>
|
||||
</div>
|
||||
<div id="app-sidebar-panels" class="app-sidebar-panels">
|
||||
<nav id="aside-panel-explorer" class="app-sidebar-panel" data-aside-panel="explorer"
|
||||
data-aside-title="<?php e(t('Explorer')); ?>" role="tabpanel" aria-labelledby="aside-tab-explorer"
|
||||
aria-label="<?php e(t('Primary navigation')); ?>">
|
||||
<ul>
|
||||
<li>
|
||||
<?php $home = navActive(['', 'admin'], false); ?>
|
||||
<a href="<?php e(lurl('')); ?>" class="<?php e($home['class']); ?>" <?php echo $home['aria']; ?>>
|
||||
<?php e(t('Home')); ?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="app-sidebar-panel-tools" data-aside-panel-tools hidden>
|
||||
<!-- <button type="button" class="icon-button" aria-label="<?php e(t('Add')); ?>">
|
||||
<i class="bi bi-plus-lg"></i>
|
||||
</button> -->
|
||||
</div>
|
||||
</nav>
|
||||
<?php if ($hasAdminPanel): ?>
|
||||
<nav id="aside-panel-admin" class="app-sidebar-panel" data-aside-panel="admin"
|
||||
data-aside-title="<?php e(t('Admin')); ?>" role="tabpanel" aria-labelledby="aside-tab-admin" hidden>
|
||||
<ul>
|
||||
<?php foreach ($navSections as $section): ?>
|
||||
<?php $renderNavSection($section, $tenantQueryParam); ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<div class="app-sidebar-panel-tools" data-aside-panel-tools hidden></div>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($canViewAddressBook): ?>
|
||||
<?php $addressBookActive = navActive('address-book', true); ?>
|
||||
<nav id="aside-panel-people" class="app-sidebar-panel" data-aside-panel="people"
|
||||
data-aside-details-storage="aside-people-tenant"
|
||||
data-aside-title="<?php e(t('Address book')); ?>" role="tabpanel" aria-labelledby="aside-tab-people" hidden>
|
||||
<ul>
|
||||
<?php if (!$peopleGroups): ?>
|
||||
<li>
|
||||
<a href="<?php e($addressBookUrl); ?>" class="<?php e($addressBookActive['class'] ?? ''); ?>"
|
||||
<?php echo $addressBookActive['aria'] ?? ''; ?>>
|
||||
<?php e(t('Address book')); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<?php
|
||||
$allPeopleActive = $addressBookActive['isActive'] && !$activeAddressTenants && !$activeAddressDepartments;
|
||||
?>
|
||||
<?php foreach ($peopleGroups as $index => $group): ?>
|
||||
<?php
|
||||
$tenant = $group['tenant'] ?? [];
|
||||
$departments = $group['departments'] ?? [];
|
||||
$tenantUuid = (string) ($tenant['uuid'] ?? '');
|
||||
$tenantName = (string) ($tenant['description'] ?? '');
|
||||
if ($tenantUuid === '') {
|
||||
continue;
|
||||
}
|
||||
$baseHref = $addressBookUrl . '?tenants=' . urlencode($tenantUuid);
|
||||
$isActiveTenant = $addressBookActive['isActive']
|
||||
&& !$activeAddressDepartments
|
||||
&& count($activeAddressTenants) === 1
|
||||
&& $activeAddressTenants[0] === $tenantUuid;
|
||||
?>
|
||||
<li class="app-sidebar-group">
|
||||
<details data-details-key="<?php e($tenantUuid); ?>" <?php echo $index === 0 ? 'open' : ''; ?>>
|
||||
<summary>
|
||||
<span>
|
||||
<?php e($tenantName); ?>
|
||||
</span>
|
||||
</summary>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="<?php e($baseHref); ?>" class="<?php e($isActiveTenant ? 'active' : ''); ?>"
|
||||
<?php echo $isActiveTenant ? 'aria-current="page"' : ''; ?>>
|
||||
<small><?php e(t('All people')); ?></small>
|
||||
</a>
|
||||
</li>
|
||||
<?php foreach ($departments as $department): ?>
|
||||
<?php
|
||||
$departmentId = (int) ($department['id'] ?? 0);
|
||||
if ($departmentId <= 0) {
|
||||
continue;
|
||||
}
|
||||
$departmentName = (string) ($department['description'] ?? '');
|
||||
$href = $baseHref . '&departments=' . $departmentId;
|
||||
$isActive = $addressBookActive['isActive']
|
||||
&& in_array($tenantUuid, $activeAddressTenants, true)
|
||||
&& in_array($departmentId, $activeAddressDepartments, true);
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php e($href); ?>" class="<?php e($isActive ? 'active' : ''); ?>"
|
||||
<?php echo $isActive ? 'aria-current="page"' : ''; ?>>
|
||||
<small>
|
||||
<?php e($departmentName); ?>
|
||||
</small>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</details>
|
||||
<hr>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<div class="app-sidebar-panel-tools" data-aside-panel-tools hidden></div>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="aside-panel-search" class="app-sidebar-panel" data-aside-panel="search"
|
||||
data-aside-title="<?php e(t('Search')); ?>" role="tabpanel" aria-labelledby="aside-tab-search" hidden>
|
||||
<form class="app-search">
|
||||
<input type="search" name="side-search" id="side-search" placeholder="<?php e(t('Search...')); ?>"
|
||||
aria-label="<?php e(t('Search')); ?>">
|
||||
</form>
|
||||
<nav id="global-search">
|
||||
<ul class="app-search-results" data-global-search-results>
|
||||
<?php if (can('users.view')): ?>
|
||||
<?php $usersSearch = navActive('admin/users', true); ?>
|
||||
<li data-search-key="users" data-search-base="<?php e(lurl('admin/users')); ?>">
|
||||
<a href="<?php e(lurl('admin/users')); ?>" class="<?php e($usersSearch['class']); ?>" <?php echo $usersSearch['aria']; ?>>
|
||||
<span><?php e(t('Users')); ?></span>
|
||||
<span class="badge" data-search-count>0</span>
|
||||
</a>
|
||||
<ul class="app-search-preview" data-search-preview></ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($canViewAddressBook): ?>
|
||||
<?php $addressBookSearch = navActive('address-book', true); ?>
|
||||
<li data-search-key="address-book" data-search-base="<?php e(lurl('address-book')); ?>">
|
||||
<a href="<?php e(lurl('address-book')); ?>" class="<?php e($addressBookSearch['class'] ?? ''); ?>"
|
||||
<?php echo $addressBookSearch['aria'] ?? ''; ?>>
|
||||
<span><?php e(t('Address book')); ?></span>
|
||||
<span class="badge" data-search-count>0</span>
|
||||
</a>
|
||||
<ul class="app-search-preview" data-search-preview></ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (can('tenants.view')): ?>
|
||||
<?php $tenantsSearch = navActive('admin/tenants', true); ?>
|
||||
<li data-search-key="tenants" data-search-base="<?php e(lurl('admin/tenants')); ?>">
|
||||
<a href="<?php e(lurl('admin/tenants')); ?>" class="<?php e($tenantsSearch['class']); ?>" <?php echo $tenantsSearch['aria']; ?>>
|
||||
<span><?php e(t('Tenants')); ?></span>
|
||||
<span class="badge" data-search-count>0</span>
|
||||
</a>
|
||||
<ul class="app-search-preview" data-search-preview></ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (can('departments.view')): ?>
|
||||
<?php $departmentsSearch = navActive('admin/departments', true); ?>
|
||||
<li data-search-key="departments" data-search-base="<?php e(lurl('admin/departments')); ?>">
|
||||
<a href="<?php e(lurl('admin/departments')); ?>"
|
||||
class="<?php e($departmentsSearch['class']); ?>" <?php echo $departmentsSearch['aria']; ?>>
|
||||
<span><?php e(t('Departments')); ?></span>
|
||||
<span class="badge" data-search-count>0</span>
|
||||
</a>
|
||||
<ul class="app-search-preview" data-search-preview></ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (can('roles.view')): ?>
|
||||
<?php $rolesSearch = navActive('admin/roles', true); ?>
|
||||
<li data-search-key="roles" data-search-base="<?php e(lurl('admin/roles')); ?>">
|
||||
<a href="<?php e(lurl('admin/roles')); ?>" class="<?php e($rolesSearch['class']); ?>" <?php echo $rolesSearch['aria']; ?>>
|
||||
<span><?php e(t('Roles')); ?></span>
|
||||
<span class="badge" data-search-count>0</span>
|
||||
</a>
|
||||
<ul class="app-search-preview" data-search-preview></ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (can('permissions.view')): ?>
|
||||
<?php $permissionsSearch = navActive('admin/permissions', true); ?>
|
||||
<li data-search-key="permissions" data-search-base="<?php e(lurl('admin/permissions')); ?>">
|
||||
<a href="<?php e(lurl('admin/permissions')); ?>"
|
||||
class="<?php e($permissionsSearch['class']); ?>" <?php echo $permissionsSearch['aria']; ?>>
|
||||
<span><?php e(t('Permissions')); ?></span>
|
||||
<span class="badge" data-search-count>0</span>
|
||||
</a>
|
||||
<ul class="app-search-preview" data-search-preview></ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
$pagesSearch = navActivePublicPages();
|
||||
?>
|
||||
<li data-search-key="pages" data-search-base="<?php e(lurl('')); ?>">
|
||||
<a href="<?php e(lurl('')); ?>" class="<?php e($pagesSearch['class']); ?>" <?php echo $pagesSearch['aria']; ?>>
|
||||
<span><?php e(t('Pages')); ?></span>
|
||||
<span class="badge" data-search-count>0</span>
|
||||
</a>
|
||||
<ul class="app-search-preview" data-search-preview></ul>
|
||||
</li>
|
||||
<?php if (can('settings.view')): ?>
|
||||
<?php $settingsSearch = navActive('admin/settings', true); ?>
|
||||
<li data-search-key="settings" data-search-base="<?php e(lurl('admin/settings')); ?>">
|
||||
<a href="<?php e(lurl('admin/settings')); ?>" class="<?php e($settingsSearch['class']); ?>"
|
||||
<?php echo $settingsSearch['aria']; ?>>
|
||||
<span><?php e(t('Settings')); ?></span>
|
||||
<span class="badge" data-search-count>0</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="app-sidebar-panel-tools" data-aside-panel-tools hidden>
|
||||
<button type="button" class="icon-button" data-tooltip="<?php e(t('Toggle search details')); ?>"
|
||||
data-tooltip-pos="bottom" aria-label="<?php e(t('Toggle search details')); ?>"
|
||||
data-search-details-toggle>
|
||||
<i class="bi bi-dash-square" data-search-details-icon></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<nav id="aside-panel-files" class="app-sidebar-panel" data-aside-panel="files"
|
||||
data-aside-title="<?php e(t('Files')); ?>" role="tabpanel" aria-labelledby="aside-tab-files" hidden>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="#"><?php e(t('All files')); ?></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"><?php e(t('My files')); ?></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"><?php e(t('Shared with me')); ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="app-sidebar-panel-tools" data-aside-panel-tools hidden>
|
||||
<button type="button" class="icon-button" aria-label="<?php e(t('New folder')); ?>">
|
||||
<i class="bi bi-folder-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</aside>
|
||||
34
templates/partials/app-flash.phtml
Normal file
34
templates/partials/app-flash.phtml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use MintyPHP\Support\Flash;
|
||||
use MintyPHP\Http\Request;
|
||||
use MintyPHP\Session;
|
||||
|
||||
$messages = Flash::peek(Request::path());
|
||||
if (!$messages) {
|
||||
return;
|
||||
}
|
||||
|
||||
$returnTarget = Request::pathWithQuery();
|
||||
$timeouts = [
|
||||
'success' => 5000,
|
||||
'info' => 6000,
|
||||
'warning' => 7000,
|
||||
'error' => 0,
|
||||
];
|
||||
|
||||
?>
|
||||
<div class="flash-stack">
|
||||
<?php foreach ($messages as $message) : ?>
|
||||
<?php $type = $message['type'] ?? 'info'; ?>
|
||||
<?php $timeout = $timeouts[$type] ?? 5000; ?>
|
||||
<div class="notice" data-variant="<?php e($type); ?>" data-flash-timeout="<?php e($timeout); ?>">
|
||||
<?php e(t($message['message'] ?? '')); ?>
|
||||
<form method="post" action="flash/dismiss/<?php e($message['id'] ?? ''); ?>">
|
||||
<input type="hidden" name="return" value="<?php e($returnTarget); ?>">
|
||||
<button type="submit" class="contrast outline small"><i class="bi bi-x"></i></button>
|
||||
<?php Session::getCsrfInput(); ?>
|
||||
</form>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
24
templates/partials/app-footer.phtml
Normal file
24
templates/partials/app-footer.phtml
Normal file
@@ -0,0 +1,24 @@
|
||||
<footer class="site-footer">
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/">
|
||||
<span class="muted">©
|
||||
<?php e(date('Y')); ?> IMVS
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li><a href="imprint">Impressum</a></li>
|
||||
<li><a href="privacy">Datenschutz</a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>
|
||||
<?php
|
||||
$variant = 'select';
|
||||
require __DIR__ . '/app-language-switcher.phtml';
|
||||
unset($variant);
|
||||
?>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</footer>
|
||||
66
templates/partials/app-language-switcher.phtml
Normal file
66
templates/partials/app-language-switcher.phtml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
use MintyPHP\I18n;
|
||||
use MintyPHP\Http\Request;
|
||||
|
||||
$locales = defined('APP_LOCALES') ? APP_LOCALES : [I18n::$defaultLocale];
|
||||
$returnTarget = Request::pathWithQuery();
|
||||
$variant = $variant ?? 'select';
|
||||
$baseUrl = lurl('lang');
|
||||
$isLoggedIn = !empty($_SESSION['user']['id']);
|
||||
$publicTarget = Request::stripLocale($returnTarget);
|
||||
$publicTarget = ltrim($publicTarget, '/');
|
||||
$base = \MintyPHP\Router::getBaseUrl();
|
||||
$base = rtrim($base, '/');
|
||||
$publicTarget = ltrim($publicTarget, '/');
|
||||
?>
|
||||
|
||||
<?php if ($variant === 'dropdown'): ?>
|
||||
<details class="dropdown">
|
||||
<summary>
|
||||
<i class="bi bi-translate"></i>
|
||||
</summary>
|
||||
<ul dir="rtl">
|
||||
<?php foreach ($locales as $locale): ?>
|
||||
<?php
|
||||
$isActive = $locale === I18n::$locale;
|
||||
$label = strtoupper((string) $locale);
|
||||
$publicUrl = $base . '/' . $locale . ($publicTarget !== '' ? '/' . $publicTarget : '');
|
||||
$switchUrl = $isLoggedIn
|
||||
? ($baseUrl . '?locale=' . $locale . '&return=' . urlencode($returnTarget))
|
||||
: $publicUrl;
|
||||
?>
|
||||
<li dir="ltr">
|
||||
<a href="<?php e($switchUrl); ?>"
|
||||
<?php if ($isActive) { ?>aria-current="true"<?php } ?>>
|
||||
<?php e($label); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</details>
|
||||
<?php else: ?>
|
||||
<?php if ($isLoggedIn): ?>
|
||||
<form class="nav nav--lang" method="get" action="<?php e($baseUrl); ?>" aria-label="Language switcher">
|
||||
<input type="hidden" name="return" value="<?php e($returnTarget); ?>">
|
||||
<select class="lang-select" name="locale" onchange="this.form.submit()">
|
||||
<?php foreach ($locales as $locale): ?>
|
||||
<option value="<?php e($locale); ?>" <?php if ($locale === I18n::$locale) { ?>selected<?php } ?>>
|
||||
<?php e(strtoupper((string) $locale)); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<div class="nav nav--lang" role="listbox" aria-label="Language switcher">
|
||||
<?php foreach ($locales as $locale): ?>
|
||||
<?php
|
||||
$publicUrl = $base . '/' . $locale . ($publicTarget !== '' ? '/' . $publicTarget : '');
|
||||
?>
|
||||
<a href="<?php e($publicUrl); ?>" class="lang-link"
|
||||
<?php if ($locale === I18n::$locale) { ?>aria-current="true"<?php } ?>>
|
||||
<?php e(strtoupper((string) $locale)); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
44
templates/partials/app-tile.phtml
Normal file
44
templates/partials/app-tile.phtml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var string $href
|
||||
* @var string $label
|
||||
* @var string|null $count
|
||||
* @var string|null $icon
|
||||
* @var string|null $iconBg
|
||||
* @var string|null $iconColor
|
||||
* @var string|null $class
|
||||
*/
|
||||
|
||||
$href = $href ?? '#';
|
||||
$label = $label ?? '';
|
||||
$count = $count ?? null;
|
||||
$icon = $icon ?? 'bi bi-grid-1x2';
|
||||
$iconBg = $iconBg ?? null;
|
||||
$iconColor = $iconColor ?? null;
|
||||
$class = $class ?? '';
|
||||
|
||||
$styleParts = [];
|
||||
if ($iconBg) {
|
||||
$styleParts[] = '--tile-icon-bg:' . $iconBg;
|
||||
}
|
||||
if ($iconColor) {
|
||||
$styleParts[] = '--tile-icon-color:' . $iconColor;
|
||||
}
|
||||
$style = $styleParts ? implode(';', $styleParts) . ';' : '';
|
||||
|
||||
?>
|
||||
<a class="app-tile<?php echo $class ? ' ' . $class : ''; ?>" href="<?php e($href); ?>" <?php if ($style) : ?>style="<?php e($style); ?>"<?php endif; ?>>
|
||||
<span class="app-tile-icon">
|
||||
<i class="<?php e($icon); ?>" aria-hidden="true"></i>
|
||||
</span>
|
||||
<?php if ($count !== null && $count !== '') : ?>
|
||||
<span class="app-tile-count"><?php e($count); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ($label !== '') : ?>
|
||||
<span class="app-tile-label"><?php e($label); ?></span>
|
||||
<?php endif; ?>
|
||||
<span class="app-tile-link" aria-hidden="true">
|
||||
<i class="bi bi-box-arrow-up-right"></i>
|
||||
</span>
|
||||
</a>
|
||||
106
templates/partials/app-topbar.phtml
Normal file
106
templates/partials/app-topbar.phtml
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
use MintyPHP\Session;
|
||||
|
||||
$user = $_SESSION['user'] ?? [];
|
||||
$accountUrl = accountUrl();
|
||||
$theme = 'light';
|
||||
$userTheme = strtolower(trim((string) ($user['theme'] ?? '')));
|
||||
if (in_array($userTheme, ['light', 'dark'], true)) {
|
||||
$theme = $userTheme;
|
||||
}
|
||||
$themeIcon = $theme === 'dark' ? 'bi-moon-stars-fill' : 'bi-sun-fill';
|
||||
$csrfKey = Session::$csrfSessionKey;
|
||||
$csrfToken = $_SESSION[$csrfKey] ?? '';
|
||||
|
||||
// Tenant switcher data
|
||||
$currentTenant = $_SESSION['current_tenant'] ?? null;
|
||||
$currentTenantId = $currentTenant['id'] ?? null;
|
||||
$availableTenants = $_SESSION['available_tenants'] ?? [];
|
||||
|
||||
?>
|
||||
<header class="app-header">
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a id="global-back" data-tooltip-pos="bottom" data-tooltip="<?php e(t('Back')); ?>" title="<?php e(t('Back')); ?>" href="admin"><i class="bi bi-arrow-left"></i></a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="global-forward" data-tooltip-pos="bottom" data-tooltip="<?php e(t('Forward')); ?>" title="<?php e(t('Forward')); ?>" href="admin"><i class="bi bi-arrow-right"></i></a>
|
||||
</li>
|
||||
<li id="async-messages"></li>
|
||||
</ul>
|
||||
<ul class="nav-list">
|
||||
<li data-tooltip="<?php e(t("Toggle Sidebar"));?>" data-tooltip-pos="bottom">
|
||||
<button id="toggle-aside"><i class="bi bi-layout-sidebar-inset"></i></button>
|
||||
</li>
|
||||
<li data-tooltip="<?php e(t("Toggle Detail Sidebar"));?>" data-tooltip-pos="bottom">
|
||||
<button id="toggle-main-content-aside"><i class="bi bi-layout-sidebar-inset-reverse"></i></button>
|
||||
</li>
|
||||
<?php if (allowUserTheme()): ?>
|
||||
<li data-tooltip="<?php e(t("Theme"));?>" data-tooltip-pos="bottom">
|
||||
<button
|
||||
type="button"
|
||||
class="theme-toggle"
|
||||
data-theme-toggle
|
||||
data-theme-url="admin/users/theme"
|
||||
data-csrf-key="<?php e($csrfKey); ?>"
|
||||
data-csrf-token="<?php e($csrfToken); ?>"
|
||||
aria-label="<?php e(t('Toggle theme')); ?>"
|
||||
>
|
||||
<i class="bi <?php e($themeIcon); ?>"></i>
|
||||
</button>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($currentTenant && count($availableTenants) > 1): ?>
|
||||
<li data-tooltip="<?php e(t('Switch tenant')); ?>" data-tooltip-pos="bottom">
|
||||
<details class="dropdown">
|
||||
<summary><i class="bi bi-buildings"></i></summary>
|
||||
<ul dir="rtl">
|
||||
<?php foreach ($availableTenants as $tenant): ?>
|
||||
<?php $isActive = ($tenant['id'] ?? 0) === $currentTenantId; ?>
|
||||
<li>
|
||||
<a href="#"
|
||||
class="<?php echo $isActive ? 'active' : ''; ?>"
|
||||
<?php if (!$isActive): ?>
|
||||
data-switch-tenant="<?php e($tenant['id'] ?? ''); ?>"
|
||||
data-csrf-key="<?php e($csrfKey); ?>"
|
||||
data-csrf-token="<?php e($csrfToken); ?>"
|
||||
data-error-message="<?php e(t('Failed to switch tenant')); ?>"
|
||||
<?php endif; ?>>
|
||||
<?php e($tenant['description'] ?? ''); ?>
|
||||
<?php if ($isActive): ?>
|
||||
<i class="bi bi-check"></i>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</details>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<li>
|
||||
<?php
|
||||
$variant = 'dropdown';
|
||||
require __DIR__ . '/app-language-switcher.phtml';
|
||||
unset($variant);
|
||||
?>
|
||||
</li>
|
||||
<li>
|
||||
<details class="dropdown">
|
||||
<summary><i class="bi bi-person-fill"></i></summary>
|
||||
<ul dir="rtl">
|
||||
<li><a href="<?php e($accountUrl); ?>">
|
||||
<?php e(t('Account')); ?>
|
||||
</a>
|
||||
</li>
|
||||
<li><a href="logout">
|
||||
<?php e(t('Logout')); ?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
Reference in New Issue
Block a user