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:
Chris Hill-Scott
2019-09-05 16:18:02 +01:00
parent d37566a79b
commit 8b8893ed1d
8 changed files with 178 additions and 11 deletions

View File

@@ -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?')

View File

@@ -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:

View File

@@ -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):