{% extends "withnav_template.html" %} {% from "components/banner.html" import banner_wrapper %} {% from "components/radios.html" import radio_select %} {% from "components/table.html" import list_table, field, text_field, index_field, hidden_field_heading %} {% from "components/file-upload.html" import file_upload %} {% from "components/page-footer.html" import page_footer %} {% from "components/message-count-label.html" import message_count_label %} {% set file_contents_header_id = 'file-preview' %} {% macro skip_to_file_contents() %}

Skip to file contents

{% endmacro %} {% block service_page_title %} Error {% endblock %} {% block maincolumn_content %}
{% call banner_wrapper(type='dangerous') %} {% if recipients.too_many_rows %}

Your file has too many rows

Notify can process up to {{ "{:,}".format(recipients.max_rows) }} rows at once. Your file has {{ "{:,}".format(recipients|length) }} rows.

{% elif not count_of_recipients %}

Your file is missing some rows

{% if recipients.missing_column_headers %}

It needs at least one row of data, and {{ recipients.missing_column_headers | sort() | formatted_list( prefix='a column called', prefix_plural='columns called' ) }}.

{% else %}

It needs at least one row of data.

{% endif %} {% elif not recipients.has_recipient_columns %}

Your file needs {{ ( recipients.missing_column_headers if template.template_type == 'letter' else required_recipient_columns ) | formatted_list( prefix='a column called', prefix_plural='columns called' ) }}

Right now it has {{ recipients.column_headers | formatted_list( prefix='one column, called ', prefix_plural='columns called ' ) }}.

{% elif recipients.duplicate_recipient_column_headers %}

Your file has more than one column called {{ ( recipients.duplicate_recipient_column_headers ) | formatted_list( conjunction='or', prefix='', prefix_plural='' ) }}

Delete or rename one of these columns and try again.

{% elif recipients.missing_column_headers %}

The columns in your file need to match the double brackets in your template

Your file is missing {{ recipients.missing_column_headers | formatted_list( conjunction='and', prefix='a column called ', prefix_plural='columns called ' ) }}.

{% elif sent_previously %} {% include "partials/check/sent-previously.html" %} {% elif not recipients.allowed_to_send_to %} {% with count_of_recipients=count_of_recipients, template_type_label=recipients.recipient_column_headers[0] %} {% include "partials/check/not-allowed-to-send-to.html" %} {% endwith %} {% elif trying_to_send_letters_in_trial_mode %}
{% with count_of_recipients=count_of_recipients %} {% include "partials/check/trying-to-send-letters-in-trial-mode.html" %} {% endwith %}
{% elif recipients.more_rows_than_can_send %} {% include "partials/check/too-many-messages.html" %} {% endif %} {{ skip_to_file_contents() }} {% endcall %}
{% if request.args.from_test %} Back {% else %} {{ file_upload( form.file, action=url_for('.send_messages', service_id=current_service.id, template_id=template.id), button_text='Re-upload your file' ) }} {% endif %}
Back to top
{% if not request.args.from_test %} {% set column_headers = recipients._raw_column_headers if recipients.duplicate_recipient_column_headers else recipients.column_headers %}

{{ original_file_name }}

{% call(item, row_number) list_table( recipients.displayed_rows, caption=original_file_name, caption_visible=False, field_headings=[ 'Row in file'|safe ] + column_headers ) %} {% call index_field() %} {% set displayed_index = item.index + 2 %} {% if ( trying_to_send_letters_in_trial_mode and (not errors or recipients.more_rows_than_can_send) and displayed_index != preview_row ) %} {{ displayed_index }} {% else %} {{ displayed_index }} {% endif %} {% endcall %} {% for column in column_headers %} {% if item[column].error and not recipients.missing_column_headers %} {% call field() %} {{ item[column].error }} {{ item[column].data if item[column].data != None }} {% endcall %} {% elif item[column].ignore %} {{ text_field(item[column].data or '', status='default') }} {% else %} {{ text_field(item[column].data or '') }} {% endif %} {% endfor %} {% if item[None].data %} {% for column in item[None].data %} {{ text_field(column, status='default') }} {% endfor %} {% endif %} {% endcall %} {% endif %}
{% if recipients.too_many_rows %} {% elif count_of_displayed_recipients < count_of_recipients %} {% elif row_errors and not recipients.missing_column_headers %} {% endif %}

Preview of {{ template.name }}

{{ template|string }} {% endblock %}