mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-17 04:59:37 -04:00
Merge pull request #59 from GSA/stvnrlly-update-form-flow
Update services for post-sign-up tour
This commit is contained in:
@@ -5,11 +5,9 @@ from functools import partial
|
||||
from flask import flash, redirect, render_template, request, send_file, url_for
|
||||
from flask_login import current_user
|
||||
from notifications_python_client.errors import HTTPError
|
||||
from werkzeug.exceptions import abort
|
||||
|
||||
from app import (
|
||||
current_organisation,
|
||||
current_service,
|
||||
email_branding_client,
|
||||
letter_branding_client,
|
||||
org_invite_api_client,
|
||||
@@ -17,8 +15,6 @@ from app import (
|
||||
)
|
||||
from app.main import main
|
||||
from app.main.forms import (
|
||||
AddGPOrganisationForm,
|
||||
AddNHSLocalOrganisationForm,
|
||||
AdminBillingDetailsForm,
|
||||
AdminNewOrganisationForm,
|
||||
AdminNotesForm,
|
||||
@@ -81,62 +77,6 @@ def add_organisation():
|
||||
)
|
||||
|
||||
|
||||
@main.route('/services/<uuid:service_id>/add-gp-organisation', methods=['GET', 'POST'])
|
||||
@user_has_permissions('manage_service')
|
||||
def add_organisation_from_gp_service(service_id):
|
||||
if (not current_service.organisation_type == Organisation.TYPE_NHS_GP) or current_service.organisation:
|
||||
abort(403)
|
||||
|
||||
form = AddGPOrganisationForm(service_name=current_service.name)
|
||||
|
||||
if form.validate_on_submit():
|
||||
Organisation.create(
|
||||
form.get_organisation_name(),
|
||||
crown=False,
|
||||
organisation_type='nhs_gp',
|
||||
agreement_signed=False,
|
||||
).associate_service(
|
||||
service_id
|
||||
)
|
||||
return redirect(url_for(
|
||||
'.service_agreement',
|
||||
service_id=service_id,
|
||||
))
|
||||
|
||||
return render_template(
|
||||
'views/organisations/add-gp-organisation.html',
|
||||
form=form
|
||||
)
|
||||
|
||||
|
||||
@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 == Organisation.TYPE_NHS_LOCAL) or current_service.organisation:
|
||||
abort(403)
|
||||
|
||||
form = AddNHSLocalOrganisationForm(organisation_choices=[
|
||||
(organisation.id, organisation.name)
|
||||
for organisation in sorted(AllOrganisations())
|
||||
if organisation.organisation_type == 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/<uuid:org_id>", methods=['GET'])
|
||||
@user_has_permissions()
|
||||
def organisation_dashboard(org_id):
|
||||
|
||||
Reference in New Issue
Block a user