{# -*- engine:django -*- #}


{% load i18n %}

{% block content %}
  <h5>
    {% blocktrans with group=group.group_name %}Results for {{ group }}{% endblocktrans %}
  </h5>

  {% for part_result in results.results_by_part.values %}
    <h6>{{ part_result.part.name }}</h6>
    <div class="row">
      <div class="col s12">
        <strong>
          {% trans 'Average results' %}
        </strong>
        <canvas id="chart-average-{{ group.id }}-{{ part_result.part.id }}" width="400"
                height="200"></canvas>
      </div>
      <div class="page-break">&nbsp;</div>

      <div class="col s12">
        <strong>
          {% blocktrans with part=part_result.part.name %}Average results as dartboard{% endblocktrans %}
        </strong>
        <canvas id="chart-average-radar-{{ group.id }}-{{ part_result.part.id }}" width="400"
                height="200"></canvas>
      </div>
      <div class="page-break">&nbsp;</div>

      {% for result in part_result.results %}
        {% if result.item.item_type == 'free_text' %}
          <div class="col s12 m12">
            <strong>{{ result.item.name }}</strong>
            <p>
              <em class="grey-text text-darken-1">{{ result.item.question }}</em>
            </p>
            <ul class="collection">
              {% for answer in result.answers %}
                <li class="collection-item">{{ answer }}</li>
                {% empty %}
                <li class="collection-item">
                  {% trans 'No answers.' %}
                </li>
              {% endfor %}
            </ul>
          </div>
        {% elif result.item.item_type == 'agreement' %}
          <div class="col s12">
            <strong>{{ result.item.name }}</strong>
            <p>
              <em class="grey-text text-darken-1">{{ result.item.question }}</em>
            </p>
            <canvas id="chart-frequency-{{ group.id }}-{{ result.item.id }}" width="400"
                    height="200"></canvas>
          </div>
        {% endif %}
      {% endfor %}
    </div>
    <div class="page-break">&nbsp;</div>
  {% endfor %}
{% endblock %}
