def back_to_task_list(application_id): if not application_id: return BackLink() return BackLink( strings.Common.BACK_TO_TASK_LIST, reverse_lazy("applications:task_list", kwargs={"pk": application_id}))
def get(self, request, **kwargs): return_to_good_page = request.GET.get("goodpage", "no") good_id = str(kwargs["pk"]) extra_data = {"good_id": good_id} draft_pk = str(kwargs.get("draft_pk", "")) if draft_pk: extra_data["draft_pk"] = draft_pk if return_to_good_page == "yes": if draft_pk: back_link = BackLink( AttachDocumentForm.BACK_GOOD_LINK, reverse( "goods:good_detail_application", kwargs={"pk": good_id, "type": "application", "draft_pk": draft_pk}, ), ) else: back_link = BackLink(AttachDocumentForm.BACK_GOOD_LINK, reverse("goods:good", kwargs={"pk": good_id})) else: if draft_pk: back_link = BackLink( AttachDocumentForm.BACK_FORM_LINK, reverse("goods:add_document_add_application", kwargs={"pk": good_id, "draft_pk": draft_pk}), ) else: back_link = BackLink( AttachDocumentForm.BACK_FORM_LINK, reverse("goods:check_document_sensitivity", kwargs={"pk": good_id}), ) form = attach_documents_form(back_link) return form_page(request, form, extra_data=extra_data)
def init(self, request, **kwargs): self.object_pk = kwargs["pk"] self.level = self.get_level() flags = self.get_potential_flags() self.success_message = getattr(SetFlagsForm, self.level).SUCCESS_MESSAGE if self.level == FlagLevel.ORGANISATIONS: self.context = {"organisation": "123"} self.form = set_flags_form(flags, self.level) self.form.back_link = BackLink(url=reverse("organisations:organisation", kwargs={"pk": self.object_pk})) else: self.case = get_case(request, self.object_pk) self.context = {"case": self.case, "hide_flags_row": True} show_sidebar = False if self.level == FlagLevel.GOODS or self.level == FlagLevel.DESTINATIONS: show_sidebar = True self.context["goods"] = get_param_goods(self.request, self.case) self.context["destinations"] = get_param_destinations(self.request, self.case) self.form = set_flags_form(flags, self.level, show_case_header=True, show_sidebar=show_sidebar) self.form.back_link = BackLink( url=reverse("cases:case", kwargs={"queue_pk": kwargs["queue_pk"], "pk": self.object_pk}) ) self.data = {"flags": self.get_object_flags()}
def approve_licence_form(queue_pk, case_id, is_open_licence, editable_duration, goods, goods_html): return Form( title=lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.APPROVE_TITLE, questions=[ DateInput( description=lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.DATE_DESCRIPTION, title=lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.DATE_TITLE, prefix="", ), conditional( editable_duration, TextInput( title=lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.DURATION_TITLE, name="duration", description=lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.DURATION_DESCRIPTION, ), ), HiddenField(name="action", value="approve"), conditional(goods, Custom(goods_html, data=goods,)), ], container="case", back_link=conditional( is_open_licence, BackLink( url=reverse_lazy("cases:finalise_goods_countries", kwargs={"queue_pk": queue_pk, "pk": case_id}), text=lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.Actions.BACK_TO_DECISION_MATRIX_BUTTON, ), BackLink( url=reverse_lazy("cases:case", kwargs={"queue_pk": queue_pk, "pk": case_id, "tab": "final-advice"}), text=lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.Actions.BACK_TO_ADVICE_BUTTON, ), ), )
def add_goods_questions(request, application_pk=None): return Form( title=conditional(application_pk, CreateGoodForm.TITLE_APPLICATION, CreateGoodForm.TITLE_GOODS_LIST), questions=[ TextArea( title=CreateGoodForm.Description.TITLE, description=CreateGoodForm.Description.DESCRIPTION, name="description", extras={"max_length": 280}, ), TextInput(title=CreateGoodForm.PartNumber.TITLE, name="part_number", optional=True), RadioButtons( title=CreateGoodForm.IsControlled.TITLE, description=conditional( application_pk, CreateGoodForm.IsControlled.DESCRIPTION, CreateGoodForm.IsControlled.CLC_REQUIRED, ), name="is_good_controlled", options=[ Option( key="yes", value=CreateGoodForm.IsControlled.YES, components=[ control_list_entries_question( control_list_entries=get_control_list_entries(request, convert_to_options=True), title=CreateGoodForm.ControlListEntry.TITLE, description=CreateGoodForm.ControlListEntry.DESCRIPTION, ), ], ), Option(key="no", value=CreateGoodForm.IsControlled.NO), conditional(not application_pk, Option(key="unsure", value=CreateGoodForm.IsControlled.UNSURE)), ], ), RadioButtons( title=CreateGoodForm.IsGraded.TITLE, description=CreateGoodForm.IsGraded.DESCRIPTION, name="is_pv_graded", options=[ Option(key="yes", value=CreateGoodForm.IsGraded.YES), Option(key="no", value=CreateGoodForm.IsGraded.NO), conditional( not application_pk, Option(key="grading_required", value=CreateGoodForm.IsGraded.RAISE_QUERY) ), ], ), ], back_link=conditional( application_pk, BackLink(generic.BACK, reverse_lazy("applications:goods", kwargs={"pk": application_pk})), Breadcrumbs( [ BackLink(generic.SERVICE_NAME, reverse_lazy("core:home")), BackLink(GoodsList.TITLE, reverse_lazy("goods:goods")), BackLink(GoodsList.CREATE_GOOD), ] ), ), default_button_name=CreateGoodForm.SUBMIT_BUTTON, )
def get(self, request, **kwargs): return_to_good_page = request.GET.get("goodpage", "no") good_id = str(kwargs["pk"]) if return_to_good_page == "yes": back_link = BackLink(AttachDocumentForm.BACK_GOOD_LINK, reverse("goods:good", kwargs={"pk": good_id})) else: back_link = BackLink( AttachDocumentForm.BACK_FORM_LINK, reverse("goods:add_document", kwargs={"pk": good_id})) form = attach_documents_form(back_link) return form_page(request, form, extra_data={"good_id": good_id})
def opening_question(): return Form( title=InitialApplicationQuestionsForms.OpeningQuestion.TITLE, description=InitialApplicationQuestionsForms.OpeningQuestion. DESCRIPTION, questions=[ RadioButtons( name="licence_type", options=[ Option( key="export_licence", value=InitialApplicationQuestionsForms.OpeningQuestion. LicenceTypes.EXPORT_LICENCE_TITLE, description=InitialApplicationQuestionsForms. OpeningQuestion.LicenceTypes. EXPORT_LICENCE_DESCRIPTION, ), Option( key="transhipment", value=InitialApplicationQuestionsForms.OpeningQuestion. LicenceTypes.TRANSHIPMENT_LICENCE_TITLE, description=InitialApplicationQuestionsForms. OpeningQuestion.LicenceTypes. TRANSHIPMENT_LICENCE_DESCRIPTION, ), Option( key="trade_control_licence", value=InitialApplicationQuestionsForms.OpeningQuestion. LicenceTypes.TRADE_CONTROL_LICENCE_TITLE, description=InitialApplicationQuestionsForms. OpeningQuestion.LicenceTypes. TRADE_CONTROL_LICENCE_DESCRIPTION, ), Option( key="mod", value=InitialApplicationQuestionsForms.OpeningQuestion. LicenceTypes.MOD_CLEARANCE_TITLE, description=InitialApplicationQuestionsForms. OpeningQuestion.LicenceTypes.MOD_CLEARANCE_DESCRIPTION, ), ], ), ], default_button_name=generic.CONTINUE, back_link=Breadcrumbs([ BackLink(hub.ACCOUNT_HOME, reverse_lazy("core:home")), BackLink( InitialApplicationQuestionsForms.OpeningQuestion.BREADCRUMB, ""), ]), )
def opening_question(): options = [ Option( key="export_licence", value="Export licence", description= ("Select if you’re sending products from the UK to another country. You need an export licence " "before you provide access to controlled technology, software or data." ), ), Option( key="transhipment", value="Transhipment licence", description= ("Select if you're shipping something from overseas through the UK on to another country. " "If the products will be in the UK for 30 days or more, apply for an export licence." ), disabled=settings.FEATURE_FLAG_ONLY_ALLOW_SIEL, ), Option( key="trade_control_licence", value="Trade control licence", description= ("Select if you’re arranging or brokering the sale or movement of controlled military products " "located overseas."), disabled=settings.FEATURE_FLAG_ONLY_ALLOW_SIEL, ), Option( key="mod", value="MOD clearance", description= ("Select if you need to share information (an F680) or to go to an exhibition, or if you're gifting " "surplus products."), disabled=settings.FEATURE_FLAG_ONLY_ALLOW_SIEL, ), ] if settings.FEATURE_FLAG_ONLY_ALLOW_SIEL: description = render_to_string("applications/use-spire-triage.html") else: description = "" return Form( title="Select what you need", description=description, questions=[RadioButtons(name="licence_type", options=options)], default_button_name="Continue", back_link=Breadcrumbs([ BackLink("Account home", reverse("core:home")), BackLink("Apply for a licence", ""), ]), )
def add_user_form(request): return Form( title=AddUserForm.TITLE, questions=[ TextInput(title=AddUserForm.Email.TITLE, description=AddUserForm.Email.DESCRIPTION, name="email"), Select( title=AddUserForm.Team.TITLE, description=AddUserForm.Team.DESCRIPTION, name="team", options=get_teams(request, True), ), Select( title=AddUserForm.Role.TITLE, description=AddUserForm.Role.DESCRIPTION, name="role", options=get_roles(request, True), ), Select( title=AddUserForm.DefaultQueue.TITLE, description=AddUserForm.DefaultQueue.DESCRIPTION, name="default_queue", options=get_queues(request, include_system=True, convert_to_options=True), ), ], back_link=BackLink(AddUserForm.BACK_LINK, reverse_lazy("users:users")), javascript_imports={"/javascripts/filter-default-queue-list.js"}, )
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, )
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") ), )
def edit_user_form(request, user, can_edit_role: bool): return Form( title=EditUserForm.TITLE.format(user["first_name"], user["last_name"]), questions=[ TextInput(title=EditUserForm.Email.TITLE, description=EditUserForm.Email.DESCRIPTION, name="email"), Select( title=EditUserForm.Team.TITLE, description=EditUserForm.Team.DESCRIPTION, name="team", options=get_teams(request, True), ), conditional( can_edit_role, Select( title=EditUserForm.Role.TITLE, description=EditUserForm.Role.DESCRIPTION, name="role", options=get_roles(request, True), ), ), Select( title=EditUserForm.DefaultQueue.TITLE, description=EditUserForm.DefaultQueue.DESCRIPTION, name="default_queue", options=get_queues(request, include_system=True, convert_to_options=True), ), ], back_link=BackLink( EditUserForm.BACK_LINK.format(user["first_name"], user["last_name"]), reverse_lazy("users:user", kwargs={"pk": user["id"]}), ), default_button_name=EditUserForm.SUBMIT_BUTTON, javascript_imports={"/javascripts/filter-default-queue-list.js"}, )
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, )
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, )
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", )
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})), )
def new_party_form_group(request, application, strings, back_url, clearance_options=None, is_end_user=False): back_link = BackLink( PartyTypeForm.BACK_LINK, reverse_lazy(back_url, kwargs={"pk": application["id"]})) forms = [ party_type_form(application, strings.TITLE, strings.BUTTON, back_link), party_name_form(strings.NAME_FORM_TITLE, strings.BUTTON), party_website_form(strings.WEBSITE_FORM_TITLE, strings.BUTTON), ] if clearance_options: forms.extend(clearance_level_forms(clearance_options, strings.BUTTON)) # Exclude the UK if end user on standard transhipment is_gb_excluded = application.case_type["reference"][ "key"] == CaseTypes.SITL and is_end_user forms.append( party_address_form(request, strings.ADDRESS_FORM_TITLE, strings.SUBMIT_BUTTON, is_gb_excluded=is_gb_excluded)) if is_end_user: forms.append( party_signatory_name_form("Signatory name", "Save and continue")) return FormGroup(forms)
def post(self, request, **kwargs): good_id = str(kwargs["good_pk"]) draft_id = str(kwargs["pk"]) back_link = BackLink( "Back", reverse("applications:document_grading", kwargs={ "pk": draft_id, "good_pk": good_id })) data, error = add_document_data(request) if error: form = attach_documents_form(back_link) return form_page(request, form, errors={"file": ["Select a document"]}) data, status_code = post_good_documents(request, good_id, data) if status_code != HTTPStatus.CREATED: return error_page(request, data["errors"]["file"]) return redirect( reverse_lazy("applications:add_good_to_application", kwargs={ "pk": draft_id, "good_pk": good_id }) + f"?preexisting={self.request.GET.get('preexisting', False)}")
def post(self, request, **kwargs): draft_pk = str(kwargs.get("draft_pk", "")) good_id = str(kwargs["pk"]) back_link = BackLink( AttachDocumentForm.BACK_FORM_LINK, reverse("goods:check_document_sensitivity", kwargs={"pk": good_id}), ) data, error = add_document_data(request) if error: form = attach_documents_form(back_link) return form_page(request, form, errors={"file": ["Select a document"]}) data, status_code = post_good_documents(request, good_id, data) if status_code != HTTPStatus.CREATED: return error_page(request, data["errors"]["file"]) if draft_pk: return redirect( reverse( "goods:good_detail_application", kwargs={"pk": good_id, "type": "application", "draft_pk": draft_pk}, ) ) else: return redirect(reverse("goods:good", kwargs={"pk": good_id}))
def reissue_ogl_confirmation_form(case_id, queue_id): return Form( title=Manage.ReissueOGL.TITLE, description=Manage.ReissueOGL.DESCRIPTION, questions=[ RadioButtons( name="confirm", options=[ Option(key=True, value=Manage.ReissueOGL.YES), Option(key=False, value=Manage.ReissueOGL.NO) ], classes=["govuk-checkboxes--inline"], ), DetailComponent( title=Manage.ReissueOGL.NOTE, components=[ TextArea(name="note", classes=["govuk-!-margin-0"]) ], ), ], back_link=BackLink(url=reverse("cases:case", kwargs={ "queue_pk": queue_id, "pk": case_id })), default_button_name=Manage.ReissueOGL.SUBMIT, container="case", )
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, )
def edit_queue_form(request, queue_id): return Form( title=EditQueueForm.TITLE, description=EditQueueForm.DESCRIPTION, questions=[ TextInput( title=EditQueueForm.Name.TITLE, description=EditQueueForm.Name.DESCRIPTION, name="name", ), Select( title=EditQueueForm.CountersigningQueue.TITLE, description=EditQueueForm.CountersigningQueue.DESCRIPTION, options=remove_current_queue_id( get_queues(request=request, disable_pagination=True, convert_to_options=True, users_team_first=True), queue_id, ), name="countersigning_queue", ), ], back_link=BackLink(EditQueueForm.BACK, reverse_lazy("queues:manage")), )
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, )
def get(self, request, *args, **kwargs): organisation = get_user(request, params={"in_review": True})["organisations"][0] organisation_name = organisation["name"] organisation_status = organisation["status"]["key"] if organisation_status != "in_review": raise Http404 return success_page( request=request, title=f"You've successfully registered: {organisation_name}", secondary_title="We're currently processing your application.", description="", what_happens_next=[ "Export Control Joint Unit (ECJU) is processing your request for an export control account. " "We'll send you an email when we've made a final decision." ], links={}, back_link=conditional( request.GET.get("show_back_link", False), BackLink(generic.BACK, reverse_lazy("core:pick_organisation"))), animated=True, additional_context={"user_in_limbo": True}, )
def third_party_forms(request, application, strings, back_url, clearance_options=None): form_options = role_option_list.copy() if application["case_type"]["sub_type"]["key"] != F680: form_options.pop("customer") export_type = application.get("export_type") if not export_type or export_type.get("key") == PERMANENT: del form_options["additional_end_user"] options = [Option(key, value) for key, value in form_options.items()] options.append( Option("other", PartyForm.Options.OTHER, show_or=True, components=[TextInput(name="role_other")])) forms = [ _third_party_role_form(application, strings.ROLE_TITLE, strings.BUTTON, options, back_url), party_type_form(application, strings.TYPE_TITLE, strings.BUTTON, BackLink()), party_name_form(strings.NAME_FORM_TITLE, strings.BUTTON), party_website_form(strings.WEBSITE_FORM_TITLE, strings.BUTTON), ] if clearance_options: forms.extend(clearance_level_forms(clearance_options, strings.BUTTON)) forms.append( party_address_form(request, strings.ADDRESS_FORM_TITLE, strings.SUBMIT_BUTTON)) return FormGroup(forms)
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, )
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}), ), )
def get_form(self): forms = open_general_licence_forms( self.request, OpenGeneralExportLicences.get_by_id( self.object["case_type"]["id"]), open_general_licences_strings.Edit, ).forms if self.kwargs["edit"] == constants.DETAILS: form = forms[1] elif self.kwargs["edit"] == constants.CONTROL_LIST_ENTRIES: form = forms[2] elif self.kwargs["edit"] == constants.COUNTRIES: form = forms[3] else: raise Http404 form = copy.deepcopy(form) form.caption = self.object["case_type"]["reference"][ "value"] + " (" + self.object["name"] + ")" form.buttons[0].value = generic.SAVE_AND_RETURN form.back_link = BackLink( url=reverse("open_general_licences:open_general_licence", kwargs={"pk": self.kwargs["pk"]})) return form
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"]})), )
def initial_routing_rule_questions(request, team_id, is_editing: bool): if is_editing: title = Forms.EDIT_TITLE else: title = Forms.CREATE_TITLE return Form( title=title, questions=[ Select(title=Forms.CASE_STATUS, name="status", options=get_statuses(request, True)), AutocompleteInput( title=Forms.QUEUE, name="queue", options=get_team_queues(request, team_id, True, True), ), TextInput(title=Forms.TIER, name="tier"), HiddenField(name="additional_rules[]", value=None), Checkboxes( title=Forms.ADDITIONAL_RULES, name="additional_rules[]", options=additional_rules, ), ], back_link=BackLink(Forms.BACK_BUTTON, reverse_lazy("routing_rules:list")), )