mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
merge from main
This commit is contained in:
@@ -30,7 +30,6 @@
|
||||
<div class="bottom-gutter-3-2">
|
||||
<form method="post" enctype="multipart/form-data" action="{{url_for('main.start_job', service_id=current_service.id, upload_id=upload_id)}}" class='page-footer'>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<input type="hidden" name="contact_list_id" value="{{ request.args.get('contact_list_id', '') }}" />
|
||||
{% if choose_time_form %}
|
||||
{{ choose_time_form.scheduled_for(param_extensions={
|
||||
'formGroup': {'classes': 'bottom-gutter-2-3'},
|
||||
@@ -41,12 +40,12 @@
|
||||
}
|
||||
}) }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% set button_text %}
|
||||
Send {{ count_of_recipients|message_count(template.template_type) }}
|
||||
{% endset %}
|
||||
{{ govukButton({ "text": button_text }) }}
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -17,31 +17,13 @@
|
||||
) %}
|
||||
{% call row_heading() %}
|
||||
<div class="file-list">
|
||||
{% if item.upload_type == 'contact_list' %}
|
||||
<a class="file-list-filename-large govuk-link govuk-link--no-visited-state" href="{{ url_for('.contact_list', service_id=current_service.id, contact_list_id=item.id) }}">{{ item.original_file_name }}</a>
|
||||
{% else %}
|
||||
<a class="file-list-filename-large govuk-link govuk-link--no-visited-state" href="{{ url_for('.view_job', service_id=current_service.id, job_id=item.id) }}">{{ item.original_file_name }}</a>
|
||||
{% endif %}
|
||||
<a class="file-list-filename-large govuk-link govuk-link--no-visited-state" href="{{ url_for('.view_job', service_id=current_service.id, job_id=item.id) }}">{{ item.original_file_name }}</a>
|
||||
{% if item.scheduled %}
|
||||
<span class="file-list-hint-large">
|
||||
Sending {{
|
||||
item.scheduled_for|format_datetime_relative
|
||||
}}
|
||||
</span>
|
||||
{% elif item.upload_type == 'contact_list' %}
|
||||
<span class="file-list-hint-large">
|
||||
{% if item.recent_job_count %}
|
||||
Used {{ item.recent_job_count|iteration_count }}
|
||||
in the last
|
||||
{{ current_service.get_days_of_retention(item.template_type) }}
|
||||
days
|
||||
{% elif item.has_jobs %}
|
||||
Not used in the last
|
||||
{{ current_service.get_days_of_retention(item.template_type) }}
|
||||
days
|
||||
{% else %}
|
||||
Not used yet
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<span class="file-list-hint-large">
|
||||
Sent {{
|
||||
@@ -62,12 +44,6 @@
|
||||
suffix='waiting to send'
|
||||
)
|
||||
) }}
|
||||
{% elif item.upload_type == 'contact_list' %}
|
||||
{{ big_number(
|
||||
item.row_count,
|
||||
smallest=True,
|
||||
label="saved {}".format(item.row_count|recipient_count_label(item.template_type))
|
||||
) }}
|
||||
{% else %}
|
||||
<div class="govuk-grid-row">
|
||||
<div class="govuk-grid-column-one-third">
|
||||
|
||||
@@ -17,15 +17,5 @@
|
||||
</p>
|
||||
{% endif %}
|
||||
{{ previous_next_navigation(prev_page, next_page) }}
|
||||
{% if current_user.has_permissions('send_messages') %}
|
||||
<div class="js-stick-at-bottom-when-scrolling">
|
||||
{{ govukButton({
|
||||
"element": "a",
|
||||
"text": "Upload an emergency contact list",
|
||||
"href": url_for('.upload_contact_list', service_id=current_service.id),
|
||||
"classes": "govuk-button--secondary"
|
||||
}) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/big-number.html" import big_number -%}
|
||||
{% from "components/list.html" import list_of_placeholders %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/table.html" import list_table, field, right_aligned_field_heading, row_heading %}
|
||||
{% from "components/uk_components/back-link/macro.njk" import govukBackLink %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Choose an emergency contact list
|
||||
{% endblock %}
|
||||
|
||||
{% block backLink %}
|
||||
{{ govukBackLink({ "href": url_for('.send_one_off', service_id=current_service.id, template_id=template.id) }) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
{{ page_header('Choose an emergency contact list') }}
|
||||
|
||||
{% if template.placeholders %}
|
||||
<div class="govuk-grid-row">
|
||||
<div class="govuk-grid-column-five-sixths">
|
||||
<p class="govuk-body">
|
||||
You cannot use an emergency contact list with this template because it
|
||||
is personalized with {{ list_of_placeholders(template.placeholders) }}.
|
||||
</p>
|
||||
<p class="govuk-body">
|
||||
Emergency contact lists can only include email addresses or phone
|
||||
numbers.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% elif contact_lists %}
|
||||
<div class='dashboard-table ajax-block-container'>
|
||||
{% call(item, row_number) list_table(
|
||||
contact_lists,
|
||||
caption="Emergency contact lists",
|
||||
caption_visible=False,
|
||||
empty_message=(
|
||||
'You have not saved any contact lists yet.'
|
||||
),
|
||||
field_headings=[
|
||||
'File',
|
||||
'Status'
|
||||
],
|
||||
field_headings_visible=False
|
||||
) %}
|
||||
{% call row_heading() %}
|
||||
<div class="file-list">
|
||||
<a class="file-list-filename-large govuk-link govuk-link--no-visited-state" href="{{ url_for('main.send_from_contact_list', service_id=current_service.id, template_id=template.id, contact_list_id=item.id) }}">{{ item.original_file_name }}</a>
|
||||
<span class="file-list-hint-large">
|
||||
Uploaded {{ item.created_at|format_datetime_relative }}
|
||||
</span>
|
||||
</div>
|
||||
{% endcall %}
|
||||
{% call field() %}
|
||||
{{ big_number(
|
||||
item.row_count,
|
||||
smallest=True,
|
||||
label=item.row_count|recipient_count_label(item.template_type),
|
||||
) }}
|
||||
{% endcall %}
|
||||
{% endcall %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="govuk-grid-row">
|
||||
<div class="govuk-grid-column-five-sixths">
|
||||
<p class="govuk-body">
|
||||
You have not saved any lists of {{ 99|recipient_count_label(template.template_type) }} yet.
|
||||
</p>
|
||||
<p class="govuk-body">
|
||||
To upload and save an emergency contact list, go to the <a class="govuk-link govuk-link--no-visited-state" href="{{ url_for('main.uploads', service_id=current_service.id) }}">uploads</a> page.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -31,9 +31,6 @@
|
||||
<div class="govuk-grid-column-full">
|
||||
{% if link_to_upload %}
|
||||
<a class="govuk-link govuk-link--no-visited-state govuk-!-margin-right-3" href="{{ url_for('.send_messages', service_id=current_service.id, template_id=template.id) }}">Upload a list of {{ 999|recipient_count_label(template.template_type) }}</a>
|
||||
{% if current_service.contact_lists %}
|
||||
<a class="govuk-link govuk-link--no-visited-state govuk-!-margin-right-3" href="{{ url_for('.choose_from_contact_list', service_id=current_service.id, template_id=template.id) }}">Use an emergency list</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if skip_link %}
|
||||
<a href="{{ skip_link[1] }}" class="govuk-link govuk-link--no-visited-state govuk-!-margin-right-3">{{ skip_link[0] }}</a>
|
||||
@@ -49,6 +46,6 @@
|
||||
{{ page_footer('Continue') }}
|
||||
{% endcall %}
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/radios.html" import radio_select %}
|
||||
{% from "components/table.html" import list_table, field, text_field, index_field, hidden_field_heading %}
|
||||
{% from "components/file-upload.html" import file_upload %}
|
||||
{% from "components/uk_components/back-link/macro.njk" import govukBackLink %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Error
|
||||
{% endblock %}
|
||||
|
||||
{% block backLink %}
|
||||
{{ govukBackLink({ "href": url_for('main.upload_contact_list', service_id=current_service.id) }) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<div class="bottom-gutter-1-2">
|
||||
{% call banner_wrapper(type='dangerous') %}
|
||||
|
||||
{% if recipients.too_many_rows %}
|
||||
|
||||
<h1 class='banner-title' data-module="track-error" data-error-type="Too many rows" data-error-label="{{ upload_id }}">
|
||||
Your file has too many rows
|
||||
</h1>
|
||||
<p class="govuk-body">
|
||||
Notify can store files up to
|
||||
{{ "{:,}".format(recipients.max_rows) }} rows in size. Your
|
||||
file has {{ "{:,}".format(recipients|length) }} rows.
|
||||
</p>
|
||||
|
||||
{% elif not recipients.allowed_to_send_to %}
|
||||
|
||||
<h1 class='banner-title' data-module="track-error" data-error-type="Trial mode: bad recipients" data-error-label="{{ upload_id }}">
|
||||
You cannot save
|
||||
{{ 'this' if recipients|length == 1 else 'these' }}
|
||||
{{ recipients|length|recipient_count_label(recipients.template_type) }}
|
||||
</h1>
|
||||
<p class="govuk-body">
|
||||
In <a class="govuk-link govuk-link--no-visited-state" href="{{ url_for('.trial_mode_new') }}">trial mode</a> you can only
|
||||
send to yourself and members of your team
|
||||
</p>
|
||||
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="js-stick-at-top-when-scrolling">
|
||||
<div class="form-group">
|
||||
{{ file_upload(
|
||||
form.file,
|
||||
allowed_file_extensions=allowed_file_extensions,
|
||||
action=url_for('.upload_contact_list', service_id=current_service.id),
|
||||
button_text='Upload your file again'
|
||||
) }}
|
||||
</div>
|
||||
<a href="#content" class="govuk-link govuk-link--no-visited-state back-to-top-link">Back to top</a>
|
||||
</div>
|
||||
|
||||
<h2 class="heading-medium" id="file-preview">{{ original_file_name }}</h2>
|
||||
|
||||
{% call(item, row_number) list_table(
|
||||
recipients.displayed_rows,
|
||||
caption=original_file_name,
|
||||
caption_visible=False,
|
||||
field_headings=[
|
||||
'<span class="govuk-visually-hidden">Row in file</span> <span aria-hidden="true">1</span>'|safe
|
||||
] + recipients.column_headers
|
||||
) %}
|
||||
{{ index_field(item.index + 2) }}
|
||||
{% for column in recipients.column_headers %}
|
||||
{{ text_field(item[column].data or '') }}
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
|
||||
{% if recipients.displayed_rows|list|length < recipients|length %}
|
||||
<p class="table-show-more-link">
|
||||
Only showing the first {{ recipients.displayed_rows|list|length }} rows
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,142 +0,0 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/big-number.html" import big_number %}
|
||||
{% from "components/radios.html" import radio_select %}
|
||||
{% from "components/table.html" import list_table, field, text_field, index_field, hidden_field_heading, row, row_heading %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/uk_components/button/macro.njk" import govukButton %}
|
||||
{% from "components/uk_components/back-link/macro.njk" import govukBackLink %}
|
||||
|
||||
{% block service_page_title %}
|
||||
{{ contact_list.original_file_name }}
|
||||
{% endblock %}
|
||||
|
||||
{% block backLink %}
|
||||
{{ govukBackLink({ "href": url_for('main.uploads', service_id=current_service.id) }) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
{{ page_header(contact_list.original_file_name) }}
|
||||
|
||||
<p class="govuk-body">
|
||||
Uploaded by {{ contact_list.created_by }} {{ contact_list.created_at|format_datetime_human }}.
|
||||
</p>
|
||||
|
||||
{% if jobs %}
|
||||
<p class="govuk-body">
|
||||
Used {{ jobs|length|iteration_count }}
|
||||
in the last {{ current_service.get_days_of_retention(contact_list.template_type) }}
|
||||
days.
|
||||
</p>
|
||||
<div class='dashboard-table ajax-block-container'>
|
||||
{% call(item, row_number) list_table(
|
||||
jobs,
|
||||
caption="Messages sent from this contact list",
|
||||
caption_visible=False,
|
||||
empty_message='',
|
||||
field_headings=[
|
||||
'Template',
|
||||
'Status'
|
||||
],
|
||||
field_headings_visible=False
|
||||
) %}
|
||||
{% call row_heading() %}
|
||||
<div class="file-list">
|
||||
<a class="file-list-filename-large govuk-link govuk-link--no-visited-state" href="{{ url_for('.view_job', service_id=current_service.id, job_id=item.id) }}">{{ item.template_name }}</a>
|
||||
{% if item.scheduled %}
|
||||
<span class="file-list-hint-large">
|
||||
Sending {{
|
||||
item.scheduled_for|format_datetime_relative
|
||||
}}
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="file-list-hint-large">
|
||||
Sent {{
|
||||
(item.scheduled_for or item.created_at)|format_datetime_relative
|
||||
}}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endcall %}
|
||||
{% call field() %}
|
||||
{% if item.scheduled %}
|
||||
{{ big_number(
|
||||
item.notification_count,
|
||||
smallest=True,
|
||||
label=item.notification_count|message_count_label(
|
||||
item.template_type,
|
||||
suffix='waiting to send'
|
||||
)
|
||||
) }}
|
||||
{% else %}
|
||||
<div class="govuk-grid-row">
|
||||
<div class="govuk-grid-column-one-third">
|
||||
{{ big_number(
|
||||
item.notifications_sending,
|
||||
smallest=True,
|
||||
label='sending',
|
||||
) }}
|
||||
</div>
|
||||
<div class="govuk-grid-column-one-third">
|
||||
{{ big_number(item.notifications_delivered, smallest=True, label='delivered') }}
|
||||
</div>
|
||||
<div class="govuk-grid-column-one-third">
|
||||
{{ big_number(item.notifications_failed, smallest=True, label='failed') }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{% endcall %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="govuk-body">
|
||||
{% if contact_list.has_jobs %}
|
||||
Not used in the last {{ current_service.get_days_of_retention(contact_list.template_type) }} days.
|
||||
{% else %}
|
||||
Not used yet.
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<h2 class="govuk-heading-m govuk-!-margin-bottom-2">
|
||||
{{ contact_list.recipients|length|format_thousands }} saved {{ contact_list.recipients|length|recipient_count_label(contact_list.template_type) }}
|
||||
</h2>
|
||||
|
||||
{% set recipient_column = contact_list.recipients.column_headers[0] %}
|
||||
|
||||
<div class="body-copy-table">
|
||||
{% call(item, row_number) list_table(
|
||||
contact_list.recipients.displayed_rows,
|
||||
caption=contact_list.recipients|length|recipient_count_label(contact_list.template_type)|capitalize,
|
||||
caption_visible=False,
|
||||
field_headings=[recipient_column],
|
||||
field_headings_visible=False,
|
||||
) %}
|
||||
{% if not loop.first %}
|
||||
{{ text_field(item[recipient_column].data) }}
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
|
||||
{% if contact_list.recipients.displayed_rows|list|length < contact_list.recipients|length %}
|
||||
<p class="table-show-more-link">
|
||||
Only showing the first {{ contact_list.recipients.displayed_rows|list|length }} rows
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="js-stick-at-bottom-when-scrolling">
|
||||
<div class="page-footer">
|
||||
{% if not confirm_delete_banner %}
|
||||
<span class="page-footer-link page-footer-delete-link-without-button">
|
||||
<a class="govuk-link govuk-link--destructive" href="{{ url_for('main.delete_contact_list', service_id=current_service.id, contact_list_id=contact_list.id) }}">Delete this contact list</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
<a class="govuk-link govuk-link--no-visited-state page-footer-right-aligned-link-without-button" download href="{{ url_for('main.download_contact_list', service_id=current_service.id, contact_list_id=contact_list.id) }}">Download this contact list (<abbr title="Comma separated values">CSV</abbr>)</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,64 +0,0 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/radios.html" import radio_select %}
|
||||
{% from "components/table.html" import list_table, field, text_field, index_field, hidden_field_heading %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/uk_components/button/macro.njk" import govukButton %}
|
||||
{% from "components/uk_components/back-link/macro.njk" import govukBackLink %}
|
||||
|
||||
{% block service_page_title %}
|
||||
{{ original_file_name }}
|
||||
{% endblock %}
|
||||
|
||||
{% block backLink %}
|
||||
{{ govukBackLink({ "href": url_for('main.upload_contact_list', service_id=current_service.id) }) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
{{ page_header(original_file_name) }}
|
||||
|
||||
<p class="govuk-body">
|
||||
{{ recipients|length|recipient_count(recipients.template_type) }} found
|
||||
</p>
|
||||
|
||||
<div class="bottom-gutter-3-2">
|
||||
<form method="post" enctype="multipart/form-data" action="{{ url_for('main.save_contact_list', service_id=current_service.id, upload_id=upload_id) }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
{{ govukButton({ "text": "Save contact list" }) }}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<h2 class="govuk-heading-m">
|
||||
File preview
|
||||
</h2>
|
||||
{% call(item, row_number) list_table(
|
||||
recipients.displayed_rows,
|
||||
caption=original_file_name,
|
||||
caption_visible=False,
|
||||
field_headings=[
|
||||
'<span class="govuk-visually-hidden">Row in file</span> <span aria-hidden="true">1</span>'|safe
|
||||
] + recipients.column_headers
|
||||
) %}
|
||||
{{ index_field(item.index + 2) }}
|
||||
{% 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 %}
|
||||
|
||||
{% if recipients.displayed_rows|list|length < recipients|length %}
|
||||
<p class="table-show-more-link">
|
||||
Only showing the first {{ recipients.displayed_rows|list|length }} rows
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,102 +0,0 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/radios.html" import radio_select %}
|
||||
{% from "components/table.html" import list_table, field, text_field, index_field, hidden_field_heading %}
|
||||
{% from "components/file-upload.html" import file_upload %}
|
||||
{% from "components/uk_components/back-link/macro.njk" import govukBackLink %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Error
|
||||
{% endblock %}
|
||||
|
||||
{% block backLink %}
|
||||
{{ govukBackLink({ "href": url_for('main.upload_contact_list', service_id=current_service.id) }) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<div class="bottom-gutter-1-2">
|
||||
{% call banner_wrapper(type='dangerous') %}
|
||||
{% if row_errors|length == 1 %}
|
||||
<h1 class='banner-title' data-module="track-error" data-error-type="Bad rows" data-error-label="{{ upload_id }}">
|
||||
There’s a problem with {{ original_file_name }}
|
||||
</h1>
|
||||
<p class="govuk-body">
|
||||
You need to {{ row_errors[0] }}.
|
||||
</p>
|
||||
{% else %}
|
||||
<h1 class='banner-title' data-module="track-error" data-error-type="Bad rows" data-error-label="{{ upload_id }}">
|
||||
There are some problems with {{ original_file_name }}
|
||||
</h1>
|
||||
<p class="govuk-body">
|
||||
You need to:
|
||||
</p>
|
||||
<ul class="list-bullet">
|
||||
{% for error in row_errors %}
|
||||
<li>{{ error }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
</div>
|
||||
|
||||
<div class="js-stick-at-top-when-scrolling">
|
||||
<div class="form-group">
|
||||
{{ file_upload(
|
||||
form.file,
|
||||
allowed_file_extensions=allowed_file_extensions,
|
||||
action=url_for('.upload_contact_list', service_id=current_service.id),
|
||||
button_text='Upload your file again'
|
||||
) }}
|
||||
</div>
|
||||
<a href="#content" class="govuk-link govuk-link--no-visited-state back-to-top-link">Back to top</a>
|
||||
</div>
|
||||
|
||||
{% call(item, row_number) list_table(
|
||||
recipients.displayed_rows,
|
||||
caption=original_file_name,
|
||||
caption_visible=False,
|
||||
field_headings=[
|
||||
'<span class="govuk-visually-hidden">Row in file</span> <span aria-hidden="true" class="table-field-invisible-error">1</span>'|safe
|
||||
] + recipients.column_headers
|
||||
) %}
|
||||
{% call index_field() %}
|
||||
<span class="{% if item.has_errors %}table-field-error{% endif %}">
|
||||
{{ item.index + 2 }}
|
||||
</span>
|
||||
{% endcall %}
|
||||
{% for column in recipients.column_headers %}
|
||||
{% if item[column].error and not recipients.missing_column_headers %}
|
||||
{% call field() %}
|
||||
<span>
|
||||
<span class="table-field-error-label">{{ item[column].error }}</span>
|
||||
{{ item[column].data if item[column].data != None }}
|
||||
</span>
|
||||
{% endcall %}
|
||||
{% elif 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 %}
|
||||
|
||||
{% if recipients.displayed_rows|list|length < recipients|length %}
|
||||
{% if recipients.displayed_rows|list|length < recipients.rows_with_errors|list|length %}
|
||||
<p class="table-show-more-link">
|
||||
Only showing the first {{ recipients.displayed_rows|list|length }} rows with errors
|
||||
</p>
|
||||
{% else %}
|
||||
<p class="table-show-more-link">
|
||||
Only showing rows with errors
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,104 +0,0 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/radios.html" import radio_select %}
|
||||
{% from "components/table.html" import list_table, field, text_field, index_field, hidden_field_heading %}
|
||||
{% from "components/file-upload.html" import file_upload %}
|
||||
{% from "components/uk_components/back-link/macro.njk" import govukBackLink %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Error
|
||||
{% endblock %}
|
||||
|
||||
{% block backLink %}
|
||||
{{ govukBackLink({ "href": url_for('main.upload_contact_list', service_id=current_service.id) }) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<div class="bottom-gutter-1-2">
|
||||
{% call banner_wrapper(type='dangerous') %}
|
||||
|
||||
{% if not recipients|length %}
|
||||
|
||||
<h1 class='banner-title' data-module="track-error" data-error-type="No rows" data-error-label="{{ upload_id }}">
|
||||
Your file is missing some rows
|
||||
</h1>
|
||||
<p class="govuk-body">
|
||||
It needs at least one row of data
|
||||
{%- if template_type %}.{% else %}, in a column called ‘email address’ or ‘phone number’.{% endif %}
|
||||
</p>
|
||||
|
||||
{% elif recipients.column_headers|length == 1 %}
|
||||
|
||||
<h1 class='banner-title' data-module="track-error" data-error-type="Too many rows" data-error-label="{{ upload_id }}">
|
||||
Your file needs a column called ‘email address’ or ‘phone number’.
|
||||
</h1>
|
||||
<p class="govuk-body">
|
||||
Right now it has 1 column called ‘{{ recipients._raw_column_headers[0] }}’.
|
||||
</p>
|
||||
|
||||
{% else %}
|
||||
|
||||
<h1 class='banner-title' data-module="track-error" data-error-type="Too many rows" data-error-label="{{ upload_id }}">
|
||||
Your file has too many columns
|
||||
</h1>
|
||||
<p class="govuk-body">
|
||||
It needs to have 1 column, called ‘email address’ or ‘phone number’.
|
||||
</p>
|
||||
<p class="govuk-body">
|
||||
Right now it has {{ recipients._raw_column_headers|length }} columns called {{ recipients._raw_column_headers | formatted_list }}.
|
||||
</p>
|
||||
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="js-stick-at-top-when-scrolling">
|
||||
<div class="form-group">
|
||||
{{ file_upload(
|
||||
form.file,
|
||||
allowed_file_extensions=allowed_file_extensions,
|
||||
action=url_for('.upload_contact_list', service_id=current_service.id),
|
||||
button_text='Upload your file again'
|
||||
) }}
|
||||
</div>
|
||||
<a href="#content" class="govuk-link govuk-link--no-visited-state back-to-top-link">Back to top</a>
|
||||
</div>
|
||||
|
||||
{% set column_headers = recipients._raw_column_headers if recipients.duplicate_recipient_column_headers else recipients.column_headers %}
|
||||
|
||||
<h2 class="heading-medium" id="file-preview">{{ original_file_name }}</h2>
|
||||
|
||||
<div class="fullscreen-content" data-module="fullscreen-table">
|
||||
{% call(item, row_number) list_table(
|
||||
recipients.displayed_rows,
|
||||
caption=original_file_name,
|
||||
caption_visible=False,
|
||||
field_headings=[
|
||||
'<span class="govuk-visually-hidden">Row in file</span> <span aria-hidden="true">1</span>'|safe
|
||||
] + recipients._raw_column_headers
|
||||
) %}
|
||||
{{ index_field(item.index + 2) }}
|
||||
{% for column in 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 %}
|
||||
</div>
|
||||
|
||||
{% if recipients.displayed_rows|list|length < recipients|length %}
|
||||
<p class="table-show-more-link">
|
||||
Only showing the first {{ recipients.displayed_rows|list|length }} rows
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,96 +0,0 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/file-upload.html" import file_upload %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/table.html" import list_table, text_field, index_field, index_field_heading %}
|
||||
{% from "components/uk_components/back-link/macro.njk" import govukBackLink %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Upload an emergency contact list
|
||||
{% endblock %}
|
||||
|
||||
{% block backLink %}
|
||||
{% if not error %}
|
||||
{{ govukBackLink({ "href": url_for('main.uploads', service_id=current_service.id) }) }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
{% if error %}
|
||||
{% call banner_wrapper(type='dangerous') %}
|
||||
<h1 class="banner-title">{{ error.title }}</h1>
|
||||
{% if error.detail %}
|
||||
<p class="govuk-body">{{ error.detail | safe }}</p>
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{% else %}
|
||||
{{ page_header('Upload an emergency contact list') }}
|
||||
<p class="govuk-body">
|
||||
Save a list of staff email addresses or phone numbers in Notify.
|
||||
</p>
|
||||
<p class="govuk-body">
|
||||
In an emergency, you can send a message to everyone on the list.
|
||||
</p>
|
||||
<p class="govuk-body">
|
||||
Do not include contact details for members of the public.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<div class="bottom-gutter">
|
||||
{{ file_upload(
|
||||
form.file,
|
||||
allowed_file_extensions=allowed_file_extensions,
|
||||
button_text='Choose file',
|
||||
show_errors=False,
|
||||
)}}
|
||||
</div>
|
||||
|
||||
<h2 class="heading-medium">Your file needs to look like one of these examples</h2>
|
||||
|
||||
<p class="hint">
|
||||
Save your file as a
|
||||
<acronym title="Comma Separated Values">CSV</acronym>,
|
||||
<acronym title="Tab Separated Values">TSV</acronym>,
|
||||
<acronym title="Open Document Spreadsheet">ODS</acronym>,
|
||||
or Microsoft Excel spreadsheet
|
||||
</p>
|
||||
|
||||
<div class="govuk-grid-row">
|
||||
<div class="govuk-grid-column-one-half">
|
||||
<div class="spreadsheet">
|
||||
{% call(item, row_number) list_table(
|
||||
[
|
||||
['email address'],
|
||||
['test@example.gsa.gov'],
|
||||
],
|
||||
caption="Example",
|
||||
caption_visible=False,
|
||||
field_headings=['', 'A']
|
||||
) %}
|
||||
{{ index_field(row_number - 1) }}
|
||||
{% for column in item %}
|
||||
{{ text_field(column) }}
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="govuk-grid-column-one-half">
|
||||
<div class="spreadsheet">
|
||||
{% call(item, row_number) list_table(
|
||||
[
|
||||
['phone number'],
|
||||
['555-867-5309'],
|
||||
],
|
||||
caption="Example",
|
||||
caption_visible=False,
|
||||
field_headings=['', 'A']
|
||||
) %}
|
||||
{{ index_field(row_number - 1) }}
|
||||
{% for column in item %}
|
||||
{{ text_field(column) }}
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user