{% 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" if errors else "Preview" }} {% endblock %} {% block maincolumn_content %} {% if recipients.too_many_rows %}
{% call banner_wrapper(type='dangerous') %}

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.

{{ skip_to_file_contents() }} {% endcall %}
{% elif not count_of_recipients %}
{% call banner_wrapper(type='dangerous') %}

Your file is missing some rows

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

{{ skip_to_file_contents() }} {% endcall %}
{% elif not recipients.has_recipient_columns %}
{% call banner_wrapper(type='dangerous') %}

Your file needs to have {{ recipients.recipient_column_headers | formatted_list( prefix='a column called', prefix_plural='columns called' ) }}

Your file has {{ recipients.column_headers | formatted_list( prefix='one column, called ', prefix_plural='columns called ' ) }}.

{{ skip_to_file_contents() }} {% endcall %}
{% elif recipients.missing_column_headers %}
{% call banner_wrapper(type='dangerous') %}

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

Your file has {{ recipients.column_headers | formatted_list( prefix='one column, called ', prefix_plural='columns called ' ) }}.

It doesn’t have {{ recipients.missing_column_headers | formatted_list( conjunction='or', prefix='a column called ', prefix_plural='columns called ' ) }}.

{{ skip_to_file_contents() }} {% endcall %}
{% elif row_errors %}
{% call banner_wrapper(type='dangerous') %} {% if row_errors|length == 1 %}

There is a problem with your data

You need to {{ row_errors[0] }}

{% else %}

There are some problems with your data

You need to:

{% endif %} {{ skip_to_file_contents() }} {% endcall %}
{% elif not recipients.allowed_to_send_to %}
{% call banner_wrapper(type='dangerous') %}

You can’t send to {{ 'this' if count_of_recipients == 1 else 'these' }} {{ recipients.recipient_column_headers[0] }} {%- if count_of_recipients != 1 -%} {{ 'es' if 'email address' == recipients.recipient_column_headers[0] else 's' }} {%- endif %}

In trial mode you can only send to yourself and members of your team

{{ skip_to_file_contents() }} {% endcall %}
{% elif recipients.more_rows_than_can_send %} {% include "partials/check/too-many-messages.html" %} {% else %}

Preview of {{ template.name }}

{{ skip_to_file_contents() }} {% endif %} {{ template|string }}
{% if errors %} {% if request.args.from_test %} Back {% else %} {{file_upload(form.file, button_text='Re-upload your file')}} {% endif %} {% else %} {% endif %}

{{ original_file_name }}

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