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

{% set page_title = "Do you have a Government Grants Information System (GGIS) reference number?" %}
{% set active_item_identifier = "grants" %}

{% block beforeContent %}
  {{
    govukBackLink({
      "text": "Back",
      "href": back_link_href,
    })
  }}
{% endblock %}

{% block content %}
  <div class="govuk-grid-row">
    <div class="govuk-grid-column-two-thirds">
      <span class="govuk-caption-l">Set up the grant</span>
      <h1 class="govuk-heading-l">{{ page_title }}</h1>
      <p class="govuk-body">You’ll need to provide your GGIS number before you can create forms or assess grant applications.</p>
      <form method="post" novalidate>
        {{ form.csrf_token }}

        {{
          form.has_ggis(params={
            "fieldset": {
              "legend": {
                "text": form.has_ggis.label.text,
                "classes": "govuk-visually-hidden",
              },
            },
            "items": [
              {
                "value": "yes",
                "text": "Yes",
                "conditional": {
                  "html": form.ggis_number(
                    params={
                      "classes": "govuk-!-width-two-thirds",
                      "spellcheck": false,
                      "autocomplete": "off"
                    }
                  )
                }
              },
              {
                "value": "no",
                "text": "No",
                "checked": true if form.has_ggis.data == "no" else false
              }
            ]
          })
        }}

        {{ form.submit }}
      </form>
    </div>
  </div>
{% endblock %}
