{% set sidebar = app.session.get('sidebar') %}

{% for nav01 in sidebar %}
    {% if(nav01.path starts with '@') %}
        {{ include(nav01.path) }}
    {% elseif(nav01.path == '<hr>') %}
        <hr>
    {% else %}
        <li>
            {% if(nav01.path) %}
                <a href="{{ path(nav01.path) }}">
            {% else %}
                <a href="#">
            {% endif %}
            <i class="{{ nav01.fonticon }} fa-fw"></i> {{ nav01.label }}
            {% if nav01.childs is defined %}
            <span class="fa arrow"></span>
            {% endif %}
            </a>

            {% if nav01.childs is defined %}
                <ul class="nav nav-second-level collapse">
                {% for nav02 in nav01.childs %}
                    <li>
                    {% if(nav02.path) %}
                        <a href="{{ path(nav02.path) }}">
                    {% else %}
                        <a href="#">
                    {% endif %}
                    <i class="{{ nav02.fonticon }} fa-fw"></i> {{ nav02.label }}
                    {% if nav02.childs is defined %}
                    <span class="fa arrow"></span>
                    {% endif %}                
                    </a>

                    {% if nav02.childs is defined %}
                        <ul class="nav nav-third-level collapse">
                        {% for nav03 in nav02.childs %}
                            <li>
                            {% if(nav03.path is defined ) %}
                                <a href="{{ path(nav03.path) }}">
                            {% else %}
                                <a href="#">
                            {% endif %}
                            <i class="{{ nav03.fonticon }} fa-fw"></i> {{ nav03.label }}           
                            </a>
                            </li>
                        {% endfor %}
                        </ul>
                    {% endif %}

                    </li>
                {% endfor %}
                </ul>
            {% endif %}
        </li>
    {% endif %}
{% endfor %}

