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

{% block content %}
    <h1 class="mt-4">Aliases</h1>

    {% if alias_list %}
        <table class="table table-striped table-responsive-md btn-table">
            <thead>
            <tr>
                <th scope="col">Source</th>
                <th scope="col">Destination</th>
                <th scope="col">Actions</th>
            </tr>
            </thead>
            <tbody>

            {% for alias in alias_list %}
                <tr>
                    <th scope="row"><a
                            href="{% url 'multimail:edit_alias' alias.id %}">{{ alias.source_username }}@{{ alias.source_domain }}</a>
                    </th>
                    <th scope="row">{{ alias.destination_username }}@{{ alias.destination_domain }}</th>
                    <td><a href="{% url 'multimail:delete_alias' alias.id %}"
                           class="btn btn-danger btn-sm m-0">Delete</a></td>
                </tr>
            {% endfor %}

            </tbody>
            <tfoot>
            <tr>
                <th scope="row">
                </th>
                <th scope="row"></th>
                <td><a href="{% url 'multimail:new_alias' %}" class="btn btn-primary btn-sm m-0">Add</a>
                </td>
            </tr>
            </tfoot>
        </table>
    {% else %}
        <p>You haven't set up any aliases yet.</p>
    {% endif %}

{% endblock %}