Browse Source

Extract income and benefits soft validations

pull/2735/head
Kat 2 years ago
parent
commit
63289a92b8
  1. 8
      app/models/form/lettings/pages/care_home_charges_value_check.rb
  2. 5
      app/models/form/lettings/pages/net_income_value_check.rb
  3. 8
      app/models/form/lettings/pages/pscharge_value_check.rb
  4. 5
      app/models/form/lettings/pages/rent_value_check.rb
  5. 8
      app/models/form/lettings/pages/scharge_value_check.rb
  6. 8
      app/models/form/lettings/pages/supcharg_value_check.rb
  7. 3
      app/models/form/lettings/questions/care_home_charges_value_check.rb
  8. 3
      app/models/form/lettings/questions/net_income_value_check.rb
  9. 4
      app/models/form/lettings/questions/pscharge_value_check.rb
  10. 4
      app/models/form/lettings/questions/rent_value_check.rb
  11. 4
      app/models/form/lettings/questions/scharge_value_check.rb
  12. 4
      app/models/form/lettings/questions/supcharg_value_check.rb
  13. 8
      app/models/form/lettings/subsections/income_and_benefits.rb
  14. 19
      config/locales/en.yml
  15. 48
      config/locales/forms/2023/lettings/soft_validations.en.yml

8
app/models/form/lettings/pages/care_home_charges_value_check.rb

@ -2,11 +2,15 @@ class Form::Lettings::Pages::CareHomeChargesValueCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "care_home_charges_value_check"
@copy_key = "lettings.soft_validations.carehome_charges_value_check"
@depends_on = [{ "care_home_charge_expected_not_provided?" => true }]
@title_text = {
"translation" => "soft_validations.care_home_charges.title_text",
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
}
@informative_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
}
@informative_text = ""
end
def questions

5
app/models/form/lettings/pages/net_income_value_check.rb

