{% load i18n %}
<div id="sidebar" class="relative sidebar bg-base-100 border-base-200 border-e w-56  hidden xl:block lg:block">
    <!-- Sidebar header with logo -->
    <a class="flex h-16 items-center p-2" href="{% url 'admin:index' %}">
        <div class="inline">
            <img loading="lazy" width="50" height="24" class="inline" src="{{ logo }}">
        </div>
        <div class="inline">
            {{ site_title|default:'Django Daisy' }}
        </div>
    </a>

    <!-- Sidebar menu -->
    <ul class="menu rounded-box mb-auto w-56">
        <!-- Dashboard link -->
        <li>
            <a href="{% url 'admin:index' %}">
                <i class="fa fa-th"></i>
                {% trans 'Dashboard' %}
            </a>
        </li>

        <!-- App list -->
        {% for app in app_list %}
            {% if not app.apps %}
                {% if app.divider_title %}
                    <div class="divider text-base-content/40 menu-title divider-start">{{ app.divider_title|safe }}</div>
                {% endif %}

                {% if app.models|length == 1 %}
                    <li>
                        <a class="{% if app.models.0.admin_url in request.path|urlencode %} active{% endif %}"
                           href="{{ app.models.0.admin_url }}">
                            <i class="{{ app.icon }}"></i>
                            {{ app.name }}
                        </a>
                    </li>

                {% else %}
                    <li class="mb-2">
                        <details {% if app.app_url in request.path|urlencode %} open {% endif %}>
                            <summary>
                                <i class="{{ app.icon }}"></i>
                                {{ app.name }}
                            </summary>
                            <ul>
                                {% for model in app.models %}
                                    <li class="model-{{ model.object_name|lower }}">
                                        <a class="{% if model.admin_url in request.path|urlencode %} active {% endif %}"
                                           href="{{ model.admin_url }}">
                                            {{ model.name }}
                                        </a>
                                    </li>
                                {% endfor %}
                            </ul>
                        </details>
                    </li>
                {% endif %}
            {% endif %}
        {% endfor %}
    </ul>

    {% if not app_list %}
        <ul class="menu rounded-box w-56">
            <li>{% translate 'You don’t have permission to view or edit anything.' %}</li>
        </ul>
    {% endif %}

    <div class="absolute bottom-2 text-center right-0 text-xs left-0 mx-auto">
        <span>
            {{ SIDEBAR_FOOTNOTE|safe }}
        </span>
        {% if not DONT_SUPPORT_ME %}
            <a target="_blank" class="block p-2 text-base-content/70  hover:underline"
               href="https://github.com/hypy13/django-daisy">
                Made with
                <svg class="inline animate-heartbeat" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="red"
                     width="12px" height="12px">
                    <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
                </svg>
                on GitHub

            </a>

        {% endif %}
    </div>
</div>


