mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Merge branch 'main' into stvnrlly-remove-broadcasts
This commit is contained in:
@@ -5,7 +5,7 @@ from notifications_python_client.errors import HTTPError
|
||||
from app import service_api_client
|
||||
from app.formatters import email_safe
|
||||
from app.main import main
|
||||
from app.main.forms import CreateNhsServiceForm, CreateServiceForm
|
||||
from app.main.forms import CreateServiceForm
|
||||
from app.utils.user import user_is_gov_user, user_is_logged_in
|
||||
|
||||
|
||||
@@ -46,13 +46,11 @@ def _create_example_template(service_id):
|
||||
@user_is_gov_user
|
||||
def add_service():
|
||||
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
|
||||
)
|
||||
form = CreateServiceForm(
|
||||
# avoid setting a default for now; the US gov email addresses aren't as useful as the UK
|
||||
# ones for guessing the org type
|
||||
organisation_type=None
|
||||
)
|
||||
|
||||
if form.validate_on_submit():
|
||||
email_from = email_safe(form.name.data)
|
||||
|
||||
@@ -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):
|
||||
@@ -182,8 +122,8 @@ def download_organisation_usage_report(org_id):
|
||||
])
|
||||
|
||||
monetary_column_names = OrderedDict([
|
||||
('sms_cost', 'Spent on text messages (£)'),
|
||||
('letter_cost', 'Spent on letters (£)')
|
||||
('sms_cost', 'Spent on text messages ($)'),
|
||||
('letter_cost', 'Spent on letters ($)')
|
||||
])
|
||||
|
||||
org_usage_data = [
|
||||
|
||||
@@ -12,10 +12,10 @@ def features_nav():
|
||||
"name": "Text messages",
|
||||
"link": "main.features_sms",
|
||||
},
|
||||
{
|
||||
"name": "Letters",
|
||||
"link": "main.features_letters",
|
||||
},
|
||||
# {
|
||||
# "name": "Letters",
|
||||
# "link": "main.features_letters",
|
||||
# },
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -84,14 +84,14 @@ def using_notify_nav():
|
||||
"name": "Send files by email",
|
||||
"link": "main.send_files_by_email",
|
||||
},
|
||||
{
|
||||
"name": "Upload a letter",
|
||||
"link": "main.upload_a_letter",
|
||||
},
|
||||
{
|
||||
"name": "Letter specification",
|
||||
"link": "main.letter_specification",
|
||||
},
|
||||
# {
|
||||
# "name": "Upload a letter",
|
||||
# "link": "main.upload_a_letter",
|
||||
# },
|
||||
# {
|
||||
# "name": "Letter specification",
|
||||
# "link": "main.letter_specification",
|
||||
# },
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user