コード例 #1
0
ファイル: forms.py プロジェクト: uktrade/lite-frontend
def set_flags_form(flags, level, show_case_header=False, show_sidebar=False):
    form = Form(
        title=getattr(SetFlagsForm, level).TITLE,
        description=getattr(SetFlagsForm, level).DESCRIPTION,
        questions=[
            Filter(placeholder=getattr(SetFlagsForm, level).FILTER),
            Checkboxes(
                name="flags[]",
                options=flags,
                filterable=True,
                disabled_hint="You do not have permission to remove this flag.",
            ),
            DetailComponent(
                title=getattr(SetFlagsForm, level).Note.TITLE,
                components=[
                    TextArea(name="note", classes=["govuk-!-margin-0"]),
                ],
            ),
        ],
        default_button_name=getattr(SetFlagsForm, level).SUBMIT_BUTTON,
        container="case" if show_case_header else "two-pane",
        javascript_imports={"/javascripts/flags-permission-hints.js"},
    )

    if show_sidebar:
        form.helpers = [
            HelpSection("Setting flags on:",
                        "",
                        includes="case/includes/selection-sidebar.html")
        ]

    return form
コード例 #2
0
def MOD_questions(application_type=None):
    return FormGroup([
        Form(
            title=MODQuestions.WhatAreYouApplyingFor.TITLE,
            description=MODQuestions.WhatAreYouApplyingFor.DESCRIPTION,
            questions=[
                RadioButtons(
                    name="application_type",
                    options=[
                        Option(
                            key=CaseTypes.F680,
                            value=MODQuestions.WhatAreYouApplyingFor.
                            PERMISSION_TITLE,
                            description=MODQuestions.WhatAreYouApplyingFor.
                            PERMISSION_DESCRIPTION,
                        ),
                        Option(
                            key=CaseTypes.EXHC,
                            value=MODQuestions.WhatAreYouApplyingFor.
                            EXHIBITION_CLEARANCE_TITLE,
                            description=MODQuestions.WhatAreYouApplyingFor.
                            EXHIBITION_CLEARANCE_DESCRIPTION,
                        ),
                        Option(
                            key=CaseTypes.GIFT,
                            value=MODQuestions.WhatAreYouApplyingFor.
                            GIFTING_CLEARANCE_TITLE,
                            description=MODQuestions.WhatAreYouApplyingFor.
                            GIFTING_CLEARANCE_DESCRIPTION,
                        ),
                    ],
                ),
            ],
            default_button_name=generic.CONTINUE,
            back_link=BackLink(MODQuestions.WhatAreYouApplyingFor.BACK,
                               reverse_lazy("apply_for_a_licence:start")),
        ),
        conditional(
            application_type == CaseTypes.F680,
            Form(
                title=MODQuestions.ConfirmationStatement.TITLE,
                questions=[
                    Label(paragraph) for paragraph in
                    MODQuestions.ConfirmationStatement.DESCRIPTION.split("\n")
                ],
                default_button_name=generic.CONFIRM_AND_CONTINUE,
            ),
        ),
        reference_name_form(),
    ])
コード例 #3
0
ファイル: forms.py プロジェクト: django-doctor/lite-frontend
def group_two_product_type_form(back_link=None):
    form = Form(
        title=CreateGoodForm.FirearmGood.ProductType.TITLE,
        questions=[
            HiddenField("product_type_step", True),
            RadioButtons(
                title="",
                name="type",
                options=[
                    Option(
                        key="firearms",
                        value=CreateGoodForm.FirearmGood.ProductType.FIREARM),
                    Option(key="ammunition",
                           value=CreateGoodForm.FirearmGood.ProductType.
                           AMMUNITION),
                    Option(
                        key="components_for_firearms",
                        value=CreateGoodForm.FirearmGood.ProductType.
                        COMPONENTS_FOR_FIREARM,
                    ),
                    Option(
                        key="components_for_ammunition",
                        value=CreateGoodForm.FirearmGood.ProductType.
                        COMPONENTS_FOR_AMMUNITION,
                    ),
                    Option(key="firearms_accessory",
                           value=CreateGoodForm.FirearmGood.ProductType.
                           FIREARMS_ACCESSORY),
                    Option(
                        key="software_related_to_firearms",
                        value=CreateGoodForm.FirearmGood.ProductType.
                        SOFTWARE_RELATED_TO_FIREARM,
                    ),
                    Option(
                        key="technology_related_to_firearms",
                        value=CreateGoodForm.FirearmGood.ProductType.
                        TECHNOLOGY_RELATED_TO_FIREARM,
                    ),
                ],
            ),
        ],
        default_button_name="Save and continue",
    )

    if back_link:
        form.back_link = BackLink("Back", back_link)

    return form
