From 3158b91378c5155c63f2fc2b6d7d220c19777dfd Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Thu, 29 Aug 2024 14:28:37 -0700 Subject: [PATCH] new revised table --- app/main/views/dashboard.py | 6 ++ app/templates/views/dashboard/dashboard.html | 4 +- .../views/dashboard/template-statistics.html | 71 +++++++++++-------- 3 files changed, 49 insertions(+), 32 deletions(-) diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index d5d26f0a3..447a4b552 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -327,6 +327,12 @@ def aggregate_template_usage(template_statistics, sort_key="count"): "template_name": template_stats[0]["template_name"], "template_type": template_stats[0]["template_type"], "count": sum(s["count"] for s in template_stats), + "last_used": max(s["last_used"] for s in template_stats if s["last_used"]), + "created_by": template_stats[0]["created_by"], + "created_by_id": template_stats[0]["created_by_id"], + "status": template_stats[0]["status"], + "template_folder": template_stats[0]["template_folder"], + "template_folder_id": template_stats[0]["template_folder_id"], } ) diff --git a/app/templates/views/dashboard/dashboard.html b/app/templates/views/dashboard/dashboard.html index 114667f2d..a6b410105 100644 --- a/app/templates/views/dashboard/dashboard.html +++ b/app/templates/views/dashboard/dashboard.html @@ -52,9 +52,7 @@
- {% if current_user.has_permissions('manage_service') %}{% endif %} - {{ ajax_block(partials, updates_url, 'template-statistics') }}

Recent Batches

@@ -122,7 +120,7 @@
-

Recent templates

+

Most Used Templates

{{ ajax_block(partials, updates_url, 'template-statistics') }} diff --git a/app/templates/views/dashboard/template-statistics.html b/app/templates/views/dashboard/template-statistics.html index 9acd142d6..6e7b8e3a8 100644 --- a/app/templates/views/dashboard/template-statistics.html +++ b/app/templates/views/dashboard/template-statistics.html @@ -1,34 +1,47 @@ -{% from "components/table.html" import list_table, field, right_aligned_field_heading, row_heading, spark_bar_field %} -
{% if template_statistics|length > 1 %} -
- {% call(item, row_number) list_table( - template_statistics, - caption="Messages sent by template", - caption_visible=False, - border_visible=True, - empty_message='', - field_headings=[ - 'Template', - 'Messages sent' - ], - field_headings_visible=False - ) %} - - {% call row_heading() %} - {{ item.template_name }} - - {{ 1|message_count_label(item.template_type, suffix='template')|capitalize }} - - {% endcall %} - - {{ spark_bar_field(item.count, most_used_template_count, id=item.template_id) }} - {% endcall %} - See templates used by month +
+ + + + + + + + + + + + + {% for item in template_statistics[:8] %} + + + + + + + + {% endfor %} + +
+ Messages sent by template +
+ Template name + + Folder + + Last used + + Created by + + # Times used +
+ {{ item.template_name }} + + {{ 1|message_count_label(item.template_type, suffix='template')|capitalize }} + +

{{ item.template_folder }}

{{ item.last_used|format_datetime_table}}

{{ item.created_by }}

{{ item.count }}

+ See templates by month
{% endif %}