2015-12-14 16:53:07 +00:00
|
|
|
|
{% extends "withnav_template.html" %}
|
2015-12-10 16:48:07 +00:00
|
|
|
|
{% from "components/sms-message.html" import sms_message %}
|
2016-02-03 14:36:11 +00:00
|
|
|
|
{% from "components/table.html" import list_table, field %}
|
2015-12-10 17:54:05 +00:00
|
|
|
|
{% from "components/placeholder.html" import placeholder %}
|
2016-02-17 14:20:55 +00:00
|
|
|
|
{% from "components/file-upload.html" import file_upload %}
|
2016-01-07 20:11:22 +00:00
|
|
|
|
{% from "components/page-footer.html" import page_footer %}
|
2015-11-30 14:20:17 +00:00
|
|
|
|
|
|
|
|
|
|
{% block page_title %}
|
2016-02-08 09:23:51 +00:00
|
|
|
|
Check and confirm – GOV.UK Notify
|
2015-11-30 14:20:17 +00:00
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
2015-12-14 16:53:07 +00:00
|
|
|
|
{% block maincolumn_content %}
|
|
|
|
|
|
|
2015-11-30 14:20:17 +00:00
|
|
|
|
|
2016-02-17 15:49:07 +00:00
|
|
|
|
{% if template.additional_data %}
|
|
|
|
|
|
{{ banner(
|
|
|
|
|
|
"Remove these columns from your CSV file:" + ", ".join(template.missing_data),
|
|
|
|
|
|
type="dangerous"
|
|
|
|
|
|
) }}
|
|
|
|
|
|
{% elif not upload_result.valid %}
|
|
|
|
|
|
{{ banner(
|
|
|
|
|
|
"Your CSV file contained missing or invalid data",
|
|
|
|
|
|
type="dangerous"
|
|
|
|
|
|
) }}
|
|
|
|
|
|
{% endif %}
|
2015-11-30 14:20:17 +00:00
|
|
|
|
|
2016-02-17 15:49:07 +00:00
|
|
|
|
<h1 class="heading-large">
|
|
|
|
|
|
{{ "Check and confirm" if upload_result.valid else "Send text messages" }}
|
|
|
|
|
|
</h1>
|
2015-11-30 14:20:17 +00:00
|
|
|
|
|
2016-02-17 15:49:07 +00:00
|
|
|
|
<div class="grid-row">
|
|
|
|
|
|
<div class="column-two-thirds">
|
|
|
|
|
|
{% if template.missing_data or template.additional_data %}
|
|
|
|
|
|
{{ sms_message(template.formatted_as_markup)}}
|
|
|
|
|
|
{% else %}
|
|
|
|
|
|
{{ sms_message(template.replaced)}}
|
|
|
|
|
|
{% endif %}
|
2016-02-04 12:20:24 +00:00
|
|
|
|
</div>
|
2016-02-17 15:49:07 +00:00
|
|
|
|
</div>
|
2016-01-11 15:00:51 +00:00
|
|
|
|
|
2016-02-17 15:49:07 +00:00
|
|
|
|
{% if upload_result.valid %}
|
|
|
|
|
|
<form method="post" enctype="multipart/form-data">
|
|
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
|
|
|
|
|
<input type="submit" class="button" value="{{ "Send {} text message{}".format(upload_result.rows|count, '' if upload_result.rows|count == 1 else 's') }}" />
|
|
|
|
|
|
<a href="{{url_for('.send_sms', service_id=service_id, template_id=template.id)}}" class="page-footer-back-link">Back</a>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
{% else %}
|
|
|
|
|
|
<form method="post" action="{{ url_for('.send_sms', service_id=service_id, template_id=template.id) }}" enctype="multipart/form-data">
|
|
|
|
|
|
{{file_upload(form.file, button_text='Choose a CSV file')}}
|
|
|
|
|
|
{{ page_footer(
|
|
|
|
|
|
"Upload"
|
2016-02-17 14:20:55 +00:00
|
|
|
|
) }}
|
2016-02-17 15:49:07 +00:00
|
|
|
|
</form>
|
|
|
|
|
|
{% endif %}
|
2015-12-20 00:00:01 +00:00
|
|
|
|
|
2016-02-17 15:49:07 +00:00
|
|
|
|
{% call(item) list_table(
|
|
|
|
|
|
upload_result.rows,
|
|
|
|
|
|
caption=original_file_name,
|
|
|
|
|
|
field_headings=column_headers
|
|
|
|
|
|
) %}
|
|
|
|
|
|
{% if item.phone|valid_phone_number %}
|
2016-02-03 14:36:11 +00:00
|
|
|
|
{% call field() %}
|
|
|
|
|
|
{{ item.phone }}
|
|
|
|
|
|
{% endcall %}
|
2016-02-17 15:49:07 +00:00
|
|
|
|
{% else %}
|
|
|
|
|
|
{% call field(status='missing') %}
|
|
|
|
|
|
{{ item.phone }}
|
|
|
|
|
|
{% endcall %}
|
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
{% for column in template.placeholders %}
|
|
|
|
|
|
{% if item.get(column) %}
|
|
|
|
|
|
{% call field() %}
|
|
|
|
|
|
{{ item.get(column) }}
|
|
|
|
|
|
{% endcall %}
|
|
|
|
|
|
{% else %}
|
|
|
|
|
|
{% call field(status='missing') %}
|
|
|
|
|
|
missing
|
|
|
|
|
|
{% endcall %}
|
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
{% endfor %}
|
|
|
|
|
|
{% endcall %}
|
2015-12-11 17:25:04 +00:00
|
|
|
|
|
2015-11-30 14:20:17 +00:00
|
|
|
|
{% endblock %}
|