mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-04 13:41:38 -04:00
remove nhs and gpo forms
This commit is contained in:
@@ -1191,50 +1191,6 @@ class RenameOrganisationForm(StripWhitespaceForm):
|
||||
])
|
||||
|
||||
|
||||
class AddGPOrganisationForm(StripWhitespaceForm):
|
||||
|
||||
def __init__(self, *args, service_name='unknown', **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.same_as_service_name.label.text = 'Is your GP practice called ‘{}’?'.format(service_name)
|
||||
self.service_name = service_name
|
||||
|
||||
def get_organisation_name(self):
|
||||
if self.same_as_service_name.data:
|
||||
return self.service_name
|
||||
return self.name.data
|
||||
|
||||
same_as_service_name = OnOffField(
|
||||
'Is your GP practice called the same name as your service?',
|
||||
choices=(
|
||||
(True, 'Yes'),
|
||||
(False, 'No'),
|
||||
),
|
||||
)
|
||||
|
||||
name = GovukTextInputField(
|
||||
'What’s your practice called?',
|
||||
)
|
||||
|
||||
def validate_name(self, field):
|
||||
if self.same_as_service_name.data is False:
|
||||
if not field.data:
|
||||
raise ValidationError('Cannot be empty')
|
||||
else:
|
||||
field.data = ''
|
||||
|
||||
|
||||
class AddNHSLocalOrganisationForm(StripWhitespaceForm):
|
||||
|
||||
def __init__(self, *args, organisation_choices=None, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.organisations.choices = organisation_choices
|
||||
|
||||
organisations = GovukRadiosField(
|
||||
'Which NHS Trust or Clinical Commissioning Group do you work for?',
|
||||
thing='an NHS Trust or Clinical Commissioning Group'
|
||||
)
|
||||
|
||||
|
||||
class OrganisationOrganisationTypeForm(StripWhitespaceForm):
|
||||
organisation_type = OrganisationTypeField('What type of organisation is this?')
|
||||
|
||||
@@ -1298,7 +1254,7 @@ class CreateServiceForm(StripWhitespaceForm):
|
||||
MustContainAlphanumericCharacters(),
|
||||
Length(max=255, message='Service name must be 255 characters or fewer')
|
||||
])
|
||||
# organisation_type = OrganisationTypeField('Who runs this service?')
|
||||
organisation_type = OrganisationTypeField('Where is this service run?')
|
||||
|
||||
|
||||
class AdminNewOrganisationForm(
|
||||
|
||||
@@ -45,10 +45,9 @@ def _create_example_template(service_id):
|
||||
@user_is_logged_in
|
||||
@user_is_gov_user
|
||||
def add_service():
|
||||
# default_organisation_type = current_user.default_organisation_type
|
||||
default_organisation_type = 'central'
|
||||
default_organisation_type = current_user.default_organisation_type
|
||||
form = CreateServiceForm(
|
||||
organisation_type=default_organisation_type
|
||||
# organisation_type=default_organisation_type
|
||||
)
|
||||
|
||||
if form.validate_on_submit():
|
||||
|
||||
@@ -17,8 +17,6 @@ from app import (
|
||||
)
|
||||
from app.main import main
|
||||
from app.main.forms import (
|
||||
AddGPOrganisationForm,
|
||||
AddNHSLocalOrganisationForm,
|
||||
AdminBillingDetailsForm,
|
||||
AdminNewOrganisationForm,
|
||||
AdminNotesForm,
|
||||
@@ -81,62 +79,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):
|
||||
|
||||
@@ -16,30 +16,36 @@ from app.notify_client.organisations_api_client import organisations_client
|
||||
|
||||
class Organisation(JSONModel, SortByNameMixin):
|
||||
|
||||
TYPE_CENTRAL = 'central'
|
||||
TYPE_LOCAL = 'local'
|
||||
TYPE_NHS_CENTRAL = 'nhs_central'
|
||||
TYPE_NHS_LOCAL = 'nhs_local'
|
||||
TYPE_NHS_GP = 'nhs_gp'
|
||||
TYPE_EMERGENCY_SERVICE = 'emergency_service'
|
||||
TYPE_SCHOOL_OR_COLLEGE = 'school_or_college'
|
||||
TYPE_OTHER = 'other'
|
||||
TYPE_FEDERAL = 'federal'
|
||||
TYPE_STATE = 'state'
|
||||
|
||||
NHS_TYPES = (
|
||||
TYPE_NHS_CENTRAL,
|
||||
TYPE_NHS_LOCAL,
|
||||
TYPE_NHS_GP,
|
||||
)
|
||||
# TYPE_CENTRAL = 'central'
|
||||
# TYPE_LOCAL = 'local'
|
||||
# TYPE_NHS_CENTRAL = 'nhs_central'
|
||||
# TYPE_NHS_LOCAL = 'nhs_local'
|
||||
# TYPE_NHS_GP = 'nhs_gp'
|
||||
# TYPE_EMERGENCY_SERVICE = 'emergency_service'
|
||||
# TYPE_SCHOOL_OR_COLLEGE = 'school_or_college'
|
||||
# TYPE_OTHER = 'other'
|
||||
|
||||
# NHS_TYPES = (
|
||||
# TYPE_NHS_CENTRAL,
|
||||
# TYPE_NHS_LOCAL,
|
||||
# TYPE_NHS_GP,
|
||||
# )
|
||||
|
||||
TYPE_LABELS = OrderedDict([
|
||||
(TYPE_CENTRAL, 'Central government'),
|
||||
(TYPE_LOCAL, 'Local government'),
|
||||
(TYPE_NHS_CENTRAL, 'NHS – central government agency or public body'),
|
||||
(TYPE_NHS_LOCAL, 'NHS Trust or Clinical Commissioning Group'),
|
||||
(TYPE_NHS_GP, 'GP practice'),
|
||||
(TYPE_EMERGENCY_SERVICE, 'Emergency service'),
|
||||
(TYPE_SCHOOL_OR_COLLEGE, 'School or college'),
|
||||
(TYPE_OTHER, 'Other'),
|
||||
(TYPE_FEDERAL, 'Federal government'),
|
||||
(TYPE_STATE, 'State government')
|
||||
|
||||
# (TYPE_CENTRAL, 'Central government'),
|
||||
# (TYPE_LOCAL, 'Local government'),
|
||||
# (TYPE_NHS_CENTRAL, 'NHS – central government agency or public body'),
|
||||
# (TYPE_NHS_LOCAL, 'NHS Trust or Clinical Commissioning Group'),
|
||||
# (TYPE_NHS_GP, 'GP practice'),
|
||||
# (TYPE_EMERGENCY_SERVICE, 'Emergency service'),
|
||||
# (TYPE_SCHOOL_OR_COLLEGE, 'School or college'),
|
||||
# (TYPE_OTHER, 'Other'),
|
||||
])
|
||||
|
||||
ALLOWED_PROPERTIES = {
|
||||
|
||||
Reference in New Issue
Block a user