コード例 #4
0
def product_uses_information_security(request):
    return Form(
        title=CreateGoodForm.ProductInformationSecurity.TITLE,
        questions=[
            HiddenField("is_information_security_step", True),
            RadioButtons(
                title="",
                name="uses_information_security",
                options=[
                    Option(
                        key=True,
                        value="Yes",
                        components=[
                            TextArea(
                                title=CreateGoodForm.ProductInformationSecurity.INFORMATION_SECURITY_DETAILS,
                                description="",
                                name="information_security_details",
                                optional=True,
                            ),
                        ],
                    ),
                    Option(key=False, value=CreateGoodForm.ProductInformationSecurity.NO),
                ],
            ),
        ],
    )
コード例 #5
0
def pv_details_form(request):
    return Form(
        title=GoodGradingForm.TITLE,
        description=GoodGradingForm.DESCRIPTION,
        questions=[
            Heading("PV grading", HeadingStyle.M),
            Group(
                components=[
                    TextInput(title=GoodGradingForm.PREFIX, name="prefix", optional=True),
                    Select(
                        options=get_pv_gradings(request, convert_to_options=True),
                        title=GoodGradingForm.GRADING,
                        name="grading",
                        optional=True,
                    ),
                    TextInput(title=GoodGradingForm.SUFFIX, name="suffix", optional=True),
                ],
                classes=["app-pv-grading-inputs"],
            ),
            TextInput(title=GoodGradingForm.OTHER_GRADING, name="custom_grading", optional=True),
            TextInput(title=GoodGradingForm.ISSUING_AUTHORITY, name="issuing_authority"),
            TextInput(title=GoodGradingForm.REFERENCE, name="reference"),
            DateInput(
                title=GoodGradingForm.DATE_OF_ISSUE, prefix="date_of_issue", name="date_of_issue", optional=False
            ),
        ],
        default_button_name=GoodGradingForm.BUTTON,
    )
コード例 #6
0
ファイル: clearance.py プロジェクト: uktrade/lite-frontend
def clearance_level_form(application_id, options):
    return Form(
        title=ClearanceLevel.TITLE,
        description=ClearanceLevel.DESCRIPTION,
        questions=[RadioButtons(name="clearance_level", options=options)],
        back_link=back_to_task_list(application_id),
    )
コード例 #7
0
ファイル: forms.py プロジェクト: django-doctor/lite-frontend
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)],
    )
コード例 #8
0
ファイル: roles.py プロジェクト: uktrade/lite-frontend
def add_role(request: HttpRequest):
    return Form(
        title=AddRoleForm.TITLE,
        description=AddRoleForm.DESCRIPTION,
        questions=[
            TextInput(title=AddRoleForm.ROLE_NAME, name="name"),
            Checkboxes(
                name="permissions[]",
                options=get_permissions(request, True),
                title=AddRoleForm.PERMISSION_CHECKBOXES_TITLE,
                description=AddRoleForm.PERMISSION_CHECKBOXES_DESCRIPTION,
                optional=True,
                classes=["govuk-checkboxes--small"],
            ),
            Checkboxes(
                name="statuses[]",
                options=get_statuses(request, True),
                title=AddRoleForm.STATUSES_CHECKBOXES_TITLE,
                description=AddRoleForm.STATUSES_CHECKBOXES_DESCRIPTION,
                optional=True,
                classes=["govuk-checkboxes--small"],
            ),
        ],
        back_link=BackLink(AddRoleForm.BACK_LINK, reverse_lazy("users:roles")),
        default_button_name=AddRoleForm.FORM_CREATE,
    )
