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

{% set type_constants = collection_type.constants %}
{% set page_title = type_constants.plural | uppercase_first %}
{% set active_item_identifier = type_constants.active_nav %}

{% block beforeContent %}
  {{
    govukBackLink({
      "text": "Back",
      "href": url_for("deliver_grant_funding.select_collection_to_copy", grant_id=grant.id, collection_type=collection_type) if source_collection else url_for(type_constants.list_endpoint, grant_id=grant.id),
    })
  }}
{% endblock %}

{% block content %}
  <div class="govuk-grid-row">
    <div class="govuk-grid-column-two-thirds">
      <span class="govuk-caption-l">{{ grant.name }}</span>
      <h1 class="govuk-heading-l">What is the name of the {{ type_constants.singular }}?</h1>
      {% if source_collection %}
        <p class="govuk-body">This {{ type_constants.singular }} will be a copy of the ‘{{ source_collection.name }}’ {{ type_constants.singular }} for {{ source_collection.grant.name }}.</p>
      {% endif %}
      <p class="govuk-body">{{ type_constants.singular | uppercase_first }} name will be shown in emails to Access grant funding users. You do not need to include the grant name.</p>
      <form method="post" novalidate>
        {{ form.csrf_token }}
        {{ form.name(params={"label": {"classes": "govuk-visually-hidden"} }) }}

        <div class="govuk-button-group">
          {{ form.submit(params={"preventDoubleClick": true}) }}
          <a class="govuk-link govuk-link--no-visited-state" href="{{ url_for(type_constants.list_endpoint, grant_id=grant.id) }}">Cancel</a>
        </div>
      </form>
    </div>
  </div>
{% endblock content %}
