forked from fa/breadcrumb-the-shire
55 lines
2.0 KiB
PHTML
55 lines
2.0 KiB
PHTML
|
|
<?php
|
||
|
|
|
||
|
|
$layoutNav = is_array($layoutNav ?? null) ? $layoutNav : [];
|
||
|
|
$helpdeskNav = is_array($layoutNav['helpdesk.nav'] ?? null) ? $layoutNav['helpdesk.nav'] : [];
|
||
|
|
$canManageSettings = !empty($helpdeskNav['can_manage_settings']);
|
||
|
|
|
||
|
|
$helpdeskNavItems = [
|
||
|
|
[
|
||
|
|
'label' => t('Customers'),
|
||
|
|
'path' => 'helpdesk/debitor',
|
||
|
|
'active' => navActive('helpdesk/debitor', true),
|
||
|
|
'visible' => true,
|
||
|
|
],
|
||
|
|
[
|
||
|
|
'label' => t('Settings'),
|
||
|
|
'path' => 'helpdesk/settings',
|
||
|
|
'active' => navActive('helpdesk/settings', true),
|
||
|
|
'visible' => $canManageSettings,
|
||
|
|
],
|
||
|
|
];
|
||
|
|
|
||
|
|
$visibleItems = array_values(array_filter($helpdeskNavItems, static fn (array $item): bool => !empty($item['visible'])));
|
||
|
|
$groupIsActive = false;
|
||
|
|
foreach ($visibleItems as $item) {
|
||
|
|
$activeState = $item['active'] ?? [];
|
||
|
|
if (!empty($activeState['isActive'])) {
|
||
|
|
$groupIsActive = true;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
?>
|
||
|
|
<ul class="app-sidebar-admin-nav" aria-label="<?php e(t('Helpdesk')); ?>">
|
||
|
|
<?php if ($visibleItems): ?>
|
||
|
|
<li class="app-sidebar-group app-sidebar-admin-group">
|
||
|
|
<details data-details-key="helpdesk-navigation"<?php if ($groupIsActive): ?> open<?php endif; ?>>
|
||
|
|
<summary>
|
||
|
|
<i class="bi bi-headset"></i>
|
||
|
|
<span><?php e(t('Helpdesk')); ?></span>
|
||
|
|
</summary>
|
||
|
|
<ul>
|
||
|
|
<?php foreach ($visibleItems as $item):
|
||
|
|
$active = $item['active'] ?? ['class' => '', 'aria' => ''];
|
||
|
|
?>
|
||
|
|
<li>
|
||
|
|
<a href="<?php e(lurl($item['path'])); ?>" class="<?php e($active['class'] ?? ''); ?>" <?php echo $active['aria'] ?? ''; ?>>
|
||
|
|
<?php e($item['label']); ?>
|
||
|
|
</a>
|
||
|
|
</li>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</ul>
|
||
|
|
</details>
|
||
|
|
</li>
|
||
|
|
<?php endif; ?>
|
||
|
|
</ul>
|