{% extends "base.html" %}
{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}

{% load bootstrap %}
{% load i18n %}
{% load static %}

{% block page_js %}
  <script type="text/javascript" src="{% static 'users/users.js' %}"
          defer></script>
{% endblock %}

{% block content %}
  <h3>
    {% blocktrans trimmed with username=object.username %}
      Edit User <em>{{ username }}</em>
    {% endblocktrans %}
  </h3>

  <p>
    {% url 'users:change_password' object.username as change_password_url %}

    {% blocktrans trimmed %}
      Use the <a href='{{ change_password_url }}'>change password form
      </a> to change the password.
    {% endblocktrans %}
  </p>

  <form class="form form-update" method="post">
    {% csrf_token %}

    {{ form|bootstrap }}

    <input type="submit" class="btn btn-primary"
           value="{% trans "Save Changes" %}"/>
  </form>

  <div id="user-delete-confirm-dialog" class="modal" tabindex="-1"
       role="dialog">
    <div class="modal-dialog modal-dialog-centered" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title">
            {% blocktrans trimmed with username=object.username %}
              Delete user <em>{{ username }}</em> and all the user's files?
            {% endblocktrans %}
          </h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal"
                  aria-label="{% trans 'Close' %}">
          </button>
        </div>
        <div class="modal-body">
          <p>
            {% blocktrans trimmed %}
              Deleting a user account also removes all the files user's home
              directory. If you wish to keep these files, disable the user
              account instead.
            {% endblocktrans %}
          </p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-danger confirm">
            {% trans "Delete user and files" %}
          </button>
          <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
            {% trans "Cancel" %}
          </button>
        </div>
      </div>
    </div>
  </div>
{% endblock %}
