{% extends request.ajax ? 'layout_blank.html.twig' : 'layout_default.html.twig' %}

{% set active_menu = 'activity' %}

{% block meta_title %}{{ email.subject }}{% endblock %}

{% block breadcrumbs %}
    <ol class="breadcrumb">
        <li class="breadcrumb-item">
            <a href="{{ '/'|alink }}">
                <svg class="icon">
                    <use xlink:href="#home" />
                </svg>
            </a>
        </li>
        <li class="breadcrumb-item">
            <a href="{{ 'email/history'|alink }}">{{ 'Email history'|trans }}</a>
        </li>
        <li class="breadcrumb-item active" aria-current="page">{{ email.subject }}</li>
    </ol>
{% endblock %}

{% block content %}
<div class="card">
    <div class="card-body">
        <h5>{{ email.subject }}</h5>
    </div>

    <table class="table card-table table-vcenter table-striped text-nowrap">
        <tbody>
            <tr>
                <td class="w-50 text-end">{{ 'From'|trans }}:</td>
                <td>{{ email.sender }}</td>
            </tr>

            <tr>
                <td class="text-end">{{ 'To'|trans }}:</td>
                <td>{{ email.recipients }}</td>
            </tr>

            <tr>
                <td class="text-end">{{ 'Sent'|trans }}:</td>
                <td>{{ email.created_at|format_date }}</td>
            </tr>
         </tbody>
    </table>

    <div class="card-footer text-center">
        <a class="btn btn-primary api-link"
            href="{{'api/admin/email/email_resend'|link({ 'id': email.id }) }}"
            data-api-msg="{{ 'Email resent'|trans }}">
            <svg class="icon icon-tabler" width="24" height="24">
                <use xlink:href="#refresh" />
            </svg>
            <span class="d-block text-secondary">{{ 'Resend'|trans }}</span>
        </a>
        <a class="btn btn btn-primary api-link"
            href="{{'api/admin/email/email_delete'|link({ 'id': email.id }) }}"
            data-api-confirm="{{ 'Are you sure?'|trans }}"
            data-api-redirect="{{ 'email/history'|alink }}">
            <svg class="icon icon-tabler" width="24" height="24">
                <use xlink:href="#delete" />
            </svg>
            <span class="d-block text-secondary">{{ 'Delete'|trans }}</span>
        </a>
    </div>

    <div class="card-body">
        {{ email.content_html|raw }}
    </div>
</div>
{% endblock %}
