mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Handle multi-column recipients
Implements https://github.com/alphagov/notifications-utils/pull/81 Handles addresses as multiple columns: - in ‘Send yourself a test’ - in example CSV files - in validating that a CSV file has recipients (eg at least an ‘address line 1’ and ‘postcode’ column) - when showing the contents of a CSV file As few UI changes as possible, once we have the thing working end-to-end we can think about how the UI might need to work differently.
This commit is contained in:
@@ -15,10 +15,24 @@
|
||||
You can still send {{ remaining_messages }} messages today, but
|
||||
{% endif %}
|
||||
‘{{ original_file_name }}’ contains
|
||||
{{ count_of_recipients }} {{ recipients.recipient_column_header }}
|
||||
{%- if count_of_recipients != 1 -%}
|
||||
{{ 'es' if 'email address' == recipients.recipient_column_header else 's' }}
|
||||
{%- endif %}.
|
||||
{{ count_of_recipients }}
|
||||
{% if count_of_recipients == 1 -%}
|
||||
{%- if template.template_type == 'email' -%}
|
||||
email address
|
||||
{%- elif template.template_type == 'sms' -%}
|
||||
phone number
|
||||
{%- elif template.template_type == 'letter' -%}
|
||||
address
|
||||
{%- endif -%}
|
||||
{%- else -%}
|
||||
{%- if template.template_type == 'email' -%}
|
||||
email addresses
|
||||
{%- elif template.template_type == 'sms' -%}
|
||||
phone numbers
|
||||
{%- elif template.template_type == 'letter' -%}
|
||||
addresses
|
||||
{%- endif -%}
|
||||
{%- endif -%}.
|
||||
</p>
|
||||
{% endcall %}
|
||||
</div>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
{% endcall %}
|
||||
</div>
|
||||
|
||||
{% elif not recipients.has_recipient_column %}
|
||||
{% elif not recipients.has_recipient_columns %}
|
||||
|
||||
<div class="bottom-gutter">
|
||||
{% call banner_wrapper(type='dangerous') %}
|
||||
@@ -193,7 +193,9 @@
|
||||
{{ item['columns'][column].data if item['columns'][column].data != None }}
|
||||
{% endcall %}
|
||||
{% else %}
|
||||
{{ text_field(item['columns'][column].data) }}
|
||||
{% call field() %}
|
||||
{{ item['columns'][column].data if item['columns'][column].data != None }}
|
||||
{% endcall %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if item['columns'].get(None) %}
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
<form method="post">
|
||||
{% call(item, row_number) list_table(
|
||||
example,
|
||||
caption="Fill in the {}".format('field' if template.placeholders|length == 1 else 'fields'),
|
||||
field_headings=[recipient_column] + template.placeholders|list
|
||||
caption="Fill in the {}".format('field' if (recipient_columns + template.placeholders|list)|length == 2 else 'fields'),
|
||||
field_headings=recipient_columns + template.placeholders|list
|
||||
) %}
|
||||
{% for column in item %}
|
||||
{% call field() %}
|
||||
|
||||
Reference in New Issue
Block a user