<nav id="admin-sidebar">
    <div id="admin-logo">
        <h3><a href="{{ base_url_relative }}">{{ "PLUGIN_ADMIN.GRAV_ADMIN"|tu }}</a> <a target="_blank" href="{{ base_url_relative_frontend }}"><i class="fa fa-fw fa-angle-double-right"></i></a></h3>
    </div>

    {#{% if admin.authorize %}#}
    <div id="admin-user-details">
        <a href="{{ base_url_relative }}/users/{{ admin.user.username }}">
            <img src="http://www.gravatar.com/avatar/{{ admin.user.email|md5 }}?s=32" />

            <div class="admin-user-names">
                <h4>{{ admin.user.fullname }}</h4>
                <h5>{{ admin.user.title }}</h5>
            </div>
        </a>
    </div>
    {#{% endif %}#}

    <ul id="admin-menu">
        <li class="{{ (location == 'dashboard') ? 'selected' : '' }}">
            <a href="{{ base_url_relative }}"><i class="fa fa-fw fa-th"></i> {{ "PLUGIN_ADMIN.DASHBOARD"|tu }}</a>
        </li>
        {% if authorize(['admin.configuration', 'admin.super']) %}
            <li class="{{ (location == 'system' or location == 'site') ? 'selected' : '' }}">
                <a href="{{ base_url_relative }}/system"><i class="fa fa-fw fa-wrench"></i> {{ "PLUGIN_ADMIN.CONFIGURATION"|tu }}</a>
            </li>
        {% endif %}
        {% if authorize(['admin.pages', 'admin.super']) %}
            <li class="{{ (location == 'pages') ? 'selected' : '' }}">
                <a href="{{ base_url_relative }}/pages">
                    <i class="fa fa-fw fa-file-text-o"></i> {{ "PLUGIN_ADMIN.PAGES"|tu }}
                    <span class="badges">
                        <span class="badge count">{{ admin.countPages }}</span>
                    </span>
                </a>
            </li>
        {% endif %}
        {% if grav.twig.plugins_hooked_nav %}
            {% for label, item in grav.twig.plugins_hooked_nav %}
                {% if authorize(['admin.' ~ item.route, 'admin.super']) %}
                    <li class="{{ (location == item.route) ? 'selected' : '' }}">
                        <a href="{{ base_url_relative }}/{{ item.route }}">
                            <i class="fa fa-fw {{ item.icon }}"></i> {{ label|tu }}
                        </a>
                    </li>
                {% endif %}
            {% endfor %}
        {% endif %}
        {% if authorize(['admin.plugins', 'admin.super']) %}
            <li class="{{ (location == 'plugins') ? 'selected' : '' }}">
                <a href="{{ base_url_relative }}/plugins">
                    <i class="fa fa-fw fa-plug"></i> {{ "PLUGIN_ADMIN.PLUGINS"|tu }}
                    <span class="badges">
                        <span class="badge updates"></span>
                        <span class="badge count">{{ admin.plugins|length }}</span>

                    </span>
                </a>
            </li>
        {% endif %}
        {% if authorize(['admin.themes', 'admin.super']) %}
            <li class="{{ (location == 'themes') ? 'selected' : '' }}">
                <a href="{{ base_url_relative }}/themes">
                    <i class="fa fa-fw fa-tint"></i> {{ "PLUGIN_ADMIN.THEMES"|tu }}
                    <span class="badges">
                        <span class="badge updates"></span>
                        <span class="badge count">{{ admin.themes|length }}</span>
                    </span>
                </a>
            </li>
        {% endif %}

        {% include 'nav-pro.html.twig' ignore missing %}

        <!-- <li class="{{ (location == 'logs') ? 'selected' : '' }}">
            <a href="{{ base_url_relative }}/logs">
                <i class="fa fa-fw fa-warning"></i> Error Logs
                <span class="badges">
                    <span class="badge count">{{ admin.logs|length }}</span>
                </span>
            </a>
        </li> -->
        <li>
            <a href="{{ base_url_relative }}/task{{ config.system.param_sep }}logout"><i class="fa fa-fw fa-sign-out"></i> {{ "PLUGIN_ADMIN.LOGOUT"|tu }}</a>
        </li>
    </ul>
</nav>