@ -2,9 +2,10 @@ class Form::Lettings::Pages::NetIncomeValueCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "net_income_value_check"
@copy_key = "lettings.soft_validations.net_income_value_check"
@depends_on = [{ "net_income_soft_validation_triggered?" => true }]
@title_text = {
"translation" => "soft_validations.net_income.title_text",
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [
{
"key" => "incfreq",
@ -20,7 +21,7 @@ class Form::Lettings::Pages::NetIncomeValueCheck < ::Form::Page
}
@informative_text = {
"translation" => "soft_validations.net_income.hint_text",
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [
{
"key" => "net_income_higher_or_lower_text",

8
app/models/form/lettings/pages/pscharge_value_check.rb

@ -2,16 +2,20 @@ class Form::Lettings::Pages::PschargeValueCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "pscharge_value_check"
@copy_key = "lettings.soft_validations.pscharge_value_check"
@depends_on = [{ "pscharge_in_soft_max_range?" => true }]
@title_text = {
"translation" => "soft_validations.pscharge.over_soft_max_title",
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{
"key" => "pscharge",
"label" => true,
"i18n_template" => "pscharge",
}],
}
@informative_text = I18n.t("soft_validations.charges.informative_text")
@informative_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
}
end
def questions

5
app/models/form/lettings/pages/rent_value_check.rb

@ -2,8 +2,9 @@ class Form::Lettings::Pages::RentValueCheck < ::Form::Page
def initialize(id, hsh, subsection, check_answers_card_number: nil)
super(id, hsh, subsection)
@depends_on = [{ "rent_soft_validation_triggered?" => true }]
@copy_key = "lettings.soft_validations.rent_value_check"
@title_text = {
"translation" => "soft_validations.rent.outside_range_title",
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [
{
"key" => "brent",
@ -13,7 +14,7 @@ class Form::Lettings::Pages::RentValueCheck < ::Form::Page
],
}
@informative_text = {
"translation" => "soft_validations.rent.informative_text",
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [
{
"key" => "rent_soft_validation_higher_or_lower_text",

8
app/models/form/lettings/pages/scharge_value_check.rb

@ -2,16 +2,20 @@ class Form::Lettings::Pages::SchargeValueCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "scharge_value_check"
@copy_key = "lettings.soft_validations.scharge_value_check"
@depends_on = [{ "scharge_in_soft_max_range?" => true }]
@title_text = {
"translation" => "soft_validations.scharge.over_soft_max_title",
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{
"key" => "scharge",
"label" => true,
"i18n_template" => "scharge",
}],
}
@informative_text = I18n.t("soft_validations.charges.informative_text")
@title_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
}
end
def questions

8
app/models/form/lettings/pages/supcharg_value_check.rb

@ -2,16 +2,20 @@ class Form::Lettings::Pages::SupchargValueCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "supcharg_value_check"
@copy_key = "lettings.soft_validations.supcharg_value_check"
@depends_on = [{ "supcharg_in_soft_max_range?" => true }]
@title_text = {
"translation" => "soft_validations.supcharg.over_soft_max_title",
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{
"key" => "supcharg",
"label" => true,
"i18n_template" => "supcharg",
}],
}
@informative_text = I18n.t("soft_validations.charges.informative_text")
@informative_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
}
end
def questions

3
app/models/form/lettings/questions/care_home_charges_value_check.rb

@ -2,8 +2,7 @@ class Form::Lettings::Questions::CareHomeChargesValueCheck < ::Form::Question
def initialize(id, hsh, page)
super
@id = "carehome_charges_value_check"
@check_answer_label = "Care home charges confirmation"
@header = "Are you sure there are no care home charges?"
@copy_key = "lettings.soft_validations.carehome_charges_value_check"
@type = "interruption_screen"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS

3
app/models/form/lettings/questions/net_income_value_check.rb

@ -2,8 +2,7 @@ class Form::Lettings::Questions::NetIncomeValueCheck < ::Form::Question
def initialize(id, hsh, page)
super
@id = "net_income_value_check"
@check_answer_label = "Net income confirmation"
@header = "Are you sure this is correct?"
@copy_key = "lettings.soft_validations.net_income_value_check"
@type = "interruption_screen"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS

4
app/models/form/lettings/questions/pscharge_value_check.rb

@ -2,13 +2,11 @@ class Form::Lettings::Questions::PschargeValueCheck < ::Form::Question
def initialize(id, hsh, page)
super
@id = "pscharge_value_check"
@check_answer_label = "Personal service charge confirmation"
@header = "Are you sure?"
@copy_key = "lettings.soft_validations.pscharge_value_check"
@type = "interruption_screen"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
@hidden_in_check_answers = { "depends_on" => [{ "pscharge_value_check" => 0 }, { "pscharge_value_check" => 1 }] }
@hint_text = I18n.t("soft_validations.charges.hint_text")
end
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze

4
app/models/form/lettings/questions/rent_value_check.rb

@ -2,10 +2,8 @@ class Form::Lettings::Questions::RentValueCheck < ::Form::Question
def initialize(id, hsh, page, check_answers_card_number:)
super(id, hsh, page)
@id = "rent_value_check"
@check_answer_label = "Total rent confirmation"
@header = "Are you sure this is correct?"
@copy_key = "lettings.soft_validations.rent_value_check"
@type = "interruption_screen"
@hint_text = I18n.t("soft_validations.rent.hint_text")
@check_answers_card_number = check_answers_card_number
@answer_options = ANSWER_OPTIONS
@hidden_in_check_answers = { "depends_on" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] }

4
app/models/form/lettings/questions/scharge_value_check.rb

@ -2,13 +2,11 @@ class Form::Lettings::Questions::SchargeValueCheck < ::Form::Question
def initialize(id, hsh, page)
super
@id = "scharge_value_check"
@check_answer_label = "Service charge confirmation"
@header = "Are you sure?"
@copy_key = "lettings.soft_validations.scharge_value_check"
@type = "interruption_screen"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
@hidden_in_check_answers = { "depends_on" => [{ "scharge_value_check" => 0 }, { "scharge_value_check" => 1 }] }
@hint_text = I18n.t("soft_validations.charges.hint_text")
end
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze

4
app/models/form/lettings/questions/supcharg_value_check.rb

@ -2,13 +2,11 @@ class Form::Lettings::Questions::SupchargValueCheck < ::Form::Question
def initialize(id, hsh, page)
super
@id = "supcharg_value_check"
@check_answer_label = "Support charge confirmation"
@header = "Are you sure?"
@copy_key = "lettings.soft_validations.supcharg_value_check"
@type = "interruption_screen"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
@hidden_in_check_answers = { "depends_on" => [{ "supcharg_value_check" => 0 }, { "supcharg_value_check" => 1 }] }
@hint_text = I18n.t("soft_validations.charges.hint_text")
end
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze

8
app/models/form/lettings/subsections/income_and_benefits.rb

@ -10,7 +10,7 @@ class Form::Lettings::Subsections::IncomeAndBenefits < ::Form::Subsection
@pages ||= [
Form::Lettings::Pages::IncomeKnown.new(nil, nil, self),
Form::Lettings::Pages::IncomeAmount.new(nil, nil, self),
Form::Lettings::Pages::NetIncomeValueCheck.new(nil, nil, self),
Form::Lettings::Pages::NetIncomeValueCheck.new(nil, nil, self),n
Form::Lettings::Pages::HousingBenefit.new("housing_benefit", nil, self),
Form::Lettings::Pages::BenefitsProportion.new("benefits_proportion", nil, self),
Form::Lettings::Pages::RentOrOtherCharges.new(nil, nil, self),
@ -25,9 +25,9 @@ class Form::Lettings::Subsections::IncomeAndBenefits < ::Form::Subsection
Form::Lettings::Pages::Rent4Weekly.new(nil, nil, self),
Form::Lettings::Pages::RentMonthly.new(nil, nil, self),
Form::Lettings::Pages::RentValueCheck.new("brent_rent_value_check", nil, self, check_answers_card_number: 0),
Form::Lettings::Pages::SchargeValueCheck.new(nil, nil, self),
Form::Lettings::Pages::PschargeValueCheck.new(nil, nil, self),
Form::Lettings::Pages::SupchargValueCheck.new(nil, nil, self),
Form::Lettings::Pages::SchargeValueCheck.new(nil, nil, self), # soft validation
Form::Lettings::Pages::PschargeValueCheck.new(nil, nil, self), # soft validation
Form::Lettings::Pages::SupchargValueCheck.new(nil, nil, self), # soft validation
Form::Lettings::Pages::Outstanding.new(nil, nil, self),
Form::Lettings::Pages::OutstandingAmount.new(nil, nil, self),
].compact

19
config/locales/en.yml

@ -639,17 +639,6 @@ en:
organisation_not_selected: "Select an organisation from the search list."
soft_validations:
net_income:
title_text: "You told us that the household’s income is %{earnings} %{incfreq}."
hint_text: "This is %{net_income_higher_or_lower_text} than we would expect for the household’s working situation."
in_soft_min_range:
message: "Net income is lower than expected based on the household’s working situation. Are you sure this is correct?"
in_soft_max_range:
message: "Net income is higher than expected based on the household’s working situation. Are you sure this is correct?"
rent:
outside_range_title: "You told us the rent is %{brent}."
informative_text: "This is %{higher_or_lower} than we would expect."
hint_text: "Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>"
purchase_price:
title_text: "You told us the purchase price is %{value}."
hint_text: "This is %{higher_or_lower} than we would expect."
@ -679,20 +668,12 @@ Make sure these answers are correct."
discounted_sale_value:
title_text: "Mortgage, deposit, and grant total must equal %{value_with_discount}."
informative_text: "Your given mortgage, deposit and grant total is %{mortgage_deposit_and_grant_total}."
care_home_charges:
title_text: "Care home charges should be provided if this is a care home accommodation."
percentage_discount_value:
title_text: "You told us that the percentage discount is %{discount}."
hint_text: "This is higher than we would expect."
grant:
title_text: "You told us that the grant amount is %{grant}."
hint_text: "Loans, grants and subsidies are usually between £9,000 and £16,000."
scharge:
over_soft_max_title: "You told us the service charge is %{scharge}."
pscharge:
over_soft_max_title: "You told us the personal service charge is %{pscharge}."
supcharg:
over_soft_max_title: "You told us the support charge is %{supcharg}."
charges:
informative_text: "This is higher than we would expect."
hint_text: "Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the needs type</li></ul>"

48
config/locales/forms/2023/lettings/soft_validations.en.yml

@ -65,5 +65,53 @@ en:
question_text: "Are you sure?"
title_text: "Are you sure?"
informative_text: "This is a general needs log, and this referral type is for supported housing."
net_income_value_check:
page_header: ""
check_answer_label: "Net income confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text: "You told us that the household’s income is %{earnings} %{incfreq}."
informative_text: "This is %{net_income_higher_or_lower_text} than we would expect for the household’s working situation."
care_home_charges_value_check:
page_header: ""
check_answer_label: "Care home charges confirmation"
hint_text: ""
question_text: "Are you sure there are no care home charges?"
title_text: "Care home charges should be provided if this is a care home accommodation."
informative_text: "Are you sure there are no care home charges?"
rent_value_check:
page_header: ""
check_answer_label: "Total rent confirmation"
hint_text: "Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>"
question_text: "Are you sure this is correct?"
title_text: "You told us the rent is %{brent}."
informative_text: "This is %{higher_or_lower} than we would expect."
scharge_value_check:
page_header: ""
check_answer_label: "Service charge confirmation"
hint_text: "Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the needs type</li></ul>"
question_text: "Are you sure?"
title_text: "You told us the service charge is %{scharge}."
informative_text: "This is higher than we would expect."
pscharge_value_check:
page_header: ""
check_answer_label: "Personal service charge confirmation"
hint_text: "Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the needs type</li></ul>"
question_text: "Are you sure?"
title_text: "You told us the personal service charge is %{pscharge}."
informative_text: "This is higher than we would expect."
supcharg_value_check:
page_header: ""
check_answer_label: "Support charge confirmation"
hint_text: "Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the needs type</li></ul>"
question_text: "Are you sure?"
title_text: "You told us the support charge is %{supcharg}."
informative_text: "This is higher than we would expect."
Loading…
Cancel
Save