{% extends "postorius/base.html" %}
{% load i18n %}

{% block head_title %}
{% trans 'Domains' %} - {{ block.super }}
{% endblock %}

{% block content %}

    <div class="page-header">
        <h1>{% trans 'Domains' %}</h1>
    </div>

    <p class="text-right"><a class="btn btn-success" href="{% url 'domain_new' %}">{% trans 'Add Domain' %}</a></p>

    {% if domains %}
    <div class="table-responsive">
        <table class="table table-bordered table-striped">
            <thead>
                <tr>
                    <th>{% trans 'Mail Host' %}</th>
                    <th>{% trans 'Description' %}</th>
                    <th>{% trans 'Alias Domain' %}</th>
                    <th>{% trans 'Web Host' %}</th>
                    <th>{% trans 'Action' %}</th>
                </tr>
            </thead>
            <tbody>
                {% for domain in domains %}
                    <tr>
                        <td>{{ domain.mail_host }}</td>
                        <td>{% if domain.description %}{{ domain.description }}{% endif %}</td>
                        <td>{% if domain.alias_domain %}{{ domain.alias_domain }}{% endif %}</td>
                        <td>{{ domain.site.name }} ({{ domain.site.domain }})</td>
                        <td>
                            <a href="{% url 'domain_template_list' domain.mail_host %}" class="btn btn-xs btn-primary">{% trans 'Templates' %}</a>
                            <a href="{% url 'domain_edit' domain.mail_host %}" class="btn btn-xs btn-primary">{% trans 'Edit' %}</a>
                            <a href="{% url 'domain_delete' domain.mail_host %}" class="btn btn-xs btn-danger">{% trans 'Delete' %}</a>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
    {% else %}
    <p>No domains yet.</p>
    {% endif %}

{% endblock content %}
