{% 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>
        Open the {{ collection.type.constants.singular }} for submissions
      </h1>
      <p class="govuk-body">Opening the {{ collection.type.constants.singular }} will allow grant recipients to start making submissions.</p>

      {{ govukInsetText({ "text": "Once the " + collection.type.constants.singular + " is live, grant recipients will be able to access it and begin submitting their data." }) }}

      <p class="govuk-body">Confirm the following before opening the {{ collection.type.constants.singular }} for submissions:</p>

      <form method="post" novalidate>
        {{ form.csrf_token }}
        {{ form.confirm_grant_recipients }}
        {{ form.confirm_grant_recipient_users }}
        {% if 'confirm_missing_data_providers' in form %}
          {{ form.confirm_missing_data_providers }}
        {% endif %}
        {{ form.confirm_privacy_policy }}
        {{ form.confirm_certification }}
        {{ form.confirm_reporting_dates }}
        {{ form.confirm_submission_dates }}
        {% if 'confirm_reporting_and_submission_overlap' in form %}
          {{ form.confirm_reporting_and_submission_overlap }}
        {% endif %}
        {{ form.confirm_reminder_days }}
        {{ form.confirm_multiple_submissions }}
        {% if 'confirm_managed_by_service' in form %}
          {{ form.confirm_managed_by_service }}
        {% endif %}
        {% if 'confirm_managed_submissions_count' in form %}
          {{ form.confirm_managed_submissions_count }}
        {% endif %}
        {% if 'confirm_missing_data' in form %}
          {{ form.confirm_missing_data }}
        {% endif %}
        {{ form.submit }}
      </form>
    </div>
  </div>
{% endblock %}
