Files
notifications-admin/app/templates/views/dashboard/_jobs.html
T
Chris Hill-Scott 050f98fea6 Show contact lists on the uploads page
Uploads page is where all the stuff you’ve uploaded lives. Now you can
upload contact lists they should live here too.

They always come first because they’re the most-removed from stuff
you’ve sent.
2020-03-16 13:09:16 +00:00

108 lines
3.8 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 -%}
<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.can_upload_letters 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' %}
<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">
Sending {{
item.scheduled_for|format_datetime_relative
}}
</span>
{% elif item.upload_type == 'contact_list' %}
<span class="file-list-hint">
Uploaded {{
item.created_at|format_datetime_relative
}}
</span>
{% else %}
<span class="file-list-hint">
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 govuk-!-margin-bottom-1">
{% 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>