{% extends "app.html" %}
{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}

{% load i18n %}

{% block subsubmenu %}
  <a class="btn btn-default" role="button" href="/rspamd/">
    {% trans "Manage Spam" %}
    <span class="fa fa-external-link"></span>
  </a>
  <a class="btn btn-default" role="button"
     href="{% url 'email:aliases' %}">
    {% trans "Manage Aliases" %}
  </a>
{% endblock %}

{% block extra_content %}
  {{ block.super }}

  <h3>{% trans "DNS Records" %}</h3>

  <p>
    {% blocktrans trimmed %}
      The following DNS records must be added manually on your primary domain
      for the mail server to work properly.
    {% endblocktrans %}
  </p>

  <div class="table-responsive">
    <table class="table table-sm">
      <thead>
        <tr>
          <th>{% trans "Domain" %}</th>
          <th>{% trans "TTL" %}</th>
          <th>{% trans "Class" %}</th>
          <th>{% trans "Type" %}</th>
          <th>{% trans "Priority" %}</th>
          <th>{% trans "Weight" %}</th>
          <th>{% trans "Port" %}</th>
          <th>{% trans "Host/Target/Value" %}</th>
        </tr>
      </thead>
      <tbody>
        {% for dns_entry in dns_entries %}
          <tr>
            <td>{{ dns_entry.domain|default_if_none:"" }}</td>
            <td>{{ dns_entry.ttl }}</td>
            <td>{{ dns_entry.class_ }}</td>
            <td>{{ dns_entry.type_ }}</td>
            <td>{{ dns_entry.priority }}</td>
            <td>{{ dns_entry.weight|default_if_none:"" }}</td>
            <td>{{ dns_entry.port|default_if_none:"" }}</td>
            <td class="text-break">{{ dns_entry.get_split_value }}</td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
{% endblock %}
