{% extends "base.html" %}
{% load i18n %}

{% block top_search %}{% endblock %} {# no 'file search' for system admin pages #}
{% block main_class %}d-flex ovhd{% endblock %}

{% block admin_link %}
    <a href="{{ SITE_ROOT }}" title="{% trans "Exit admin panel" %}" class="item">{% trans "Exit admin panel" %}</a>
{% endblock %}

{% block main_content %}
<div class="row flex-1 d-flex">
    <div id="side-nav" class="side-nav side-tabnav col-md-3">
        <a href="#" title="{% trans "Close" %}" aria-label="{% trans "Close" %}" class="sf2-icon-x1 sf-popover-close op-icon hidden-md-up js-close-side-nav fright"></a>
        {% block left_panel %}
        <h3 class="hd">{% trans "System Admin" %}</h3>
        <ul class="side-tabnav-tabs">

            {% if user.admin_permissions.can_view_system_info %}
            <li class="tab">
                <a href="{{ SITE_ROOT }}sysadmin/#dashboard/"><span class="sf2-icon-info"></span>{% trans "Info" %}</a>
            </li>
            {% endif %}

            {% if is_pro and user.admin_permissions.can_view_statistic %}
            <li class="tab {% block cur_statistic %}{% endblock %}">
                <a href="{% url "sys_statistic_file" %}"><span class="sf2-icon-histogram"></span>{% trans "Statistic" %}</a>
            </li>
            {% endif %}

            {% if is_default_admin %}
            <li class="tab">
                <a href="{{ SITE_ROOT }}sysadmin/#desktop-devices/"><span class="sf2-icon-monitor"></span>{% trans "Devices" %}</a>
            </li>
            {% endif %}

            {% if constance_enabled and user.admin_permissions.can_config_system %}
            <li class="tab {% block cur_settings %}{% endblock %}">
                <a href="{% url "sys_settings" %}"><span class="sf2-icon-cog2"></span>{% trans "Settings" %}</a>
            </li>
            {% endif %}

            {% if user.admin_permissions.can_manage_library %}
            <li class="tab {% block cur_repo %}{% endblock %}">
                <a href="{{ SITE_ROOT }}sysadmin/#all-libs/"><span class="sf2-icon-library"></span>{% trans "Libraries" %}</a>
            </li>
            {% endif %}

            {% if user.admin_permissions.can_manage_user %}
            <li class="tab {% block cur_users %}{% endblock %}">
                <a href="{{ SITE_ROOT }}sys/useradmin/"><span class="sf2-icon-user"></span>{% trans "Users" %}</a>
            </li>
            {% endif %}

            {% if user.admin_permissions.can_manage_group %}
            <li class="tab {% block cur_groups %}{% endblock %}">
                <a href="{{ SITE_ROOT }}sysadmin/#groups/"><span class="sf2-icon-group"></span>{% trans "Groups" %}</a>
            </li>
            {% endif %}

            {% if is_pro and user.admin_permissions.can_manage_group %}
            <li class="tab">
                <a href="{{ SITE_ROOT }}sysadmin/#address-book/"><span class="sf2-icon-organization"></span>{% trans "Departments" context "address book" %}</a>
            </li>
            {% endif %}

            {% if multi_tenancy and is_default_admin %}
            <li class="tab {% block cur_org %}{% endblock %}">
                <a href="{{ SITE_ROOT }}sys/orgadmin/"><span class="sf2-icon-organization"></span>{% trans "Organizations" %}</a>
            </li>
            {% endif %}

            {% if multi_institution and is_default_admin %}
            <li class="tab {% block cur_inst %}{% endblock %}">
                <a href="{{ SITE_ROOT }}sys/instadmin/"><span class="sf2-icon-organization"></span>{% trans "Institutions" %}</a>
            </li>
            {% endif %}

            {% if is_default_admin %}
            <li class="tab {% block cur_notice %}{% endblock %}">
                <a href="{{ SITE_ROOT }}sys/notificationadmin/"><span class="sf2-icon-msgs"></span>{% trans "Notifications" %}</a>
            </li>
            {% endif %}

            {% if is_default_admin %}
            <li class="tab {% block cur_links %}{% endblock %}">
                <a href="{{ SITE_ROOT }}sys/publinkadmin/"><span class="sf2-icon-link"></span>{% trans "Links" %}</a>
            </li>
            {% endif %}

            {% if sysadmin_extra_enabled and user.admin_permissions.can_view_user_log %}
            <li class="tab {% block cur_log %}{% endblock %}">
                <a href="{{ SITE_ROOT }}sys/loginadmin/"><span class="sf2-icon-clock"></span>{% trans "Logs" %}</a>
            </li>
            {% endif %}

            {% if events_enabled and is_default_admin %}
            <li class="tab {% block cur_virus_scan %}{% endblock %}">
                <a href="{{ SITE_ROOT }}sys/virus_scan_records/"><span class="sf2-icon-security"></span>{% trans "Virus Scan" %}</a>
            </li>
            {% endif %}

            {% if enable_guest_invitation and is_default_admin %}
            <li class="tab {% block cur_invitations %}{% endblock %}">
                <a href="{{ SITE_ROOT }}sys/invitationadmin/"><span class="sf2-icon-invite"></span>{% trans "Invitations" %}</a>
            </li>
            {% endif %}

            {% if is_default_admin %}
            <li class="tab tc {% if not enable_terms_and_conditions %} hide {% endif %} {% block cur_tc %}{% endblock %}">
                <a href="{{ SITE_ROOT }}sys/termsadmin/"><span class="sf2-icon-wiki"></span>{% trans "Terms and Conditions" %}</a>
            </li>
            {% endif %}

            {% if is_pro and user.admin_permissions.can_view_admin_log %}
            <li class="tab">
                <a href="{{ SITE_ROOT }}sysadmin/#admin-operation-logs/"><span class="sf2-icon-admin-log"></span>{% trans "Admin Logs" %}</a>
            </li>
            {% endif %}

        </ul>
        {% endblock %}
    </div>

    <div id="right-panel" class="col-md-9 ov-auto flex-1">
        {% block right_panel %}{% endblock %}
    </div>
</div>
{% endblock %}
