{% extends "musician/mail_base.html" %}
{% load i18n %}

{% block tabcontent %}
<div class="tab-pane fade show active" id="mailboxes" role="tabpanel" aria-labelledby="mailboxes-tab">
  <table class="table service-list">
    <colgroup>
      <col span="1" style="width: 25%;">
      <col span="1" style="width: 10%;">
      <col span="1" style="width: 65%;">
    </colgroup>
    <thead class="thead-dark">
      <tr>
        <th scope="col">{% trans "Name" %}</th>
        <th scope="col">{% trans "Filtering" %}</th>
        <th scope="col">{% trans "Addresses" %}</th>
      </tr>
    </thead>
    <tbody>
      {% for mailbox in object_list %}
      {# <!-- Exclude (don't render) inactive mailboxes -->#}
      {% if mailbox.is_active %}
      <tr>
        <td>
          <a href="{% url 'musician:mailbox-update' mailbox.id %}">{{ mailbox.name }}</a>
          <a class="roll-hover btn btn-outline-warning" href="{% url 'musician:mailbox-password' mailbox.id %}">
            <i class="fas fa-key"></i> {% trans "Update password" %}</a>
        </td>
        <td>{{ mailbox.filtering }}</td>
        <td>
          {% for addr in mailbox.addresses %}
            <a href="{% url 'musician:address-update' addr.data.id %}">
              {{ addr.full_address_name }}
            </a><br/>
          {% endfor %}
        </td>
      </tr>
      {% endif %}{# <!-- /is_active --> #}
      {% endfor %}
    </tbody>
    {% include "musician/components/table_paginator.html" %}
  </table>
  <a class="btn btn-primary mt-4 mb-4" href="{% url 'musician:mailbox-create' %}">{% trans "New mailbox" %}</a>

</div>
{% endblock %}
