예제 #1
0
def activity_form(request):
    activities = get_trade_control_activities(request)
    options = []

    for activity in activities:
        option = Option(activity["key"], activity["value"])

        if activity["key"] == "other":
            option.components = [
                TextArea(
                    title=TradeControlLicenceQuestions.ControlActivity.OTHER_DESCRIPTION,
                    name="trade_control_activity_other",
                    optional=False,
                    rows=1,
                    extras={"max_length": 100},
                )
            ]

        options.append(option)

    return Form(
        title=TradeControlLicenceQuestions.ControlActivity.TITLE,
        description=TradeControlLicenceQuestions.ControlActivity.DESCRIPTION,
        questions=[RadioButtons(name="trade_control_activity", options=options)],
        default_button_name=generic.CONTINUE,
    )
예제 #2
0
def create_admin_user_form():
    return Form(
        title="Create an admin user for this organisation",
        questions=[TextInput(title=RegisterAnOrganisation.EMAIL, name="user.email"),],
        default_button_name="Submit",
        helpers=[HelpSection("Help", RegisterAnOrganisation.DEFAULT_USER)],
    )
def product_category_form(request):
    product_categories = get_trade_control_product_categories(request)
    hint_text_map = {
        "category_a":
        TradeControlLicenceQuestions.ProductCategory.CATEGORY_A_HINT,
        "category_b":
        TradeControlLicenceQuestions.ProductCategory.CATEGORY_B_HINT,
        "category_c":
        TradeControlLicenceQuestions.ProductCategory.CATEGORY_C_HINT,
    }

    options = [
        Option(product_category["key"], product_category["value"],
               hint_text_map.get(product_category["key"]))
        for product_category in product_categories
    ]

    return Form(
        title=TradeControlLicenceQuestions.ProductCategory.TITLE,
        description=TradeControlLicenceQuestions.ProductCategory.DESCRIPTION,
        questions=[
            Checkboxes(name="trade_control_product_categories[]",
                       options=options)
        ],
        default_button_name=generic.SAVE_AND_CONTINUE,
    )
예제 #4
0
def select_flagging_rule_type():
    return Form(
        title=strings.FlaggingRules.Create.Type.TITLE,
        questions=[RadioButtons(name="level", options=_levels,)],
        back_link=BackLink(strings.FlaggingRules.Create.BACKLINK, reverse_lazy("flags:flagging_rules")),
        default_button_name=strings.FlaggingRules.Create.Type.SAVE,
    )
예제 #5
0
def new_location_form(request, application_type, location_type):
    exclude = []
    if application_type in [CaseTypes.SITL, CaseTypes.SICL, CaseTypes.OICL]:
        exclude.append("GB")

    countries = get_countries(request, True, exclude)

    return Form(
        title=NewLocationForm.TITLE,
        description=NewLocationForm.DESCRIPTION,
        questions=[
            HiddenField(name="external_locations", value=""),
            TextInput(name="name", title=NewLocationForm.Name.TITLE),
            TextArea(
                name="address",
                title=conditional(
                    location_type == LocationType.SEA_BASED,
                    NewLocationForm.Address.SEA_BASED_TITLE,
                    NewLocationForm.Address.TITLE,
                ),
                description=conditional(
                    application_type == CaseTypes.SITL,
                    NewLocationForm.Address.SITL_DESCRIPTION,
                    conditional(
                        location_type == LocationType.SEA_BASED,
                        NewLocationForm.Address.SEA_BASED_DESCRIPTION,
                        NewLocationForm.Address.DESCRIPTION,
                    ),
                ),
            ),
            conditional(location_type != LocationType.SEA_BASED,
                        country_question(prefix="", countries=countries)),
        ],
        default_button_name=strings.SAVE_AND_CONTINUE,
    )
예제 #6
0
def reference_name_form():
    return Form(
        title=applications.HMRCQuery.InitialQuestions.REFERENCE_NAME_TITLE,
        description=applications.HMRCQuery.InitialQuestions.REFERENCE_NAME_DESCRIPTION,
        questions=[TextInput(name="name"),],
        default_button_name=applications.HMRCQuery.InitialQuestions.REFERENCE_NAME_BUTTON,
    )