コード例 #9
0
def edit_type_form(application_id):
    return Form(
        title=strings.Applications.Edit.TITLE,
        description=strings.Applications.Edit.DESCRIPTION,
        questions=[
            RadioButtons(
                name="edit-type",
                options=[
                    Option(
                        key="minor",
                        value=strings.Applications.Edit.Minor.TITLE,
                        description=strings.Applications.Edit.Minor.
                        DESCRIPTION,
                    ),
                    Option(
                        key="major",
                        value=strings.Applications.Edit.Major.TITLE,
                        description=strings.Applications.Edit.Major.
                        DESCRIPTION,
                    ),
                ],
            )
        ],
        back_link=BackLink(
            strings.BACK_TO_APPLICATION,
            reverse_lazy("applications:application",
                         kwargs={"pk": application_id}),
        ),
        default_button_name=strings.CONTINUE,
    )
コード例 #10
0
def edit_individual_form(organisation, can_edit_name, are_fields_optional):
    return Form(
        title=EditIndividualOrganisationPage.TITLE,
        questions=[
            conditional(
                can_edit_name,
                TextInput(
                    title=EditIndividualOrganisationPage.Name.TITLE,
                    description=EditIndividualOrganisationPage.Name.
                    DESCRIPTION,
                    name="name",
                ),
            ),
            TextInput(
                title=EditIndividualOrganisationPage.EORINumber.TITLE,
                description=EditIndividualOrganisationPage.Name.DESCRIPTION,
                name="eori_number",
                optional=are_fields_optional,
            ),
            TextInput(
                title=EditIndividualOrganisationPage.VATNumber.TITLE,
                description=EditIndividualOrganisationPage.VATNumber.
                DESCRIPTION,
                optional=True,
                name="vat_number",
            ),
        ],
        back_link=BackLink(
            EditIndividualOrganisationPage.BACK_LINK,
            reverse("organisations:organisation",
                    kwargs={"pk": organisation["id"]}),
        ),
        default_button_name=EditIndividualOrganisationPage.SUBMIT_BUTTON,
    )
コード例 #11
0
def raise_a_goods_query(good_id, raise_a_clc: bool, raise_a_pv: bool):
    questions = []

    if raise_a_clc:
        if GoodsQueryForm.CLCQuery.TITLE:
            questions += [
                Heading(GoodsQueryForm.CLCQuery.TITLE, HeadingStyle.M),
            ]
        questions += [
            TextInput(
                title=GoodsQueryForm.CLCQuery.Code.TITLE,
                description=GoodsQueryForm.CLCQuery.Code.DESCRIPTION,
                name="clc_control_code",
                optional=True,
            ),
            TextArea(title=GoodsQueryForm.CLCQuery.Details.TITLE, name="clc_raised_reasons", optional=True,),
        ]

    if raise_a_pv:
        if GoodsQueryForm.PVGrading.TITLE:
            questions += [
                Heading(GoodsQueryForm.PVGrading.TITLE, HeadingStyle.M),
            ]
        questions += [
            TextArea(title=GoodsQueryForm.PVGrading.Details.TITLE, name="pv_grading_raised_reasons", optional=True,),
        ]

    return Form(
        title=GoodsQueryForm.TITLE,
        description=GoodsQueryForm.DESCRIPTION,
        questions=questions,
        back_link=BackLink(GoodsQueryForm.BACK_LINK, reverse("goods:good", kwargs={"pk": good_id})),
        default_button_name="Save",
    )
