Browse Source

Update validation message: net income

pull/1584/head
Kat 3 years ago
parent
commit
433dda7680
  1. 20
      app/models/form/lettings/pages/net_income_value_check.rb
  2. 4
      app/models/validations/soft_validations.rb
  3. 25
      config/forms/2022_2023.json
  4. 4
      config/locales/en.yml

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

@ -3,14 +3,13 @@ class Form::Lettings::Pages::NetIncomeValueCheck < ::Form::Page
super
@id = "net_income_value_check"
@depends_on = [{ "net_income_soft_validation_triggered?" => true }]
@title_text = { "translation" => "soft_validations.net_income.title_text" }
@informative_text = {
"translation" => "soft_validations.net_income.hint_text",
@title_text = {
"translation" => "soft_validations.net_income.title_text",
"arguments" => [
{
"key" => "ecstat1",
"key" => "incfreq",
"label" => true,
"i18n_template" => "ecstat1",
"i18n_template" => "incfreq",
},
{
"key" => "field_formatted_as_currency",
@ -19,6 +18,17 @@ class Form::Lettings::Pages::NetIncomeValueCheck < ::Form::Page
},
],
}
@informative_text = {
"translation" => "soft_validations.net_income.hint_text",
"arguments" => [
{
"key" => "net_income_higher_or_lower_text",
"label" => false,
"i18n_template" => "net_income_higher_or_lower_text",
},
],
}
end
def questions

4
app/models/validations/soft_validations.rb

@ -93,6 +93,10 @@ module Validations::SoftValidations
voiddate.present? && startdate.present? && voiddate.between?(startdate.to_date - TEN_YEARS_IN_DAYS, startdate.to_date - TWO_YEARS_IN_DAYS)
end
def net_income_higher_or_lower_text
net_income_in_soft_max_range? ? "higher" : "lower"
end
private
def details_known_or_lead_tenant?(tenant_number)

25
config/forms/2022_2023.json

@ -7299,23 +7299,30 @@
}
],
"title_text": {
"translation": "soft_validations.net_income.title_text"
},
"informative_text": {
"translation": "soft_validations.net_income.hint_text",
"arguments": [
"translation": "soft_validations.net_income.title_text",
"arguments" :[
{
"key": "ecstat1",
"key": "incfreq",
"label": true,
"i18n_template": "ecstat1"
"i18n_template": "incfreq"
},
{
"key": "earnings",
"label": true,
"key": "field_formatted_as_currency",
"arguments_for_key": "earnings",
"i18n_template": "earnings"
}
]
},
"informative_text": {
"translation": "soft_validations.net_income.hint_text",
"arguments": [
{
"key": "net_income_higher_or_lower_text",
"label": false,
"i18n_template": "net_income_higher_or_lower_text"
}
]
},
"questions": {
"net_income_value_check": {
"check_answer_label": "Net income confirmation",

4
config/locales/en.yml

@ -518,8 +518,8 @@ en:
soft_validations:
net_income:
title_text: "Net income is outside the expected range based on the lead tenant’s working situation"
hint_text: "<p>You told us the lead tenant’s working situation is: <strong>%{ecstat1}</strong>.</p><p>The household income you have entered is <strong>%{earnings}</strong>.</p>"
title_text: "You told us the lead tenant’s income is %{earnings} %{incfreq}."
hint_text: "This is %{net_income_higher_or_lower_text} than we would expect for their working situation."
in_soft_min_range:
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:

Loading…
Cancel
Save