added template-stats.html

This commit is contained in:
Beverly Nguyen
2024-08-29 15:10:08 -07:00
parent 2cae3462d3
commit e704cb1b78
2 changed files with 44 additions and 31 deletions

View File

@@ -137,6 +137,7 @@
</table> </table>
</div> </div>
</div> </div>
<h2 class="margin-top-4 margin-bottom-1">Most Used Templates</h2>
{{ ajax_block(partials, updates_url, 'template-statistics') }} {{ ajax_block(partials, updates_url, 'template-statistics') }}
</div> </div>

View File

@@ -1,35 +1,47 @@
{% from "components/table.html" import list_table, field, right_aligned_field_heading, row_heading, spark_bar_field %}
<div class="ajax-block-container"> <div class="ajax-block-container">
{% if template_statistics|length > 0 %} {% if template_statistics|length > 1 %}
<h2 class="margin-top-4 margin-bottom-1">Recent templates</h2> <div class="template-statistics-table table-overflow-x-auto">
<div class='template-statistics-table table-overflow-x-auto'> <table class="usa-table width-full">
{% call(item, row_number) list_table( <caption class="font-body-lg table-heading usa-sr-only">
template_statistics, Messages sent by template
caption="Messages sent by template", </caption>
caption_visible=False, <thead class="table-field-headings">
border_visible=True, <tr>
empty_message='', <th class="table-field-heading-first" width="">
field_headings=[ <span>Template name</span>
'Template', </th>
'Messages sent' <th class="table-field-heading" width="">
], <span>Folder</span>
field_headings_visible=False </th>
) %} <th class="table-field-heading" width="">
<span>Last used</span>
{% call row_heading() %} </th>
<a class="usa-link template-statistics-table-template-name" href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template_id) }}">{{ item.template_name }}</a> <th class="table-field-heading" width="">
<span class="template-statistics-table-hint"> <span>Created by</span>
{{ 1|message_count_label(item.template_type, suffix='template')|capitalize }} </th>
</span> <th class="table-field-heading" width="">
{% endcall %} <span># Times used</span>
</th>
{{ spark_bar_field(item.count, most_used_template_count, id=item.template_id) }} </tr>
{% endcall %} </thead>
<a <tbody>
href="{{ url_for('.template_usage', service_id=current_service.id) }}" {% for item in template_statistics[:8] %}
class="usa-link show-more-no-border" <tr class="table-row">
><span>See templates used by month</span></a> <td>
<a class="usa-link template-statistics-table-template-name" href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template_id) }}">{{ item.template_name }}</a>
<span class="template-statistics-table-hint">
{{ 1|message_count_label(item.template_type, suffix='template')|capitalize }}
</span>
</td>
<td><p>{{ item.template_folder }}</p></td>
<td><p>{{ item.last_used|format_datetime_table}}</p></td>
<td><p>{{ item.created_by }}</p></td>
<td><p>{{ item.count }}</p></td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="/services/78409625-0c0a-485e-b82c-b19c8f4b1bdb/template-usage" class="usa-link show-more-no-border"><span>See templates by month</span></a>
</div> </div>
{% endif %} {% endif %}
</div> </div>