コード例 #12
0
def told_by_an_official_form(application_id=None):
    return Form(
        title=ExportLicenceQuestions.HaveYouBeenInformedQuestion.TITLE,
        description=ExportLicenceQuestions.HaveYouBeenInformedQuestion.
        DESCRIPTION,
        questions=[
            RadioButtons(
                name="have_you_been_informed",
                options=[
                    Option(
                        key="yes",
                        value=strings.YES,
                        components=[
                            TextInput(
                                title=ExportLicenceQuestions.
                                HaveYouBeenInformedQuestion.
                                WHAT_WAS_THE_REFERENCE_CODE_TITLE,
                                description=ExportLicenceQuestions.
                                HaveYouBeenInformedQuestion.
                                WHAT_WAS_THE_REFERENCE_CODE_DESCRIPTION,
                                name="reference_number_on_information_form",
                                optional=True,
                            ),
                        ],
                    ),
                    Option(key="no", value=strings.NO),
                ],
            ),
        ],
        back_link=back_to_task_list(application_id),
        default_button_name=conditional(application_id,
                                        generic.SAVE_AND_RETURN,
                                        generic.CONTINUE),
    )
コード例 #13
0
def register_individual_form(in_uk):
    return Form(
        title=RegisterAnOrganisation.INDIVIDUAL_TITLE,
        questions=[
            TextInput(
                title=RegisterAnOrganisation.IndividualName.TITLE,
                description=RegisterAnOrganisation.IndividualName.DESCRIPTION,
                name="name",
            ),
            EmailInput(title=RegisterAnOrganisation.EMAIL, name="user.email"),
            TextInput(
                title=RegisterAnOrganisation.EORINumber.TITLE,
                description=RegisterAnOrganisation.EORINumber.DESCRIPTION,
                name="eori_number",
                optional=not in_uk,
            ),
            TextInput(
                title=RegisterAnOrganisation.UkVatNumber.TITLE,
                description=RegisterAnOrganisation.UkVatNumber.DESCRIPTION,
                optional=True,
                name="vat_number",
            ),
        ],
        default_button_name=strings.CONTINUE,
    )
コード例 #14
0
def done_with_case_form(request, queue_pk, case_pk, has_review_date):
    queue = None
    queues, _ = get_user_case_queues(request, case_pk)

    if not queues:
        queue = get_queue(request, queue_pk)

    return Form(
        title=DoneWithCaseOnQueueForm.TITLE if not queue else
        DoneWithCaseOnQueueForm.TITLE_SINGULAR.format(queue["name"]),
        questions=[
            conditional(
                queues,
                Checkboxes(
                    name="queues[]",
                    options=[
                        Option(queue["id"], queue["name"]) for queue in queues
                    ],
                    title=DoneWithCaseOnQueueForm.CHECKBOX_TITLE,
                    description=DoneWithCaseOnQueueForm.CHECKBOX_DESCRIPTION,
                ),
                HiddenField(name="queues[]", value=queue_pk),
            ),
            DetailComponent(
                title=DoneWithCaseOnQueueForm.NOTE,
                components=[
                    TextArea(name="note", classes=["govuk-!-margin-0"]),
                ],
            ),
        ],
        default_button_name=DoneWithCaseOnQueueForm.SUBMIT,
        container="case",
        javascript_imports=conditional(has_review_date,
                                       {"/javascripts/assign_queue.js"}, None),
    )
