{% extends "django_qbe2/base.html" %} {% load i18n static %} {% block extrahead %}{{ block.super }}{% endblock %} {% block breadcrumbs %}{% endblock %} {% block content %}

{% translate "Saved queries" %}

{% if saved_query %}

{% translate "Editing a saved definition:" %} {{ saved_query.name }}. {% translate "Previewing does not save changes." %}

{% endif %}

{% translate "Choose the data you need. Add conditions, preview results, and export your report." %}

{% if has_reports %}
{{ form.report.as_field_group }}
{% url 'django_qbe2:results' as results_url %}
{% csrf_token %} {% if saved_query %}{% endif %} {% if form.errors %}{% endif %}

{% translate "Report type" %}

{{ form.mode.errors }}{{ form.mode.as_field_group }}

{% translate "Changing report type preserves the report and conditions, but resets columns, calculations and ordering. Saved queries change only when you explicitly update them." %}

{% if form.mode.value == "summary" %}

{% translate "1. Grouping and calculations" %}

{% translate "Optionally group by fields, then choose the calculations to display." %}

{{ form.group_by.errors }}{{ form.group_by }} {{ form.metrics.management_form }}{{ form.metrics.non_form_errors }}
{% for row in form.metrics %}
{{ row.as_div }}
{% endfor %}
{% else %}

{% translate "1. Columns" %}

{% translate "Select the fields to include in your report." %}

{{ form.columns.errors }}{{ form.columns }}
{% endif %}

{% translate "2. Conditions" %}

{% translate "Choose AND to match all conditions, OR to match any, and NOT to exclude a group. Choose a listed value when options are available. For boolean values, use true or false." %}

{{ form.filters.management_form }}{{ form.filters.non_form_errors }} {{ form.groups.management_form }}{{ form.groups.non_form_errors }}
{% include "django_qbe2/condition_group.html" with node=form.condition_groups only %}

{% translate "3. Ordering" %}

{% if form.mode.value == "summary" %} {{ form.summary_ordering.management_form }}{{ form.summary_ordering.non_form_errors }}
{% for row in form.summary_ordering %}
{{ row.as_div }}
{% endfor %}
{% else %} {{ form.ordering.management_form }}{{ form.ordering.non_form_errors }}
{% for row in form.ordering %}
{{ row.as_div }}
{% endfor %}
{% endif %} {{ form.page_size.as_field_group }}
{{ field_data|json_script:"qbe-fields" }} {{ widget_labels|json_script:"qbe-widget-labels" }} {% else %}

{% translate "No reports available" %}

{% translate "Ask your administrator to register a report and grant you access." %}

{% endif %}
{% endblock %}