{% extends 'django_outbox/base.html' %}

{% block content %}
  {% if mails %}
    <table class="outbox-table">
      <thead>
        <tr>
          <th>subject</th>
          <th></th>
          <th>from</th>
          <th>to</th>
          <th>when</th>
        </tr>
      </thead>
      <tbody>
        {% for mail in mails %}
          <tr>
            <td>
              {{ mail.subject }}
            </td>
            <td>
              {% for content_type in mail.body %}
                <a href="{% url 'mail' id=mail.id %}?content_type={{ content_type }}">
                  {{ content_type }}
                </a>
              {% endfor %}
            </td>
            <td>{{ mail.from_address }}</td>
            <td>{{ mail.to }}</td>
            <td>{{ mail.when }}</td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
  {% else %}
    <div class="outbox-empty">Outbox is empty.</div>
  {% endif %}
{% endblock content %}
