{% 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 %}
{% set back_link = url_for("deliver_grant_funding.collection_settings", grant_id=grant.id, collection_type=collection.type, collection_id=collection.id) %}

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

{% block content %}
  <div class="govuk-grid-row">
    <div class="govuk-grid-column-two-thirds">
      <span class="govuk-caption-l">{{ collection.name }}</span>
      <h1 class="govuk-heading-l">Change {{ type_constants.singular }} name</h1>
      <p class="govuk-hint">The {{ type_constants.singular }} name automatically ends with ‘{{ type_constants.singular }}’ and will show with the grant name in emails to Access grant funding users.</p>
      <form method="post" novalidate>
        {{ form.csrf_token }}
        {{ form.name(params={"label": {"text": type_constants.singular | uppercase_first ~ " name", "classes": "govuk-visually-hidden"} }) }}

        <div class="govuk-button-group">
          {{ form.submit(params={"text": "Update " ~ type_constants.singular ~ " name"}) }}
          <a class="govuk-link govuk-link--no-visited-state" href="{{ back_link }}">Cancel</a>
        </div>
      </form>
    </div>
  </div>
{% endblock content %}
