{% extends "outreach/admin/base.html" %} {% load i18n %} {% block page_title %}{% trans "Import" %}{% endblock %} {% block breadcrumbs_last %}{% endblock %} {% block content %}
{% csrf_token %}
{{ form.import_file.errors }} {{ form.import_file.label_tag }} {{ form.import_file }} {% trans "A UTF-8 CSV file with a header row and an email column." %}
{% if form.update_existing %}
{{ form.update_existing.help_text }}
{% endif %}
{% trans "Cancel" %}
{% if preview %} {% if preview.invalid_rows %}

{% trans "Some rows are invalid" %}

{% trans "Nothing was imported. Correct these rows in your file, then upload it again." %}

{% for column in columns %}{% endfor %} {% for row in preview.invalid_rows %} {% for cell in row.cells %}{% endfor %} {% endfor %}
{% trans "Line" %} {% trans "Errors" %}{{ column }}
{{ row.line }}
    {% for error in row.errors %}
  • {{ error }}
  • {% endfor %}
{{ cell }}
{% else %}

{% trans "Preview" %}

{% blocktrans with new=preview.new_rows|length update=preview.update_rows|length kept=preview.kept_rows|length repeated=preview.repeated_rows|length %}{{ new }} new, {{ update }} to update, {{ kept }} kept as they are, {{ repeated }} repeated in the file.{% endblocktrans %}

{% if confirm_form.fields.audience_lines %}{% endif %} {% for column in columns %}{% endfor %} {% for row in preview.rows %} {% if confirm_form.fields.audience_lines %} {% endif %} {% for cell in row.cells %}{% endfor %} {% endfor %}
{% trans "Audience" %}{{ column }}
{% if row.status.value != "repeated" %} {% endif %} {{ row.status.label }} {% for field_name, change in row.changes.items %}
{{ field_name }}: {{ change.0|default:"-" }} → {{ change.1 }}{% endfor %}
{{ cell }}
{% if preview.new_rows or preview.update_rows or confirm_form.fields.audience_lines and preview.audience_rows %}
{% csrf_token %} {% for field in confirm_form.hidden_fields %}{{ field }}{% endfor %} {% if confirm_form.fields.audience_lines %}
{% if confirm_form.non_field_errors %} {% endif %}
{{ confirm_form.audience.errors }} {{ confirm_form.audience.label_tag }} {{ confirm_form.audience }} {% trans "Tick the rows that join the audience. Prospects already in it are left as they are. Unsubscribed prospects can be members, but are never mailed." %}
{{ confirm_form.new_audience_name.errors }} {{ confirm_form.new_audience_name.label_tag }} {{ confirm_form.new_audience_name }} {% trans "Creates the audience. Choose an audience or type a new name, not both." %}
{% endif %}

{% trans "If you are satisfied with the preview, confirm the import." %}

{% else %}

{% trans "Every row already exists, so there is nothing to import." %}

{% endif %}
{% endif %} {% endif %} {% endblock %}