{% set menu = {
'Dashboard': {
'link': path('admin_home'),
'addClass': '',
'icon': 'nav-icon fas fa-tachometer-alt',
'route': '',
'path': ''
},
'Imóveis': {
'link': path('admin_clientes_lista'),
'addClass': 'menu-is-opening menu-open',
'icon': 'nav-icon fas fa-user-check',
'route': '',
'path': '/admin/clientes',
'sub':{
'Novo': {
'link': path('admin_clientes_new'),
'addClass': '', 'icon': '', 'route': ''
},
'Lista': {
'link': path('admin_clientes_lista'),
'addClass': '', 'icon': '', 'route': ''
},
}
},
'Usuários': {
'link': path('users_list'),
'addClass': 'users',
'icon': 'nav-icon fas fa-user-friends',
'route': '',
'path': '/admin/usuarios',
'sub':{
'Novo': {
'link': path('admin_user_new'),
'addClass': '', 'icon': '', 'route': ''
},
'Lista': {
'link': path('users_list'),
'addClass': '', 'icon': '', 'route': ''
},
}
},
'Profissionais': {
'link': path('profissionais_list'),
'addClass': '',
'icon': 'nav-icon fas fa-globe',
'route': '',
'path': '/admin/profissionais',
},
'Funções': {
'link': path('funcoes_list'),
'addClass': '',
'icon': 'nav-icon fas fa-robot',
'route': '',
'path': '/admin/funcoes',
},
'Minhas reservas': {
'link': path('admin_reserva_minhas'),
'addClass': '',
'icon': 'nav-icon fas fa-house-user',
'route': '',
'path': '',
},
'Consulta disponibilidade': {
'link': path('admin_disponibilidade_list'),
'addClass': '',
'icon': 'nav-icon fas fa-search-location',
'route': '',
'path': '',
},
}
%}
<aside class="main-sidebar sidebar-dark-primary elevation-4">
<!-- Brand Logo -->
<a href="/" class="brand-link">
<img src="/imgs/logo_full.png" alt="Admin bnbguests" style="opacity: .8; width: 190px">
</a>
{% set currentPath = path(app.request.attributes.get('_route'),app.request.attributes.get('_route_params')) %}
{% set currentRoute = app.request.get('_route') %}
<!-- Sidebar -->
<div class="sidebar">
<!-- Sidebar user (optional) -->
<div class="user-panel mt-3 pb-3 mb-3 d-flex">
<div class="image">
<img src="{{ app.user.foto? app.user.foto: '/imgs/user.png' }}?w=35&h=35&crop=1" class="img-circle elevation-2" />
</div>
<div class="info">
<a href="{{ path('admin_user_edit',{id: app.user.id}) }}" alt="Editar meu perfil" title="Editar meu perfil" class="d-block">{{ app.user.fullName }}</a>
</div>
</div>
<!-- Sidebar Menu -->
<nav class="mt-2 {{ app.user.roles|join(' ') }}">
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
{% for name,row in menu %}
<li class="nav-item{{ ((row.sub is defined and currentRoute==row.route) or (row.sub is defined and row.path in currentPath and row.path != '' ))? ' menu-open': '' }} {{ row.link|replace({'/':'-'}) }}">
<a href="{{ row.link? row.link: '#' }}" class="nav-link{{ (currentPath==row.link or currentRoute==row.route or (currentPath starts with row.path and row.path !=''))?' active': '' }}">
<i class="{{ row.icon}}"></i>
<p>{{ name }}{% if row.sub is defined %}<i class="fas fa-angle-left right"></i>{% endif %}</p>
</a>
{% if row.sub is defined %}
<ul class="nav nav-treeview">
{% for name2,row2 in row.sub %}
<li class="nav-item{# (row2.sub is defined)? ' menu-open': '' #}">
<a href="{{ row2.link? row2.link: '#' }}" class="nav-link{{ (currentPath==row2.link or currentRoute==row2.route)?' active': '' }}">
<i class="far fa-circle nav-icon"></i>
<p>{{ name2 }}</p>
</a>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
<!-- /.sidebar-menu -->
</div>
<!-- /.sidebar -->
</aside>