{% load i18n static milea_tags milea_notify_tags %}
<!DOCTYPE html>
<!--
* The MILEA Framework
* by red pepper services - Webdesign und IT-Dienstleistungen aus Vorarlberg
* @version {% get_setting "milea_base.VERSION" %}
* @link https://www.red-pepper.at
* Copyright 2024 red pepper Services e.U.
-->
{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" dir="{{ LANGUAGE_BIDI|yesno:'rtl,ltr,auto' }}">

    <head>
        <!-- Meta -->
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <meta name="description" content="{% get_setting "milea_base.NAME" %}" />
        <meta name="keywords" content="" />
        <link rel="icon" href="{% static 'milea_base/img/favicon.ico' %}" />
        {% block blockbots %}
            <meta name="robots" content="NONE,NOARCHIVE" />
        {% endblock blockbots %}
        {% block extrahead %}
        {% endblock extrahead %}
        <!-- Title -->
        <title>
            {% block title %}
            {% endblock title %}
        </title>
 
        <!-- CSS -->
        <link rel="stylesheet" href="{% static 'milea_base/css/tabler.css' %}" />
        <link rel="stylesheet" href="{% static 'milea_base/css/tabler-vendor.css' %}" />
        <link rel="stylesheet" href="{% static 'milea_base/css/tabler-icons.css' %}" />
        <link rel="stylesheet" href="{% static 'milea_base/css/custom.css' %}" />
        {% block extrastyle %}
        {% endblock extrastyle %}
    </head>

    <body class="{% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock bodyclass %}" data-admin-utc-offset="{% now "Z" %}">
        <!-- Container -->
        <div id="container">

            <!-- Header -->
            {% block header %}
                <header class="navbar navbar-expand-md navbar-light d-print-none">
                    <div class="container-xl">
                        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu" aria-controls="navbar-menu" aria-expanded="false" aria-label="Toggle navigation">
                            <span class="navbar-toggler-icon"></span>
                        </button>
                        <h1 class="navbar-brand navbar-brand-autodark d-none-navbar-horizontal pe-0 pe-md-3">
                            <a href="{{ site_url }}">
                                <img src="{% static 'milea_base/img/logo.png' %}" width="110" height="32" alt="Logo" class="navbar-brand-image" />
                            </a>
                        </h1>

                        {% if has_permission %}
                            <div class="navbar-nav flex-row order-md-last">

                                <!-- Buttons -->
                                <div class="d-none d-md-flex me-3">
                                    {% include "admin/language_switcher.html" %}
                                    {% include "admin/theme_switcher.html" %}
                                    {% header_notifications %}
                                </div>
 
                                <!-- User Menu -->
                                <div class="nav-item dropdown">
                                    <a href="#" class="nav-link d-flex lh-1 text-reset p-0" data-bs-toggle="dropdown" aria-label="Open user menu">
                                        <span class="avatar avatar-sm" style="background-image: url({% static 'milea_base/img/user-icon.png' %})"></span>
                                        <div class="d-none d-xl-block ps-2">
                                            <div>{% translate "Welcome" %}</div>
                                            <div class="mt-1 small text-muted">{% firstof user.get_short_name user.get_username %}</div>
                                        </div>
                                    </a>
                                    <div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
                                        {% if user.is_active and user.is_staff %}
                                            {% url 'django-admindocs-docroot' as docsroot %}
                                            {% if docsroot %}
                                                <a href="{{ docsroot }}" class="dropdown-item">{% translate "Documentation" %}</a>
                                                <div class="dropdown-divider my-1"></div>
                                            {% endif %}
                                        {% endif %}
                                        {% if user.has_usable_password %}
                                            <a href="{% url 'admin:password_change' %}" class="dropdown-item">{% translate "Change password" %}</a>
                                        {% endif %}
                                        <form id="logout-form" method="post" action="{% url 'admin:logout' %}">
                                            {% csrf_token %}
                                            <button class="dropdown-item" type="submit">{% translate "Log out" %}</button>
                                        </form>
                                    </div>
                                </div>
 
                            </div>
                        {% endif %}
                        {% block nav-global %}
                        {% endblock nav-global %}
                    </div>
                </header>

            {% endblock header %}

            <!-- Navbar -->
            {% if not is_popup and is_nav_sidebar_enabled %}
                {% block nav-sidebar %}
                    {% include "admin/nav_sidebar.html" %}
                {% endblock nav-sidebar %}
            {% endif %}

            <div class="page-wrapper">
                <div class="page-header d-print-none">
                    <div class="container-xxl">
                        <div class="row g-2 align-items-center">
                            <div class="col mt-0">
                                <!-- Breadcrumbs -->
                                {% block breadcrumbs %}
                                {% endblock breadcrumbs %}

                                <!-- Titel -->
                                {% block pretitle %}
                                {% endblock pretitle %}
                                {% block content_title %}
                                    {% if title %}<h1 class="page-title">{{ title }}</h1>{% endif %}
                                {% endblock content_title %}

                            </div>

                            <!-- Header Actions -->
                            <div class="col-auto ms-auto d-print-none">
                                <div class="btn-list">
                                    <span class="d-none d-sm-inline">
                                        {% block object-tools %}
                                        {% endblock object-tools %}
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="page-body">
                    <div class="container-xxl">

                        <!-- Messages -->
                        {% block messages %}
                            {% if messages %}
                                <div class="row g-2 align-items-center">
                                    <div class="col alert-messages">
                                        {% for message in messages %}
                                            <div class="alert alert-dismissible alert-{% if message.tags == 'error' %}danger{% else %}{{ message.tags }}{% endif %}" role="alert">
                                                <div class="d-flex">
                                                    <div>
                                                        <i class="ti ti-check alert-icon display-6"></i>
                                                    </div>
                                                    <div>
                                                        <h4 class="alert-title fs-3">{{ message|capfirst }}</h4>
                                                    </div>
                                                </div>
                                                <a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>
                                            </div>
                                        {% endfor %}
                                    </div>
                                </div>
                            {% endif %}
                        {% endblock messages %}

                        <!-- Content -->
                        {% block content %}
                            {{ content }}
                        {% endblock content %}
                        {% block sidebar %}
                        {% endblock sidebar %}
                    </div>
                </div>
            </div>
        </div>

        <!-- Footer -->
        {% block footer %}
            <div id="footer"></div>
        {% endblock footer %}

        <!-- JS -->
        <script src="{% static 'milea_base/js/tabler.js' %}"></script>
        <script src="{% static 'milea_base/js/custom.js' %}"></script>
        <script src="{% static 'milea_notify/js/header_notifications.js' %}"></script>
        {% block javascript %}
        {% endblock javascript %}

    </body>
</html>