コード例 #15
0
def application_type_form():
    return Form(
        title=TradeControlLicenceQuestions.TradeControlLicenceQuestion.TITLE,
        description=TradeControlLicenceQuestions.TradeControlLicenceQuestion.DESCRIPTION,
        questions=[
            RadioButtons(
                name="application_type",
                options=[
                    Option(
                        key=CaseTypes.OGTCL,
                        value=TradeControlLicenceQuestions.TradeControlLicenceQuestion.OPEN_GENERAL_TRADE_CONTROL_LICENCE,
                        description=TradeControlLicenceQuestions.TradeControlLicenceQuestion.OPEN_GENERAL_TRADE_CONTROL_LICENCE_DESCRIPTION,
                    ),
                    Option(
                        key=CaseTypes.SICL,
                        value=TradeControlLicenceQuestions.TradeControlLicenceQuestion.STANDARD_LICENCE,
                        description=TradeControlLicenceQuestions.TradeControlLicenceQuestion.STANDARD_LICENCE_DESCRIPTION,
                    ),
                    Option(
                        key=CaseTypes.OICL,
                        value=TradeControlLicenceQuestions.TradeControlLicenceQuestion.OPEN_LICENCE,
                        description=TradeControlLicenceQuestions.TradeControlLicenceQuestion.OPEN_LICENCE_DESCRIPTION,
                    ),
                ],
            )
        ],
        default_button_name=generic.CONTINUE,
        back_link=BackLink(
            TradeControlLicenceQuestions.TradeControlLicenceQuestion.BACK, reverse_lazy("apply_for_a_licence:start")
        ),
    )
コード例 #16
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,
    )
コード例 #17
0
def edit_good_detail_form(request, good_id):
    return Form(
        title=EditGoodForm.TITLE,
        description=EditGoodForm.DESCRIPTION,
        questions=[
            TextArea(
                title=EditGoodForm.Description.TITLE,
                description=EditGoodForm.Description.DESCRIPTION,
                name="description",
                extras={"max_length": 280},
            ),
            TextInput(title=EditGoodForm.PartNumber.TITLE, name="part_number", optional=True),
            RadioButtons(
                title=EditGoodForm.IsControlled.TITLE,
                description=EditGoodForm.IsControlled.DESCRIPTION,
                name="is_good_controlled",
                options=[
                    Option(
                        key="yes",
                        value=EditGoodForm.IsControlled.YES,
                        components=[
                            control_list_entries_question(
                                control_list_entries=get_control_list_entries(request, convert_to_options=True),
                                title=EditGoodForm.ControlListEntry.TITLE,
                                description=EditGoodForm.ControlListEntry.DESCRIPTION,
                            ),
                        ],
                    ),
                    Option(key="no", value=EditGoodForm.IsControlled.NO),
                ],
            ),
        ],
        back_link=BackLink(CreateGoodForm.BACK_BUTTON, reverse_lazy("goods:good", kwargs={"pk": good_id})),
    )
コード例 #18
0
def uk_service_equipment_form():
    return Form(
        caption=F680Questions.CAPTION,
        title=F680Questions.UKServiceEquipment.TITLE,
        questions=[
            RadioButtons(
                name="uk_service_equipment",
                options=[
                    Option(
                        key=True,
                        value="Yes",
                        components=[
                            TextArea(
                                title=F680Questions.UKServiceEquipment.
                                PROVIDE_DETAILS_OPTIONAL,
                                name="uk_service_equipment_description",
                                extras={"max_length": 2200},
                            )
                        ],
                    ),
                    Option(key=False, value="No"),
                ],
            )
        ],
        default_button_name=generic.SAVE_AND_CONTINUE,
    )
コード例 #19
0
def document_grading_form(request, good_id):
    select_options = get_document_missing_reasons(request)[0]["reasons"]

    return Form(
        title=DocumentSensitivityForm.TITLE,
        description=DocumentSensitivityForm.DESCRIPTION,
        questions=[
            RadioButtons(
                name="has_document_to_upload",
                options=[
                    Option(key="yes", value=DocumentSensitivityForm.Options.YES),
                    Option(
                        key="no",
                        value=DocumentSensitivityForm.Options.NO,
                        components=[
                            Label(text=DocumentSensitivityForm.ECJU_HELPLINE),
                            Select(
                                name="missing_document_reason",
                                title=DocumentSensitivityForm.LABEL,
                                options=select_options,
                            ),
                        ],
                    ),
                ],
            ),
        ],
        back_link=BackLink(DocumentSensitivityForm.BACK_BUTTON, reverse_lazy("goods:good", kwargs={"pk": good_id})),
        default_button_name=DocumentSensitivityForm.SUBMIT_BUTTON,
    )
