Browse Source

Refactor sales household pages and questions

pull/2709/head
Kat 2 years ago
parent
commit
f7d9ca8c09
  1. 1
      app/models/form/sales/pages/buyer1_income.rb
  2. 1
      app/models/form/sales/pages/buyer2_income.rb
  3. 1
      app/models/form/sales/pages/housing_benefits.rb
  4. 1
      app/models/form/sales/pages/previous_ownership.rb
  5. 1
      app/models/form/sales/pages/savings.rb
  6. 3
      app/models/form/sales/questions/buyer1_income.rb
  7. 3
      app/models/form/sales/questions/buyer1_income_known.rb
  8. 2
      app/models/form/sales/questions/buyer1_mortgage.rb
  9. 4
      app/models/form/sales/questions/buyer2_income.rb
  10. 3
      app/models/form/sales/questions/buyer2_income_known.rb
  11. 2
      app/models/form/sales/questions/buyer2_mortgage.rb
  12. 3
      app/models/form/sales/questions/housing_benefits.rb
  13. 3
      app/models/form/sales/questions/prevown.rb
  14. 3
      app/models/form/sales/questions/savings.rb
  15. 3
      app/models/form/sales/questions/savings_nk.rb
  16. 6
      config/locales/en.yml
  17. 84
      config/locales/forms/2023/sales/income_benefits_and_savings.en.yml
  18. 84
      config/locales/forms/2024/sales/income_benefits_and_savings.en.yml

1
app/models/form/sales/pages/buyer1_income.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer1Income < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_income"
@copy_key = "sales.income_benefits_and_savings.buyer1_income"
end
def questions

1
app/models/form/sales/pages/buyer2_income.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer2Income < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_income"
@copy_key = "sales.income_benefits_and_savings.buyer_2_income"
@depends_on = [{
"joint_purchase?" => true,
}]

1
app/models/form/sales/pages/housing_benefits.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::HousingBenefits < ::Form::Page
def initialize(id, hsh, subsection, joint_purchase:)
super(id, hsh, subsection)
@joint_purchase = joint_purchase
@copy_key = "sales.income_benefits_and_savings.housing_benefits.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
end
def questions

1
app/models/form/sales/pages/previous_ownership.rb

@ -3,6 +3,7 @@ class Form::Sales::Pages::PreviousOwnership < ::Form::Page
super(id, hsh, subsection)
@joint_purchase = joint_purchase
@depends_on = [{ "joint_purchase?" => @joint_purchase }]
@copy_key = "sales.income_benefits_and_savings.prevown.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
end
def questions

1
app/models/form/sales/pages/savings.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Savings < ::Form::Page
def initialize(id, hsh, subsection, joint_purchase:)
super(id, hsh, subsection)
@joint_purchase = joint_purchase
@copy_key = "sales.income_benefits_and_savings.savings.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
end
def questions

3
app/models/form/sales/questions/buyer1_income.rb

@ -2,9 +2,6 @@ class Form::Sales::Questions::Buyer1Income < ::Form::Question
def initialize(id, hsh, page)
super
@id = "income1"
@check_answer_label = "Buyer 1’s gross annual income"
@header = "Buyer 1’s gross annual income"
@hint_text = "Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments."
@type = "numeric"
@min = 0
@max = 999_999

