{% extends "deliver_grant_funding/grant_base.html" %}
{% from "govuk_frontend_jinja/components/back-link/macro.html" import govukBackLink %}

{% set page_title = "Add a question - " ~ db_form.title %}
{% set type_constants = db_form.collection.type.constants %}
{% set active_item_identifier = type_constants.active_nav %}

{% set return_to_form_or_group_url = url_for("deliver_grant_funding.list_section_questions", grant_id=grant.id, form_id=db_form.id) if not parent else url_for('deliver_grant_funding.list_group_questions', grant_id=grant.id, group_id=parent.id) %}
{% block beforeContent %}
  {{
    govukBackLink({
      "text": "Back",
      "href": return_to_form_or_group_url,
    })
  }}
{% endblock beforeContent %}

{% block content %}
  <div class="govuk-grid-row">
    <div class="govuk-grid-column-two-thirds">
      <form method="post" novalidate>
        <span class="govuk-caption-l">{{ db_form.title }}</span>
        {{ form.csrf_token }}
        {{ form.form_id }}

        {{ form.question_data_type(params={"fieldset": {"legend": {"text": form.question_data_type.label, "isPageHeading": true, "classes": "govuk-fieldset__legend--l"} } }) }}

        <span class="govuk-button-group">
          {{ form.submit(params={"text": "Continue"}) }}
          <a class="govuk-link govuk-link--no-visited-state" href="{{ return_to_form_or_group_url }}">Cancel</a>
        </span>
      </form>
    </div>
  </div>
{% endblock content %}