コード例 #20
0
def prospect_value_form():
    return Form(
        caption=F680Questions.CAPTION,
        title=F680Questions.ProspectValue.TITLE,
        questions=[CurrencyInput(name="prospect_value")],
        default_button_name=generic.SAVE_AND_CONTINUE,
    )
コード例 #21
0
def product_military_use_form(request):
    return Form(
        title=CreateGoodForm.MilitaryUse.TITLE,
        questions=[
            HiddenField("is_military_use_step", True),
            RadioButtons(
                title="",
                name="is_military_use",
                options=[
                    Option(key="yes_designed", value=CreateGoodForm.MilitaryUse.YES_DESIGNED),
                    Option(
                        key="yes_modified",
                        value=CreateGoodForm.MilitaryUse.YES_MODIFIED,
                        components=[
                            TextArea(
                                title=CreateGoodForm.MilitaryUse.MODIFIED_MILITARY_USE_DETAILS,
                                description="",
                                name="modified_military_use_details",
                                optional=False,
                            ),
                        ],
                    ),
                    Option(key="no", value=CreateGoodForm.MilitaryUse.NO),
                ],
            ),
        ],
    )
コード例 #22
0
def foreign_technology_form():
    return Form(
        caption=F680Questions.CAPTION,
        title=F680Questions.ForeignTechnology.TITLE,
        questions=[
            RadioButtons(
                name="foreign_technology",
                options=[
                    Option(
                        key=True,
                        value="Yes",
                        components=[
                            TextArea(
                                title=F680Questions.ForeignTechnology.
                                PROVIDE_DETAILS,
                                name="foreign_technology_description",
                                description=F680Questions.ForeignTechnology.
                                DESCRIPTION,
                                extras={"max_length": 2200},
                                optional=False,
                            ),
                        ],
                    ),
                    Option(key=False, value="No"),
                ],
            )
        ],
        default_button_name=generic.SAVE_AND_CONTINUE,
    )
コード例 #23
0
def route_of_goods_form(back_link):
    return Form(
        title=RouteOfGoods.TITLE,
        back_link=BackLink(strings.BACK_TO_APPLICATION, back_link),
        questions=[
            RadioButtons(
                name="is_shipped_waybill_or_lading",
                short_title="",
                options=[
                    Option(key=True, value="Yes"),
                    Option(
                        key=False,
                        value="No",
                        components=[
                            TextArea(
                                name="non_waybill_or_lading_route_details",
                                title="",
                                description=RouteOfGoods.NO_ANSWER_DESCRIPTION,
                                extras={"max_length": 2000},
                                optional=False,
                            )
                        ],
                    ),
                ],
                classes=["govuk-radios--inline"],
            )
        ],
        default_button_name=RouteOfGoods.SAVE_BUTTON,
    )
コード例 #24
0
def site_form(request, is_individual, location):
    from core.views import RegisterAnOrganisationTriage

    is_in_uk = location == RegisterAnOrganisationTriage.Locations.UNITED_KINGDOM

    return Form(
        title=conditional(
            not is_individual,
            conditional(
                is_in_uk, RegisterAnOrganisation.Headquarters.TITLE, RegisterAnOrganisation.Headquarters.TITLE_FOREIGN,
            ),
            conditional(
                is_in_uk,
                RegisterAnOrganisation.Headquarters.TITLE_INDIVIDUAL,
                RegisterAnOrganisation.Headquarters.TITLE_INDIVIDUAL_FOREIGN,
            ),
        ),
        description=RegisterAnOrganisation.Headquarters.DESCRIPTION,
        caption="Step 4 of 4",
        questions=[
            TextInput(
                title=RegisterAnOrganisation.Headquarters.NAME,
                description=RegisterAnOrganisation.Headquarters.NAME_DESCRIPTION,
                name="site.name",
            ),
            *conditional(
                is_in_uk,
                address_questions(None, "site.address."),
                foreign_address_questions(get_countries(request, True, ["GB"]), "site.address."),
            ),
        ],
        default_button_name=generic.CONTINUE,
    )
