{% extends 'admin/master.html' %} {% import 'admin/lib.html' as lib with context %} {% import 'admin/static.html' as admin_static with context%} {% import 'admin/model/layout.html' as model_layout with context %} {% import 'admin/actions.html' as actionlib with context %} {% import 'admin/model/row_actions.html' as row_actions with context %} {% from 'govuk_frontend_jinja/components/button/macro.html' import govukButton %} {% from 'govuk_frontend_jinja/components/pagination/macro.html' import govukPagination %} {% from 'govuk_frontend_jinja/components/notification-banner/macro.html' import govukNotificationBanner %} {% from 'govuk_frontend_jinja/components/details/macro.html' import govukDetails %} {% from 'govuk_frontend_jinja/components/select/macro.html' import govukSelect %} {% from 'govuk_frontend_jinja/components/tag/macro.html' import govukTag %} {% block head %} {{ super() }} {{ lib.form_css() }} {% endblock %} {% block action_panel %}
{# Confirmation banner for bulk actions - shown at top #} {% if actions and request.args.get('_confirm_action') %} {% set action_to_confirm = request.args.get('_confirm_action') %} {% set action_name = dict(actions).get(action_to_confirm, action_to_confirm) %} {% set confirmation_message = actions_confirmation.get(action_to_confirm, 'Are you sure you want to perform this action?') %} {% set confirmation_html %} {% set cancel_url = request.base_url %} {% if request.args %} {% set cancel_params = [] %} {% for key, value in request.args.items(multi=True) %} {% if key not in ['_confirm_action', 'rowid'] %} {% set _ = cancel_params.append((key, value)) %} {% endif %} {% endfor %} {% if cancel_params %} {% set cancel_url = cancel_url + '?' + cancel_params|map('join', '=')|join('&') %} {% endif %} {% endif %}

Confirm: {{ action_name }}

{{ confirmation_message }}

{{ request.args.getlist('rowid')|length }} item(s) selected

{% if action_form.csrf_token is defined and action_form.csrf_token %} {{ action_form.csrf_token }} {% elif csrf_token is defined and csrf_token %} {% endif %} {% set clean_return_url = request.base_url %} {% if request.args %} {% set return_params = [] %} {% for key, value in request.args.items(multi=True) %} {% if key not in ['_confirm_action', 'rowid'] %} {% set _ = return_params.append((key, value)) %} {% endif %} {% endfor %} {% if return_params %} {% set clean_return_url = clean_return_url + '?' + return_params|map('join', '=')|join('&') %} {% endif %} {% endif %} {# Include the rowids from the query string #} {% for rowid in request.args.getlist('rowid') %} {% endfor %}
{{ govukButton({ "text": "Confirm " + action_name|lower, "classes": "govuk-button--primary" }) }} Cancel
{% endset %} {{ govukNotificationBanner({ "html": confirmation_html, "titleText": "Confirm action", }) }} {% endif %} {# Flash messages using GOV.UK Notification Banner #} {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} {% from 'govuk_frontend_jinja/components/notification-banner/macro.html' import govukNotificationBanner %} {% for category, message in messages %} {% if category == 'success' %} {{ govukNotificationBanner({ "type": "success", "html": message }) }} {% else %} {# error, warning, or other categories #} {{ govukNotificationBanner({ "html": message, "titleText": "Important" if category == 'error' else "Information" }) }} {% endif %} {% endfor %} {% endif %} {% endwith %}

{{ admin_view.name }}

{# MOJ Filter Layout - using macro from model/layout.html #} {% call model_layout.mojFilterLayout() %} {# Table #} {% block model_list_table %} {# Bulk actions checkbox #} {% if actions %} {% endif %} {% for c, name in list_columns %} {% set column = loop.index0 %} {% endfor %} {% for row in data %} {# Bulk action checkbox #} {% if actions %} {% endif %} {% for c, name in list_columns %} {% endfor %} {% else %} {% endfor %}
{{ admin_view.name }} entries
{% if admin_view.is_sortable(c) %} {% set sortClasses = "govuk-link govuk-link--no-visited-state xgovuk-fa-link--sort" %} {% if sort_column == column %} {% set sortClasses = sortClasses + (" xgovuk-fa-link--sort-descending" if sort_desc else " xgovuk-fa-link--sort-ascending") %} {{ name }} {% else %} {{ name }} {% endif %} {% else %} {{ name }} {% endif %} {% if admin_view.column_descriptions.get(c) %} {{ admin_view.column_descriptions[c] }} {% endif %}
{% if loop.index == 1 %} {% if admin_view.can_edit %} {{ get_value(row, c) }} (view and edit) {% elif admin_view.can_view_details %} {{ get_value(row, c) }} (view details) {% else %} {{ get_value(row, c) }} {% endif %} {% else %} {{ get_value(row, c) }} {% endif %}
{% block empty_list_message %}

{{ admin_view.get_empty_list_message() }}

{% endblock %}
{% endblock %} {% endcall %} {% endblock %} {% block bodyEnd %} {{ super() }} {{ lib.form_js() }} {# Initialize FilterToggleButton with custom text showing active filter count #} {% if search_supported or filters %} {% endif %} {# Progressive enhancement for filters - remove empty inputs before submit #} {% if filters %} {% endif %} {# Progressive enhancement for bulk actions #} {% if actions %} {% endif %} {% endblock %}