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

{% load bootstrap %}
{% load i18n %}
{% load extras %}

{% block configuration %}
  {{ block.super }}

  <h3>{% trans "Manage Passwords" %}</h3>

  <div class="btn-toolbar">
    <a href="{% url 'bepasty:add' %}" class="btn btn-default"
       role="button" title="{% trans 'Add password' %}">
      {% icon 'plus' %}
      {% trans 'Add password' %}
    </a>
  </div>

  {% if not passwords %}
    <p>{% trans 'No passwords currently configured.' %}</p>
  {% else %}
    <div class="table-responsive">
      <table class="table" id="passwords-list">
        <thead>
          <tr>
            <th>{% trans "Password" %}</th>
            <th>{% trans "Permissions" %}</th>
            <th>{% trans "Comment" %}</th>
            <th></th>
          </tr>
        </thead>

        <tbody>
          {% for password in passwords %}
            <tr id="password-{{ password.password }}" class="password">
              <td class="password-password">{{ password.password }}</td>
              <td class="password-permissions">{{ password.permissions }}</td>
              <td class="password-comment">{% trans password.comment %}</td>
              <td class="password-operations">
                <form class="form form-inline" method="post"
                      action="{% url 'bepasty:remove' password.password %}">
                  {% csrf_token %}
                  <button class="password-remove btn btn-sm btn-default"
                          type="submit">
                    {% icon 'trash-o' %}
                  </button>
                </form>
              </td>
            </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  {% endif %}

{% endblock %}