コード例 #25
0
def exhibition_details_form(application_id):
    return Form(
        title=strings.Exhibition.EXHIBITION_TITLE,
        questions=[
            TextInput(title=strings.Exhibition.TITLE, name="title"),
            DateInput(
                title=strings.Exhibition.FIRST_EXHIBITION_DATE,
                description=strings.Exhibition.DATE_DESCRIPTION,
                prefix="first_exhibition_date",
                name="first_exhibition_date",
            ),
            DateInput(
                title=strings.Exhibition.REQUIRED_BY_DATE,
                description=strings.Exhibition.DATE_DESCRIPTION,
                prefix="required_by_date",
                name="required_by_date",
            ),
            TextArea(
                title=strings.Exhibition.REASON_FOR_CLEARANCE,
                name="reason_for_clearance",
                optional=True,
                extras={"max_length": 2000},
            ),
        ],
        back_link=BackLink(
            strings.BACK_TO_APPLICATION,
            reverse_lazy("applications:task_list",
                         kwargs={"pk": application_id}),
        ),
    )
コード例 #26
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,
    )
コード例 #27
0
def locally_manufactured_form():
    return Form(
        caption=F680Questions.CAPTION,
        title=F680Questions.LocallyManufactured.TITLE,
        questions=[
            RadioButtons(
                name="locally_manufactured",
                options=[
                    Option(
                        key=True,
                        value="Yes",
                        components=[
                            TextArea(
                                title=F680Questions.LocallyManufactured.
                                PROVIDE_DETAILS,
                                name="locally_manufactured_description",
                                extras={"max_length": 2200},
                                optional=False,
                            ),
                        ],
                    ),
                    Option(key=False, value="No"),
                ],
            )
        ],
        default_button_name=generic.SAVE_AND_CONTINUE,
    )
コード例 #28
0
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,
    )
コード例 #29
0
ファイル: third_party.py プロジェクト: uktrade/lite-frontend
def _third_party_role_form(application, title, button, options, back_url):
    return Form(
        title=title,
        questions=[RadioButtons("role", options=options)],
        default_button_name=button,
        back_link=BackLink(PartyTypeForm.BACK_LINK, reverse_lazy(back_url, kwargs={"pk": application["id"]})),
    )
コード例 #30
0
def no_open_general_licence_form(open_general_licence_type, selected_entry,
                                 selected_country):
    return Form(
        title=OpenGeneralLicenceQuestions.NoOpenGeneralLicencesAvailable.TITLE.
        format(open_general_licence_type.name.lower()),
        description=OpenGeneralLicenceQuestions.NoOpenGeneralLicencesAvailable.
        DESCRIPTION,
        questions=[
            *[
                Label(
                    x.format(open_general_licence_type.name.lower(),
                             selected_entry, selected_country))
                for x in OpenGeneralLicenceQuestions.
                NoOpenGeneralLicencesAvailable.INFORMATION.split("\n")
            ],
            Link(
                OpenGeneralLicenceQuestions.NoOpenGeneralLicencesAvailable.
                APPLY_FOR_A_LICENCE_LINK,
                reverse("apply_for_a_licence:start"),
                classes=["govuk-body", "govuk-link--no-visited-state"],
            ),
            Link(
                OpenGeneralLicenceQuestions.NoOpenGeneralLicencesAvailable.
                RETURN_TO_ACCOUNT_HOME_LINK,
                reverse("core:home"),
                classes=["govuk-body", "govuk-link--no-visited-state"],
            ),
        ],
        buttons=[],
    )