<div class="sidebar">

    <ul class="topnav">

        <li class="siteNavigation t">
            <span class="sectionHeader">
                Site Navigation
            </span>

            {% if admin_id is not empty and admin_user is not empty %}
                <ul>
                    <li>
                        <a href="/admin/"
                            title="Go to {{ config('app.name') }} Admin home"
                        >
                            <i class="fa fa-home"></i>
                            Dashboard
                        </a>
                    </li>
                    <li>
                        <a href="/"
                            title="Go to {{ config('app.name') }}"
                            target="_blank"
                        >
                            <i class="fa fa-globe"></i>
                            Homepage
                        </a>
                    </li>
                    <li>
                        <a href="/admin/logout.php">
                            <i class="fa fa-sign-out"></i>
                            Logout
                        </a>
                    </li>
                </ul>
            {% endif %}
        </li> <!-- .siteNavigation -->

        {% include('admin/favourite_links.twig') %}


        {% if admin_id is not empty %}
            {% for menu_item in admin_menu %}
                <li>
                    <span class="sectionHeader">
                        {{ menu_item.title }}
                    </span>
                    {% if menu_item.subItems|length > 0 %}
                        <ul class="{% if menu_item.hasActiveChild() %}show{% endif %}">
                            {% for sub_menu_item in menu_item.subItems %}
                                {% if sub_menu_item.allowed() and sub_menu_item.icon and sub_menu_item.sub_id %}
                                    <li class="{% if sub_menu_item.isActive() %}active nav-twig{% endif %}">
                                        <a href="{{ sub_menu_item.path }}"
                                        {% if sub_menu_item.new_window %}
                                            target="_blank"
                                            title="opens in a new window"
                                        {% endif %}>
                                            <i class="{{ sub_menu_item.icon }}"></i>
                                            {{ sub_menu_item.title }}
                                            {% if sub_menu_item.path == '/plugins/MembersMessaging/admin/my_messages.php' %}
                                                ({{ new_message_count }})
                                            {% endif %}
                                        </a>
                                        {{ sub_menu_item.showCMSTreeIfAllowed(admin_user) }}
                                    </li>
                                {% endif %}
                            {% endfor %}
                        </ul>
                    {% endif %}
                </li>
            {% endfor %}
            {% if admin_user.user.role == 7 %}
                <li>
                    <span class="sectionHeader">Support</span>
                    <ul>
                        <li>
                            <a href="https://projects.mtcmedia.co.uk" target="_blank">Submit a ticket <i class="fa fa-file"></i></a>
                        </li>
                    </ul>
                </li>
            {% endif %}
        {% else %}
            <li>
                <span class="sectionHeader">Admin Login</span>
                <ul>
                    <li>
                        <a href="/admin/login.php">Login <i class="fa fa-file"></i></a>
                    </li>
                </ul>
            </li>
        {% endif %}
    </ul>

</div>
