{% extends 'emails/base_i18n.txt' %}

{% macro user_details(user) -%}
    {% trans %}Name:{% endtrans %} {{ user.full_name }}
    {% trans %}Email:{% endtrans %} {{ user.email }}
    {%- if user.phone %}
    {% trans %}Phone:{% endtrans %} {{ user.phone }}
    {%- endif -%}
{%- endmacro %}


{% macro event_details(event) -%}
    {% trans %}Name:{% endtrans %} {{ event.title }}
    {% if event.start_dt.date() == event.end_dt.date() -%}
    {% trans %}Date:{% endtrans %} {{ event.start_dt | format_date(timezone=event.tzinfo) }}, {{ event.start_dt | format_time(timezone=event.tzinfo) }}
    {%- else -%}
    {% trans %}Dates:{% endtrans %} {{ event.start_dt | format_date(timezone=event.tzinfo) }}, {{ event.start_dt | format_time(timezone=event.tzinfo) }} - {{ event.end_dt | format_date(timezone=event.tzinfo) }}, {{ event.end_dt | format_time(timezone=event.tzinfo) }}
    {%- endif %}
    {% trans %}Location:{% endtrans %} {% if event.venue_name %}{{ event.venue_name }}: {% endif %}{{ event.room_name }}
    {% trans %}Details:{% endtrans %} {{ event.external_url }}
{%- endmacro %}


{%- block subject -%}
    [{{ req.definition.title }}] {% block request_subject %}{% endblock %}
{%- endblock -%}


{% block header %}{% endblock %}


{% block body -%}
    {%- filter dedent -%}
        {% block request_message %}{% endblock %}
        {{ url_for('requests.event_requests_details', req, _external=true) }}

        {% filter underline %}{% trans %}Requested by{% endtrans %}{% endfilter %}
        {{ user_details(req.created_by_user) }}
        {%- if req.created_by_user != event.creator %}

            {% filter underline %}{% trans %}Event created by{% endtrans %}{% endfilter %}
            {{ user_details(event.creator) }}
        {%- endif %}

        {% filter underline %}{% trans %}Event details{% endtrans %}{% endfilter %}
        {{ event_details(event) }}

        {%- if self.request_details() %}

            {% filter underline %}{% trans %}Request details{% endtrans %}{% endfilter %}
            {% block request_details %}{% endblock -%}
        {% endif %}
    {%- endfilter %}
{% endblock %}


{% block footer_title %}{% trans %}Service Requests{% endtrans %}{% endblock %}
