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. 23
      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 super
@id = "net_income_value_check" @id = "net_income_value_check"
@depends_on = [{ "net_income_soft_validation_triggered?" => true }] @depends_on = [{ "net_income_soft_validation_triggered?" => true }]
@title_text = { "translation" => "soft_validations.net_income.title_text" } @title_text = {
@informative_text = { "translation" => "soft_validations.net_income.title_text",
"translation" => "soft_validations.net_income.hint_text",
"arguments" => [ "arguments" => [
{ {
"key" => "ecstat1", "key" => "incfreq",
"label" => true, "label" => true,
"i18n_template" => "ecstat1", "i18n_template" => "incfreq",
}, },
{ {
"key" => "field_formatted_as_currency", "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 end
def questions 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) voiddate.present? && startdate.present? && voiddate.between?(startdate.to_date - TEN_YEARS_IN_DAYS, startdate.to_date - TWO_YEARS_IN_DAYS)
end end
def net_income_higher_or_lower_text
net_income_in_soft_max_range? ? "higher" : "lower"
end
private private
def details_known_or_lead_tenant?(tenant_number) def details_known_or_lead_tenant?(tenant_number)

23
config/forms/2022_2023.json

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

4
config/locales/en.yml

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

Loading…
Cancel
Save