{% extends "deliver_grant_funding/grant_base.html" %} {% from "govuk_frontend_jinja/components/summary-list/macro.html" import govukSummaryList %} {% from "govuk_frontend_jinja/components/notification-banner/macro.html" import govukNotificationBanner %} {% from "govuk_frontend_jinja/components/summary-list/macro.html" import govukSummaryList %} {% from "govuk_frontend_jinja/components/details/macro.html" import govukDetails %} {% from "deliver_grant_funding/macros/deliver_grant_funding_collection_breadcrumb.html" import deliver_grant_funding_collection_breadcrumb %} {% from "common/macros/status.html" import reportStatusTag with context %} {% from "deliver_grant_funding/macros/dependency_banner.html" import section_dependency_banner %} {% set type_constants = collection.type.constants %} {% set page_title = collection.name %} {% set active_item_identifier = type_constants.active_nav %} {% set can_edit = authorisation_helper.can_edit_collection(current_user, collection.id) %} {% set can_preview = collection.data_sources | length == 0 and collection.status != enum.collection_status.CLOSED %} {# this does kick off one more request to the database - we could revisit making this check more concise #} {% set user_can_test_grant_recipient_journey = grant.test_grant_recipients and grant in current_user.access_grants %} {% block beforeContent %} {{ deliver_grant_funding_collection_breadcrumb(grant=grant, collection_type=collection.type, this_page_breadcrumb_item={"text":collection.name}) }} {% endblock beforeContent %} {% block content %}
{% with flashes = get_flashed_messages(category_filter=[enum.flash_message_type.SECTION_DEPENDENCY_ORDER_ERROR.value]) %} {% if flashes %} {{ section_dependency_banner(flashes[0]) }} {% endif %} {% endwith %} {% with flashes = get_flashed_messages(category_filter=[enum.flash_message_type.SUBMISSION_TESTING_COMPLETE.value]) %} {% if flashes %} {{ govukNotificationBanner(params={"titleText": "Preview complete", "text": flashes[0]}) }} {% endif %} {% set errors = None %} {% endwith %} {% with flashes = get_flashed_messages(category_filter=[enum.flash_message_type.TESTING_GRANT_RECIPIENT_JOURNEY_STARTED.value]) %} {% if flashes %} {{ govukNotificationBanner(params={"titleText": "Success", "type": "success", "text": flashes[0]}) }} {% endif %} {% set errors = None %} {% endwith %} {% if delete_form %} {% set banner_html %}

Are you sure you want to delete the section "{{ delete_task.title }}"?

{{ delete_form.csrf_token }}
{{ delete_form.confirm_deletion(params={"text": "Yes, delete this section", "classes": "govuk-button--warning govuk-!-margin-bottom-0"}) }} Cancel
{% endset %} {{ govukNotificationBanner(params={"role": "alert", "titleText": "Important", "classes": "", "html": banner_html}) }} {% endif %}

{{ collection.name }}

Submission period: {{ format_date_range(collection.submission_period_start_date, collection.submission_period_end_date) if collection.submission_period_start_date and collection.submission_period_end_date else "Not set" }}

{{ type_constants.singular | uppercase_first }} status: {{ reportStatusTag(collection.status) }}

Sections

{% if not collection.forms %}

This {{ type_constants.singular }} has no sections.

{% if can_edit %}

Add a section

{% endif %} {% else %} {% set rows = [] %} {% for form in collection.forms %} {% set taskHtml %} {{ form.title }} {% endset %} {% set questionsHtml %} {{ form.cached_questions | length }} questions in {{ form.title }} {% endset %} {% set actions = [] %} {% if can_edit and collection.forms|length > 1 %} {% do actions.append({"text": "Move up", "visuallyHiddenText": form.title, "href": url_for('deliver_grant_funding.move_section', grant_id=grant.id, form_id=form.id, direction='up'), "classes": "govuk-link--no-visited-state" ~ (" move-up-down-link-hidden" if loop.first else ""), "attributes": {"aria-hidden": true} if loop.first else {} }) %} {% do actions.append({"text": "Move down", "visuallyHiddenText": form.title, "href": url_for('deliver_grant_funding.move_section', grant_id=grant.id, form_id=form.id, direction='down'), "classes": "govuk-link--no-visited-state" ~ (" move-up-down-link-hidden" if loop.last else ""), "attributes": {"aria-hidden": true} if loop.last else {} }) %} {% else %} {# Append some empty actions in order to keep the layout visually the same - might need to think about this more when we have examples #} {% do actions.append({}) %} {% endif %} {% do rows.append( { "key": {"html": taskHtml, "classes": "govuk-!-font-weight-regular"}, "value": {"html": questionsHtml}, "actions": { "items": actions, "classes": "govuk-!-width-one-third", }, }) %} {% endfor %} {{ govukSummaryList({ "rows": rows }) }} {% endif %} {% if can_edit %} Add another section {% endif %}

Actions

{% if can_preview %}
{{ form.csrf_token }} {{ form.submit(params={"text": "Preview " ~ type_constants.singular, "classes": "govuk-button--secondary"}) }} {% if previewers and authorisation_helper.is_deliver_grant_admin(grant.id, current_user) %} {% set previewer_list_html %}
    {% for previewer in previewers %}
  • {{ previewer.name }}
  • {% endfor %}
{% endset %} {{ govukDetails({ "id": "previewers-details", "summaryText": (previewers | length) ~ " previewers", "html": previewer_list_html }) }} {% endif %}
{% else %}

Preview not available

{% endif %} {% if user_can_test_grant_recipient_journey %} Test grant recipient journey {% endif %}
{% endblock content %}