{% extends "cms/base.html" %}

{% block main %}

  <div class="container">


    <h1>{{ quiz.name }}</h1>

    {% if conclusion %}

      <p class="quiz-conclusion">
        <b>{% translate "You have a majority of" %} {{ symbol }} !</b>
      </p>

      <p class="quiz-conclusion-description">
        {{ conclusion|safe }}
      </p>

      {% weasyprint_download_uuid %}
      <a href="{% url 'quiz_download_pdf' weasyprint_download_uuid %}" download="resultat_quiz_stdv.pdf" target="_blank">{% translate "Download the summary in pdf" %}</a>
    {% endif %}

    {% if thank_you %}
      <p class="thank_you">{% translate "Thank you for your answers." %}</p>
    {% endif %}

    {% if more_info_quiz %}
      {% include "django_easy_quiz/more_info_quiz.html" %}
    {% endif %}

{% else %}

  <form method="post">
    {% csrf_token %}

    {% for form in formset.forms %}
      <fieldset>
        <legend>{{ form.initial.question.label|safe }}</legend>
        {% for answer in form.initial.answers %}
          <p>
            <input type="radio" name="question_{{ form.initial.question.id }}" value="{{ answer.id }}" id="answer_{{ form.initial.question.id }}_{{ answer.id }}" required />
            <label for="answer_{{ form.initial.question.id }}_{{ answer.id }}">
              <span class="symbol" style="font-family: monospace">{{ answer.symbol }}</span>
              <span class="answer">{{ answer.label|safe }}</span>
            </label>
          </p>
        {% endfor %}
      </fieldset>
    {% endfor %}
    {% if saved_quiz_id %}
      <input type="hidden" name="saved_quiz" value="{{ saved_quiz_id }}" />
    {% endif %}
    <button type="submit">{% translate "Submit" %}</button>
  </form>

{% endif %}




</div>

{% endblock main %}
