{% extends "deliver_grant_funding/grant_base.html" %}
{% from "govuk_frontend_jinja/components/back-link/macro.html" import govukBackLink %}
{% from "govuk_frontend_jinja/components/summary-list/macro.html" import govukSummaryList %}
{% set type_constants = component.form.collection.type.constants %}
{% set active_item_identifier = type_constants.active_nav %}

{% set page_title = form.need_calculation.label.text %}

{% block beforeContent %}
  {% set back_link = url_for("deliver_grant_funding.edit_question", grant_id=grant.id, question_id=component.id) if not component.is_group else url_for("deliver_grant_funding.list_group_questions", grant_id=grant.id, group_id=component.id) %}
  {{ govukBackLink({ "text": "Back", "href": back_link }) }}
{% endblock beforeContent %}

{% block content %}
  <div class="govuk-grid-row">
    <div class="govuk-grid-column-two-thirds">
      {% set legendHtml %}
        <h1 class="govuk-heading-l">{{ page_title }}</h1>

        {{
          govukSummaryList({
          "rows": [
            {"key": {"text": "Section"}, "value": {"text": component.form.title} },
            {
              "key": { "text": "This question" if not component.is_group else "This group" },
              "value": { "text": interpolate(component.text) },
            },
          ],
          "classes": "app-!-border-top-line"})
        }}
      {% endset %}

      <form method="post" novalidate>
        {{ form.csrf_token }}
        {{
          form.need_calculation(params={
          "fieldset": {"legend": {"html": legendHtml} },
          "items": [ { "hint": { "text": "If the condition requires adding, subtracting, multiplying or dividing two or more numbers", } }, {}, ]})
        }}
        {{ form.submit }}
      </form>
    </div>
  </div>
{% endblock content %}
