diff --git a/app/__init__.py b/app/__init__.py index 590f0f595..65a08337b 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -311,6 +311,11 @@ def init_app(application): def _nav_selected(): return navigation + @application.context_processor + def _attach_current_remaining_messages(): + request + return {'side_nav_remaining_messages': current_service.message_limit - service_api_client.get_notification_count(service_id=current_service.id)} + @application.before_request def record_start_time(): g.start = monotonic() @@ -395,6 +400,9 @@ def load_organisation_before_request(): raise +def load_current_daily_messages_per_service(): + service = request.args.get('service') + def save_service_or_org_after_request(response): # Only save the current session if the request is 200 service_id = request.view_args.get('service_id', None) if request.view_args else None diff --git a/app/templates/main_nav.html b/app/templates/main_nav.html index 757616832..2ddd198d9 100644 --- a/app/templates/main_nav.html +++ b/app/templates/main_nav.html @@ -27,4 +27,10 @@ {% endif %} +
+

Messages Left / Daily Limit

+ +
{% endif %} diff --git a/app/templates/views/send.html b/app/templates/views/send.html index ee716c23f..88c71eb6a 100644 --- a/app/templates/views/send.html +++ b/app/templates/views/send.html @@ -60,7 +60,7 @@

Daily message limit for this service:

{{ current_service.name }} - {{ current_service.message_limit }}

Daily remaining messages for this service:

-

{{ remaining_messages }}

+

{{ side_nav_remaining_messages }}

{% endblock %}