{% load i18n static jazzmin %}
<!DOCTYPE html>
{% get_current_language as LANGUAGE_CODE %}
{% get_current_language_bidi as LANGUAGE_BIDI %}
{% get_jazzmin_settings as jazzmin_settings %}
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="x-ua-compatible" content="ie=edge">

    <title>{% block title %}{% endblock %}</title>

    <!-- Font Awesome Icons -->
    <link rel="stylesheet" href="{% static "adminlte/plugins/fontawesome-free/css/all.min.css" %}">
    <!-- Theme style -->
    <link rel="stylesheet" href="{% static "adminlte/css/adminlte.min.css" %}">
    <!-- Custom fixes for django -->
    <link rel="stylesheet" href="{% static "jazzmin/css/django.css" %}">

    <!-- Google Font: Source Sans Pro -->
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
    {% block extrastyle %} {% endblock %}

    {% block extrahead %} {% endblock %}
</head>
<body class="hold-transition login-page">

<div class="login-box">
    <div class="login-logo">
        <a href="{% url 'admin:index' %}">
            <b>{{ jazzmin_settings.site_header }}</b>
        </a>
    </div>

    <div class="card">
        <div class="card-body login-card-body">
            <p class="login-box-msg">{{ jazzmin_settings.welcome_sign }}</p>
            <form action="{{ app_path }}" method="post">
                {% csrf_token %}
                {% if form.errors %}

                    {% if form.username.errors %}
                    <div class="callout callout-danger">
                        <p>Username: {{ form.username.errors|join:', ' }}</p>
                    </div>
                    {% endif %}

                    {% if form.password.errors %}
                    <div class="callout callout-danger">
                        <p>Password: {{ form.password.errors|join:', ' }}</p>
                    </div>
                    {% endif %}

                    {% if form.non_field_errors %}
                    <div class="callout callout-danger">
                        {% for error in form.non_field_errors %}
                            <p>{{ error }}</p>
                        {% endfor %}
                    </div>
                    {% endif %}

                {% endif %}
                <div class="input-group mb-3">
                    <input type="text" name="username" class="form-control" placeholder="{% trans 'username' %}" required>
                    <div class="input-group-append">
                        <div class="input-group-text">
                            <span class="fas fa-user"></span>
                        </div>
                    </div>
                </div>
                <div class="input-group mb-3">
                    <input type="password" name="password" class="form-control" placeholder="{% trans 'password' %}" required>
                    <div class="input-group-append">
                        <div class="input-group-text">
                            <span class="fas fa-lock"></span>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class=col-12>
                        <button type="submit" class="btn btn-primary btn-block">{% trans "Log in" %}</button>
                    </div>
                </div>
            </form>

        </div>

    </div>
</div>

<!-- jQuery -->
<script src="{% static 'adminlte/plugins/jquery/jquery.min.js' %}"></script>
<!-- Bootstrap 4 -->
<script src="{% static 'adminlte/plugins/bootstrap/js/bootstrap.bundle.min.js' %}"></script>
<!-- AdminLTE App -->
<script src="{% static 'adminlte/js/adminlte.min.js' %}"></script>

</body>
</html>
