Browse Source

feat: wip add dynamic text for soft min only

CLDC-1790-sales-validation-content-updates
natdeanlewissoftwire 2 years ago
parent
commit
f089bccf74
  1. 15
      app/models/form/sales/pages/buyer1_income_value_check.rb
  2. 2
      app/models/form/sales/questions/buyer1_income_value_check.rb
  3. 4
      app/models/sales_log.rb
  4. 2
      app/models/validations/sales/soft_validations.rb
  5. 1
      config/locales/en.yml

15
app/models/form/sales/pages/buyer1_income_value_check.rb

@ -6,6 +6,21 @@ class Form::Sales::Pages::Buyer1IncomeValueCheck < ::Form::Page
"income1_under_soft_min?" => true,
},
]
@title_text = {
"translation" => "soft_validations.net_income.below_soft_min",
"arguments" => [
{
"key" => "income1",
"label" => true,
"i18n_template" => "income1",
},
{
"key" => "allowed_income_soft_min",
"label" => false,
"i18n_template" => "soft_min",
},
],
}
@informative_text = {}
end

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

@ -3,7 +3,7 @@ class Form::Sales::Questions::Buyer1IncomeValueCheck < ::Form::Question
super
@id = "income1_value_check"
@check_answer_label = "Income confirmation"
@header = "Are you sure this income is correct?"
@header = "Are you sure this is correct?"
@type = "interruption_screen"
@answer_options = {
"0" => { "value" => "Yes" },

4
app/models/sales_log.rb

@ -211,4 +211,8 @@ class SalesLog < Log
def old_persons_shared_ownership?
type == 24
end
def allowed_income_soft_min
ALLOWED_INCOME_RANGES[ecstat1].soft_min
end
end

2
app/models/validations/sales/soft_validations.rb

@ -10,7 +10,7 @@ module Validations::Sales::SoftValidations
def income1_under_soft_min?
return false unless ecstat1 && income1 && ALLOWED_INCOME_RANGES[ecstat1]
income1 < ALLOWED_INCOME_RANGES[ecstat1][:soft_min]
income1 < ALLOWED_INCOME_RANGES[ecstat1] [:soft_min]
end
def mortgage_over_soft_max?

1
config/locales/en.yml

@ -434,6 +434,7 @@ en:
message: "Net income is lower than expected based on the lead tenant’s working situation. Are you sure this is correct?"
in_soft_max_range:
message: "Net income is higher than expected based on the lead tenant’s working situation. Are you sure this is correct?"
below_soft_min: "You said income was %{income1}, which is below this working situation's minimum (%{soft_min})"
rent:
min:
title_text: "You told us the rent is %{brent}"

Loading…
Cancel
Save