mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-29 10:30:20 -04:00
Merge pull request #3166 from alphagov/usage-back-on-dashboard
Put usage summary back on the dashboard
This commit is contained in:
@@ -299,7 +299,14 @@ def get_dashboard_partials(service_id):
|
||||
)
|
||||
for key, value in dashboard_totals[0].items()
|
||||
)
|
||||
|
||||
free_sms_allowance = billing_api_client.get_free_sms_fragment_limit_for_year(
|
||||
current_service.id,
|
||||
get_current_financial_year(),
|
||||
)
|
||||
yearly_usage = billing_api_client.get_service_usage(
|
||||
service_id,
|
||||
get_current_financial_year(),
|
||||
)
|
||||
return {
|
||||
'upcoming': render_template(
|
||||
'views/dashboard/_upcoming.html',
|
||||
@@ -332,7 +339,12 @@ def get_dashboard_partials(service_id):
|
||||
'views/dashboard/_jobs.html',
|
||||
jobs=immediate_jobs
|
||||
),
|
||||
'has_jobs': bool(immediate_jobs)
|
||||
'has_jobs': bool(immediate_jobs),
|
||||
'usage': render_template(
|
||||
'views/dashboard/_usage.html',
|
||||
column_width=column_width,
|
||||
**calculate_usage(yearly_usage, free_sms_allowance),
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{% from "components/big-number.html" import big_number %}
|
||||
|
||||
<div class='grid-row ajax-block-container'>
|
||||
<div class='column-half'>
|
||||
<div class='{{ column_width }}'>
|
||||
<div class="keyline-block">
|
||||
{{ big_number("Unlimited", 'free email allowance', smaller=True) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class='column-half'>
|
||||
<div class='{{ column_width }}'>
|
||||
<div class="keyline-block">
|
||||
{% if sms_chargeable %}
|
||||
{{ big_number(
|
||||
total_sms_cost,
|
||||
sms_chargeable * sms_rate,
|
||||
'spent on text messages',
|
||||
currency="£",
|
||||
smaller=True
|
||||
@@ -20,4 +20,14 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class='{{ column_width }}'>
|
||||
<div class="keyline-block">
|
||||
{{ big_number(
|
||||
letter_cost,
|
||||
'spent on letters',
|
||||
currency="£",
|
||||
smaller=True
|
||||
) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -43,6 +43,15 @@
|
||||
) }}
|
||||
{% endif %}
|
||||
|
||||
{% if current_user.has_permissions('manage_service') %}
|
||||
<h2 class='heading-medium'>This year</h2>
|
||||
{{ ajax_block(partials, updates_url, 'usage') }}
|
||||
{{ show_more(
|
||||
url_for(".usage", service_id=current_service['id']),
|
||||
'See usage'
|
||||
) }}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user