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

{% set page_title = "Decline sign off: " + submission.name %}

{% set constants = submission.collection.type.constants %}
{% set active_item_identifier = constants.active_nav %}

{% set return_link = url_for("access_grant_funding.route_to_submission", organisation_id=grant_recipient.organisation.id, grant_id=grant_recipient.grant.id, collection_id = submission.collection_id) %}
{% block beforeContent %}
  {{ super() }}
  {{
    govukBackLink({
      "href": return_link,
      "text": "Back"
    })
  }}
{% endblock beforeContent %}
{% block content %}
  <div class="govuk-grid-row">
    <div class="govuk-grid-column-two-thirds">
      <form method="POST" novalidate>
        {{ form.csrf_token }}

        {{
          form.decline_reason(
            params={
            "label":{
              "isPageHeading":true,
              "classes": "govuk-label--l",
              "text": "Why are you declining sign off for the " + submission.long_collection_name + " " + constants.singular + "?"
            },
            "hint":{
              "text": "Tell " + (submission.sent_for_certification_by.name if submission.sent_for_certification_by else "the submitter")
              + " why you are declining sign off so they can update and resubmit the " + constants.singular + "."
            }
            }

          )
        }}
        <div class="govuk-button-group">
          {{ form.submit }}
          <a class="govuk-link govuk-link--no-visited-state" href="{{ return_link }}">Cancel</a>
        </div>
      </form>
    </div>
  </div>
{% endblock %}
