updated download links and table html

This commit is contained in:
Beverly Nguyen
2024-01-25 15:32:44 -08:00
parent c9ed1ab59d
commit 524a1e4687
5 changed files with 100 additions and 58 deletions

View File

@@ -6,7 +6,7 @@
<thead class="table-field-headings{% if field_headings_visible %}-visible{% endif %}">
<tr>
{% for field_heading in field_headings %}
<th scope="col" class="table-field-heading{% if loop.first %}-first{% endif %}" width="{% if equal_length %}{{ (100 / field_headings|length)|int }}%{% endif %}">
<th scope="col" class="table-field-heading{% if loop.first %}-first{% endif %} {{ field_heading|lower|replace(' ', '-') }}" width="{% if equal_length %}{{ (100 / field_headings|length)|int }}%{% endif %}">
{% if field_headings_visible %}
{{ field_heading }}
{% else %}

View File

@@ -31,57 +31,71 @@
<h2 class="margin-top-4 margin-bottom-1">Recent Batches</h2>
<div class='job-table'>
{% call(item, row_number) list_table(
notifications,
caption="Batched Jobs",
caption_visible=False,
border_visible=True,
empty_message='No batched job messages found &thinsp;(messages are kept for {} days)'.format(service_data_retention_days)|safe,
field_headings=['File Name','Template','Time Sent', 'Sender', '# of Recipients', "Report"],
field_headings_visible=False
) %}
{% if item.job.original_file_name and item.job.id and item.template %}
{% call row_heading() %}
<a class="usa-link file-list-filename" href="/services/{{ item.service }}/jobs/{{ item.job.id }}">{{ item.job.original_file_name if item.job.id else '' }}</a>
{% endcall %}
{% call row_heading() %}
{{ item.template.name }}
{% endcall %}
{% call row_heading() %}
{{ (item.updated_at or item.created_at)| format_datetime_short_america
}}
{% endcall %}
{% call row_heading() %}
{{ item.created_by.name }}
{% endcall %}
{% set availability = jobs|selectattr('job_id', 'equalto', item.job.id)|first %}
{% call row_heading() %}
{% if availability %}
{{ availability.notification_count}}
<table class="usa-table usa-table--borderless width-full">
<thead class="table-field-headings">
<tr>
<th scope="col" class="table-field-heading-first file-name">
<span>File name</span>
</th>
<th scope="col" class="table-field-heading template">
<span>Template</span>
</th>
<th scope="col" class="table-field-heading time-sent">
<span>Time sent</span>
</th>
<th scope="col" class="table-field-heading sender">
<span>Sender</span>
</th>
<th scope="col" class="table-field-heading #-of-recipients">
<span># of Recipients</span>
</th>
<th scope="col" class="table-field-heading report">
<span>Report</span>
</th>
</tr>
</thead>
<tbody>
{% for notification in notifications %}
{% if notification %}
<tr class="table-row" id="f4b38296-06a3-4963-a66b-fb44fd6fa55c">
<th class="table-field">
{% if notification.job.original_file_name %}
{{ notification.job.original_file_name }}
{% else %}
{{ 'Manually entered number' }}
{% endif %}
<br>
<a class="usa-link file-list-filename" href="/services/{{ notification.service }}/jobs/{{ notification.job.id }}">View Batch</a>
</th>
<th class="table-field">
{{ notification.template.name }}
</th>
<th class="table-field">
{{ (notification.updated_at or notification.created_at)| format_datetime_short_america }}
</th>
<th class="table-field">
{{ notification.created_by.name }}
</th>
{% set job_available = jobs|selectattr('job_id', 'equalto', notification.job.id)|first %}
<th class="table-field">
{{ job_available.notification_count if job_available else ''}}
</th>
<th class="table-field">
{% if job_available and job_available.time_left != "Data no longer available" %}
<a class="usa-link file-list-filename" href="{{ job_available.download_link }}">
{{ "Download" if job_available.job_id else '' }}</a>
<span class="usa-hint">{{ job_available.time_left }}</span>
{% elif job_available %}
<span>{{ job_available.time_left }}</span>
{% endif %}
</th>
</tr>
{% endif %}
{% endcall %}
{% call row_heading() %}
{% if availability and availability.time_left != "Data no longer available" %}
<a class="usa-link file-list-filename" href="{{ availability.download_link[0] }}">{{ "Download" if item.job.original_file_name else '' }}</a>
<span class="usa-hint">{{ availability.time_left }}</span>
{% elif availability %}
<span>{{ availability.time_left }}</span>
{% endif %}
{% endcall %}
{% endif %}
{% endcall %}
{% endfor %}
</tbody>
</table>
</div>
{% if show_pagination %}
{{ previous_next_navigation(prev_page, next_page) }}
{% elif next_page %}
<p class="table-show-more-link">
Only showing the first 50 messages
</p>
{% endif %}
<h2 class="margin-top-4 margin-bottom-1">Usage</h2>
<h3 class="margin-bottom-0">Daily</h3>
<p class="margin-0">Across all services</p>