Ejemplo n.º 1
0
class AdditionalBenefitsForm(BaseForm):
    @classproperty
    def title(self):
        if session and session.checker.has_partner:
            return _(u"You and your partner’s additional benefits")
        return _(u"Your additional benefits")

    benefits = PartnerMultiCheckboxField(
        label=_(u"Do you get any of these benefits?"),
        partner_label=_(u"Do you or your partner get any of these benefits?"),
        description=_(u"These benefits don’t count as income. Please tick "
                      u"the ones you receive."),
        choices=NON_INCOME_BENEFITS,
    )
    other_benefits = PartnerYesNoField(
        label=_(u"Do you receive any other benefits not listed above? "),
        partner_label=_(u"Do you or your partner receive any other benefits "
                        u"not listed above? "),
        description=_(u"For example, National Asylum Support Service Benefit, "
                      u"Incapacity Benefit, Contribution-based Jobseeker's "
                      u"Allowance"),
        yes_text=lazy_pgettext(u"I am", u"Yes"),
        no_text=lazy_pgettext(u"I’m not", u"No"),
    )
    total_other_benefit = MoneyIntervalField(
        label=_(u"If Yes, total amount of benefits not listed above"),
        choices=money_intervals_except("per_month"),
        validators=[
            IgnoreIf("other_benefits", FieldValue(NO)),
            MoneyIntervalAmountRequired()
        ],
    )
class AdaptationsForm(BabelTranslationsFormMixin, NoCsrfForm):
    """
    Subform for adaptations
    """

    bsl_webcam = BooleanField(_(u"British Sign Language – Webcam"))
    minicom = BooleanField(_(u"Minicom – for textphone users"))
    text_relay = BooleanField(
        _(u"Text Relay – for people with hearing or speech impairments"))
    welsh = BooleanField(_(u"Welsh"))
    is_other_language = BooleanField(_(u"Other language"))
    other_language = SelectField(_(u"Choose a language"),
                                 choices=(LANG_CHOICES))
    is_other_adaptation = BooleanField(_(u"Any other communication needs"))
    other_adaptation = TextAreaField(
        _(u"Other communication needs"),
        description=_(u"Please tell us what you need in the box below"),
        validators=[
            IgnoreIf("is_other_adaptation", FieldValue(False)),
            Length(
                max=4000,
                message=
                _(u"Your other communication needs must be 4000 characters or fewer"
                  )),
            Optional(),
        ],
    )

    def __init__(self,
                 formdata=None,
                 obj=None,
                 prefix="",
                 data=None,
                 meta=None,
                 **kwargs):
        if data is None:
            data = {"welsh": get_locale()[:2] == "cy"}
        super(AdaptationsForm, self).__init__(formdata, obj, prefix, data,
                                              meta, **kwargs)
