diff --git a/app/main/views/send.py b/app/main/views/send.py index b53d763b0..9f98c9a71 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -506,9 +506,14 @@ def _check_messages(service_id, template_id, upload_id, preview_row): email_reply_to=email_reply_to, sms_sender=sms_sender, ) + simplifed_template = get_template( + db_template, + current_service, + show_recipient=False, + ) recipients = RecipientCSV( contents, - template=template, + template=template or simplifed_template, max_initial_rows_shown=50, max_errors_shown=50, guestlist=itertools.chain.from_iterable( @@ -547,6 +552,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row): if preview_row < len(recipients) + 2: template.values = recipients[preview_row - 2].recipient_and_personalisation + simplifed_template.values = recipients[preview_row - 2].recipient_and_personalisation elif preview_row > 2: abort(404) @@ -574,7 +580,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row): service_id, template.id, db_template["version"], original_file_name ), template_id=template_id, - db_template=db_template + simplifed_template=simplifed_template, ) @@ -651,14 +657,10 @@ def preview_job(service_id, template_id, upload_id, row_index=2): if data["errors"]: return render_template("views/check/column-errors.html", **data) - simplifed_template = get_template( - data.get('db_template', {}), - current_service, - ) - return render_template( - "views/check/preview.html", scheduled_for=session["scheduled_for"], **data, - simplifed_template=simplifed_template + "views/check/preview.html", + scheduled_for=session["scheduled_for"], + **data, ) @@ -841,7 +843,10 @@ def _check_notification(service_id, template_id, exception=None): email_reply_to=email_reply_to, sms_sender=sms_sender, ) - + simplifed_template = get_template( + db_template, + current_service, + ) placeholders = fields_to_fill_in(template) back_link = get_back_link(service_id, template, len(placeholders), placeholders) @@ -867,6 +872,7 @@ def _check_notification(service_id, template_id, exception=None): choose_time_form=choose_time_form, db_template=db_template, **(get_template_error_dict(exception) if exception else {}), + simplifed_template=simplifed_template ) @@ -913,18 +919,11 @@ def preview_notification(service_id, template_id): ) session["scheduled_for"] = request.args.get("scheduled_for", "") - data = _check_notification(service_id, template_id) - db_template = data.get('db_template', None) - simplifed_template = get_template( - db_template, - current_service, - ) return render_template( "views/notifications/preview.html", - **data, + **_check_notification(service_id, template_id), scheduled_for=session["scheduled_for"], - simplifed_template=simplifed_template, recipient=recipient, ) diff --git a/app/templates/views/check/preview.html b/app/templates/views/check/preview.html index f6fe2cb04..d47e9e779 100644 --- a/app/templates/views/check/preview.html +++ b/app/templates/views/check/preview.html @@ -29,50 +29,49 @@

Message

{{ simplifed_template|string }}
-
- + {% if not request.args.from_test %} +

Recipients list

+
+
+
+ {% call(item, row_number) list_table( + recipients.displayed_rows, + caption="Note: Only the first 5 rows are displayed here.", + caption_visible=True, + field_headings=recipients.column_headers + ) %} + {% for column in recipients.column_headers %} + {% if item[column].ignore %} + {{ text_field(item[column].data or '', status='default') }} + {% else %} + {{ text_field(item[column].data or '') }} + {% endif %} + {% endfor %} + {% if item[None].data %} + {% for column in item[None].data %} + {{ text_field(column, status='default') }} + {% endfor %} + {% endif %} + {% endcall %} +
+ {% endif %} + + {% endblock %} diff --git a/app/templates/views/notifications/preview.html b/app/templates/views/notifications/preview.html index 13ef103b0..a22fda5bb 100644 --- a/app/templates/views/notifications/preview.html +++ b/app/templates/views/notifications/preview.html @@ -60,7 +60,7 @@ help='3' if help else 0 )}}" class='page-footer'> -

Placeholder: This message will be delivered to 400 phone numbers and will use a total of 800 message parts, leaving Washington DSHS with 249,200 message parts remaining.

+

Does everything look good?

{% if not error %} {% set button_text %}