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

{% if not is_popup %}
  {% block breadcrumbs %}
    {% spaceless %}
      <nav class="breadcrumb">
        {% breadcrumbs_icon opts %}
        <a class="breadcrumb-item" href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>
        <a href="{% url opts|admin_urlname:'change' original.pk|admin_urlquote %}" class="breadcrumb-item">{{ original|truncatewords:"18" }}</a>
        <span class="breadcrumb-item active">{% trans 'Change password' %}</span>
      </nav>
    {% endspaceless %}
  {% endblock %}
{% endif %}


{% block messages-extra %}
 {% if form.errors %}
    {% if form.errors|length == 1 %}{% translate "Please correct the error below." as error_msg %}{% else %}{% translate "Please correct the errors below." as error_msg  %}{% endif %}
    {% include 'admin/message.html' with message=error_msg title="error" only %}
 {% endif %}
{% endblock messages-extra %}

{% block content %}
  <div id="content-main" class="container-fluid">
    <form action="{{ form_url }}" class="main-form" method="post" id="{{ opts.model_name }}_form" novalidate>{% csrf_token %}{% block form_top %}{% endblock %}
      {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
      <input type="text" name="username" value="{{ original.get_username }}" class="d-none hidden">

      <fieldset class="module aligned">
        <div class="row align-items-stretch">
          <div class="col main-col module-left-section py-4 px-4 bg-body-tertiary">
            <h3>{% translate 'Change password' %}</h3>
            <div class="description">
              {% blocktrans with username=original %}Enter a new password for the user <strong>{{ username }}</strong>.{% endblocktrans %}
            </div>
          </div>

          <div class="col-xs-12 col-sm-8 col-lg-8 col-xl-9 module-right-section py-4 px-4">

            <div class="form-group mb-3 {% if form.password1.errors %}has-error{% endif %}">
              <label for="id_password1" class="form-label required">{% trans 'Password' %}:</label>
              {{ form.password1|add_class:"form-control form-control-lg" }}
              {{ form.password1.errors }}
              {% if form.password1.help_text %}
              <div class="help form-text text-muted"{% if form.password1.id_for_label %} id="{{ form.password1.id_for_label }}_helptext">{% endif %}{{ form.password1.help_text|safe }}</div>
              {% endif %}
            </div>

            <div class="form-group mb-3 {% if form.password2.errors %}has-error{% endif %}">
              <label for="id_password2" class="form-label required">{% trans 'Password (again)' %}:</label>
              {{ form.password2|add_class:"form-control form-control-lg" }}
              {{ form.password2.errors }}
              {% if form.password2.help_text %}
              <div class="help form-text text-muted"{% if form.password2.id_for_label %} id="{{ form.password2.id_for_label }}_helptext"{% endif %}>{{ form.password2.help_text|safe }}</div>
              {% endif %}
            </div>

          </div>
        </div>
      </fieldset>

      <div class="form-actions py-4 px-4 text-end">
        <input type="submit" value="{% trans 'Change password' %}" class="btn btn-primary" />
      </div>
    </form>
  </div>
{% endblock %}
