{% extends 'base.jinja2' %}

{% block body %}
    <div class="d-flex wrapper">
        <div class="bg-light border-right sidebar-wrapper">
            <div class="border-top w-100"></div>
            {% if request.user.is_superuser %}
                <div class="list-group list-group-flush">
                    <a class="list-group-item list-group-item-action bg-light"
                       href="{{ url('django-additional-admin-list') }}"><i class="fas fa-crown"></i> Django Adminbereich</a>
                </div>
            {% endif %}
            {% if realms %}
                <h2 class="sidebar-heading">Bereiche</h2>
                <div class="list-group list-group-flush">
                    {% for realm_item in realms %}
                        <a href="{{ url('realm-detail', args=[realm_item.id]) }}"
                           class="list-group-item list-group-item-action bg-light">{{ realm_item.name }} </a>
                    {% endfor %}
                </div>
            {% else %}
                <div class="list-group-flush">
                    <a href="{{ url('realm-home') }}" class="list-group-item list-group-item-action bg-light">
                        <i class="fas fa-list"></i> Bereichsübersicht</a>
                </div>
                {% if realm %}
                    <h2 class="sidebar-heading">Bereich {{ realm.name }}</h2>
                    <div class="list-group list-group-flush">
                        <a href="{{ url('realm-detail', args=[realm.id]) }}"
                           class="list-group-item list-group-item-action bg-light"><i class="fas fa-cogs"></i>
                            Bereichsinformationen</a>
                        <a href="{{ url('realm-user-list', args=[realm.id]) }}"
                           class="list-group-item list-group-item-action bg-light"><i class="fas fa-users"></i>
                            Nutzer</a>
                        <a href="{{ url('realm-group-list', args=[realm.id]) }}"
                           class="list-group-item list-group-item-action bg-light"><i class="fas fa-user-friends"></i>
                            Gruppen</a>
                    </div>
                {% endif %}
            {% endif %}
            {% if request.user.is_superuser %}
                <div class="list-group-flush border-top">
                    <div class="list-group-item bg-light border-0"></div>
                    <a href="{{ url('realm-add') }}"
                       class="list-group-item list-group-item-action bg-light"><i class="fas fa-plus-square"></i>
                        Bereich hinufügen</a>
                </div>
            {% endif %}
            <div class="sidebar-bottom list-group-flush border-top">
                <a href="{{ url('about') }}" class="list-group-item list-group-item-action bg-light">Über</a>
            </div>
        </div>

        <div class="page-content-wrapper">
            <div class="container-fluid">
                {% block admin_content %}{% endblock %}
            </div>
        </div>
    </div>
{% endblock %}

{% block extra_nav %}
    <button class="menu-toggle btn nav-link d-sm-block d-md-none"><i class="fas fa-bars"></i></button>
{% endblock %}