mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-10 11:24:10 -04:00
Link to downloadable report for org usage
Link is sticky so that it is easy to spot even when an org has many services.
This commit is contained in:
@@ -156,10 +156,20 @@ def organisation_dashboard(org_id):
|
||||
**{
|
||||
f'total_{key}': sum(service[key] for service in services)
|
||||
for key in ('emails_sent', 'sms_cost', 'letter_cost')
|
||||
}
|
||||
},
|
||||
download_link=url_for(
|
||||
'.download_services_report_for_org',
|
||||
org_id=org_id,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@main.route("/organisations/<uuid:org_id>", methods=['GET'])
|
||||
@user_has_permissions()
|
||||
def download_services_report_for_org(org_id):
|
||||
pass
|
||||
|
||||
|
||||
@main.route("/organisations/<uuid:org_id>/trial-services", methods=['GET'])
|
||||
@user_is_platform_admin
|
||||
def organisation_trial_mode_services(org_id):
|
||||
|
||||
@@ -112,4 +112,10 @@
|
||||
<div class="keyline-block govuk-!-margin-top-2"></div>
|
||||
{% endif %}
|
||||
|
||||
<div class="js-stick-at-bottom-when-scrolling">
|
||||
<p class="bottom-gutter">
|
||||
<a href="{{ download_link }}" download="download" class="govuk-link govuk-link--no-visited-state govuk-!-font-weight-bold">Download this report</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -624,6 +624,36 @@ def test_organisation_services_hides_search_bar_for_7_or_fewer_services(
|
||||
assert not page.select_one('.live-search')
|
||||
|
||||
|
||||
def test_organisation_services_links_to_downloadable_report(
|
||||
client_request,
|
||||
mock_get_organisation,
|
||||
mocker,
|
||||
active_user_with_permissions,
|
||||
fake_uuid,
|
||||
):
|
||||
mocker.patch(
|
||||
'app.organisations_client.get_services_and_usage',
|
||||
return_value={"services": [
|
||||
{
|
||||
'service_id': SERVICE_ONE_ID,
|
||||
'service_name': 'Service 1',
|
||||
'chargeable_billable_sms': 250122,
|
||||
'emails_sent': 13000,
|
||||
'free_sms_limit': 250000,
|
||||
'letter_cost': 30.50,
|
||||
'sms_billable_units': 122,
|
||||
'sms_cost': 1.93,
|
||||
'sms_remainder': None
|
||||
},
|
||||
] * 2}
|
||||
)
|
||||
client_request.login(active_user_with_permissions)
|
||||
page = client_request.get('.organisation_dashboard', org_id=ORGANISATION_ID)
|
||||
|
||||
link_to_report = page.find('a', text="Download this report")
|
||||
assert link_to_report.attrs["href"] == url_for('.download_services_report_for_org', org_id=ORGANISATION_ID)
|
||||
|
||||
|
||||
def test_organisation_trial_mode_services_shows_all_non_live_services(
|
||||
client_request,
|
||||
platform_admin_user,
|
||||
|
||||
Reference in New Issue
Block a user