Ejemplo n.º 3
0
class ContactForm(Honeypot, BabelTranslationsFormMixin, Form):
    """
    Form to contact CLA
    """

    full_name = StringField(
        _(u"Your full name"),
        validators=[
            Length(max=400,
                   message=_(u"Your full name must be 400 "
                             u"characters or less")),
            InputRequired()
        ],
    )
    contact_type = RadioField(
        _(u"Select a contact option"),
        choices=CONTACT_PREFERENCE,
        validators=[
            InputRequired(message=_(u"Please choose one of the options"))
        ],
    )
    callback = ValidatedFormField(
        CallBackForm,
        validators=[
            IgnoreIf("contact_type", FieldValue("call")),
            IgnoreIf("contact_type", FieldValue("thirdparty"))
        ],
    )
    thirdparty = ValidatedFormField(
        ThirdPartyForm,
        validators=[
            IgnoreIf("contact_type", FieldValue("call")),
            IgnoreIf("contact_type", FieldValue("callback"))
        ],
    )
    email = StringField(
        _(u"Email"),
        description=_(u"If you add your email we will send you the "
                      u"reference number when you submit your details"),
        validators=[
            Length(max=255,
                   message=_(u"Your address must be 255 characters "
                             u"or less")),
            EmailValidator(message=_(u"Invalid email address")),
            Optional(),
        ],
    )
    address = ValidatedFormField(AddressForm)
    extra_notes = TextAreaField(
        _(u"Tell us more about your problem"),
        validators=[
            Length(max=4000,
                   message=_(u"Your notes must be 4000 characters "
                             u"or less")),
            Optional()
        ],
    )
    adaptations = ValidatedFormField(
        AdaptationsForm,
        _(u"Do you have any special communication needs?"),
        validators=[Optional()])

    def api_payload(self):
        "Form data as data structure ready to send to API"

        def process_selected_time(form_time):
            # all time slots are timezone naive (local time)
            # so we convert them to UTC for the backend
            naive = form_time.scheduled_time()
            local_tz = pytz.timezone(current_app.config["TIMEZONE"])
            local = local_tz.localize(naive)
            return local.astimezone(pytz.utc).isoformat()

        data = {
            "personal_details": {
                "full_name": self.full_name.data,
                "email": self.email.data,
                "postcode": self.address.form.post_code.data,
                "mobile_phone": self.callback.form.contact_number.data,
                "street": self.address.form.street_address.data,
                "safe_to_contact": self.callback.form.safe_to_contact.data,
            },
            "adaptation_details": {
                "bsl_webcam":
                self.adaptations.bsl_webcam.data,
                "minicom":
                self.adaptations.minicom.data,
                "text_relay":
                self.adaptations.text_relay.data,
                "language":
                self.adaptations.welsh.data and "WELSH"
                or self.adaptations.other_language.data,
                "notes":
                self.adaptations.other_adaptation.data
                if self.adaptations.is_other_adaptation.data else "",
            },
        }
        if self.contact_type.data == "callback":
            data["requires_action_at"] = process_selected_time(
                self.callback.form.time)

        if self.contact_type.data == "thirdparty":
            data["thirdparty_details"] = {"personal_details": {}}
            data["thirdparty_details"]["personal_details"][
                "full_name"] = self.thirdparty.full_name.data
            data["thirdparty_details"]["personal_details"][
                "mobile_phone"] = self.thirdparty.contact_number.data
            data["thirdparty_details"]["personal_details"][
                "safe_to_contact"] = self.thirdparty.safe_to_contact.data
            data["thirdparty_details"][
                "personal_relationship"] = self.thirdparty.relationship.data

            data["requires_action_at"] = process_selected_time(
                self.thirdparty.form.time)

        return data
