{% load static wagtailcore_tags wagtailuserbar %}
{% load menu_tags %}
{% load i18n %}

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>
            {% block title %}
            {% if page.seo_title %}{{ page.seo_title }}{% else %}{{ page.title }}{% endif %}
            {% endblock %}
            {% block title_suffix %}
            {% wagtail_site as current_site %}
            {% if current_site and current_site.site_name %}- {{ current_site.site_name }}{% endif %}
            {% endblock %}
        </title>
        {% if page.search_description %}
        <meta name="description" content="{{ page.search_description }}" />
        {% endif %}
        <meta name="viewport" content="width=device-width, initial-scale=1" />

        {# Force all links in the live preview panel to be opened in a new tab #}
        {% if request.in_preview_panel %}
        <base target="_blank">
        {% endif %}

        {# Global stylesheets #}
        <link rel="stylesheet" type="text/css" href="{% static 'css/artel.css' %}">
        <link rel="stylesheet" type="text/css" href="{% static 'bootstrap/css/bootstrap.min.css' %}">

        {% block extra_css %}
        {# Override this in templates to add extra stylesheets #}
        {% endblock %}
    </head>

    <body class="{% block body_class %}{% endblock %}">
        {% wagtailuserbar %}
        <div class="container">
            <div class="row">
                {% if navbar_position == 'top' %}
                    {% with size=12 %}
                        {% include 'includes/menu_block.html' %}
                    {% endwith %}
                {% endif %}

                {% if navbar_position == 'left' %}
                    {% with size=3 %}
                        {% include 'includes/menu_block.html' %}
                    {% endwith %}
                {% endif %}
                <div class="col-md-9 mt-5 ml-2">
                    {% for message in messages %}
                        <div class="alert alert-{{message.tags}}" role="alert">
                            {{message}}
                        </div>
                    {% endfor %}
                    {% block content %}{% endblock %}
                </div>
                {% if navbar_position == 'right' %}
                    {% with size=3 %}
                        {% include 'includes/menu_block.html' %}
                    {% endwith %}
                {% endif %}
            </div>
            <div class="row">
                <div class="col-md-11 mt-5 ml-2"></div>
                <div class="col-md-1 mt-5 ml-2">
                      
                    {% if page  and page.get_translations.live %}
                        <div class="dropdown">
                            <button class="btn btn-outline-secondary btn-lg" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                <img src="{% static 'images/icons/globe.svg' %}">
                            </button>
                            <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                                {% for translation in page.get_translations.live %}
                                    <a class="dropdown-item text-center" href="{% pageurl translation %}"" rel="alternate" hreflang="{{ translation.locale.language_code }}">
                                            {{translation.locale.language_code | language_name}}
                                    </a>
                                {% endfor %}
                            </div>
                        </div>
                    {% endif %}

                </div>
            </div>
        </div>

        {# Global javascript #}
        <script type="text/javascript" src="{% static 'js/jquery-3.6.4.min.js' %}"></script>
        <script type="text/javascript" src="{% static 'bootstrap/js/bootstrap.bundle.min.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/artel.js' %}"></script>
        <script src="{% static 'js/cart.js' %}"></script>
        {% block extra_js %}
        {# Override this in templates to add extra javascript #}
        {% endblock %}
    </body>
</html>
