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

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

{% block description %}

{% for paragraph in description %}
<p>{{ paragraph|safe }}</p>
{% endfor %}

<p>
    {% url 'config:index' as index_url %}
    {% blocktrans trimmed with domain_name=domain_name %}
    The Tahoe-LAFS server domain is set to <b>{{ domain_name }}</b>.
    Changing the FreedomBox domain name needs a reinstall of
    Tahoe-LAFS and you WILL LOSE DATA. You can access Tahoe-LAFS at
    <a href="https://{{domain_name}}:5678">https://{{domain_name}}:5678</a>.
    {% endblocktrans %}
</p>
{% endblock %}

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

  <h4>{% trans "Local introducer" %}</h4>
  <table class="table table-bordered local-introducers">
    <thead>
      <tr>
        <th>{% trans "Pet Name" %}</th>
        <th> furl </th>
      </tr>
    </thead>
    <tr>
      <td class="introducer-pet-name">{{ local_introducer.0 }}</td>
      <td class="introducer-furl">{{ local_introducer.1 }}</td>
    </tr>
  </table>

  <form class="form form-add-introducer" method="post"
        action="{% url 'tahoe:add-introducer' %}">
    {% csrf_token %}
    <h4>{% trans "Add new introducer" %}</h4>

    <div class="form-group">
      <label>{% trans "Pet Name" %}:</label>
      <input type="text" class="form-control" name="pet_name">
    </div>
    <div class="form-group">
      <label>furl:</label>
      <textarea class="form-control" rows="5" name="furl"></textarea>
    </div>
    <input type="submit" class="btn btn-primary"
           value="{% trans "Add" %}"/>
  </form>

  <br/>

  <h4>{% trans "Connected introducers" %}</h4>
  <table class="table table-bordered connected-introducers">
    <thead>
      <tr>
        <th>{% trans "Pet Name" %}</th>
        <th> furl </th>
      </tr>
    </thead>
    {% for introducer, furl in introducers %}
      <tr>
        <td class="introducer-pet-name">{{ introducer }}</td>
        <td class="introducer-furl">{{ furl }}</td>
        <td class="introducer-operations">
          <form class="form form-remove" method="post"
                action="{% url 'tahoe:remove-introducer' introducer %}">
            {% csrf_token %}
            <button type="submit" class="btn btn-danger">
              {% trans "Remove" %}
            </button>
          </form>
        </td>
      </tr>
    {% endfor %}
  </table>

{% endblock %}
