{% extends "deliver_grant_funding/grant_base.html" %} {% 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/button/macro.html" import govukButton %} {% from "deliver_grant_funding/macros/dependency_banner.html" import dependency_banner %} {% from "deliver_grant_funding/macros/question_table.html" import question_table %} {% from "deliver_grant_funding/macros/group_nesting_error_banner.html" import group_nesting_error_banner %} {% from "deliver_grant_funding/macros/deliver_grant_funding_collection_breadcrumb.html" import deliver_grant_funding_collection_breadcrumb %} {% set page_title = group.name ~ " - " ~ db_form.title %} {% set type_constants = db_form.collection.type.constants %} {% set active_item_identifier = type_constants.active_nav %} {% set grant_admin = authorisation_helper.is_deliver_grant_admin(grant.id, current_user) %} {% block beforeContent %} {% set parent_item = None %} {% if group.parent %} {% set parent_html %} Question group: {{ group.parent.name }} {% endset %} {% set parent_item={"html": parent_html, "href": url_for("deliver_grant_funding.list_group_questions", grant_id=grant.id, group_id=group.parent_id)} %} {% endif %} {{ deliver_grant_funding_collection_breadcrumb(grant=grant, collection=db_form.collection, form=db_form, immediate_parent_breadcrumb_item=parent_item,this_page_breadcrumb_item={"text":group.name}) }} {% endblock beforeContent %} {% block content %}
{% with flashes = get_flashed_messages(category_filter=[enum.flash_message_type.NESTED_GROUP_ERROR.value]) %} {% if flashes %} {% for error in flashes %} {{ group_nesting_error_banner(error, interpolate=interpolate) }} {% endfor %} {% endif %} {% endwith %} {% with flashes = get_flashed_messages(category_filter=[enum.flash_message_type.DEPENDENCY_ORDER_ERROR.value, enum.flash_message_type.DATA_SOURCE_ITEM_DEPENDENCY_ERROR.value]) %} {% if flashes %} {% for error in flashes %} {{ dependency_banner(error, interpolate=interpolate) }} {% endfor %} {% endif %} {% endwith %} {% if delete_form %} {% set banner_html %}

Are you sure you want to delete this question group?

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

{{ group.name }}

Question group settings

{% set change_add_another_html %} Changeadd another setting {% endset %} {% set change_display_html %} Changedisplay setting {% endset %} {# todo: business logic with these change links could quickly get out of sync with interfaces #} {# only keep the ones that feel really valuable to see up front (likely an actionable buttons #} {{ govukSummaryList({ "rows": [ { "key": {"text": "Display"}, "value": {"text": "All questions on the same page" if group.same_page else "One question per page"}, "actions": { "items": [{ "html": change_display_html, "href": url_for("deliver_grant_funding.change_group_display_options", grant_id=grant.id, group_id=group.id) }] } if not group.has_nested_groups else {} }, { "key": {"text": "Add another"}, "value": {"text": "People can add answers for this group more than once" if group.add_another else "People can only answer the questions in this group once"}, "actions": { "items": [{ "html": change_add_another_html, "href": url_for("deliver_grant_funding.change_group_add_another_options", grant_id=grant.id, group_id=group.id) }] } if not group.contains_add_another_components and not group.contains_questions_depended_on_elsewhere and not group.parent.add_another_container else {} } ] }) }} {# todo: we've agreed to remove these from these settings "Change" tables and only keep this pattern for #} {# where theres an action button not shown (Like "Add question group") - remove these and rely on error summary #} {% if group.has_nested_groups %}

You cannot change the display type because this group has one or more nested groups.

{% endif %} {% if group.contains_add_another_components %}

You cannot allow this question group to be answered more than once as it already contains one or more questions that can be answered more than once.

{% endif %} {% if group.contains_questions_depended_on_elsewhere %}

You cannot allow this question group to be answered more than once as it contains questions that are depended on by other questions in this form.

{% endif %} {% if group.parent and group.parent.add_another_container %}

You cannot allow this question group to be answered more than once as it is already contained in a group that can be answered more than once.

{% endif %}
{% if group.add_another %}

Add another settings

Customise the add another summary page by selecting how each response to this question group should be summarised or providing guidance on answering this question group multiple times.

{% set answer_summary_list_html %} {% if group.questions_in_add_another_summary | length %}

A comma separated list including the answers to:

{% else %} There are no questions in this question group. {% endif %} {% endset %} {% set guidance_text %} {% if group.add_another_guidance_body %}
{{ interpolate(group.add_another_guidance_body, with_interpolation_highlighting=True) }}
{% else %} (None set) {% endif %} {% endset %} {{ govukSummaryList({ "rows": [{ "key": {"text": "Answer summary"}, "value": {"html": answer_summary_list_html}, "actions": { "items": [{ "text": "Change", "visuallyHiddenText": "add another response summary", "href": url_for("deliver_grant_funding.change_group_add_another_summary", grant_id=grant.id, group_id=group.id) }] if group.questions_in_add_another_summary else [] } }, { "key": {"text": "Guidance text"}, "value": {"html": guidance_text}, "actions": { "items": [{ "text": "Change", "visuallyHiddenText": "add another guidance text", "href": url_for("deliver_grant_funding.manage_add_another_guidance", grant_id=grant.id, group_id=group.id) }] } }] }) }}
{% endif %}

Questions

{% if not group.components %}

This question group has no questions.

{% else %} {{ question_table(group, interpolate, role_can_edit=grant_admin, enum=enum) }} {% endif %} {% if grant_admin %} {{ "Add another question" if group.cached_questions else "Add a question" }} {% if group.can_have_child_group and not group.presentation_options.show_questions_on_the_same_page %} {{ "Add a question group" }} {% endif %} {% if not group.can_have_child_group %}

You cannot add a nested group because this group is already nested.

{% elif group.same_page %}

You cannot add a nested group when display is set to show all questions on the same page.

{% endif %} {% endif %}
{% if group.same_page %}

Guidance

Only add guidance if you need to give a longer explanation of how to answer the question group, or to format your content with paragraphs, headings, lists or links.

{% if group.guidance_body %} {% set guidance_text %}
{{ interpolate(group.guidance_body, with_interpolation_highlighting=True) }}
{% endset %} {{ govukSummaryList({ "rows": [ {"key": {"text": "Page heading"}, "value": {"text": group.guidance_heading}, "actions": {"items": [{"href": url_for('deliver_grant_funding.manage_guidance', grant_id=grant.id, question_id=group.id), "text": "Change", "visuallyHiddenText": "page heading"}] } }, {"key": {"text": "Guidance text"}, "value": {"html": guidance_text}, "actions": {"items": [{"href": url_for('deliver_grant_funding.manage_guidance', grant_id=grant.id, question_id=group.id), "text": "Change", "visuallyHiddenText": "guidance text"}] } }, ] }) }} {% else %} Add guidance {% endif %}
{% endif %}

Conditions

Add conditions to only show this question group if the grant recipient has answered other questions in a particular way.

{% with component=group %} {% include 'deliver_grant_funding/partials/component-conditions-operator-table.html' %} {% endwith %} {% set rows = [] %} {% with component=group %} {% include 'deliver_grant_funding/partials/_implicit-conditions.html' %} {% endwith %} {% with component=group %} {% include 'deliver_grant_funding/partials/_explicit-conditions.html' %} {% endwith %} {% if rows %} {{ govukSummaryList({ "rows": rows, "classes": "app-tasklist-builder" }) }} {% endif %} {{ govukButton({ "text": "Add condition", "href": url_for('deliver_grant_funding.add_question_condition_select_calculation', grant_id=grant.id, component_id=group.id), "classes": "govuk-button--secondary", }) }}

Validations

{% if group.same_page %}

Add validations to show an error message if a calculation including at least one answer from the question group does not meet a requirement.

For example, validation to stop users from entering numbers that add up to more than a required amount.

{% set rows = [] %} {% with component=group %} {% include 'deliver_grant_funding/partials/_explicit-validations.html' %} {% endwith %} {% if rows %} {{ govukSummaryList({ "rows": rows, "classes": "app-tasklist-builder" }) }} {% endif %} {% if grant_admin %} {{ govukButton({ "text": "Add more validation" if group.validations else "Add validation", "href": url_for('deliver_grant_funding.add_group_validation', grant_id=grant.id, group_id=group.id), "classes": "govuk-button--secondary govuk-!-margin-bottom-3", }) }} {% endif %} {% else %} {# TODO: content review #}

You can only add validations to a question group when questions are displayed on the same page. To add a validation, change the display setting to 'All questions on the same page'.

{% endif %}
{% if grant_admin %} {% endif %}
{% endblock content %}