2021-07-22 21:22:21 +02:00
|
|
|
{% import 'macros/base.twig' as m %}
|
|
|
|
|
2023-01-22 19:16:33 +01:00
|
|
|
{% macro toolbar_item(label, link, active_page, icon, title) %}
|
2021-04-17 14:49:53 +02:00
|
|
|
<li class="nav-item">
|
2023-01-22 19:16:33 +01:00
|
|
|
<a
|
|
|
|
class="nav-link{% if page() == active_page %} active{% endif %}"
|
|
|
|
{% if page() == active_page %}aria-current="page"{% endif %}
|
|
|
|
{% if title %}title="{{ title }}"{% endif %}
|
|
|
|
href="{{ link }}"
|
|
|
|
>
|
2021-07-22 21:22:21 +02:00
|
|
|
{% if icon %}{{ m.icon(icon) }}{% endif %}
|
2018-09-23 19:13:19 +02:00
|
|
|
{{ label|raw }}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2023-01-22 19:16:33 +01:00
|
|
|
{% macro dropdown_item(label, link, active_page, icon) %}
|
|
|
|
<li>
|
|
|
|
<a class="dropdown-item{% if page() == active_page %} active{% endif %}"{% if page() == active_page %} aria-current="page"{% endif %} href="{{ link }}">
|
|
|
|
{{ icon }} {{ label }}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2023-04-19 21:19:22 +02:00
|
|
|
|
|
|
|
{% if is_guest() %}
|
|
|
|
{% set navbar_expand_class = 'navbar-expand-md' %}
|
|
|
|
{% else %}
|
|
|
|
{% set navbar_expand_class = 'navbar-expand-xxl' %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<nav class="navbar fixed-top {{ navbar_expand_class }} border-bottom {{ theme['navbar_classes'] }}">
|
2018-09-23 19:13:19 +02:00
|
|
|
<div class="container-fluid">
|
2021-04-17 14:49:53 +02:00
|
|
|
<a class="navbar-brand" href="{{ url('/') }}">
|
2023-04-03 19:05:35 +02:00
|
|
|
{{ m.angel() }}
|
2021-04-17 14:49:53 +02:00
|
|
|
<strong class="visible-lg-inline">{{ config('app_name')|upper }}</strong>
|
|
|
|
</a>
|
|
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
|
|
|
<span class="navbar-toggler-icon"></span>
|
|
|
|
</button>
|
|
|
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
2023-01-22 19:16:33 +01:00
|
|
|
<ul class="navbar-nav mb-2 mb-lg-0">
|
|
|
|
{{ menu() }}
|
|
|
|
</ul>
|
2018-09-23 19:13:19 +02:00
|
|
|
|
2021-04-17 14:49:53 +02:00
|
|
|
{% if config('header_items') %}
|
|
|
|
<ul class="navbar-nav mb-2 mb-lg-0">
|
|
|
|
{% for text,link in config('header_items', {}) %}
|
|
|
|
<li class="nav-item">
|
2021-12-26 17:40:13 +01:00
|
|
|
<a class="nav-link" href="{{ link|replace({'%lang%': session_get('locale')|split('_')[0]})|escape('html_attr') }}">
|
2021-04-17 14:49:53 +02:00
|
|
|
{{ text }}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
{% endif %}
|
|
|
|
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
2023-01-22 19:16:33 +01:00
|
|
|
{% if is_guest() %}
|
2023-04-19 21:19:22 +02:00
|
|
|
{% include "layouts/parts/language_dropdown.twig" %}
|
|
|
|
|
2023-01-22 19:16:33 +01:00
|
|
|
{% if has_permission_to('register') and config('registration_enabled') %}
|
2023-04-01 14:23:52 +02:00
|
|
|
{{ _self.toolbar_item(__('Register'), url('/sign-up'), 'register', 'plus') }}
|
2023-01-22 19:16:33 +01:00
|
|
|
{% endif %}
|
2018-09-23 19:13:19 +02:00
|
|
|
|
2023-01-22 19:16:33 +01:00
|
|
|
{% if has_permission_to('login') %}
|
2023-10-02 16:15:25 +02:00
|
|
|
{{ _self.toolbar_item(__('general.login'), url('login'), 'login', 'box-arrow-in-right') }}
|
2023-01-22 19:16:33 +01:00
|
|
|
{% endif %}
|
2021-04-17 14:49:53 +02:00
|
|
|
{% endif %}
|
2018-09-23 19:13:19 +02:00
|
|
|
|
2023-01-22 19:16:33 +01:00
|
|
|
{% if is_user() %}
|
|
|
|
{{ _self.toolbar_item(menuUserShiftState(user), url('shifts', {'action': 'next'}), '', 'clock', __('Next shift')) }}
|
|
|
|
|
|
|
|
{% if has_permission_to('user_messages') %}
|
|
|
|
{{ _self.toolbar_item(
|
|
|
|
user_messages ? '<span class="badge bg-danger">' ~ user_messages ~ '</span>' : '',
|
|
|
|
url('messages'),
|
|
|
|
'messages',
|
|
|
|
'envelope'
|
|
|
|
) }}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{{ menuUserHints() }}
|
|
|
|
|
2023-04-19 21:19:22 +02:00
|
|
|
{% include "layouts/parts/language_dropdown.twig" %}
|
2023-01-22 19:16:33 +01:00
|
|
|
<li class="nav-item dropdown">
|
|
|
|
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
2022-07-10 21:12:10 +02:00
|
|
|
{{ m.angel() }} {{ user.displayName }}
|
2023-01-22 19:16:33 +01:00
|
|
|
</a>
|
|
|
|
<ul class="dropdown-menu dropdown-menu-end">
|
|
|
|
{% if has_permission_to('user_myshifts') %}
|
2023-09-10 17:43:28 +02:00
|
|
|
{{ _self.dropdown_item(__('profile.my-shifts'), url('users', {'action': 'view'}), 'users', m.icon('calendar-range')) }}
|
2023-01-22 19:16:33 +01:00
|
|
|
{% endif %}
|
2018-09-23 19:13:19 +02:00
|
|
|
|
2023-01-22 19:16:33 +01:00
|
|
|
{% if has_permission_to('user_settings') %}
|
|
|
|
{{ _self.dropdown_item(__('Settings'), url('settings/profile'), 'settings/profile', m.icon('person-fill-gear')) }}
|
|
|
|
{% endif %}
|
2018-09-23 19:13:19 +02:00
|
|
|
|
2023-01-22 19:16:33 +01:00
|
|
|
{% if has_permission_to('logout') %}
|
|
|
|
{{ _self.dropdown_item(__('Logout'), url('logout'), 'logout', m.icon('box-arrow-left')) }}
|
|
|
|
{% endif %}
|
|
|
|
</ul>
|
|
|
|
</li>
|
2021-04-17 14:49:53 +02:00
|
|
|
{% endif %}
|
|
|
|
</ul>
|
|
|
|
</div>
|
2018-09-23 19:13:19 +02:00
|
|
|
</div>
|
2021-04-17 14:49:53 +02:00
|
|
|
</nav>
|