{% extends "serviceform/reports/base/report_base.html" %}
{% load i18n crispy_forms_tags l10n %}
{% block content %}
  {# Contact details #}
  <div class="preview-contactdetails">
    <h3>{% blocktrans %}Contact details{% endblocktrans %}:</h3>

    {% for detail, data in participant.contact_details %}
      <div class="row activity-preview-row">
        <div class="col-xs-4">
          {{ detail }}
        </div>
        <div class="col-xs-8">
          {{ data|linebreaks }}
        </div>
      </div>
    {% endfor %}

  </div>
  {# Activities and their choices #}
  <div class="preview-activities">
    <h3>{% blocktrans %}I am wishing to participate in the following activities{% endblocktrans %}:</h3>
    <div class="row activity-preview-header-row">
      <div class="col-xs-4">
        {% trans "Activity" %}
      </div>
      <div class="col-xs-8">
        {% trans "Additional info" %}
      </div>
    </div>

    {% for a in participant.activities %}
      <div class="row activity-preview-row">
        <div class="col-xs-4">
          {{ a.activity.name }}
        </div>
        <div class="col-xs-8">
          {{ a.additional_info_display|linebreaks }}
        </div>
      </div>
      {% for c in a.choices %}
        <div class="row">
          <div class="col-xs-3 col-xs-offset-1">
            {{ c.activity_choice.name }}
          </div>
          <div class="col-xs-8">
            {{ c.additional_info_display|linebreaks }}
          </div>
        </div>
      {% endfor %}
    {% endfor %}

  </div>
  {# question answers #}
  {% if service_form.questions %}
    <div class="preview-questions">
      <h3>{% blocktrans %}Answers to questions{% endblocktrans %}:</h3>
      <div class="row activity-preview-header-row">
        <div class="col-xs-4">
          {% trans "Question" %}
        </div>
        <div class="col-xs-8">
          {% trans "Answer" %}
        </div>
      </div>
      {% for q in participant.questions %}
        <div class="row activity-preview-row">
          <div class="col-xs-4">
            {{ q.question.question }}
          </div>
          <div class="col-xs-8">
            {% if q.question.answer_type == 'boolean' %}
              {% if q.answer %}
                {% trans "Yes" %}
              {% else %}
                {% trans "No" %}
              {% endif %}
            {% else %}
              {{ q.answer|linebreaks }}
            {% endif %}
          </div>
        </div>
      {% endfor %}
    </div>
  {% endif %}

  <div class="preview-otherdata">
    <h3>{% blocktrans %}Other information{% endblocktrans %}:</h3>

    {% for detail, data in participant.additional_data %}
      <div class="row activity-preview-row">
        <div class="col-xs-4">
          {{ detail }}
        </div>
        <div class="col-xs-8">
          {{ data|localize|linebreaks }}
        </div>
      </div>
    {% endfor %}

  </div>

  <div class="preview-log">
    <h3>{% trans "Log" %}</h3>
    <ul>
      {% for l in participant.log %}
        <li>{{ l.created_at }} {{ l.written_by }}: {{ l.message }}</li>
      {% endfor %}
    </ul>
    <form method="post">
      {% csrf_token %}
      <input class="add-entry-input" id="id_message" name="message" type="text"> <input type="submit"
                                                                                        value="{% trans "Add entry" %}"
                                                                                        class="btn btn-primary"
                                                                                        id="submit">
    </form>
    </div>
{% endblock %}