mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-22 02:00:57 -04:00
Because we’re be grouping jobs under their parent contact lists it’s good to have some information ‘scent’ to help people find their jobs, ie by clicking into a contact list. It also lets you see which list have been used more than others, maybe because the update hasn’t been sent to that group of people yet. The hint text under uploads always says when they were used. For contact lists this is a bit more complicated, since they can: - never have been used - been used multiple times This commit makes use of the new fields being returned by the API to say determine when these messages are relevant. They also let us differentiate between a contact list that’s never been used, and one that has been used, but not recently enough to show any jobs against it.
122 lines
4.7 KiB
HTML
122 lines
4.7 KiB
HTML
{% from "components/table.html" import list_table, field, right_aligned_field_heading, row_heading %}
|
|
{% from "components/big-number.html" import big_number -%}
|
|
{% from "components/message-count-label.html" import message_count_label, recipient_count_label, iteration_count -%}
|
|
|
|
<div class='dashboard-table ajax-block-container'>
|
|
{% call(item, row_number) list_table(
|
|
jobs,
|
|
caption="Recent files uploaded",
|
|
caption_visible=False,
|
|
empty_message=(
|
|
'Upload a letter and Notify will print, pack and post it for you.' if current_service.has_permission('letter') else 'You have not uploaded any files yet.'
|
|
),
|
|
field_headings=[
|
|
'File',
|
|
'Status'
|
|
],
|
|
field_headings_visible=False
|
|
) %}
|
|
{% call row_heading() %}
|
|
<div class="file-list">
|
|
{% if item.upload_type == 'letter_day' %}
|
|
<a class="file-list-filename-large govuk-link govuk-link--no-visited-state" href="{{ url_for('.uploaded_letters', service_id=current_service.id, letter_print_day=item.created_at|format_date_numeric) }}">{{ item.original_file_name }}</a>
|
|
{% elif item.upload_type == 'letter' %}
|
|
<a class="file-list-filename-large govuk-link govuk-link--no-visited-state" href="{{ url_for('.view_notification', service_id=current_service.id, notification_id=item.id) }}">{{ item.original_file_name }}</a>
|
|
{% elif 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 %}
|
|
{% 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 {{ iteration_count(item.recent_job_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 %}
|
|
{% elif item.upload_type == 'letter_day' %}
|
|
<span class="file-list-hint-large">
|
|
{{ item.letter_printing_statement }}
|
|
</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=message_count_label(
|
|
item.notification_count,
|
|
item.template_type,
|
|
suffix='waiting to send'
|
|
)
|
|
) }}
|
|
{% elif item.template_type == 'letter' %}
|
|
{{ big_number(
|
|
item.notification_count,
|
|
smallest=True,
|
|
label=message_count_label(
|
|
item.notification_count,
|
|
item.template_type,
|
|
suffix=''
|
|
)
|
|
) }}
|
|
{% elif item.upload_type == 'contact_list' %}
|
|
{{ big_number(
|
|
item.row_count,
|
|
smallest=True,
|
|
label="saved {}".format(recipient_count_label(
|
|
item.row_count,
|
|
item.template_type
|
|
))
|
|
) }}
|
|
{% elif item.pdf_letter %}
|
|
<p class="govuk-body letter-recipient-summary">
|
|
{% for line in item.recipient.splitlines() %}
|
|
{% if loop.index < 3 %}
|
|
{{ line }}<br>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</p>
|
|
{% 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>
|