{#
/**
 * Copyright © 2003-2024 The Galette Team
 *
 * This file is part of Galette (https://galette.eu).
 *
 * Galette is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Galette is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
 */
#}
{% extends (mode == 'ajax') ? "ajax.html.twig" : "page.html.twig" %}

{% block content %}
        <div class="ui top attached accordion-styled header">
            {{ _T("Headers") }}
        </div>
        <div class="ui bottom attached accordion-styled segment">
            <div class="ui basic segments form">
                <div class="ui segment">
                    <div class="inline field">
                        <label>{{ _T("From:") }}</label>
                        <span>{{ sender }}</span>
                    </div>
                </div>
                <div class="ui segment">
                    <div class="inline field">
                        <label>{{ _T("To:") }}</label>
                        <div class="ui horizontal bulleted link list">
    {% for recipient in recipients %}
        {% if recipient.email is null and recipient.hasParent() %}
            {% set email = recipient.parent.email %}
        {% else %}
            {% set email = recipient.email %}
        {% endif %}
                            <a href="mailto:{{ email }}" class="item">{{ recipient.sname }} &lt;{{ email }}&gt;</a>
    {% endfor %}
                        </div>
                    </div>
                </div>
                <div class="ui segment">
                    <div class="inline field">
                        <label>{{ _T("Subject:") }}</label>
                        <span>{{ mailing.subject }}</span>
                    </div>
                </div>
                <div class="ui segment">
                    <div class="inline field">
                        <label>{{ _T("Attachments:") }}</label>
                        <div class="ui horizontal bulleted link list">
    {% for attachment in attachments %}
                            <a target="_blank" href="{{ url_for("previewAttachment", {"id": mailing_id, "pos": loop.index}) }}" class="item"><i class="ui paperclip icon" aria-hidden="true"></i>{{ attachment.getFileName() }}</a>
    {% else %}
                            <span class="item">-</span>
    {% endfor %}
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="ui top attached accordion-styled header">
            {{ _T("Mail body") }}
        </div>
        <div class="ui bottom attached accordion-styled{% if mode == 'ajax' %} scrolling{% endif %} segment">
    {% if mailing.html %}
            {{ mailing.message|raw }}
    {% else %}
            <pre>{{ mailing.wrapped_message|escape }}</pre>
    {% endif %}
        </div>
{% endblock %}
