mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Sum up usage for an whole organisation
We invoice on a per organisation basis, so it’s useful to know the per organisation figures without needing to do any spreadsheet-fu.
This commit is contained in:
@@ -125,10 +125,14 @@ def add_organisation_from_nhs_local_service(service_id):
|
||||
@main.route("/organisations/<uuid:org_id>", methods=['GET'])
|
||||
@user_has_permissions()
|
||||
def organisation_dashboard(org_id):
|
||||
services = current_organisation.services_and_usage()
|
||||
services = current_organisation.services_and_usage()['services']
|
||||
return render_template(
|
||||
'views/organisations/organisation/index.html',
|
||||
services=services
|
||||
services=services,
|
||||
**{
|
||||
f'total_{key}': sum(service[key] for service in services)
|
||||
for key in ('emails_sent', 'sms_cost', 'letter_cost')
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -11,8 +11,34 @@
|
||||
Usage
|
||||
</h1>
|
||||
|
||||
<div class="grid-row">
|
||||
<div class="column-one-third">
|
||||
{{ big_number(
|
||||
total_emails_sent,
|
||||
label='emails sent',
|
||||
smaller=True
|
||||
) }}
|
||||
</div>
|
||||
<div class="column-one-third">
|
||||
{{ big_number(
|
||||
total_sms_cost,
|
||||
'spent on text messages',
|
||||
currency="£",
|
||||
smaller=True
|
||||
) }}
|
||||
</div>
|
||||
<div class="column-one-third">
|
||||
{{ big_number(
|
||||
total_letter_cost,
|
||||
'spent on letters',
|
||||
currency="£",
|
||||
smaller=True
|
||||
) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
{% for service in services['services'] %}
|
||||
{% for service in services %}
|
||||
<li class="browse-list-item">
|
||||
<a href="{{ url_for('main.usage', service_id=service.service_id) }}" class="govuk-link govuk-link--no-visited-state browse-list-link">{{ service.service_name }}</a>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user