{% extends 'oscar/dashboard/layout.html' %}


{% load i18n %}

{% block title %}
    {% trans "Emails" %} | {{ block.super }}
{% endblock %}

{% block breadcrumbs %}
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a></li>
            <li class="breadcrumb-item active" aria-current="page">{% trans "Emails" %}</li>
        </ol>
    </nav>
{% endblock %}

{% block header %}
    <div class="page-header">
        <h1>{% trans "Emails" %}</h1>
    </div>
{% endblock header %}

{% block dashboard_content %}
    <table class="table table-striped table-bordered table-hover">
        <caption><i class="fas fa-envelope"></i> {% trans "Emails" %}</caption>
        {% if commtypes %}
            <thead>
                <tr>
                    <th>{% trans "Code" %}</th>
                    <th>{% trans "Name" %}</th>
                    <th>{% trans "Category" %}</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                {% for commtype in commtypes %}
                    <tr>
                        <td><a href="{% url 'dashboard:comms-update' commtype.code %}">{{ commtype.code }}</a></td>
                        <td>{{ commtype.name }}</td>
                        <td>{{ commtype.category }}</td>
                        <td>
                            <a class="btn btn-success" href="{% url 'dashboard:comms-update' commtype.code %}">{% trans "Edit" %}</a>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>

        {% else %}
            <tbody>
                <tr><td>{% trans "There are no defined emails to edit." %}</td></tr>
            </tbody>
        {% endif %}
    </table>
    {% include "oscar/dashboard/partials/pagination.html" %}

{% endblock dashboard_content %}
