{% if grant %}
  {% extends "deliver_grant_funding/grant_base.html" %}
  {% set active_item_identifier = "details" %}
{% else %}
  {% extends "deliver_grant_funding/base.html" %}
  {% set active_item_identifier = "grants" %}
{% endif %}
{% from "govuk_frontend_jinja/components/back-link/macro.html" import govukBackLink %}

{% set page_title = "Who is the main contact for this grant?" %}

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

{% block content %}
  <div class="govuk-grid-row">
    <div class="govuk-grid-column-two-thirds">
      <span class="govuk-caption-l">{% if grant %}{{ grant.name }}{% else %}Set up the grant{% endif %}</span>
      <h1 class="govuk-heading-l">Who is the main contact for this grant?</h1>
      <p class="govuk-body">This is the person that teams at MHCLG can contact if they have any questions about the grant.</p>

      <form method="post" novalidate>
        {{ form.csrf_token }}

        {{ form.primary_contact_name(params={"classes": "govuk-!-width-two-thirds"}) }}
        {{ form.primary_contact_email(params={"type": "email", "classes": "govuk-!-width-two-thirds"}) }}

        <div class="govuk-button-group">
          {% set submit_label = 'Update main contact' if grant else 'Save and continue' %}
          {{ form.submit(params={"text": submit_label}) }}

          {% if grant %}
            <a class="govuk-link govuk-link--no-visited-state" href="{{ back_link_href }}">Cancel</a>
          {% endif %}
        </div>
      </form>
    </div>
  </div>
{% endblock content %}
