{% extends 'rb/emails/base_email.html' %}

{% block header_recipient %}{% trans name=user.first_name %}Dear {{ name }},{% endtrans %}{% endblock %}
{% block subject -%}
    {% if reservations|length == 1 -%}
        {% trans %}One of your bookings will come to an end soon{% endtrans %}
    {%- else -%}
        {% trans %}Some of your bookings will come to an end soon{% endtrans %}
    {%- endif %}
{%- endblock %}


{% block body -%}
    {% block message %}
        {%- if reservations|length == 1 -%}
            {% trans %}There is a booking under your name that will soon come to an end:{% endtrans %}<br>
        {%- else -%}
            {% trans %}There are bookings under your name that will soon come to an end:{% endtrans %}<br>
        {%- endif %}
    {% endblock %}
    <ul>
        {% for reservation in reservations %}
            <li style="{{ 'margin-top: 2em;' if not loop.first }}">
                {{ _render_finishing_reservation(reservation) }}
            </li>
        {%- endfor -%}
    </ul>
{%- endblock %}


{% macro _render_dates(reservation) -%}
    <strong>{{ reservation.start_dt|format_datetime('EEEE dd/MM/yyyy HH:mm') }}</strong> - <strong>{{ reservation.end_dt|format_datetime('EEEE dd/MM/yyyy HH:mm') }}</strong>
{%- endmacro %}


{% macro _render_finishing_reservation(reservation) -%}
    {% trans %}Dates:{% endtrans %} {{ _render_dates(reservation) }}<br>
    {% trans %}Room:{% endtrans %} <strong>{{ reservation.room.full_name }}</strong><br>
    {% trans %}Reason of the booking:{% endtrans %} <strong>{{ reservation.booking_reason }}</strong><br>
{%- endmacro %}
