{% load static %}
{% load ndr_values %}

<!doctype html>
<html lang="en">
    <head>
        <meta name="description" content="NDR core admin">
        <meta name="author" content="sorin.marti@gmail.com">
        <link rel="icon" href="{% static 'ndr_core/images/favicon.ico' %}">
        <title>NDR core admin</title>
        <link href="{% static 'ndr_core/css/bootstrap.css' %}" rel="stylesheet">
        <link href="{% static 'ndr_core/css/ndr_core_default.css' %}" rel="stylesheet">
        <link href="{% static 'ndr_core/css/color_palette.css' %}" rel="stylesheet">
        <link href="{% static 'ndr_core/css/ndr_core_admin.css' %}" rel="stylesheet">
        <link href="{% static 'fontawesomefree/css/fontawesome.css' %}" rel="stylesheet" type="text/css">
        <link href="{% static 'fontawesomefree/css/brands.css' %}" rel="stylesheet" type="text/css">
        <link href="{% static 'fontawesomefree/css/solid.css' %}" rel="stylesheet" type="text/css">
        <link href="{% static 'ndr_core/plugins/image-picker/image-picker.css' %}" rel="stylesheet" type="text/css">
        {% block extra_css %}
        {% endblock %}
        <script src="{% static 'ndr_core/js/jquery.min.js' %}"></script>
    </head>

    <body>
        <div>
            <div class="container">
                <header class="py-3">
                    {% config_value 'page_is_editable' as page_is_editable %}

                    {% block nav %}

                            <nav class="navbar navbar-expand-md navbar-light bg-light ">
                                <a class="navbar-brand" href="{% url 'ndr_core:dashboard' %}">
                                    <img src="{% static 'ndr_core/images/admin/logo.png' %}" style="height: 30px;">
                                </a>
                                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
                                    <span class="navbar-toggler-icon"></span>
                                </button>

                                <div class="collapse navbar-collapse" id="navbarNavDropdown">
                                    <ul class="navbar-nav">
                                        {% if page_is_editable %}
                                            <li class="nav-item{% if "/configure/pages/" in request.path %} active{% endif %}">
                                                <a class="nav-link" href="{% url 'ndr_core:configure_pages' %}">
                                                    <i class="fa-regular fa-file"></i>
                                                    Pages
                                                </a>
                                            </li>
                                            <li class="nav-item{% if "/configure/search/" in request.path %} active{% endif %}">
                                                <a class="nav-link" href="{% url 'ndr_core:configure_search' %}">
                                                    <i class="fa-solid fa-magnifying-glass"></i>
                                                    Searches
                                                </a>
                                            </li>
                                            <li class="nav-item dropdown{% if "/configure/ui_settings/" in request.path or "/configure/colors/" in request.path %} active{% endif %}">
                                                <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-expanded="false">
                                                    <i class="fa-regular fa-palette"></i>
                                                    Style & Colors
                                                </a>
                                                <div class="dropdown-menu">
                                                    <a class="dropdown-item" href="{% url 'ndr_core:ui_settings' %}">
                                                        <i class="fa-regular fa-window-maximize"></i>
                                                        Change UI Style
                                                    </a>
                                                    <a class="dropdown-item" href="{% url 'ndr_core:configure_colors' %}">
                                                        <i class="fa-regular fa-palette"></i>
                                                        Manage Color Palettes
                                                    </a>
                                                </div>
                                            </li>
                                            <li class="nav-item dropdown{% if "/configure/ui_elements/" in request.path or "/configure/images/" in request.path or "/configure/uploads/" in request.path or "/configure/translations" in request.path %} active{% endif %}">
                                                <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-expanded="false">
                                                    <i class="fa-regular fa-folder-open"></i>
                                                    Resources
                                                </a>
                                                <div class="dropdown-menu">
                                                    <a class="dropdown-item" href="{% url 'ndr_core:configure_ui_elements' %}">
                                                        <i class="fa-regular fa-window-restore"></i>
                                                        Manage UI Elements
                                                    </a>
                                                    <a class="dropdown-item" href="{% url 'ndr_core:configure_images' %}">
                                                        <i class="fa-regular fa-images"></i>
                                                        Manage Page Images
                                                    </a>
                                                    <a class="dropdown-item" href="{% url 'ndr_core:configure_uploads' %}">
                                                        <i class="fa-regular fa-file-upload"></i>
                                                        Manage File Uploads
                                                    </a>
                                                    <a class="dropdown-item" href="{% url 'ndr_core:configure_translations' %}">
                                                        <i class="fa-regular fa-language"></i>
                                                        Manage Translations
                                                    </a>
                                                </div>
                                            </li>
                                        {% endif %}

                                        {% if page_is_editable %}
                                            <li class="nav-item dropdown">
                                                <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-expanded="false">
                                                    <i class="fa-regular fa-pen"></i>
                                                    Maintenance
                                                </a>
                                                <div class="dropdown-menu">
                                                    <a class="dropdown-item" href="{% url 'ndr_core:configure_messages' %}">
                                                        <i class="fa-regular fa-inbox"></i>
                                                        View Contact Messages
                                                    </a>
                                                    <a class="dropdown-item" href="{% url 'ndr_core:configure_corrections' %}">
                                                        <i class="fa-regular fa-check-double"></i>
                                                        View Correction Suggestions
                                                    </a>
                                                    <a class="dropdown-item" href="{% url 'ndr_core:search_statistics' %}">
                                                        <i class="fa-regular fa-chart-simple"></i>
                                                        View Search Statistics
                                                    </a>
                                                </div>
                                            </li>
                                        {% else %}
                                            <li class="nav-item{% if "/configure/messages/" in request.path %} active{% endif %}">
                                               <a class="nav-link" href="{% url 'ndr_core:configure_messages' %}">
                                                    <i class="fa-regular fa-inbox"></i>
                                                    Contact Messages
                                                </a>
                                            </li>
                                            <li class="nav-item{% if "/configure/corrections/" in request.path %} active{% endif %}">
                                               <a class="nav-link" href="{% url 'ndr_core:configure_corrections' %}">
                                                    <i class="fa-regular fa-check-double"></i>
                                                    Correction Suggestions
                                                </a>
                                            </li>
                                            <li class="nav-item{% if "/configure/statistics/" in request.path %} active{% endif %}">
                                               <a class="nav-link" href="{% url 'ndr_core:search_statistics' %}">
                                                    <i class="fa-regular fa-chart-simple"></i>
                                                    Search Statistics
                                                </a>
                                            </li>
                                        {% endif %}
                                        <li class="nav-item{% if "/configure/settings/" in request.path %} active{% endif %}">
                                            <a class="nav-link" href="{% url 'ndr_core:configure_settings' %}">
                                                <i class="fa-regular fa-gear"></i>
                                                Settings
                                            </a>
                                        </li>
                                        <li class="nav-item{% if "/help/" in request.path %} active{% endif %}">
                                            <a class="nav-link" href="{% url 'ndr_core:help' %}">
                                                <i class="fa-regular fa-question"></i>
                                                Help
                                            </a>
                                        </li>
                                        {% if user.is_authenticated %}
                                            <li class="nav-item">
                                                <a class="nav-link" href="{% url 'ndr_core:logout' %}">
                                                    <i class="fa-regular fa-right-from-bracket"></i>
                                                    Logout
                                                </a>
                                            </li>
                                        {% else %}
                                            <li class="nav-item">
                                                <a class="nav-link" href="{% url 'ndr_core:login' %}">
                                                    <i class="fa-regular fa-right-to-bracket"></i>
                                                    Login
                                                </a>
                                            </li>
                                        {% endif %}

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

                {% include 'ndr_core/messages.html' %}

                {% config_value 'under_construction' as is_under_construction %}
                {% if is_under_construction %}
                    <div class="alert alert-warning alert-dismissible alert-server" role="alert" >
                        Your Page is set to "under construction". Visitors are not able to see your page!
                    </div>
                {% endif %}

            </div>
        </div>  <!-- end of navigation -->

        <div class="container">
            {% block content %}
            {% endblock %}
        </div>

        <script src="{% static 'ndr_core/js/popper.min.js' %}"></script>
        <script src="{% static 'ndr_core/js/bootstrap.min.js' %}"></script>
        <script src="{% static 'fontawesomefree/js/fontawesome.js' %}"></script>
        <script src="{% static 'fontawesomefree/js/solid.js' %}"></script>
        <script src="{% static 'fontawesomefree/js/brands.js' %}"></script>
        <script src="{% static 'ndr_core/plugins/image-picker/image-picker.min.js' %}" ></script>

        {% block page_js %}
        {% endblock %}

    </body>
</html>
