mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-01 12:19:47 -04:00
Merge pull request #3057 from alphagov/new_org_types_part_1
Introduce new org types
This commit is contained in:
@@ -39,6 +39,11 @@ class Config(object):
|
||||
'central': 250000,
|
||||
'local': 25000,
|
||||
'nhs': 25000,
|
||||
'nhs_central': 250000,
|
||||
'nhs_local': 25000,
|
||||
'emergency_service': 25000,
|
||||
'school_or_college': 25000,
|
||||
'other': 25000,
|
||||
}
|
||||
EMAIL_EXPIRY_SECONDS = 3600 # 1 hour
|
||||
INVITATION_EXPIRY_SECONDS = 3600 * 24 * 2 # 2 days - also set on api
|
||||
|
||||
@@ -248,7 +248,24 @@ def organisation_type(label='Who runs this service?'):
|
||||
choices=[
|
||||
('central', 'Central government'),
|
||||
('local', 'Local government'),
|
||||
('nhs', 'NHS'),
|
||||
('nhs_central', 'NHS – central government agency or public body'),
|
||||
('nhs_local', 'NHS Trust or Clinical Commissioning Group'),
|
||||
('nhs_local', 'GP practice'),
|
||||
('emergency_service', 'Emergency service'),
|
||||
('school_or_college', 'School or college'),
|
||||
('other', 'Other'),
|
||||
],
|
||||
validators=[DataRequired()],
|
||||
)
|
||||
|
||||
|
||||
def nhs_organisation_type(label='Who runs this service?'):
|
||||
return RadioField(
|
||||
label,
|
||||
choices=[
|
||||
('nhs_central', 'NHS – central government agency or public body'),
|
||||
('nhs_local', 'NHS Trust or Clinical Commissioning Group'),
|
||||
('nhs_local', 'GP practice'),
|
||||
],
|
||||
validators=[DataRequired()],
|
||||
)
|
||||
@@ -584,13 +601,17 @@ class OrganisationDomainsForm(StripWhitespaceForm):
|
||||
|
||||
class CreateServiceForm(StripWhitespaceForm):
|
||||
name = StringField(
|
||||
u'What’s your service called?',
|
||||
"What’s your service called?",
|
||||
validators=[
|
||||
DataRequired(message='Can’t be empty')
|
||||
])
|
||||
organisation_type = organisation_type()
|
||||
|
||||
|
||||
class CreateNhsServiceForm(CreateServiceForm):
|
||||
organisation_type = nhs_organisation_type()
|
||||
|
||||
|
||||
class NewOrganisationForm(
|
||||
RenameOrganisationForm,
|
||||
OrganisationOrganisationTypeForm,
|
||||
|
||||
@@ -4,7 +4,7 @@ from notifications_python_client.errors import HTTPError
|
||||
|
||||
from app import billing_api_client, service_api_client
|
||||
from app.main import main
|
||||
from app.main.forms import CreateServiceForm
|
||||
from app.main.forms import CreateNhsServiceForm, CreateServiceForm
|
||||
from app.utils import email_safe, user_is_gov_user, user_is_logged_in
|
||||
|
||||
|
||||
@@ -47,9 +47,14 @@ def _create_example_template(service_id):
|
||||
@user_is_logged_in
|
||||
@user_is_gov_user
|
||||
def add_service():
|
||||
form = CreateServiceForm(
|
||||
organisation_type=current_user.default_organisation_type
|
||||
)
|
||||
default_organisation_type = current_user.default_organisation_type
|
||||
if default_organisation_type == 'nhs':
|
||||
form = CreateNhsServiceForm()
|
||||
default_organisation_type = None
|
||||
else:
|
||||
form = CreateServiceForm(
|
||||
organisation_type=default_organisation_type
|
||||
)
|
||||
heading = 'About your service'
|
||||
|
||||
if form.validate_on_submit():
|
||||
@@ -58,7 +63,7 @@ def add_service():
|
||||
|
||||
service_id, error = _create_service(
|
||||
service_name,
|
||||
current_user.default_organisation_type or form.organisation_type.data,
|
||||
default_organisation_type or form.organisation_type.data,
|
||||
email_from,
|
||||
form,
|
||||
)
|
||||
@@ -72,11 +77,12 @@ def add_service():
|
||||
return redirect(url_for(
|
||||
'main.start_tour',
|
||||
service_id=service_id,
|
||||
template_id=example_sms_template['data']['id'],
|
||||
template_id=example_sms_template['data']['id']
|
||||
))
|
||||
else:
|
||||
return render_template(
|
||||
'views/add-service.html',
|
||||
form=form,
|
||||
heading=heading
|
||||
heading=heading,
|
||||
default_organisation_type=default_organisation_type,
|
||||
)
|
||||
|
||||
@@ -268,7 +268,7 @@ class Service(JSONModel):
|
||||
|
||||
@property
|
||||
def shouldnt_use_govuk_as_sms_sender(self):
|
||||
return self.organisation_type in {'local', 'nhs'}
|
||||
return self.organisation_type != 'central'
|
||||
|
||||
@cached_property
|
||||
def sms_senders(self):
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
{{ textbox(form.name, hint="You can change this later") }}
|
||||
|
||||
{% if not current_user.default_organisation_type %}
|
||||
{% if not default_organisation_type %}
|
||||
{{ radios(form.organisation_type) }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@
|
||||
'central': 'Central government',
|
||||
'local': 'Local government',
|
||||
'nhs': 'NHS',
|
||||
'nhs_central': 'NHS – central government agency or public body',
|
||||
'nhs_local': 'NHS Trust, GP practice or Clinical Commissioning Group',
|
||||
'emergency_service': 'Emergency service',
|
||||
'school_or_college': 'School or college',
|
||||
'other': 'Other',
|
||||
}.get(current_org.organisation_type)) }}
|
||||
{{ edit_field(
|
||||
'Change',
|
||||
|
||||
@@ -322,6 +322,11 @@
|
||||
'central': 'Central government',
|
||||
'local': 'Local government',
|
||||
'nhs': 'NHS',
|
||||
'nhs_central': 'NHS – central government agency or public body',
|
||||
'nhs_local': 'NHS Trust, GP practice or Clinical Commissioning Group',
|
||||
'emergency_service': 'Emergency service',
|
||||
'school_or_college': 'School or college',
|
||||
'other': 'Other'
|
||||
}.get(current_service.organisation_type) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user