Files
notifications-admin/app/templates/views/check-sms.html
Adam Shimali 584533eb11 First slice of csv upload of phone numbers for sending messages.
At the moment the file contents are not persisted by checked in
memory.

The first and last three records are show if all are valid.

If there are invalid rows, they are reported and the user is
prompted to go back and sort out upload file.

The storing of upload result (i.e. validation of file) in session
will be removed in next story which is about persisting of file
for later processing.
2016-01-11 15:00:51 +00:00

65 lines
2.0 KiB
HTML

{% extends "withnav_template.html" %}
{% from "components/sms-message.html" import sms_message %}
{% from "components/table.html" import table, field %}
{% from "components/placeholder.html" import placeholder %}
{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
GOV.UK Notify | Send text messages
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-xlarge">Send text messages</h1>
{% if upload_result.rejects %}
<h3 class="heading-small">The following numbers are invalid</h3>
{% for rejected in upload_result.rejects %}
<p>Line {{rejected.line_number}}: {{rejected.phone }}</a>
{% endfor %}
<p><a href="{{url_for('.sendsms')}}" class="button">Go back and resolve errors</a></p>
{% else %}
<h2 class="heading-medium">Check and confirm</h2>
<form method="POST" enctype="multipart/form-data">
{{ page_footer(
button_text = "Send {} text messages".format(upload_result.valid|count),
back_link = url_for(".sendsms")
)}}
{% if upload_result.valid | count > 6 %}
<h3 class="heading-small">First three message in file</h3>
{% for recipient in upload_result.valid[:3] %}
{{ sms_message(message_template|replace_placeholders(
recipient),
'{}'.format(recipient['phone'])
)}}
{% endfor %}
<h3 class="heading-small">Last three messages in file</h3>
{% for recipient in upload_result.valid[-3:] %}
{{ sms_message(message_template|replace_placeholders(
recipient),
'{}'.format(recipient['phone'])
)}}
{% endfor %}
{% else %}
<h3 class="heading-small">All messages in file</h3>
{% for recipient in upload_result.valid %}
{{ sms_message(message_template|replace_placeholders(
recipient),
'{}'.format(recipient['phone'])
)}}
{% endfor %}
{% endif %}
{{ page_footer(
button_text = "Send {} text messages".format(upload_result.valid|count),
back_link = url_for(".sendsms")
)}}
</form>
{% endif %}
{% endblock %}