Ejemplo n.º 4
0
class AboutYouForm(BaseForm):

    title = _(u"About you")
    have_partner = YesNoField(
        label=_(u"Do you have a partner?"),
        description=(_(
            u"Your husband, wife, civil partner (unless "
            u"you have permanently separated) or someone you live with "
            u"as if you’re married")),
        yes_text=lazy_pgettext(u"There is/are", u"Yes"),
        no_text=lazy_pgettext(u"There is/are not", u"No"),
    )
    in_dispute = YesNoField(
        label=_(u"If Yes, are you in a dispute with your partner?"),
        description=(_(
            u"This means your partner is the opponent in the dispute "
            u"you need help with, for example a dispute over money or "
            u"property ")),
        validators=[
            IgnoreIf("have_partner", FieldValue(NO)),
            InputRequired(message=_(u"Please choose Yes or No"))
        ],
        yes_text=lazy_pgettext(u"I am", u"Yes"),
        no_text=lazy_pgettext(u"I’m not", u"No"),
    )
    on_benefits = YesNoField(
        label=_(u"Do you receive any benefits (including Child Benefit)?"),
        description=(
            _(u"Being on some benefits can help you qualify for legal aid")),
        yes_text=lazy_pgettext(u"I am", u"Yes"),
        no_text=lazy_pgettext(u"I’m not", u"No"),
    )
    have_children = YesNoField(
        label=_(u"Do you have any children aged 15 or under?"),
        description=_(u"Don't include any children who don't live with you"),
        yes_text=lazy_pgettext(u"There is/are", u"Yes"),
        no_text=lazy_pgettext(u"There is/are not", u"No"),
    )
    num_children = SetZeroIntegerField(
        label=_(u"If Yes, how many?"),
        validators=[
            IgnoreIf("have_children", FieldValue(NO)),
            DataRequired(_(u"Number must be between 1 and 50")),
            NumberRange(min=1,
                        max=50,
                        message=_(u"Number must be between 1 and 50")),
        ],
    )
    have_dependants = YesNoField(
        label=_(u"Do you have any dependants aged 16 or over?"),
        description=_(
            u"People who you live with and support financially. This could be "
            u"a young person for whom you get Child Benefit"),
        yes_text=lazy_pgettext(u"There is/are", u"Yes"),
        no_text=lazy_pgettext(u"There is/are not", u"No"),
    )
    num_dependants = SetZeroIntegerField(
        label=_(u"If Yes, how many?"),
        validators=[
            IgnoreIf("have_dependants", FieldValue(NO)),
            DataRequired(_(u"Number must be between 1 and 50")),
            NumberRange(min=1,
                        max=50,
                        message=_(u"Number must be between 1 and 50")),
        ],
    )
    have_savings = YesNoField(
        label=_(u"Do you have any savings or investments?"),
        yes_text=lazy_pgettext(u"There is/are", u"Yes"),
        no_text=lazy_pgettext(u"There is/are not", u"No"),
    )
    have_valuables = YesNoField(
        label=_(u"Do you have any valuable items worth over £500 each?"),
        yes_text=lazy_pgettext(u"There is/are", u"Yes"),
        no_text=lazy_pgettext(u"There is/are not", u"No"),
    )
    own_property = YesNoField(
        label=_(u"Do you own any property?"),
        description=_(u"For example, a house, static caravan or flat"))
    is_employed = YesNoField(
        label=_(u"Are you employed?"),
        description=(_(
            u"This means working as an employee - you may be both employed "
            u"and self-employed")),
        yes_text=lazy_pgettext(u"I am", u"Yes"),
        no_text=lazy_pgettext(u"I’m not", u"No"),
    )
    partner_is_employed = YesNoField(
        label=_(u"Is your partner employed?"),
        description=_(
            u"This means working as an employee - your partner may be both "
            u"employed and self-employed"),
        validators=[
            IgnoreIf("in_dispute", FieldValueOrNone(YES)),
            InputRequired(message=_(u"Please choose Yes or No")),
        ],
        yes_text=lazy_pgettext(u"There is/are", u"Yes"),
        no_text=lazy_pgettext(u"There is/are not", u"No"),
    )
    is_self_employed = YesNoField(
        label=_(u"Are you self-employed?"),
        description=(_(
            u"This means working for yourself - you may be both employed "
            u"and self-employed")),
        yes_text=lazy_pgettext(u"I am", u"Yes"),
        no_text=lazy_pgettext(u"I’m not", u"No"),
    )
    partner_is_self_employed = YesNoField(
        label=_(u"Is your partner self-employed?"),
        description=_(
            u"This means working for yourself - your partner may be both "
            u"employed and self-employed"),
        validators=[
            IgnoreIf("in_dispute", FieldValueOrNone(YES)),
            InputRequired(message=_(u"Please choose Yes or No")),
        ],
        yes_text=lazy_pgettext(u"There is/are", u"Yes"),
        no_text=lazy_pgettext(u"There is/are not", u"No"),
    )
    aged_60_or_over = YesNoField(
        label=_(u"Are you or your partner (if you have one) aged 60 or over?"),
        yes_text=lazy_pgettext(u"I am", u"Yes"),
        no_text=lazy_pgettext(u"I’m not", u"No"),
    )
