{% if external %}
  {% extends 'email_layout_external.html' %}
{% else %}
  {% extends 'email_layout_internal.html' %}
{% endif %}
{% block body %}
  <b>{% trans %}User: {% endtrans %}</b> {{ user.name }} &lt;{{ user.email }}&gt;
  <br />
  <b>{% trans %}Date: {% endtrans %}</b> {{ request_date | format_datetime("long") }}
  <br />
  <b>{% trans %}Service: {% endtrans %}</b> {{ form.service | d("undefined") }}
  <br />
  {% for field in form %}
    {# Include a line break between each field. #}
    <br />
    <b>{{ field.label }}:</b>
    {# For TextArea widget make a clear separation. #}
    {% if field.widget.__class__.__name__ == 'TextArea' %}
      <p>{{ field.data }}</p>
    {% elif field.choices is defined %}
      {# Form select field, provide the key and display name #}
      {% set ns = namespace(label='') %}
      {% for choice in field.choices %}
        {% if choice[0] == field.data %}
          {% set ns.label = choice[1] %}
        {% endif %}
      {% endfor %}
      {{ ns.label }} ({{ field.data }})
    {% else %}
      {{ field.data }}
    {% endif %}
  {% endfor %}
  {# If form contains note (failed execution) format it properly #}
  {% if form.note %}
    <p>
      <b>
        {% trans %}Note: {% endtrans %}
      </b>
      <br />
      {% for line in form.note.split('\n') %}
        {{ line }}
        {% if loop.nextitem %}<br />{% endif %}
      {% endfor %}
    </p>
  {% endif %}
  {# If available, display a link to the ticket. #}
  {% if ticket_number %}
    <p>
      You can access and track the status of your ticket here: <a href="{{ ticket_url }}">Ticket#{{ ticket_number }}</a>
    </p>
  {% endif %}
{% endblock %}
