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

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

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

            {% for domain in domain_list %}
                <tr>
                    <th scope="row"><a href="{% url 'multimail:edit_domain' domain.id %}">{{ domain.domain }}</a></th>
                    <td><a href="{% url 'multimail:delete_domain' domain.id %}" class="btn btn-danger btn-sm m-0">Delete</a></td>
                </tr>
            {% endfor %}

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

{% endblock %}