mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 16:24:08 -04:00
Takes the number of emails and SMS fragments sent from: https://github.com/alphagov/notifications-api/pull/273 Using these numbers it’s possible to show: - how much of your allowance is left - or how much you have spent For now the allowance and rates are hard coded. Only for users that have manage service.
74 lines
2.8 KiB
HTML
74 lines
2.8 KiB
HTML
{% from "components/big-number.html" import big_number, big_number_with_status %}
|
|
|
|
<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"
|
|
>
|
|
<h2 class="heading-medium">
|
|
In the last 7 days
|
|
</h2>
|
|
<div class="grid-row bottom-gutter">
|
|
<div class="column-half">
|
|
{{ big_number_with_status(
|
|
statistics.emails_requested,
|
|
'email' if statistics.emails_requested == 1 else 'emails',
|
|
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' if statistics.sms_requested == 1 else 'text messages',
|
|
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>
|
|
{% with period = "in the last 7 days" %}
|
|
{% include 'views/dashboard/template-statistics.html' %}
|
|
{% endwith %}
|
|
<p class='table-show-more-link'>
|
|
<a href="{{ url_for('.template_history', service_id=current_service.id) }}">See all templates sent this year</a>
|
|
</p>
|
|
|
|
{% if current_user.has_permissions(['manage_settings'], admin_override=True) %}
|
|
<h2 class='heading-medium' style="margin-top: 30px;">This year</h2>
|
|
|
|
<div class='grid-row'>
|
|
<div class='column-half'>
|
|
<div class="keyline-block">
|
|
{{ big_number("Unlimited", 'free email allowance', right_aligned=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="£",
|
|
right_aligned=True
|
|
) }}
|
|
{% else %}
|
|
{{ big_number(sms_allowance_remaining, 'free text messages left', right_aligned=True) }}
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="keyline-block-show-more-link">
|
|
<a href="{{ url_for(".usage", service_id=current_service['id']) }}">See usage</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
</div>
|