mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-03 23:18:25 -04:00
show organisations on the choose-service page (name TBD)
layout as follows
```
ORG_1
SERVICE_1
SERVICE_2
--------------------
ORG_2
--------------------
SERVICE_3
SERVICE_4
--------------------
Add a new service...
```
* org 1 and 2 are organisations that the user has access to.
* Service 1 and 2 are part of org 1, AND the user has access to them.
- There may be more services in org_1 that the user doesn't know
about.
* Service 3 and 4 are services the user has access to.
- They MAY be part of an organisation that the user does not know
about. They can't be part of org_1 or org_2 tho.
This commit is contained in:
@@ -1,19 +1,30 @@
|
||||
from flask import redirect, render_template, session, url_for
|
||||
from flask_login import current_user, login_required
|
||||
|
||||
from app import service_api_client
|
||||
from app import user_api_client
|
||||
from app.main import main
|
||||
from app.notify_client.service_api_client import ServicesBrowsableItem
|
||||
from app.notify_client.organisations_api_client import OrganisationBrowsableItem
|
||||
from app.utils import is_gov_user
|
||||
|
||||
|
||||
@main.route("/services")
|
||||
@login_required
|
||||
def choose_service():
|
||||
orgs_and_services = user_api_client.get_organisations_and_services_for_user(current_user)
|
||||
from pprint import pprint
|
||||
pprint(orgs_and_services)
|
||||
orgs_and_services['organisations'] = [
|
||||
OrganisationBrowsableItem(org) for org in orgs_and_services['organisations']
|
||||
]
|
||||
orgs_and_services['services_without_organisations'] = [
|
||||
ServicesBrowsableItem(x) for x in orgs_and_services['services_without_organisations']
|
||||
]
|
||||
|
||||
return render_template(
|
||||
'views/choose-service.html',
|
||||
services=[ServicesBrowsableItem(x) for x in
|
||||
service_api_client.get_active_services({'user_id': current_user.id})['data']],
|
||||
organisations=orgs_and_services['organisations'],
|
||||
services_without_organisations=orgs_and_services['services_without_organisations'],
|
||||
can_add_service=is_gov_user(current_user.email_address)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user