{% extends "admin/master.html" %}
{% import 'admin/layout.html' as layout with context %}
{% from "govuk_frontend_jinja/components/back-link/macro.html" import govukBackLink %}
{% from 'govuk_frontend_jinja/components/error-summary/macro.html' import govukErrorSummary %}
{% from 'govuk_frontend_jinja/components/inset-text/macro.html' import govukInsetText %}

{% block beforeContent %}
  {{ govukBackLink({"text": "Back", "href": url_for('collection_lifecycle.tasklist', grant_id=grant.id, collection_id=collection.id) }) }}
{% endblock %}

{% block action_panel %}
  <div class="govuk-grid-row">
    <div class="govuk-grid-column-one-half">
      {{ layout.messages() }}

      {% if form.errors %}
        {{ govukErrorSummary(wtforms_errors(form)) }}
      {% endif %}

      <h1 class="govuk-heading-l">
        <span class="govuk-caption-l">{{ grant.name }}</span>
        Close the {{ collection.type.constants.singular }}
      </h1>
      <p class="govuk-body">Closing the {{ collection.type.constants.singular }} will prevent grant recipients from starting, continuing or completing submissions, including certifying submissions which require certification.</p>

      {{ govukInsetText({ "text": "Once the "+collection.type.constants.singular+" is closed, grant recipients will not be able to make any more changes to their submissions." }) }}

      <form method="post" novalidate>
        {{ form.csrf_token }}
        {{ form.submit(params={"text": "Close the " + collection.type.constants.singular}) }}
      </form>
    </div>
  </div>
{% endblock %}
