Files
notifications-admin/app/templates/views/dashboard/today.html
Chris Hill-Scott 1b8236f5f8 Make template usage on dashboard easier to scan
The dashboard looked a bit table-y. This commit makes four main changes:

- show a bar chart (drawn in CSS) for template usage (only shown if
  you’ve used more than one template recently)
- only break down template usage by template name, not template type
  (because that’s happening with the big numbers)
- change the style of the ‘show more’ links under each section so that
  they are all consistent, and a little less busy (one less keyline)
- remove the ‘recent templates‘ title so that the first two sections of
  the page group under ‘in the last 7 days’
2016-05-13 09:59:41 +01:00

81 lines
2.9 KiB
HTML

{% from "components/big-number.html" import big_number, big_number_with_status %}
{% from "components/show-more.html" import show_more %}
<div
data-module="update-content"
data-resource="{{url_for(".service_dashboard_updates", service_id=current_service.id)}}"
data-key="today"
data-interval-seconds="2"
aria-live="polite"
>
<div class="grid-row">
<div class="column-half">
{{ big_number_with_status(
statistics.emails_requested,
'email sent' if statistics.emails_requested == 1 else 'emails sent',
statistics.emails_failed,
statistics.get('emails_failure_rate', 0.0),
statistics.get('emails_failure_rate', 0)|float > 3,
failure_link=url_for(".view_notifications", service_id=current_service.id, template_type='email', status='failed'),
label_link=url_for(".view_notifications", service_id=current_service.id, template_type='email', status='delivered,failed')
) }}
</div>
<div class="column-half">
{{ big_number_with_status(
statistics.sms_requested,
'text message sent' if statistics.sms_requested == 1 else 'text messages sent',
statistics.sms_failed,
statistics.get('sms_failure_rate', 0.0),
statistics.get('sms_failure_rate', 0)|float > 3,
failure_link=url_for(".view_notifications", service_id=current_service.id, template_type='sms', status='failed'),
label_link=url_for(".view_notifications", service_id=current_service.id, template_type='sms', status='delivered,failed')
) }}
</div>
<div class="column-whole">
{{ show_more(
url_for('.weekly', service_id=current_service.id),
'Compare to previous weeks'
) }}
</div>
</div>
{% if template_statistics|length > 1 %}
{% include 'views/dashboard/template-statistics.html' %}
{{ show_more(
url_for('.template_history', service_id=current_service.id),
'See all templates sent this year'
) }}
{% endif %}
{% if current_user.has_permissions(['manage_settings'], admin_override=True) %}
<h2 class='heading-medium'>This year</h2>
<div class='grid-row'>
<div class='column-half'>
<div class="keyline-block">
{{ big_number("Unlimited", 'free email allowance', smaller=True) }}
</div>
</div>
<div class='column-half'>
<div class="keyline-block">
{% if sms_chargeable %}
{{ big_number(
(sms_chargeable * sms_rate),
'spent on text messages',
currency="£",
smaller=True
) }}
{% else %}
{{ big_number(sms_allowance_remaining, 'free text messages left', smaller=True) }}
{% endif %}
</div>
</div>
</div>
{{ show_more(
url_for(".usage", service_id=current_service['id']),
'See usage breakdown'
) }}
{% endif %}
</div>