{% extends "admin/base_site.html" %}
{% load i18n static %}
{% load admin_urls %}

{% block scripts %}
    {{ block.super }}
    <script src="{% url 'admin:jsi18n' %}"></script>
{% endblock %}


{% block bodyclass %}
    {{ block.super }} {{ opts.app_label }}-{{ opts.model_name }} change-form
{% endblock %}

{% if not is_popup %}
    {% block breadcrumbs %}
        <div class="text-sm breadcrumbs">
            <ul>
                <li><a href="{% url 'admin:index' %}" class="link link-hover">{% trans 'Dashboard' %}</a></li>
                <li>
                    <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
                </li>
                <li>
                    <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>
                </li>
                <li>
                    <a
                            href="{% url opts|admin_urlname:'change' original.pk|admin_urlquote %}">{{ original|truncatewords:"18" }}</a>
                </li>
                <li>
                    <a class="disabled" href="#">{% translate 'Change password' %}</a>
                </li>
            </ul>
        </div>
    {% endblock %}
{% endif %}
{% block content %}
    <div class="p-3 ">
        <div class="card">
            <div class="bg-base-100 div-card-body-forms rounded-sm card-body" id="content-main">
                <form{% if form_url %} action="{{ form_url }}"{% endif %} method="post" id="{{ opts.model_name }}_form">
                    {% csrf_token %}{% block form_top %}{% endblock %}
                    <input type="text" name="username" value="{{ original.get_username }}" style="display: none">
                    <div>
                        {% if is_popup %}<input type="hidden" name="_popup" value="1">{% endif %}
                        {% if form.errors %}
                            <p class="error-line errornote">
                                {% if form.errors.items|length == 1 %}
                                    {% translate "Please correct the error below." %}{% else %}
                                    {% translate "Please correct the errors below." %}{% endif %}
                            </p>
                        {% endif %}

                        <p>{% blocktranslate with username=original %}Enter a new password for the user
                            <strong>{{ username }}</strong>.{% endblocktranslate %}</p>


                        <fieldset class="form-group p-2">

                            <div class="form-group">
                                {{ form.password1.errors }}
                                {{ form.password1.label_tag }} {{ form.password1 }}
                                {% if form.password1.help_text %}
                                    <div class="form-text text-sm text-muted">{{ form.password1.help_text|safe }}</div>
                                {% endif %}
                            </div>

                            <div class="form-group mt-3">
                                {{ form.password2.errors }}
                                {{ form.password2.label_tag }} {{ form.password2 }}
                                {% if form.password2.help_text %}
                                    <div class="form-text text-muted text-sm">{{ form.password2.help_text|safe }}</div>
                                {% endif %}
                            </div>

                        </fieldset>

                        <div class="row m-2">
                            <input type="submit" value="{% translate 'Change password' %}"
                                   class="default btn btn-primary">
                        </div>

                    </div>
                </form>
            </div>
        </div>
    </div>
{% endblock %}
