def edit_organisation_billing_details(org_id):
    form = BillingDetailsForm(
        billing_contact_email_addresses=current_organisation.
        billing_contact_email_addresses,
        billing_contact_names=current_organisation.billing_contact_names,
        billing_reference=current_organisation.billing_reference,
        purchase_order_number=current_organisation.purchase_order_number,
        notes=current_organisation.notes,
    )

    if form.validate_on_submit():
        current_organisation.update(
            billing_contact_email_addresses=form.
            billing_contact_email_addresses.data,
            billing_contact_names=form.billing_contact_names.data,
            billing_reference=form.billing_reference.data,
            purchase_order_number=form.purchase_order_number.data,
            notes=form.notes.data,
        )
        return redirect(url_for('.organisation_settings', org_id=org_id))

    return render_template(
        'views/organisations/organisation/settings/edit-organisation-billing-details.html',
        form=form,
    )
def edit_organisation_notes(org_id):
    form = EditNotesForm(notes=current_organisation.notes)

    if form.validate_on_submit():

        if form.notes.data == current_organisation.notes:
            return redirect(url_for('.organisation_settings', org_id=org_id))

        current_organisation.update(notes=form.notes.data)
        return redirect(url_for('.organisation_settings', org_id=org_id))

    return render_template(
        'views/organisations/organisation/settings/edit-organisation-notes.html',
        form=form,
    )
Esempio n. 3
0
def edit_organisation_type(org_id):

    form = OrganisationOrganisationTypeForm(
        organisation_type=current_organisation.organisation_type)

    if form.validate_on_submit():
        current_organisation.update(
            organisation_type=form.organisation_type.data,
            delete_services_cache=True,
        )
        return redirect(url_for('.organisation_settings', org_id=org_id))

    return render_template(
        'views/organisations/organisation/settings/edit-type.html',
        form=form,
    )
def organisation_preview_letter_branding(org_id):
    branding_style = request.args.get('branding_style')

    form = PreviewBranding(branding_style=branding_style)

    if form.validate_on_submit():
        current_organisation.update(
            letter_branding_id=form.branding_style.data,
            delete_services_cache=True,
        )
        return redirect(url_for('.organisation_settings', org_id=org_id))

    return render_template(
        'views/organisations/organisation/settings/preview-letter-branding.html',
        form=form,
        action=url_for('main.organisation_preview_letter_branding', org_id=org_id),
    )