{% extends "admin/base_site.html" %}

<!-- LOADING -->
{% load url from future %}
{% load i18n %}

<!-- BODYCLASS -->
{% block bodyclass %}grp-login{% endblock %}
{% block content-class %}{% endblock %}
{% block content_title %}{% endblock %}

<!-- EXTRAHEAD-->
{% block extrahead %}
{{ block.super }}
<script type="text/javascript">
    (function ($) {
        $(window).load(function () {
            $('#id_username').focus();
        });
    })(grp.jQuery);
</script>
{% endblock %}

<!-- BREADCRUMBS -->
{% block breadcrumbs %}{% endblock %}

<!-- CONTENT -->
{% block content %}
<div class="g-d-c g-d-12 g-centered">
    <style>
        #captcha input {
            width: 50px;
            height: 25px;
        }

        #captcha img {
            height: 25px;
        }
    </style>
    <div class="grp-login">
        {% if form.errors and not form.non_field_errors and not
        form.this_is_the_login_form.errors %}
        <p class="errornote">
            {% blocktrans count form.errors.items|length as counter %}Please
            correct the error below.{% plural %}Please correct the errors
            below.{% endblocktrans %}
        </p>
        {% endif %}
        {% if form.non_field_errors or form.this_is_the_login_form.errors %}
        {% for error in
        form.non_field_errors|add:form.this_is_the_login_form.errors %}
        <p class="errornote">{{ error }}</p>
        {% endfor %}
        {% endif %}
        {% if error_message %}<p class="errornote grp-login-errors">{{
        error_message }}</p>{% endif %}
        <form action="{{ app_path }}" method="post" id="grp-login-form">{%
            csrf_token %}
            <fieldset class="grp-module">
                <div class="grp-row">
                    <div class="l-2c-fluid l-d-4">
                        <div class="c-1"><label for="id_username"
                                                class="required">{% trans
                            'Username:' %}</label></div>
                        <div class="c-2">
                            <input type="text" name="username"
                                   id="id_username"/>
                            {% if not form.this_is_the_login_form.errors %}{{
                            form.username.errors }}{% endif %}
                        </div>
                    </div>
                </div>
                <div class="grp-row">
                    <div class="l-2c-fluid l-d-4">
                        <div class="c-1"><label for="id_password"
                                                class="required">{% trans
                            'Password:' %}</label></div>
                        <div class="c-2">
                            <input type="password" name="password"
                                   id="id_password"/>
                            <input type="hidden" name="this_is_the_login_form"
                                   value="1"/>
                            <input type="hidden" name="next"
                                   value="{{ next }}"/>
                            {% if not form.this_is_the_login_form.errors %}{{
                            form.password.errors }}{% endif %}
                        </div>
                    </div>
                </div>
                <div class="grp-row">
                    <div class="l-2c-fluid l-d-4">
                        <div class="c-1">
                            <label for="id_password" class="required">
                                Код:
                            </label>
                        </div>
                        <div class="c-2">
                            <div id="captcha">
                                {{ form.captcha }}
                                {% if not form.this_is_the_login_form.errors
                                %}{{ form.captcha.errors }}{% endif %}
                            </div>
                        </div>
                    </div>
                </div>
            </fieldset>
            <div class="grp-module grp-submit-row">
                <ul>
                    <li><input type="submit" class="grp-button"
                               value="{% trans 'Log in' %}"/></li>
                </ul>
            </div>
        </form>
    </div>
</div>
{% endblock %}
