mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Let NHS Trusts and CCGs choose own organisation
All we do via support is ask which organisation they work for and manually assign their service to it. This commit makes that process self service. We think we have all the trusts and clinical commissioning groups loaded into the database now. This will make the go live process smoother for these teams.
This commit is contained in:
@@ -591,6 +591,17 @@ class AddGPOrganisationForm(StripWhitespaceForm):
|
||||
field.data = ''
|
||||
|
||||
|
||||
class AddNHSLocalOrganisationForm(StripWhitespaceForm):
|
||||
|
||||
def __init__(self, *args, organisation_choices=None, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.organisations.choices = organisation_choices
|
||||
|
||||
organisations = RadioField(
|
||||
'Which NHS Trust or Clinical Commissioning Group do you work for?',
|
||||
)
|
||||
|
||||
|
||||
class OrganisationOrganisationTypeForm(StripWhitespaceForm):
|
||||
organisation_type = OrganisationTypeField('What type of organisation is this?')
|
||||
|
||||
|
||||
@@ -13,12 +13,15 @@ from app.utils import user_has_permissions
|
||||
@main.route('/services/<uuid:service_id>/agreement')
|
||||
@user_has_permissions('manage_service')
|
||||
def service_agreement(service_id):
|
||||
if (
|
||||
current_service.organisation_type == 'nhs_gp' and not current_service.organisation
|
||||
):
|
||||
return redirect(
|
||||
url_for('main.add_organisation_from_gp_service', service_id=current_service.id)
|
||||
)
|
||||
if not current_service.organisation:
|
||||
if current_service.organisation_type == 'nhs_gp':
|
||||
return redirect(
|
||||
url_for('main.add_organisation_from_gp_service', service_id=current_service.id)
|
||||
)
|
||||
if current_service.organisation_type == 'nhs_local':
|
||||
return redirect(
|
||||
url_for('main.add_organisation_from_nhs_local_service', service_id=current_service.id)
|
||||
)
|
||||
if current_service.organisation.crown is None:
|
||||
return render_template('views/agreement/service-agreement-choose.html')
|
||||
if current_service.organisation.agreement_signed:
|
||||
|
||||
@@ -17,6 +17,7 @@ from app import (
|
||||
from app.main import main
|
||||
from app.main.forms import (
|
||||
AddGPOrganisationForm,
|
||||
AddNHSLocalOrganisationForm,
|
||||
ConfirmPasswordForm,
|
||||
GoLiveNotesForm,
|
||||
InviteOrgUserForm,
|
||||
@@ -93,6 +94,34 @@ def add_organisation_from_gp_service(service_id):
|
||||
)
|
||||
|
||||
|
||||
@main.route('/services/<uuid:service_id>/add-nhs-local-organisation', methods=['GET', 'POST'])
|
||||
@user_has_permissions('manage_service')
|
||||
def add_organisation_from_nhs_local_service(service_id):
|
||||
if (not current_service.organisation_type == 'nhs_local') or current_service.organisation:
|
||||
abort(403)
|
||||
|
||||
form = AddNHSLocalOrganisationForm(organisation_choices=[
|
||||
(organisation.id, organisation.name)
|
||||
for organisation in Organisations()
|
||||
if organisation.organisation_type == 'nhs_local'
|
||||
])
|
||||
|
||||
search_form = SearchByNameForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
Organisation.from_id(form.organisations.data).associate_service(service_id)
|
||||
return redirect(url_for(
|
||||
'.service_agreement',
|
||||
service_id=service_id,
|
||||
))
|
||||
|
||||
return render_template(
|
||||
'views/organisations/add-nhs-local-organisation.html',
|
||||
form=form,
|
||||
search_form=search_form,
|
||||
)
|
||||
|
||||
|
||||
@main.route("/organisations/<org_id>", methods=['GET'])
|
||||
@user_has_permissions()
|
||||
def organisation_dashboard(org_id):
|
||||
|
||||
@@ -595,7 +595,7 @@ class Service(JSONModel):
|
||||
def able_to_accept_agreement(self):
|
||||
return (
|
||||
self.organisation.agreement_signed is not None
|
||||
or self.organisation_type == 'nhs_gp'
|
||||
or self.organisation_type in {'nhs_gp', 'nhs_local'}
|
||||
)
|
||||
|
||||
@property
|
||||
|
||||
@@ -124,6 +124,7 @@ class HeaderNavigation(Navigation):
|
||||
'add_data_retention',
|
||||
'add_organisation',
|
||||
'add_organisation_from_gp_service',
|
||||
'add_organisation_from_nhs_local_service',
|
||||
'add_service',
|
||||
'add_service_template',
|
||||
'api_callbacks',
|
||||
@@ -381,6 +382,7 @@ class MainNavigation(Navigation):
|
||||
},
|
||||
'settings': {
|
||||
'add_organisation_from_gp_service',
|
||||
'add_organisation_from_nhs_local_service',
|
||||
'branding_request',
|
||||
'estimate_usage',
|
||||
'link_service_to_organisation',
|
||||
@@ -636,6 +638,7 @@ class CaseworkNavigation(Navigation):
|
||||
'add_data_retention',
|
||||
'add_organisation',
|
||||
'add_organisation_from_gp_service',
|
||||
'add_organisation_from_nhs_local_service',
|
||||
'add_service',
|
||||
'add_service_template',
|
||||
'api_callbacks',
|
||||
@@ -930,6 +933,7 @@ class OrgNavigation(Navigation):
|
||||
'add_data_retention',
|
||||
'add_organisation',
|
||||
'add_organisation_from_gp_service',
|
||||
'add_organisation_from_nhs_local_service',
|
||||
'add_service',
|
||||
'add_service_template',
|
||||
'api_callbacks',
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/page-footer.html" import sticky_page_footer %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/radios.html" import radios %}
|
||||
{% from "components/live-search.html" import live_search %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
|
||||
{% block per_page_title %}
|
||||
Accept our data sharing and financial agreement
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
{{ page_header(
|
||||
'Accept our data sharing and financial agreement',
|
||||
back_link=url_for('main.request_to_go_live', service_id=current_service.id)
|
||||
) }}
|
||||
{% call form_wrapper() %}
|
||||
<p>
|
||||
{{ form.organisations.label.text }}
|
||||
</p>
|
||||
{{ live_search(target_selector='.multiple-choice', show=True, form=search_form, label='Search by name') }}
|
||||
{{ radios(form.organisations, hide_legend=True) }}
|
||||
{{ sticky_page_footer('Continue') }}
|
||||
{% endcall %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user