{% load i18n static %}
<!DOCTYPE html>
{% load vali_tags %}
{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
{% vali_config as VALI_CONFIG %}
<html lang="{{ LANGUAGE_CODE|default:'en' }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
<head>
    <title>
        {% block title %}
            {% trans 'Bootstrap Django Admin' %}
        {% endblock %}
    </title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="shortcut icon" type="image/png" sizes="16x16" href="">
    <link rel="stylesheet" type="text/css" href="{% static 'vali/assets/js/plugins/bootstrap-treeview.min.css' %}"/>
    <link rel="stylesheet" type="text/css" href="{% static '' %}vali/themes/{% VALI_THEME %}/main.css"/>
    <link rel="stylesheet" type="text/css" href="{% static 'vali/assets/vali.css' %}"/>
    <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
    {% block responsive %}
        <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
        <link rel="stylesheet" type="text/css" href="{% static 'admin/css/responsive.css' %}"/>
        {% if LANGUAGE_BIDI %}
            <link rel="stylesheet" type="text/css" href="{% static 'admin/css/responsive_rtl.css' %}"/>
        {% endif %}
    {% endblock %}
    {% block extrastyle %}{% endblock %}
    {% if LANGUAGE_BIDI %}
        <link rel="stylesheet" type="text/css"
              href="{% block stylesheet_rtl %}{% static 'admin/css/rtl.css' %}{% endblock %}"/>
    {% endif %}
    {% block extrahead %}{% endblock %}
    {% block blockbots %}
        <meta name="robots" content="NONE,NOARCHIVE"/>
    {% endblock %}
</head>
{% load i18n %}

<body class="app sidebar-mini rtl pace-done {% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}"
      data-admin-utc-offset="{% now 'Z' %}">
<div class="app-header">
    {% block branding %}{% trans 'Django Administration' %}{% endblock %}
    <a class="app-sidebar__toggle" href="#" data-toggle="sidebar"></a>
    <ul class="app-nav">
        {% block usertools %}

            <li class="dropdown">
                <a class="app-nav__item" href="#" data-toggle="dropdown"><i class="fa fa-cog fa-lg user-icon"></i>
                    {% block welcome-msg %}
                        {% if user.is_authenticated %}
                            <em>{% trans 'Welcome,' %}</em>
                        {% endif %}
                        <strong>{% firstof user.get_short_name user.get_username user.email %}</strong>
                    {% endblock %}
                </a>
                {% block userlinks %}
                    {% if user.is_authenticated %}
                    <ul class="dropdown-menu settings-menu dropdown-menu-right">
                        {% if site_url %}
                            <li><a class="dropdown-item" href="{{ site_url }}">
                                <i class="fa fa-globe fa"></i>{% trans 'View site' %}</a>
                            </li>
                        {% endif %}
                        {% if VALI_CONFIG.dashboard %}
                            <li><a class="dropdown-item" href="{{ VALI_CONFIG.dashboard.url }}">
                                <i class="fa fa-dashboard fa"></i>{% trans 'Dashboard' %}</a>
                            </li>
                        {% endif %}
                        {% if user.has_usable_password %}
                            <li><a class="dropdown-item" href="{% url 'admin:password_change' %}">
                                <i class="fa fa-key fa"></i>{% trans 'Change password' %}</a>
                            </li>
                        {% endif %}
                        <li>
                            <a class="dropdown-item" href="{% url 'admin:logout' %}">
                                <i class="fa fa-sign-out fa"></i>{% trans 'Log out' %}
                            </a>
                        </li>
                    </ul>
                    {% endif %}
                {% endblock %}
            </li>

        {% endblock %}
    </ul>
    {% block nav-global %}{% endblock %}
</div>

<div class="app-sidebar__overlay" data-toggle="sidebar"></div>
{% if not is_popup %}
    {% block appmenu %}
        {% if user.is_authenticated %}
            <div class="app-sidebar">
                <div class="app-sidebar__user">
                    {% if VALI_CONFIG.dashboard.url_image_profile %}
                        <img class="app-sidebar__user-avatar" src="{{ VALI_CONFIG.dashboard.url_image_profile }}"
                             width="45%" alt="{% trans 'User Image' %}">
                    {% else %}
                        <i class="fa fa-user-o fa-2x ml-1 mr-3"></i>
                    {% endif %}
                    <div>
                        <p class="app-sidebar__user-name">{% firstof user.get_short_name user.get_username %}</p>
                        <p class="app-sidebar__user-designation">{% firstof user.designation user.email %}</p>
                    </div>
                </div>
                <ul class="app-menu">
                    {% url 'admin:index' as adminurl %}
{#                    <li>#}
{#                        <a class="app-menu__item {% if request.path == adminurl %}active{% endif %}"#}
{#                           href="{{ adminurl }}">#}
{#                            <i class="app-menu__icon fa fa-database"></i>#}
{#                            <span class="app-menu__label">{% trans 'Log' %}</span>#}
{#                        </a>#}
{#                    </li>#}
                    {% if VALI_CONFIG.dashboard %}
                        <li>
                            <a class="app-menu__item {% if request.path == VALI_CONFIG.dashboard.url %}active{% endif %}"
                               href="{{ VALI_CONFIG.dashboard.url|default:adminurl }}">
                                <i class="app-menu__icon fa fa-database"></i>
                                <span class="app-menu__label">{{ VALI_CONFIG.dashboard.name|default:'Site administration' }}</span>
                            </a>
                        </li>
                    {% endif %}
                    {% get_menu request as app_list %}
                    {% if app_list %}
                        {% for app in app_list %}
                            <li class="treeview{% if app.app_url in request.path %} is-expanded{% endif %}">
                                <a class="app-menu__item" href="{{ app.app_url }}" data-toggle="treeview"
                                   title="{% blocktrans with name=app.name %}Models in the {{ name }} application{% endblocktrans %}">
                                    <i class="app-menu__icon fa fa-database"></i>
                                    <span class="app-menu__label">
                                        {{ app.name|slice:":15" }}
                                    </span>
                                    <i class="treeview-indicator fa fa-angle-right"></i>
                                </a>
                                <ul class="treeview-menu">
                                    {% for model in app.models %}
                                        {% if model.group_name %}
                                            <li class="treegroup{% if app.app_url in request.path %} is-expanded{% endif %}">
                                                <a class="app-menu__item" href="javascript:void(0)"
                                                   data-toggle="treegroup" title="{{ model.group_name }}">
                                                    <i class="app-menu__icon fa fa-dot-circle-o ml-2"></i>
                                                    <span class="app-menu__label">{{ model.group_name }}</span>
                                                    <i class="treegroup-indicator fa fa-angle-right"></i>
                                                </a>
                                                <ul class="treegroup-menu pl-0">
                                                    {% for submodel in model.models %}
                                                        {% if submodel.admin_url %}
                                                            <li>
                                                                <a class="treeview-item model-{{ submodel.object_name|lower }} {% if  submodel.admin_url in request.path %} active{% endif %}"
                                                                   href="{{ submodel.admin_url }}"><i
                                                                        class="icon fa fa-circle-o pl-3"></i> {{ submodel.name }}
                                                                </a>
                                                            </li>
                                                        {% else %}
                                                            <li>{{ submodel.name }}</li>
                                                        {% endif %}
                                                    {% endfor %}
                                                </ul>
                                            </li>
                                        {% else %}
                                            {% if model.admin_url %}
                                                <li>
                                                    <a class="treeview-item model-{{ model.object_name|lower }} {% if  model.admin_url in request.path %} active{% endif %}"
                                                       href="{{ model.admin_url }}"><i
                                                            class="icon fa fa-chevron-circle-right"></i> {{ model.name }}
                                                    </a>
                                                </li>
                                            {% else %}
                                                <li>{{ model.name }}</li>
                                            {% endif %}
                                        {% endif %}
                                    {% endfor %}
                                </ul>
                            </li>
                        {% endfor %}
                    {% endif %}
                </ul>
            </div>
        {% endif %}
    {% endblock %}
{% endif %}

<div id="container" class="{% if not is_popup %}app-content{% endif %}">
    {% if not is_popup %}
        <div class="app-title">
            <div>
                <h5 class="header_title">
                    {% url 'admin:index' as adminurl %}
                    {% if request.path == VALI_CONFIG.dashboard.url %}
                        <i class="fa fa-dashboard icon"></i>{{ VALI_CONFIG.dashboard.name }}
                        <p class="dashboard-subtitle">
                            {{ VALI_CONFIG.dashboard.subtitle }}
                        </p>
                    {% elif request.path == adminurl %}
                        <i class="fa fa-sliders icon"></i>Site administration
                        <p class="dashboard-subtitle">
                            Here you can view all log entries.
                        </p>
                    {% else %}
                        <i class="fa fa-sliders icon"></i>
                        {% firstof title opts.verbose_name_plural cl.opts.verbose_name_plural %}
                    {% endif %}
                </h5>

                {% block breadcrumbs %}
                    <ul class="app-breadcrumb breadcrumb">
                        <li class="breadcrumb-item"><i class="fa fa-home fa-lg"></i><a
                                href="{% url 'admin:index' %}">{% trans 'Home' %}</a></li>
                        {% if title %}
                            <li class="breadcrumb-item"><a href="#"> {{ title }} </a></li>
                        {% endif %}
                    </ul>
                {% endblock %}
            </div>
            {% block object-tools %}{% endblock %}
        </div>
    {% endif %}

    {% block messages %}
        <div class="col messagelist">
            {% if messages %}
                {% for message in messages %}
                    <div{% if message.tags %} class="alert alert-dismissible alert-{{ message.tags }}"{% endif %}>
                        <button class="close" type="button" data-dismiss="alert">×</button>
                        {{ message|capfirst }}
                    </div>
                {% endfor %}
            {% endif %}
        </div>
    {% endblock messages %}

    <div id="content" class="{% block coltype %}container{% endblock %}">
        {% block pretitle %}{% endblock %}
        {% block content_title %}{% endblock %}
        {% block content %}
            {{ content }}
        {% endblock %}
        {% block sidebar %}{% endblock %}
        <br class="clear"/>
    </div>

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

</div>
<script src="{% static 'vali/assets/js/jquery-3.2.1.min.js' %}"></script>
<script src="{% static 'vali/assets/js/popper.min.js' %}"></script>
<script src="{% static 'vali/assets/js/bootstrap.min.js' %}"></script>
<script src="{% static 'vali/assets/js/main.js' %}"></script>
<script src="{% static 'vali/assets/vali.js' %}"></script>
<script src="{% static 'vali/assets/js/plugins/pace.min.js' %}"></script>
<script src="{% static 'vali/assets/js/plugins/chart.js' %}"></script>

{% block extrafoot %}{% endblock %}
{% block loadcharts %}{% endblock %}

</body>
</html>