3
app/models/form/sales/questions/buyer1_income_known.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::Buyer1IncomeKnown < ::Form::Question
def initialize(id, hsh, page)
super
@id = "income1nk"
@check_answer_label = "Buyer 1’s gross annual income known?"
@header = "Do you know buyer 1’s annual income?"
@copy_key = "sales.income_benefits_and_savings.income1nk"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@conditional_for = {

2
app/models/form/sales/questions/buyer1_mortgage.rb

@ -2,8 +2,6 @@ class Form::Sales::Questions::Buyer1Mortgage < ::Form::Question
def initialize(id, hsh, page)
super
@id = "inc1mort"
@check_answer_label = "Buyer 1’s income used for mortgage application"
@header = "Was buyer 1’s income used for a mortgage application?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@check_answers_card_number = 1

4
app/models/form/sales/questions/buyer2_income.rb

@ -2,10 +2,8 @@ class Form::Sales::Questions::Buyer2Income < ::Form::Question
def initialize(id, hsh, page)
super
@id = "income2"
@check_answer_label = "Buyer 2’s gross annual income"
@header = "Buyer 2’s gross annual income"
@copy_key = "sales.income_benefits_and_savings.buyer_2_income.income2"
@type = "numeric"
@hint_text = "Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments."
@min = 0
@max = 999_999
@step = 1

3
app/models/form/sales/questions/buyer2_income_known.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::Buyer2IncomeKnown < ::Form::Question
def initialize(id, hsh, page)
super
@id = "income2nk"
@check_answer_label = "Buyer 2’s gross annual income known?"
@header = "Do you know buyer 2’s annual income?"
@copy_key = "sales.income_benefits_and_savings.buyer_2_income.income2"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@conditional_for = {

2
app/models/form/sales/questions/buyer2_mortgage.rb

@ -2,8 +2,6 @@ class Form::Sales::Questions::Buyer2Mortgage < ::Form::Question
def initialize(id, hsh, page)
super
@id = "inc2mort"
@check_answer_label = "Buyer 2’s income used for mortgage application"
@header = "Was buyer 2’s income used for a mortgage application?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2

3
app/models/form/sales/questions/housing_benefits.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::HousingBenefits < ::Form::Question
def initialize(id, hsh, page, joint_purchase:)
super(id, hsh, page)
@id = "hb"
@check_answer_label = "Housing-related benefits #{joint_purchase ? 'buyers' : 'buyer'} received before buying this property"
@header = "#{joint_purchase ? 'Were the buyers' : 'Was the buyer'} receiving any of these housing-related benefits immediately before buying this property?"
@copy_key = "sales.income_benefits_and_savings.housing_benefits.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

3
app/models/form/sales/questions/prevown.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::Prevown < ::Form::Question
def initialize(id, hsh, page, joint_purchase:)
super(id, hsh, page)
@id = "prevown"
@check_answer_label = I18n.t("check_answer_labels.prevown", count: joint_purchase ? 2 : 1)
@header = I18n.t("questions.prevown", count: joint_purchase ? 2 : 1)
@copy_key = "sales.income_benefits_and_savings.prevown.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

3
app/models/form/sales/questions/savings.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::Savings < ::Form::Question
def initialize(id, hsh, page, joint_purchase:)
super(id, hsh, page)
@id = "savings"
@check_answer_label = "#{joint_purchase ? 'Buyers’' : 'Buyer’s'} total savings before any deposit paid"
@header = "Enter their total savings to the nearest £10"
@copy_key = "sales.income_benefits_and_savings.savings.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}.savings"
@type = "numeric"
@width = 5
@prefix = "£"

3
app/models/form/sales/questions/savings_nk.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::SavingsNk < ::Form::Question
def initialize(id, hsh, page, joint_purchase:)
super(id, hsh, page)
@id = "savingsnk"
@check_answer_label = "#{joint_purchase ? 'Buyers’' : 'Buyer’s'} total savings known?"
@header = "Do you know how much the #{joint_purchase ? 'buyers' : 'buyer'} had in savings before they paid any deposit for the property?"
@copy_key = "sales.income_benefits_and_savings.savings.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}.savingsnk"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@conditional_for = {

6
config/locales/en.yml

@ -859,9 +859,6 @@ Make sure these answers are correct."
soctenant:
one: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?"
other: "Were any of the buyers private registered providers, housing association or local authority tenants immediately before this sale?"
prevown:
one: "Has the buyer previously owned a property?"
other: "Have any of the buyers previously owned a property?"
stairowned:
one: "What percentage of the property does the buyer now own in total?"
other: "What percentage of the property do the buyers now own in total?"
@ -884,9 +881,6 @@ Make sure these answers are correct."
soctenant:
one: "Buyer was a registered provider, housing association or local authority tenant immediately before this sale?"
other: "Any buyers were registered providers, housing association or local authority tenants immediately before this sale?"
prevown:
one: "Buyer previously owned a property."
other: "Buyers previously owned a property."
stairowned:
one: "Percentage the buyer now owns in total."
other: "Percentage the buyers now own in total."

84
config/locales/forms/2023/sales/income_benefits_and_savings.en.yml

@ -0,0 +1,84 @@
en:
forms:
2023:
sales:
income_benefits_and_savings:
buyer_1_income:
page_header: ""
income1nk:
check_answer_label: "Buyer 1’s gross annual income known?"
hint_text: ""
question_text: "Do you know buyer 1’s annual income?"
income1:
check_answer_label: "Buyer 1’s gross annual income"
hint_text: "Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments."
question_text: "Buyer 1’s gross annual income"
inc1mort:
page_header: ""
check_answer_label: "Buyer 1’s income used for mortgage application"
hint_text: ""
question_text: "Was buyer 1’s income used for a mortgage application?"
buyer_2_income:
page_header: ""
income2nk:
check_answer_label: "Buyer 2’s gross annual income known?"
hint_text: ""
question_text: "Do you know buyer 2’s annual income?"
income2:
check_answer_label: "Buyer 2’s gross annual income"
hint_text: "Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments."
question_text: "Buyer 2’s gross annual income"
inc2mort:
page_header: ""
check_answer_label: "Buyer 2’s income used for mortgage application"
hint_text: ""
question_text: "Was buyer 2’s income used for a mortgage application?"
housing_benefits:
joint_purchase:
page_header: ""
check_answer_label: "Housing-related benefits buyers received before buying this property"
hint_text: ""
question_text: "Were the buyers receiving any of these housing-related benefits immediately before buying this property?"
not_joint_purchase:
page_header: ""
check_answer_label: "Housing-related benefits buyer received before buying this property"
hint_text: ""
question_text: "Was the buyer receiving any of these housing-related benefits immediately before buying this property?"
savings:
joint_purchase:
page_header: ""
savingsnk:
check_answer_label: "Buyers’ total savings known?"
hint_text: ""
question_text: "Do you know how much the 'buyers' had in savings before they paid any deposit for the property?"
savings:
check_answer_label: "Buyers’ total savings before any deposit paid"
hint_text: "Include any savings, investments, ISAs, premium bonds, shares, or money held in a bank or building society account."
question_text: "Enter their total savings to the nearest £10"
not_joint_purchase:
page_header: ""
savingsnk:
check_answer_label: "Buyer’s total savings known?"
hint_text: ""
question_text: "Do you know how much the buyer had in savings before they paid any deposit for the property?"
savings:
check_answer_label: "Buyer’s total savings before any deposit paid"
hint_text: "Include any savings, investments, ISAs, premium bonds, shares, or money held in a bank or building society account."
question_text: "Enter their total savings to the nearest £10"
prevown:
joint_purchase:
page_header: ""
check_answer_label: "Buyers previously owned a property."
hint_text: ""
question_text: "Have any of the buyers previously owned a property?"
not_joint_purchase:
page_header: ""
check_answer_label: "Buyer previously owned a property."
hint_text: ""
question_text: "Has the buyer previously owned a property?"

84
config/locales/forms/2024/sales/income_benefits_and_savings.en.yml

@ -0,0 +1,84 @@
en:
forms:
2024:
sales:
income_benefits_and_savings:
buyer_1_income:
page_header: ""
income1nk:
check_answer_label: "Buyer 1’s gross annual income known?"
hint_text: ""
question_text: "Do you know buyer 1’s annual income?"
income1:
check_answer_label: "Buyer 1’s gross annual income"
hint_text: "Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments."
question_text: "Buyer 1’s gross annual income"
inc1mort:
page_header: ""
check_answer_label: "Buyer 1’s income used for mortgage application"
hint_text: ""
question_text: "Was buyer 1’s income used for a mortgage application?"
buyer_2_income:
page_header: ""
income2nk:
check_answer_label: "Buyer 2’s gross annual income known?"
hint_text: ""
question_text: "Do you know buyer 2’s annual income?"
income2:
check_answer_label: "Buyer 2’s gross annual income"
hint_text: "Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments."
question_text: "Buyer 2’s gross annual income"
inc2mort:
page_header: ""
check_answer_label: "Buyer 2’s income used for mortgage application"
hint_text: ""
question_text: "Was buyer 2’s income used for a mortgage application?"
housing_benefits:
joint_purchase:
page_header: ""
check_answer_label: "Housing-related benefits buyers received before buying this property"
hint_text: ""
question_text: "Were the buyers receiving any of these housing-related benefits immediately before buying this property?"
not_joint_purchase:
page_header: ""
check_answer_label: "Housing-related benefits buyer received before buying this property"
hint_text: ""
question_text: "Was the buyer receiving any of these housing-related benefits immediately before buying this property?"
savings:
joint_purchase:
page_header: ""
savingsnk:
check_answer_label: "Buyers’ total savings known?"
hint_text: ""
question_text: "Do you know how much the 'buyers' had in savings before they paid any deposit for the property?"
savings:
check_answer_label: "Buyers’ total savings before any deposit paid"
hint_text: "Include any savings, investments, ISAs, premium bonds, shares, or money held in a bank or building society account."
question_text: "Enter their total savings to the nearest £10"
not_joint_purchase:
page_header: ""
savingsnk:
check_answer_label: "Buyer’s total savings known?"
hint_text: ""
question_text: "Do you know how much the buyer had in savings before they paid any deposit for the property?"
savings:
check_answer_label: "Buyer’s total savings before any deposit paid"
hint_text: "Include any savings, investments, ISAs, premium bonds, shares, or money held in a bank or building society account."
question_text: "Enter their total savings to the nearest £10"
prevown:
joint_purchase:
page_header: ""
check_answer_label: "Buyers previously owned a property."
hint_text: ""
question_text: "Have any of the buyers previously owned a property?"
not_joint_purchase:
page_header: ""
check_answer_label: "Buyer previously owned a property."
hint_text: ""
question_text: "Has the buyer previously owned a property?"
Loading…
Cancel
Save