{% load i18n admin_static jet_tags %}
{% get_current_language_bidi as LANGUAGE_BIDI %}{% format_current_language LANGUAGE_CODE as LANGUAGE_CODE %}{% get_current_theme as THEME %}{% get_current_language as LANGUAGE_CODE %}
{% block html %}<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
<head>
    <title>{% block title %}{% endblock %}</title>
    <meta name="copyright" content="geex-arts.com">
    {% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE" />{% endblock %}

    <link href="{% static "jet/vendor/select2/css/select2.min.css" %}" rel="stylesheet" />
    <link href="{% static "jet/vendor/jquery-ui/jquery-ui.min.css" %}" rel="stylesheet" />
    <link href="{% static "jet/vendor/jquery-ui-timepicker/jquery.ui.timepicker.css" %}" rel="stylesheet" />
    <link href="{% static "jet/css/icons/style.css" %}" rel="stylesheet" />
    <link href="{% static "jet/css/themes/"|add:THEME|add:"/base.css" %}" rel="stylesheet" />
    <link href="{% static "jet/css/themes/"|add:THEME|add:"/select2.theme.css" %}" rel="stylesheet" />
    <link href="{% static "jet/css/themes/"|add:THEME|add:"/jquery-ui.theme.css" %}" rel="stylesheet" />
    <!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="{% block stylesheet_ie %}{% static "admin/css/ie.css" %}{% endblock %}" /><![endif]-->
    {% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% static "admin/css/rtl.css" %}{% endblock %}" />{% endif %}
    {% block extrastyle %}{% endblock %}

    <script type="text/javascript">window.__admin_media_prefix__ = "{% filter escapejs %}{% static "admin/" %}{% endfilter %}";</script>
    <script type="text/javascript">window.__admin_utc_offset__ = "{% filter escapejs %}{% now "Z" %}{% endfilter %}";</script>
    <script type="text/javascript" charset="utf-8">
        var DATE_FORMAT = "{% get_date_format %}";
        var TIME_FORMAT = "{% get_time_format %}";
        var DATETIME_FORMAT = "{% get_datetime_format %}";
    </script>
    <script type="text/javascript" src="{% url 'jet:jsi18n' %}"></script>
    <script src="{% static "jet/vendor/jquery/jquery-1.11.3.min.js" %}"></script>
    <script src="{% static "jet/vendor/jquery-ui/jquery-ui.min.js" %}"></script>
    <script src="{% static "jet/vendor/jquery-ui-timepicker/jquery.ui.timepicker.js" %}"></script>
    <script src="{% static "jet/vendor/select2/js/select2.full.min.js" %}"></script>
    {% if LANGUAGE_CODE|slice:":2" != 'en' %}
        {% with "jet/vendor/jquery-ui/i18n/datepicker-"|add:LANGUAGE_CODE|add:".js" as url %}
            <script src="{% static url %}"></script>
        {% endwith %}
        {% with "jet/vendor/jquery-ui-timepicker/i18n/jquery.ui.timepicker-"|add:LANGUAGE_CODE|add:".js" as url %}
            <script src="{% static url %}"></script>
        {% endwith %}
        {% with "jet/vendor/select2/js/i18n/"|add:LANGUAGE_CODE|add:".js" as url %}
            <script src="{% static url %}"></script>
        {% endwith %}
    {% endif %}
    <script type="text/javascript" charset="utf-8">
        var jet = jet || {};
        jet.jQuery = jQuery.noConflict(true);
    </script>
    <script src="{% static "jet/js/main.min.js" %}"></script>
    <script src="{% static "jet/js/select2.jet.min.js" %}"></script>
    {% block extrahead %}{% endblock %}
</head>
<body class="{% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}">
    {% block body %}
        {% if not is_popup %}
            <div id="container" class="container">
        {% endif %}

            <div class="content">
                {% if not is_popup %}
                    {% block header %}
                        <div id="header" class="top">
                            <div class="top-right">
                                {% block top-right %}{% endblock %}
                                {% block usertools %}
                                    {% if user.is_active and user.is_staff %}
                                        <ul class="top-user-tools" id="user-tools">
                                            <li class="top-user-tools-welcome-msg">
                                                <span class="top-user-tools-welcome-msg-arrow icon-arrow-down"></span>
                                                {% block welcome-msg %}
                                                    {% firstof user.get_short_name user.get_username %}
                                                {% endblock %}
                                            </li>

                                            {% block userlinks %}
                                                {% if user.has_usable_password %}
                                                    <li class="top-user-tools-user-link">
                                                        <span class="top-user-tools-user-link-icon icon-key"></span> <a href="{% url 'admin:password_change' %}">{% trans 'Change password' %}</a>
                                                    </li>
                                                {% endif %}
                                                <li class="top-user-tools-user-link">
                                                    <span class="top-user-tools-user-link-icon icon-exit"></span> <a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>
                                                </li>
                                            {% endblock %}
                                        </ul>
                                    {% endif %}
                                {% endblock %}
                            </div>
                            <div class="top-breadcrumbs">
                                {% format_breadcrumbs %}
                                    {% block breadcrumbs %}
                                        <div class="breadcrumbs">
                                            <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
                                            {% if title %} &rsaquo; {{ title }}{% endif %}
                                        </div>
                                    {% endblock %}
                                {% endformat_breadcrumbs %}
                            </div>
                        </div>
                    {% endblock %}
                {% endif %}


                {% block messages %}
                    {% if messages %}
                        <ul class="messagelist">
                            {% for message in messages %}
                                <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message|capfirst }}</li>
                            {% endfor %}
                        </ul>
                    {% endif %}
                {% endblock messages %}

                <div id="content" class="cf {% block coltype %}colM{% endblock %}">
                    {% block pretitle %}{% endblock %}
                    {% if is_popup %}
                        {% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
                    {% endif %}
                    <div class="context-sidebar">
                        {% block sidebar %}{% endblock %}
                    </div>
                    {% block content %}
                    {% block object-tools %}{% endblock %}
                    {{ content }}
                    {% endblock %}
                </div>

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

        {% if not is_popup %}
            <div class="sidebar">
                <div class="sidebar-menu-wrapper">
                    <div id="branding">
                        {% block branding %}{% endblock %}
                    </div>
                    <ul class="sidebar-menu">
                        {% if user.is_active and user.is_staff %}
                            <li class="sidebar-menu-item">
                                <span class="sidebar-menu-item-icon icon-data"></span> <a href="{% url 'admin:index' %}" class="sidebar-menu-item-link">{% trans 'Home' %}</a>
                            </li>
                        {% endif %}
                        {% if site_url %}
                            <li class="sidebar-menu-item">
                                <span class="sidebar-menu-item-icon icon-open-external"></span> <a href="{{ site_url }}" class="sidebar-menu-item-link">{% trans 'View site' %}</a>
                            </li>
                        {% endif %}
                        {% if user.is_active and user.is_staff %}
                            {% get_menu as app_list %}
                            {% if app_list.apps or app_list.pinned_apps %}
                                <form action="{% url "jet:toggle_application_pin" %}" method="POST" id="toggle-application-pin-form">
                                    {% csrf_token %}
                                    <input type="hidden" name="app_label">
                                </form>
                                <li class="sidebar-menu-item no-horizontal-padding">
                                    <span class="sidebar-menu-item-title">{% trans 'Applications' %}</span>
                                    <ul class="sidebar-menu-item-list apps-list-pinned">
                                        {% for app in app_list.pinned_apps %}
                                            <li class="sidebar-menu-item-list-item app-item pinned app-{{ app.app_label }}" data-app-label="{{ app.app_label }}">
                                                <a href="{{ app.app_url }}" class="sidebar-menu-item-list-item-link popup-item-link" data-popup-item-id="sidebar-popup-item-{{ app.app_label }}">
                                                    <span class="sidebar-menu-item-list-item-arrow icon-arrow-right"></span>
                                                    <span class="sidebar-menu-item-list-item-link-pin icon-star pin-toggle"></span>
                                                    <span class="sidebar-menu-item-list-item-link-unpin icon-cross pin-toggle"></span>
                                                    {% if app.name != app.app_label|capfirst|escape %}{{ app.name }}{% else %}{% trans app.app_label as app_label %}{{ app_label|capfirst|escape }}{% endif %}
                                                </a>
                                            </li>
                                        {% endfor %}
                                    </ul>
                                    <a href="#" class="sidebar-menu-item-action apps-hide"></a>
                                    <ul class="sidebar-menu-item-list apps-list">
                                        {% for app in app_list.apps %}
                                            <li class="sidebar-menu-item-list-item app-item app-{{ app.app_label }}" data-app-label="{{ app.app_label }}">
                                                <a href="{{ app.app_url }}" class="sidebar-menu-item-list-item-link popup-item-link" data-popup-item-id="sidebar-popup-item-{{ app.app_label }}">
                                                    <span class="sidebar-menu-item-list-item-arrow icon-arrow-right"></span>
                                                    <span class="sidebar-menu-item-list-item-link-pin icon-star pin-toggle"></span>
                                                    <span class="sidebar-menu-item-list-item-link-unpin icon-cross pin-toggle"></span>
                                                    {% if app.name != app.app_label|capfirst|escape %}{{ app.name }}{% else %}{% trans app.app_label as app_label %}{{ app_label|capfirst|escape }}{% endif %}
                                                </a>
                                            </li>
                                        {% endfor %}
                                    </ul>
                                </li>
                            {% endif %}
                            <li class="sidebar-menu-item no-horizontal-padding">
                                <div class="dialog-confirm" id="bookmarks-add-dialog" title="{% trans "Add bookmark" %}">
                                    <form action="{% url "jet:add_bookmark" %}" method="POST" id="bookmarks-add-form">
                                        {% csrf_token %}
                                        <p>{% trans "Title" %}:</p>
                                        <input type="text" name="title" class="fill_width">
                                        <p>{% trans "URL" %}:</p>
                                        <input type="text" name="url" class="fill_width">
                                    </form>
                                </div>
                                <form action="{% url "jet:remove_bookmark" %}" method="POST" id="bookmarks-remove-form">
                                    {% csrf_token %}
                                    <input type="hidden" name="id">
                                </form>
                                <div class="dialog-confirm" id="bookmarks-remove-dialog" title="{% trans "Delete bookmark" %}">
                                    <p>{% trans "Are you sure want to delete this bookmark?" %}</p>
                                </div>
                                <span class="sidebar-menu-item-title">
                                    <a href="#" class="sidebar-menu-item-title-icon bookmarks-add" title="{% trans "Add bookmark" %}"{% if title %} data-title="{{ title }}"{% endif %}><span class="icon-add"></span></a>
                                    {% trans 'bookmarks' %}
                                </span>
                                <ul class="sidebar-menu-item-list bookmarks-list">
                                    {% get_bookmarks user as bookmarks %}
                                    {% for bookmark in bookmarks %}
                                        <li class="sidebar-menu-item-list-item">
                                            <a href="{{ bookmark.url }}" class="sidebar-menu-item-list-item-link">
                                                <span class="sidebar-menu-item-list-item-link-remove bookmarks-remove" data-bookmark-id="{{ bookmark.pk }}">{% trans "Remove" %}</span>
                                                {{ bookmark.title }}
                                            </a>
                                        </li>
                                    {% endfor %}
                                    <li class="sidebar-menu-item-list-item empty">
                                        <a href="" class="sidebar-menu-item-list-item-link">
                                            <span class="sidebar-menu-item-list-item-link-remove bookmarks-remove">{% trans "Remove" %}</span>
                                        </a>
                                    </li>
                                </ul>
                            </li>
                            {% url 'django-admindocs-docroot' as docsroot %}
                            {% if docsroot %}
                                <li class="sidebar-menu-item">
                                    <span class="sidebar-menu-item-icon icon-book"></span> <a href="{{ docsroot }}" class="sidebar-menu-item-link">{% trans 'Documentation' %}</a>
                                </li>
                            {% endif %}
                            {% block nav-global %}{% endblock %}
                        {% endif %}
                    </ul>
                </div>
                <div class="sidebar-copyright">powered by DJANGO JET</div>
            </div>

            {% if app_list %}
                <div class="sidebar-popup-container">
                    <div class="sidebar-popup">
                        {% for app in app_list.apps|add:app_list.pinned_apps %}
                            <div class="sidebar-popup-item" id="sidebar-popup-item-{{ app.app_label }}">
                                <div class="sidebar-popup-title">
                                    {% if app.name != app.app_label|capfirst|escape %}{{ app.name }}{% else %}{% trans app.app_label as app_label %}{{ app_label|capfirst|escape }}{% endif %}
                                </div>

                                <input class="sidebar-popup-search" placeholder="Search...">

                                <ul class="sidebar-popup-list">
                                    <li class="sidebar-popup-list-item app-{{ app.app_label }}{{ app.current|yesno:" current," }}">
                                        <a href="{{ app.app_url }}" class="sidebar-popup-list-item-link">{% trans 'Application page' %}</a>
                                    </li>

                                    {% for model in app.models %}
                                        <li class="sidebar-popup-list-item model-{{ model.object_name|lower }}{{ model.current|yesno:" current," }}">
                                            {% if model.admin_url %}
                                                <a href="{{ model.admin_url }}" class="sidebar-popup-list-item-link">{{ model.name }}</a>
                                            {% else %}
                                                {{ model.name }}
                                            {% endif %}
                                        </li>
                                    {% endfor %}
                                </ul>
                            </div>
                        {% endfor %}
                    </div>
                    <div class="sidebar-popup-background"></div>
                </div>
            {% endif %}
            </div>
        {% endif %}
    {% endblock %}
</body>
</html>{% endblock %}