{% extends 'base.html' %}

{% block body %}
<div class="row">
	<div class="col">
		<p class="text-right">
			<a class="btn btn-primary" href="{{ url_for("mail.show") }}">
				<i class="fa fa-plus" aria-hidden="true"></i> {{_('New')}}
			</a>
		</p>
		<table class="table table-striped table-sm">
			<thead>
				<tr>
					<th scope="col">{{_('Name')}}</th>
					<th scope="col">{{_('Receiving addresses')}}</th>
					<th scope="col">{{_('Destinations')}}</th>
				</tr>
			</thead>
			<tbody>
				{% for mail in mails|sort(attribute="uid") %}
				<tr id="mail-{{ mail.uid }}">
					<th scope="row">
						<a href="{{ url_for("mail.show", uid=mail.uid) }}">
						{{ mail.uid }}
						</a>
					</th>
					<td>
						<ul class="m-0">
							{% for i in mail.receivers %}
							<li>{{ i }}</li>
							{% endfor %}
						</ul>
					</td>
					<td>
						<ul class="m-0">
							{% for i in mail.destinations %}
							<li>{{ i }}</li>
							{% endfor %}
						</ul>
					</td>
				</tr>
				{% endfor %}
			</tbody>
		</table>
	</div>
</div>
{% endblock %}
