2017-06-23 15:02:20 +01:00
{% extends "withnav_template.html" %}
2017-07-25 22:57:01 +01:00
{% from "components/banner.html" import banner_wrapper %}
2017-06-23 15:02:20 +01:00
{% from "components/message-count-label.html" import message_count_label %}
{% block service_page_title %}
2018-08-06 11:20:50 +01:00
{{ "Error" if error else "Preview of ‘ {}’ ".format(template.name) }}
2017-06-23 15:02:20 +01:00
{% endblock %}
{% block maincolumn_content %}
2018-10-30 16:32:10 +00:00
{% if template.template_type == 'letter' and current_service.trial_mode %}
{% set error = 'trial-mode-letters' %}
< div class = "bottom-gutter" >
2018-11-01 14:45:12 +00:00
{% call banner_wrapper(type='dangerous') %}
{% with
count_of_recipients=1
%}
2018-10-30 16:32:10 +00:00
{% include "partials/check/trying-to-send-letters-in-trial-mode.html" %}
2018-11-01 14:45:12 +00:00
{% endwith %}
{% endcall %}
2018-10-30 16:32:10 +00:00
< / div >
{% elif error == 'not-allowed-to-send-to' %}
2017-07-25 22:57:01 +01:00
< div class = "bottom-gutter" >
{% call banner_wrapper(type='dangerous') %}
{% with
count_of_recipients=1,
2017-07-25 23:06:55 +01:00
template_type_label=(
'phone number' if template.template_type == 'sms' else 'email address'
)
2017-07-25 22:57:01 +01:00
%}
{% include "partials/check/not-allowed-to-send-to.html" %}
{% endwith %}
{% endcall %}
< / div >
2017-06-29 16:06:36 +01:00
{% elif error == 'too-many-messages' %}
2017-07-25 22:57:01 +01:00
< div class = "bottom-gutter" >
{% call banner_wrapper(type='dangerous') %}
{% include "partials/check/too-many-messages.html" %}
{% endcall %}
< / div >
2017-06-29 16:06:36 +01:00
{% elif error == 'message-too-long' %}
2017-06-29 15:33:31 +01:00
{# the only row_errors we can get when sending one off messages is that the message is too long #}
2017-07-25 22:57:01 +01:00
< div class = "bottom-gutter" >
{% call banner_wrapper(type='dangerous') %}
{% include "partials/check/message-too-long.html" %}
{% endcall %}
< / div >
2017-06-29 15:33:31 +01:00
{% else %}
< h1 class = "heading-large" >
2018-08-06 11:20:50 +01:00
Preview of ‘ {{ template.name }}’
2017-06-29 15:33:31 +01:00
< / h1 >
{% endif %}
2017-06-23 15:02:20 +01:00
{{ template|string }}
2018-11-19 15:21:09 +00:00
< div class = "js-stick-at-bottom-when-scrolling" >
2017-06-30 11:49:03 +01:00
< form method = "post" enctype = "multipart/form-data" action = "{{url_for(
'main.send_notification',
service_id=current_service.id,
template_id=template.id,
help='3' if help else 0
)}}" class='page-footer'>
2017-06-23 15:02:20 +01:00
< input type = "hidden" name = "csrf_token" value = "{{ csrf_token() }}" / >
2017-06-29 15:33:31 +01:00
{% if not error %}
2018-02-01 13:32:27 +00:00
< button type = "submit" class = "button" > Send 1 {{ message_count_label(1, template.template_type, suffix='') }}< / button >
2017-06-23 15:02:20 +01:00
{% endif %}
< a href = "{{ back_link }}" class = "page-footer-back-link" > Back< / a >
2018-10-30 14:27:09 +00:00
{% if template.template_type == 'letter' %}
2018-11-22 12:17:11 +00:00
< a href = "{{ url_for('main.check_notification_preview', service_id=current_service.id, template_id=template.id, filetype='pdf') }}" download class = "page-footer-right-aligned-link" > Download as a PDF< / a >
2018-10-30 14:27:09 +00:00
{% endif %}
2017-06-23 15:02:20 +01:00
< / form >
< / div >
{% endblock %}