Ejemplo n.º 5
0
class PropertyForm(BaseNoCsrfForm):

    is_main_home = YesNoField(
        label=_(u"Is this property your main home?"),
        description=(_(
            u"If you are separated and no longer live in the property you "
            u"own, please answer ‘no’")),
    )
    other_shareholders = PartnerYesNoField(
        label=_(u"Does anyone else own a share of the property?"),
        description=_(
            u"Select 'Yes' if you share ownership with a friend, relative or "
            u"ex-partner"),
        partner_label=_(
            u"Does anyone else (other than you or your partner) own a share "
            u"of the property?"),
        yes_text=lazy_pgettext(u"There is/are", u"Yes"),
        no_text=lazy_pgettext(u"There is/are not", u"No"),
    )
    property_value = MoneyField(
        label=_(u"How much is the property worth?"),
        description=_(
            u"Use a property website or the Land Registry house prices "
            u"website."),
        validators=[InputRequired(_(u"Please enter a valid amount"))],
    )
    mortgage_remaining = MoneyField(
        label=_(u"How much is left to pay on the mortgage?"),
        description=(_(
            u"Include the full amount owed, even if the property has "
            u"shared ownership")),
        validators=[
            InputRequired(_(u"Please enter 0 if you have no mortgage"))
        ],
    )
    mortgage_payments = MoneyField(
        label=_(u"How much was your monthly mortgage repayment last month?"),
        validators=[
            IgnoreIf("mortgage_remaining", FieldValue(0)),
            InputRequired(_(u"Please enter 0 if you have no mortgage")),
        ],
    )
    is_rented = YesNoField(
        label=_(u"Do you rent out any part of this property?"),
        yes_text=lazy_pgettext(u"I am", u"Yes"),
        no_text=lazy_pgettext(u"I’m not", u"No"),
    )
    rent_amount = MoneyIntervalField(
        label=_(u"If Yes, how much rent did you receive last month?"),
        choices=money_intervals_except("per_4week"),
        validators=[
            IgnoreIf("is_rented", FieldValue(NO)),
            MoneyIntervalAmountRequired()
        ],
    )
    in_dispute = YesNoField(
        label=_(u"Is your share of the property in dispute?"),
        description=_(
            u"For example, as part of the financial settlement of a divorce"),
        yes_text=lazy_pgettext(u"There is/are", u"Yes"),
        no_text=lazy_pgettext(u"There is/are not", u"No"),
    )
Ejemplo n.º 6
0
class PropertyForm(BaseNoCsrfForm):

    is_main_home = YesNoField(
        label=_(u"Is this property your main home?"),
        description=(_(u"If you are separated and no longer live in the property you own, please answer ‘no’")),
        validators=[InputRequired(message=_(u"Tell us whether this is your main home"))],
    )
    other_shareholders = PartnerYesNoField(
        label=_(u"Does anyone else own a share of the property?"),
        description=_(u"Select ‘Yes’ if you share ownership with a friend, relative or ex-partner"),
        partner_label=_(u"Does anyone else (other than you or your partner) own a share of the property?"),
        validators=[InputRequired(message=_(u"Tell us whether anyone else owns a share of this property"))],
        yes_text=lazy_pgettext(u"There is/are", u"Yes"),
        no_text=lazy_pgettext(u"There is/are not", u"No"),
    )
    property_value = MoneyField(
        label=_(u"How much is the property worth?"),
        description=_(u"Use a property website or the Land Registry house prices website."),
        validators=[InputRequired(_(u"Tell us the approximate value of this property"))],
    )
    mortgage_remaining = MoneyField(
        label=_(u"How much is left to pay on the mortgage?"),
        description=(
            _(
                u"Include the full amount owed, even if the property has shared ownership, or enter 0 if you have no mortgage"
            )
        ),
        validators=[InputRequired(_(u"Tell us how much is left to pay on the mortgage"))],
    )
    mortgage_payments = MoneyField(
        label=_(u"How much was your monthly mortgage repayment last month?"),
        validators=[
            IgnoreIf("mortgage_remaining", FieldValue(0)),
            InputRequired(_(u"Enter your mortgage repayment for last month")),
        ],
    )
    is_rented = YesNoField(
        label=_(u"Do you rent out any part of this property?"),
        validators=[InputRequired(_(u"Tell us whether you rent out some of this property"))],
        yes_text=lazy_pgettext(u"I am", u"Yes"),
        no_text=lazy_pgettext(u"I’m not", u"No"),
    )
    rent_amount = MoneyIntervalField(
        label=_(u"If Yes, how much rent did you receive last month?"),
        choices=money_intervals_except("per_4week"),
        validators=[
            IgnoreIf("is_rented", FieldValueOrNone(NO)),
            MoneyIntervalAmountRequired(
                message=_(u"Tell us how much rent you receive from this property"),
                freq_message=_(u"Tell us how often you receive this rent"),
                amount_message=_(
                    u"Tell us how much rent you receive"
                ),  # this is followed by the time period, e.g. "... each week"
            ),
        ],
    )
    in_dispute = YesNoField(
        label=_(u"Is your share of the property in dispute?"),
        description=_(u"For example, as part of the financial settlement of a divorce"),
        validators=[InputRequired(_(u"Tell us whether this property is in dispute"))],
        yes_text=lazy_pgettext(u"There is/are", u"Yes"),
        no_text=lazy_pgettext(u"There is/are not", u"No"),
    )