def letter_branding():

    brandings = letter_branding_client.get_all_letter_branding()

    return render_template('views/letter-branding/select-letter-branding.html',
                           letter_brandings=brandings,
                           search_form=SearchByNameForm())
def service_set_letter_branding(service_id):
    letter_branding = letter_branding_client.get_all_letter_branding()

    form = SetLetterBranding(
        all_branding_options=get_branding_as_value_and_label(letter_branding),
        current_branding=current_service.letter_branding_id,
    )

    if form.validate_on_submit():
        return redirect(
            url_for(
                '.service_preview_letter_branding',
                service_id=service_id,
                branding_style=form.branding_style.data,
            ))

    return render_template('views/service-settings/set-letter-branding.html',
                           form=form,
                           search_form=SearchByNameForm())
def edit_organisation_letter_branding(org_id):
    letter_branding = letter_branding_client.get_all_letter_branding()

    form = SetLetterBranding(
        all_branding_options=get_branding_as_value_and_label(letter_branding),
        current_branding=current_organisation['letter_branding_id'],
    )

    if form.validate_on_submit():
        return redirect(url_for(
            '.organisation_preview_letter_branding',
            org_id=org_id,
            branding_style=form.branding_style.data,
        ))

    return render_template(
        'views/organisations/organisation/settings/set-letter-branding.html',
        form=form,
        search_form=SearchByNameForm()
    )