diff --git a/app/assets/stylesheets/components/sms-message.scss b/app/assets/stylesheets/components/sms-message.scss index 32d57ebd9..21dc3227c 100644 --- a/app/assets/stylesheets/components/sms-message.scss +++ b/app/assets/stylesheets/components/sms-message.scss @@ -31,7 +31,7 @@ .sms-message-recipient { @include copy-19; color: $secondary-text-colour; - margin: -20px 0 $gutter 0; + margin: 10px 0 5px 0; } .sms-message-name { diff --git a/app/main/views/send.py b/app/main/views/send.py index f18bc8c19..cf9bebc22 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -234,12 +234,14 @@ def check_messages(service_id, template_type, upload_id): with suppress(StopIteration): template.values = next(recipients.rows) + first_recipient = template.values.get(recipients.recipient_column_header, '') session['upload_data']['notification_count'] = len(list(recipients.rows)) session['upload_data']['valid'] = not recipients.has_errors return render_template( 'views/check.html', recipients=recipients, + first_recipient=first_recipient, template=template, page_heading=get_page_headings(template.template_type), errors=get_errors_for_csv(recipients, template.template_type), diff --git a/app/templates/components/email-message.html b/app/templates/components/email-message.html index 9df0f3d26..297a97a4d 100644 --- a/app/templates/components/email-message.html +++ b/app/templates/components/email-message.html @@ -1,4 +1,13 @@ -{% macro email_message(subject, body, name=None, edit_link=None, from_name=None, from_address=None) %} +{% macro email_message( + subject, + body, + name=None, + edit_link=None, + from_name=None, + from_address=None, + recipient=None, + show_placeholder_for_recipient=False +) %} {% if name %}

{% if edit_link %} @@ -20,6 +29,20 @@ {% endif %} + {% if recipient is not none %} + + To + + {% if show_placeholder_for_recipient %} + + email address + + {% else %} + {{ recipient }} + {% endif %} + + + {% endif %} {% if subject %} Subject diff --git a/app/templates/components/sms-message.html b/app/templates/components/sms-message.html index eb809d409..5ae59f21a 100644 --- a/app/templates/components/sms-message.html +++ b/app/templates/components/sms-message.html @@ -1,4 +1,12 @@ -{% macro sms_message(body, recipient=None, name=None, id=None, edit_link=None, from=None) %} +{% macro sms_message( + body, + recipient=None, + name=None, + id=None, + edit_link=None, + from=None, + show_placeholder_for_recipient=False +) %} {% if name %}

{% if edit_link %} @@ -8,6 +16,18 @@ {% endif %}

{% endif %} + {% if recipient is not none %} +

+ To: + {% if show_placeholder_for_recipient %} + + phone number + + {% else %} + {{ recipient }} + {% endif %} +

+ {% endif %}
{% if from %} @@ -16,11 +36,6 @@ {% endif %} {{ body|nl2br }}
- {% if recipient %} -

- {{ recipient }} -

- {% endif %} {% if id %}

Template ID: {{ id }} diff --git a/app/templates/views/check.html b/app/templates/views/check.html index 5cbcbc4ee..c368bca9c 100644 --- a/app/templates/views/check.html +++ b/app/templates/views/check.html @@ -77,13 +77,17 @@ template.formatted_subject_as_markup if errors else template.replaced_subject, template.formatted_as_markup if errors else template.replaced, from_address='{}@notifications.service.gov.uk'.format(current_service.email_from), - from_name=current_service.name + from_name=current_service.name, + recipient=first_recipient, + show_placeholder_for_recipient=errors )}} {% elif 'sms' == template.template_type %}

{{ sms_message( - template.formatted_as_markup if errors else template.replaced + template.formatted_as_markup if errors else template.replaced, + recipient=first_recipient, + show_placeholder_for_recipient=errors )}}