{% extends '@email/_base.html.twig' %}
{% trans_default_domain 'email' %}

{% block template %}
    <table class="email-wrapper w-full bg-gray-postmark-lighter font-sans">
        <tr>
            <td align="center">
                <table class="email-content w-full">


                    <tr>
                        <td class="email-body w-full">
                            <table align="center" class="email-body_inner w-570 bg-white mx-auto sm:w-full">
                                {{ include ('@email/_header.html.twig', ignore_missing = true) }}
                                <tr>
                                    <td class="p-45">
                                        <div class="text-base">
                                            <h1 class="mt-0 text-2xl font-bold text-left text-gray-postmark-darker">
                                                {{ 'helloWithName'|trans({'%name%': payment.billingAddress|first}) }},</h1>
                                            <div class="mt-6 mb-20 text-base leading-24 text-gray-postmark-dark">{{ content|machine_translate|markdown_to_html }}</div>

                                            <table class="w-full py-35">
                                                <tr>
                                                    <td>
                                                        <h3 align="left"
                                                            class="mt-0 text-sm text-left font-bold text-gray-postmark-darker">{{ payment.receiptNumber }}</h3>
                                                    </td>
                                                    <td>
                                                        <h3 align="right"
                                                            class="mt-0 text-sm text-right font-bold text-gray-postmark-darker">{{ payment.createdAt|date('d.m.Y') }}</h3>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2">
                                                        <table class="w-full pt-25">
                                                            <tr>
                                                                <th align="left" class="purchase_heading pb-8">
                                                                    <p class="m-0 text-base leading-24 text-gray-postmark-meta">
                                                                        {{ 'offer'|trans }}</p>
                                                                </th>
                                                                <th align="right" class="purchase_heading pb-8">
                                                                    <p class="m-0 text-base leading-24 text-gray-postmark-meta">
                                                                        {{ 'fee'|trans }}</p>
                                                                </th>
                                                            </tr>
                                                            {% for item in payment.items %}
                                                                <tr>
                                                                    <td class="w-4/5 text-base leading-18 py-10">
                                                                        {% if item.discount %}
                                                                            Guthaben
                                                                        {% elseif item.attendance is null %}
                                                                            Gelöschte Teilnahme
                                                                        {% else %}
                                                                            {{ item.attendance.offer.name|machine_translate }}
                                                                        {% endif %}
                                                                    </td>
                                                                    <td align="right"
                                                                        class="w-1/5 text-base text-right">{{ (item.amount/100)|format_currency('EUR', locale='de') }}</td>
                                                                </tr>
                                                            {% endfor %}
                                                            <tr>
                                                                <td class="purchase_footer w-4/5">
                                                                    <p align="right"
                                                                       class="m-0 pr-16 text-base leading-24 text-right text-gray-postmark-darker font-bold">
                                                                        {{ 'total'|trans }}</p>
                                                                </td>
                                                                <td class="purchase_footer w-1/5">
                                                                    <p align="right"
                                                                       class="m-0 text-base leading-24 text-right text-gray-postmark-darker font-bold">{{ (payment.totalAmount/100)|format_currency('EUR', locale='de') }}</p>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                            {% if post_content is defined %}
                                                <div class="mt-6 mb-20 text-base leading-24 text-gray-postmark-dark">{{ post_content|machine_translate|markdown_to_html }}</div>
                                            {% endif %}
                                            {% if action_url %}
                                                <table align="center" class="w-full my-30 mx-auto text-center">
                                                    <tr>
                                                        <td align="center">
                                                            <table class="w-full">
                                                                <tr>
                                                                    <td align="center">
                                                                        <a href="{{ action_url }}"
                                                                           class="button button--blue"
                                                                           target="_blank">{{ 'downloadAsPdf'|trans }}</a>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                            {% endif %}
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>

                    {{ include ('@email/_footer.html.twig', ignore_missing = true) }}

                </table>
            </td>
        </tr>
    </table>

{% endblock %}
