64 lines
2.9 KiB
HTML
64 lines
2.9 KiB
HTML
{% macro nav_link(name, url, icon=None) %}
|
|
<li class="nav-item mx-2">
|
|
<a class="nav-link" href="{{ url }}">
|
|
{% if icon %}
|
|
<i class="material-icons">{{ icon }}</i>
|
|
{% endif %}
|
|
{{ name }}
|
|
</a>
|
|
</li>
|
|
{% endmacro %}
|
|
|
|
{% macro dropdown(title, icon, children) %}
|
|
<li class="nav-item dropdown dropdown-hover mx-2">
|
|
<a role="button" class="nav-link ps-2 d-flex cursor-pointer align-items-center" id="{{ title | replace(' ', '') }}" data-bs-toggle="dropdown" aria-expanded="false">
|
|
{% if icon %}
|
|
<i class="material-icons opacity-6 me-2 text-md">{{ icon }}</i>
|
|
{% endif %}
|
|
{{ title }}
|
|
<img src="{{ url_for('static', filename='assets/img/down-arrow-dark.svg') }}" alt="down-arrow" class="arrow ms-2">
|
|
</a>
|
|
<div class="dropdown-menu dropdown-menu-animation" aria-labelledby="{{ title | replace(' ', '') }}">
|
|
<ul class="list-group w-100">
|
|
{% for child in children %}
|
|
{% if child.roles %}
|
|
{% if current_user.has_roles(*child.roles) %}
|
|
<li class="nav-item dropdown-subitem list-group-item border-0 p-0">
|
|
<a class="dropdown-item ps-3 border-radius-md mb-1" href="{{ child.url }}">
|
|
<span>{{ child.name }}</span>
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
{% else %}
|
|
<li class="nav-item dropdown-subitem list-group-item border-0 p-0">
|
|
<a class="dropdown-item ps-3 border-radius-md mb-1" href="{{ child.url }}">
|
|
<span>{{ child.name }}</span>
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
</li>
|
|
{% endmacro %}
|
|
|
|
<div class="navbar navbar-expand-lg navbar-light bg-white z-index-3 py-3">
|
|
...
|
|
<div class="collapse navbar-collapse w-100 pt-3 pb-2 py-lg-0" id="navigation">
|
|
<ul class="navbar-nav navbar-nav-hover mx-auto">
|
|
{% if current_user.is_authenticated %}
|
|
{{ dropdown('User Mgmt', 'contacts', [
|
|
{'name': 'Select Tenant', 'url': '/user/select_tenant', 'roles': ['Super User']},
|
|
{'name': 'Tenant Registration', 'url': '/user/tenant', 'roles': ['Super User']},
|
|
{'name': 'User Registration', 'url': '/user/user', 'roles': ['admin', 'manager']},
|
|
{'name': 'User List', 'url': '/user/view_users', 'roles': ['Super User', 'Tenant Admin']}
|
|
]) }}
|
|
{% endif %}
|
|
{{ dropdown('Account', 'contacts', [
|
|
{'name': 'Login', 'url': '/login'},
|
|
{'name': 'Logout', 'url': '/logout'}
|
|
]) }}
|
|
</ul>
|
|
</div>
|
|
...
|
|
</div> |