From f9922c1ba4cd20509b5362a527c182b6197013a1 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:25:20 +0000 Subject: [PATCH] CLDC-3654: Copy changes - Sales property information questions (#2694) --- app/helpers/formatting_helper.rb | 3 +- .../form/lettings/pages/property_postcode.rb | 14 --- .../form/lettings/questions/postcode_full.rb | 15 --- .../form/lettings/questions/postcode_known.rb | 17 ---- .../subsections/property_information.rb | 6 +- .../sales/pages/about_price_value_check.rb | 5 +- app/models/form/sales/pages/address.rb | 2 +- .../form/sales/pages/address_fallback.rb | 2 +- .../form/sales/pages/address_matcher.rb | 2 +- .../pages/monthly_charges_value_check.rb | 5 +- .../form/sales/pages/no_address_found.rb | 5 +- .../pages/percentage_discount_value_check.rb | 7 +- app/models/form/sales/pages/postcode.rb | 13 --- .../sales/pages/property_local_authority.rb | 9 +- app/models/form/sales/pages/uprn.rb | 1 + .../form/sales/pages/uprn_confirmation.rb | 1 - app/models/form/sales/pages/uprn_selection.rb | 1 - .../questions/about_price_value_check.rb | 3 +- .../form/sales/questions/address_line1.rb | 3 +- .../address_line1_for_address_matcher.rb | 3 +- .../form/sales/questions/address_line2.rb | 2 +- app/models/form/sales/questions/county.rb | 3 +- .../questions/monthly_charges_value_check.rb | 3 +- .../form/sales/questions/no_address_found.rb | 2 +- .../percentage_discount_value_check.rb | 3 +- app/models/form/sales/questions/postcode.rb | 22 ----- .../questions/postcode_for_address_matcher.rb | 2 +- .../questions/postcode_for_full_address.rb | 3 +- .../form/sales/questions/postcode_known.rb | 29 ------ .../sales/questions/property_building_type.rb | 3 +- .../questions/property_local_authority.rb | 2 - .../property_local_authority_known.rb | 26 ------ .../questions/property_number_of_bedrooms.rb | 4 +- .../sales/questions/property_unit_type.rb | 3 +- .../property_wheelchair_accessible.rb | 4 +- .../form/sales/questions/town_or_city.rb | 3 +- app/models/form/sales/questions/uprn.rb | 3 +- .../form/sales/questions/uprn_confirmation.rb | 2 - app/models/form/sales/questions/uprn_known.rb | 6 +- .../form/sales/questions/uprn_selection.rb | 2 - .../sales/subsections/property_information.rb | 12 --- config/locales/en.yml | 14 +-- .../2023/sales/property_information.en.yml | 74 +++++++++++++++ .../forms/2023/sales/soft_validations.en.yml | 33 ++++++- .../2024/sales/property_information.en.yml | 91 +++++++++++++++++++ .../forms/2024/sales/soft_validations.en.yml | 41 ++++++++- .../pages/about_price_value_check_spec.rb | 7 +- .../pages/monthly_charges_value_check_spec.rb | 7 +- .../form/sales/pages/no_address_found_spec.rb | 7 +- .../percentage_discount_value_check_spec.rb | 7 +- spec/models/form/sales/pages/postcode_spec.rb | 29 ------ .../pages/property_local_authority_spec.rb | 13 --- .../sales/questions/postcode_known_spec.rb | 47 ---------- .../form/sales/questions/postcode_spec.rb | 46 ---------- .../sales/questions/uprn_confirmation_spec.rb | 6 +- .../form/sales/questions/uprn_known_spec.rb | 4 +- .../subsections/property_information_spec.rb | 24 ----- 57 files changed, 298 insertions(+), 408 deletions(-) delete mode 100644 app/models/form/lettings/pages/property_postcode.rb delete mode 100644 app/models/form/lettings/questions/postcode_full.rb delete mode 100644 app/models/form/lettings/questions/postcode_known.rb delete mode 100644 app/models/form/sales/pages/postcode.rb delete mode 100644 app/models/form/sales/questions/postcode.rb delete mode 100644 app/models/form/sales/questions/postcode_known.rb delete mode 100644 app/models/form/sales/questions/property_local_authority_known.rb create mode 100644 config/locales/forms/2023/sales/property_information.en.yml create mode 100644 config/locales/forms/2024/sales/property_information.en.yml delete mode 100644 spec/models/form/sales/pages/postcode_spec.rb delete mode 100644 spec/models/form/sales/questions/postcode_known_spec.rb delete mode 100644 spec/models/form/sales/questions/postcode_spec.rb diff --git a/app/helpers/formatting_helper.rb b/app/helpers/formatting_helper.rb index 0675d42ba..ffa8b05e9 100644 --- a/app/helpers/formatting_helper.rb +++ b/app/helpers/formatting_helper.rb @@ -2,7 +2,8 @@ module FormattingHelper def format_ending(text) return text if text.blank? - modified_text = lowercase_first_letter(text) + first_word = text.split.first + modified_text = first_word == first_word.upcase ? text : lowercase_first_letter(text) ensure_sentence_ending(modified_text) end diff --git a/app/models/form/lettings/pages/property_postcode.rb b/app/models/form/lettings/pages/property_postcode.rb deleted file mode 100644 index a40d4140f..000000000 --- a/app/models/form/lettings/pages/property_postcode.rb +++ /dev/null @@ -1,14 +0,0 @@ -class Form::Lettings::Pages::PropertyPostcode < ::Form::Page - def initialize(id, hsh, subsection) - super - @id = "property_postcode" - @depends_on = [{ "is_general_needs?" => true }] - end - - def questions - @questions ||= [ - Form::Lettings::Questions::PostcodeKnown.new(nil, nil, self), - Form::Lettings::Questions::PostcodeFull.new(nil, nil, self), - ] - end -end diff --git a/app/models/form/lettings/questions/postcode_full.rb b/app/models/form/lettings/questions/postcode_full.rb deleted file mode 100644 index fc7d7691b..000000000 --- a/app/models/form/lettings/questions/postcode_full.rb +++ /dev/null @@ -1,15 +0,0 @@ -class Form::Lettings::Questions::PostcodeFull < ::Form::Question - def initialize(id, hsh, page) - super - @id = "postcode_full" - @check_answer_label = "Postcode" - @header = "What is the property’s postcode?" - @type = "text" - @width = 5 - @inferred_check_answers_value = [{ "condition" => { "postcode_known" => 0 }, "value" => "Not known" }] - @check_answers_card_number = 0 - @hint_text = "" - @inferred_answers = { "la" => { "is_la_inferred" => true } } - @disable_clearing_if_not_routed_or_dynamic_answer_options = true - end -end diff --git a/app/models/form/lettings/questions/postcode_known.rb b/app/models/form/lettings/questions/postcode_known.rb deleted file mode 100644 index ea9adb06b..000000000 --- a/app/models/form/lettings/questions/postcode_known.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Form::Lettings::Questions::PostcodeKnown < ::Form::Question - def initialize(id, hsh, page) - super - @id = "postcode_known" - @check_answer_label = "Do you know the property postcode?" - @header = "Do you know the property’s postcode?" - @type = "radio" - @check_answers_card_number = 0 - @hint_text = "" - @answer_options = ANSWER_OPTIONS - @disable_clearing_if_not_routed_or_dynamic_answer_options = true - @conditional_for = { "postcode_full" => [1] } - @hidden_in_check_answers = { "depends_on" => [{ "postcode_known" => 0 }, { "postcode_known" => 1 }] } - end - - ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze -end diff --git a/app/models/form/lettings/subsections/property_information.rb b/app/models/form/lettings/subsections/property_information.rb index 3068faf92..7b9aead2d 100644 --- a/app/models/form/lettings/subsections/property_information.rb +++ b/app/models/form/lettings/subsections/property_information.rb @@ -38,16 +38,12 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection Form::Lettings::Pages::UprnSelection.new(nil, nil, self), Form::Lettings::Pages::AddressFallback.new(nil, nil, self), ] - elsif form.start_date.year == 2023 + else [ Form::Lettings::Pages::Uprn.new(nil, nil, self), Form::Lettings::Pages::UprnConfirmation.new(nil, nil, self), Form::Lettings::Pages::Address.new(nil, nil, self), ] - else - [ - Form::Lettings::Pages::PropertyPostcode.new(nil, nil, self), - ] end end diff --git a/app/models/form/sales/pages/about_price_value_check.rb b/app/models/form/sales/pages/about_price_value_check.rb index 8b5cb45ab..41ae283dc 100644 --- a/app/models/form/sales/pages/about_price_value_check.rb +++ b/app/models/form/sales/pages/about_price_value_check.rb @@ -6,8 +6,9 @@ class Form::Sales::Pages::AboutPriceValueCheck < ::Form::Page "purchase_price_out_of_soft_range?" => true, }, ] + @copy_key = "sales.soft_validations.value_value_check" @title_text = { - "translation" => "soft_validations.purchase_price.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "value", @@ -17,7 +18,7 @@ class Form::Sales::Pages::AboutPriceValueCheck < ::Form::Page ], } @informative_text = { - "translation" => "soft_validations.purchase_price.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [ { "key" => "field_formatted_as_currency", diff --git a/app/models/form/sales/pages/address.rb b/app/models/form/sales/pages/address.rb index 6bd74f8b7..be0ed9eae 100644 --- a/app/models/form/sales/pages/address.rb +++ b/app/models/form/sales/pages/address.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::Address < ::Form::Page def initialize(id, hsh, subsection) super @id = "address" - @header = "Q#{QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]} - What is the property's address?" + @copy_key = "sales.property_information.address" @depends_on = [ { "uprn_known" => nil }, { "uprn_known" => 0 }, diff --git a/app/models/form/sales/pages/address_fallback.rb b/app/models/form/sales/pages/address_fallback.rb index 3a69dabba..1f0a3f1e8 100644 --- a/app/models/form/sales/pages/address_fallback.rb +++ b/app/models/form/sales/pages/address_fallback.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::AddressFallback < ::Form::Page def initialize(id, hsh, subsection) super @id = "address" - @header = "Q12 - What is the property's address?" + @copy_key = "sales.property_information.address" @depends_on = [ { "uprn_known" => nil, "uprn_selection" => "uprn_not_listed" }, { "uprn_known" => 0, "uprn_selection" => "uprn_not_listed" }, diff --git a/app/models/form/sales/pages/address_matcher.rb b/app/models/form/sales/pages/address_matcher.rb index 5d2a38767..23b8c5c86 100644 --- a/app/models/form/sales/pages/address_matcher.rb +++ b/app/models/form/sales/pages/address_matcher.rb @@ -2,7 +2,7 @@ class Form::Sales::Pages::AddressMatcher < ::Form::Page def initialize(id, hsh, subsection) super @id = "address_matcher" - @header = "Find an address" + @copy_key = "sales.property_information.address_matcher" @depends_on = [ { "uprn_known" => nil }, { "uprn_known" => 0 }, diff --git a/app/models/form/sales/pages/monthly_charges_value_check.rb b/app/models/form/sales/pages/monthly_charges_value_check.rb index 662a048bb..f6aef088c 100644 --- a/app/models/form/sales/pages/monthly_charges_value_check.rb +++ b/app/models/form/sales/pages/monthly_charges_value_check.rb @@ -6,8 +6,9 @@ class Form::Sales::Pages::MonthlyChargesValueCheck < ::Form::Page "monthly_charges_over_soft_max?" => true, }, ] + @copy_key = "sales.soft_validations.monthly_charges_value_check" @title_text = { - "translation" => "soft_validations.monthly_charges_over_soft_max.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [ { "key" => "field_formatted_as_currency", @@ -17,7 +18,7 @@ class Form::Sales::Pages::MonthlyChargesValueCheck < ::Form::Page ], } @informative_text = { - "translation" => "soft_validations.monthly_charges_over_soft_max.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } end diff --git a/app/models/form/sales/pages/no_address_found.rb b/app/models/form/sales/pages/no_address_found.rb index 6e3b04f40..ae2663896 100644 --- a/app/models/form/sales/pages/no_address_found.rb +++ b/app/models/form/sales/pages/no_address_found.rb @@ -3,12 +3,13 @@ class Form::Sales::Pages::NoAddressFound < ::Form::Page super @id = "no_address_found" @type = "interruption_screen" + @copy_key = "sales.soft_validations.address_search_value_check" @title_text = { - "translation" => "soft_validations.no_address_found.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [], } @informative_text = { - "translation" => "soft_validations.no_address_found.informative_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } @depends_on = [ diff --git a/app/models/form/sales/pages/percentage_discount_value_check.rb b/app/models/form/sales/pages/percentage_discount_value_check.rb index 37ff4eea4..aa8c20d75 100644 --- a/app/models/form/sales/pages/percentage_discount_value_check.rb +++ b/app/models/form/sales/pages/percentage_discount_value_check.rb @@ -1,15 +1,16 @@ class Form::Sales::Pages::PercentageDiscountValueCheck < ::Form::Page def initialize(id, hsh, subsection) super + @depends_on = [{ "percentage_discount_invalid?" => true }] + @copy_key = "sales.soft_validations.percentage_discount_value_check" @title_text = { - "translation" => "soft_validations.percentage_discount_value.title_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", "arguments" => [{ "key" => "discount", "label" => true, "i18n_template" => "discount" }], } @informative_text = { - "translation" => "soft_validations.percentage_discount_value.hint_text", + "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [], } - @depends_on = [{ "percentage_discount_invalid?" => true }] end def questions diff --git a/app/models/form/sales/pages/postcode.rb b/app/models/form/sales/pages/postcode.rb deleted file mode 100644 index c40a18845..000000000 --- a/app/models/form/sales/pages/postcode.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Form::Sales::Pages::Postcode < ::Form::Page - def initialize(id, hsh, subsection) - super - @id = "property_postcode" - end - - def questions - @questions ||= [ - Form::Sales::Questions::PostcodeKnown.new(nil, nil, self), - Form::Sales::Questions::Postcode.new(nil, nil, self), - ] - end -end diff --git a/app/models/form/sales/pages/property_local_authority.rb b/app/models/form/sales/pages/property_local_authority.rb index e0289839d..649a445f9 100644 --- a/app/models/form/sales/pages/property_local_authority.rb +++ b/app/models/form/sales/pages/property_local_authority.rb @@ -10,14 +10,7 @@ class Form::Sales::Pages::PropertyLocalAuthority < ::Form::Page def questions @questions ||= [ - la_known_question, Form::Sales::Questions::PropertyLocalAuthority.new(nil, nil, self), - ].compact - end - - def la_known_question - if form.start_date.year < 2023 - Form::Sales::Questions::PropertyLocalAuthorityKnown.new(nil, nil, self) - end + ] end end diff --git a/app/models/form/sales/pages/uprn.rb b/app/models/form/sales/pages/uprn.rb index d4c7e4d77..fce51e543 100644 --- a/app/models/form/sales/pages/uprn.rb +++ b/app/models/form/sales/pages/uprn.rb @@ -2,6 +2,7 @@ class Form::Sales::Pages::Uprn < ::Form::Page def initialize(id, hsh, subsection) super @id = "uprn" + @copy_key = "sales.property_information.uprn" end def questions diff --git a/app/models/form/sales/pages/uprn_confirmation.rb b/app/models/form/sales/pages/uprn_confirmation.rb index d553972a3..9cc2ccf94 100644 --- a/app/models/form/sales/pages/uprn_confirmation.rb +++ b/app/models/form/sales/pages/uprn_confirmation.rb @@ -2,7 +2,6 @@ class Form::Sales::Pages::UprnConfirmation < ::Form::Page def initialize(id, hsh, subsection) super @id = "uprn_confirmation" - @header = "We found an address that might be this property" end def questions diff --git a/app/models/form/sales/pages/uprn_selection.rb b/app/models/form/sales/pages/uprn_selection.rb index 94f35540f..6dc5bb2bc 100644 --- a/app/models/form/sales/pages/uprn_selection.rb +++ b/app/models/form/sales/pages/uprn_selection.rb @@ -2,7 +2,6 @@ class Form::Sales::Pages::UprnSelection < ::Form::Page def initialize(id, hsh, subsection) super @id = "uprn_selection" - @header = "We found some addresses that might be this property" @depends_on = [ { "uprn_known" => nil, "address_options_present?" => true }, { "uprn_known" => 0, "address_options_present?" => true }, diff --git a/app/models/form/sales/questions/about_price_value_check.rb b/app/models/form/sales/questions/about_price_value_check.rb index 2b51cd7fb..52f7b156f 100644 --- a/app/models/form/sales/questions/about_price_value_check.rb +++ b/app/models/form/sales/questions/about_price_value_check.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::AboutPriceValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "value_value_check" - @check_answer_label = "Purchase price confirmation" - @header = "Are you sure?" + @copy_key = "sales.soft_validations.value_value_check" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, diff --git a/app/models/form/sales/questions/address_line1.rb b/app/models/form/sales/questions/address_line1.rb index f72aaea96..f7a4c7c2d 100644 --- a/app/models/form/sales/questions/address_line1.rb +++ b/app/models/form/sales/questions/address_line1.rb @@ -2,11 +2,10 @@ class Form::Sales::Questions::AddressLine1 < ::Form::Question def initialize(id, hsh, page) super @id = "address_line1" - @header = "Address line 1" + @copy_key = "sales.property_information.address.address_line1" @error_label = "Address line 1" @type = "text" @plain_label = true - @check_answer_label = "Address lines 1 and 2" @disable_clearing_if_not_routed_or_dynamic_answer_options = true @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @hide_question_number_on_page = true diff --git a/app/models/form/sales/questions/address_line1_for_address_matcher.rb b/app/models/form/sales/questions/address_line1_for_address_matcher.rb index fd1211b69..cfc086f7b 100644 --- a/app/models/form/sales/questions/address_line1_for_address_matcher.rb +++ b/app/models/form/sales/questions/address_line1_for_address_matcher.rb @@ -2,11 +2,10 @@ class Form::Sales::Questions::AddressLine1ForAddressMatcher < ::Form::Question def initialize(id, hsh, page) super @id = "address_line1_input" - @header = "Address line 1" + @copy_key = "sales.property_information.address_matcher.address_line1_input" @error_label = "Address line 1" @type = "text" @plain_label = true - @check_answer_label = "Find address" @disable_clearing_if_not_routed_or_dynamic_answer_options = true @hide_question_number_on_page = true end diff --git a/app/models/form/sales/questions/address_line2.rb b/app/models/form/sales/questions/address_line2.rb index 94396a2af..521d1dc58 100644 --- a/app/models/form/sales/questions/address_line2.rb +++ b/app/models/form/sales/questions/address_line2.rb @@ -2,7 +2,7 @@ class Form::Sales::Questions::AddressLine2 < ::Form::Question def initialize(id, hsh, page) super @id = "address_line2" - @header = "Address line 2 (optional)" + @copy_key = "sales.property_information.address.address_line2" @type = "text" @plain_label = true @disable_clearing_if_not_routed_or_dynamic_answer_options = true diff --git a/app/models/form/sales/questions/county.rb b/app/models/form/sales/questions/county.rb index d95d90e73..8f92a5480 100644 --- a/app/models/form/sales/questions/county.rb +++ b/app/models/form/sales/questions/county.rb @@ -2,10 +2,9 @@ class Form::Sales::Questions::County < ::Form::Question def initialize(id, hsh, page) super @id = "county" - @header = "County (optional)" + @copy_key = "sales.property_information.address.county" @type = "text" @plain_label = true - @check_answer_label = "County" @disable_clearing_if_not_routed_or_dynamic_answer_options = true @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @hide_question_number_on_page = true diff --git a/app/models/form/sales/questions/monthly_charges_value_check.rb b/app/models/form/sales/questions/monthly_charges_value_check.rb index 90fcf4545..615238cda 100644 --- a/app/models/form/sales/questions/monthly_charges_value_check.rb +++ b/app/models/form/sales/questions/monthly_charges_value_check.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::MonthlyChargesValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "monthly_charges_value_check" - @check_answer_label = "Monthly charges confirmation" - @header = "Are you sure this is correct?" + @copy_key = "sales.soft_validations.monthly_charges_value_check" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, diff --git a/app/models/form/sales/questions/no_address_found.rb b/app/models/form/sales/questions/no_address_found.rb index 0db041111..06d92b594 100644 --- a/app/models/form/sales/questions/no_address_found.rb +++ b/app/models/form/sales/questions/no_address_found.rb @@ -2,7 +2,7 @@ class Form::Sales::Questions::NoAddressFound < ::Form::Question def initialize(id, hsh, page) super @id = "address_search_value_check" - @header = "No address found" + @copy_key = "sales.soft_validations.address_search_value_check" @type = "interruption_screen" @hidden_in_check_answers = true end diff --git a/app/models/form/sales/questions/percentage_discount_value_check.rb b/app/models/form/sales/questions/percentage_discount_value_check.rb index 9ac5547b4..5a1e7a045 100644 --- a/app/models/form/sales/questions/percentage_discount_value_check.rb +++ b/app/models/form/sales/questions/percentage_discount_value_check.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::PercentageDiscountValueCheck < ::Form::Question def initialize(id, hsh, page) super @id = "percentage_discount_value_check" - @check_answer_label = "Percentage discount confirmation" - @header = "Are you sure this is correct?" + @copy_key = "sales.soft_validations.percentage_discount_value_check" @type = "interruption_screen" @answer_options = { "0" => { "value" => "Yes" }, diff --git a/app/models/form/sales/questions/postcode.rb b/app/models/form/sales/questions/postcode.rb deleted file mode 100644 index 55e33199a..000000000 --- a/app/models/form/sales/questions/postcode.rb +++ /dev/null @@ -1,22 +0,0 @@ -class Form::Sales::Questions::Postcode < ::Form::Question - def initialize(id, hsh, page) - super - @id = "postcode_full" - @check_answer_label = "Property’s postcode" - @header = "Postcode" - @type = "text" - @width = 5 - @inferred_check_answers_value = [{ - "condition" => { - "pcodenk" => 1, - }, - "value" => "Not known", - }] - @inferred_answers = { - "la" => { - "is_la_inferred" => true, - }, - } - @disable_clearing_if_not_routed_or_dynamic_answer_options = true - end -end diff --git a/app/models/form/sales/questions/postcode_for_address_matcher.rb b/app/models/form/sales/questions/postcode_for_address_matcher.rb index 421cdc4fc..945bdc2ad 100644 --- a/app/models/form/sales/questions/postcode_for_address_matcher.rb +++ b/app/models/form/sales/questions/postcode_for_address_matcher.rb @@ -2,7 +2,7 @@ class Form::Sales::Questions::PostcodeForAddressMatcher < ::Form::Question def initialize(id, hsh, page) super @id = "postcode_full_input" - @header = "Postcode" + @copy_key = "sales.property_information.address_matcher.postcode_full_input" @type = "text" @width = 5 @plain_label = true diff --git a/app/models/form/sales/questions/postcode_for_full_address.rb b/app/models/form/sales/questions/postcode_for_full_address.rb index 74c235ab7..34fbea00b 100644 --- a/app/models/form/sales/questions/postcode_for_full_address.rb +++ b/app/models/form/sales/questions/postcode_for_full_address.rb @@ -2,7 +2,7 @@ class Form::Sales::Questions::PostcodeForFullAddress < ::Form::Question def initialize(id, hsh, page) super @id = "postcode_full" - @header = "Postcode" + @copy_key = "sales.property_information.address.postcode_full" @type = "text" @width = 5 @inferred_check_answers_value = [{ @@ -17,7 +17,6 @@ class Form::Sales::Questions::PostcodeForFullAddress < ::Form::Question }, } @plain_label = true - @check_answer_label = "Postcode" @disable_clearing_if_not_routed_or_dynamic_answer_options = true @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @hide_question_number_on_page = true diff --git a/app/models/form/sales/questions/postcode_known.rb b/app/models/form/sales/questions/postcode_known.rb deleted file mode 100644 index 10a3e2765..000000000 --- a/app/models/form/sales/questions/postcode_known.rb +++ /dev/null @@ -1,29 +0,0 @@ -class Form::Sales::Questions::PostcodeKnown < ::Form::Question - def initialize(id, hsh, page) - super - @id = "pcodenk" - @check_answer_label = "Property’s postcode" - @header = "Do you know the property’s postcode?" - @type = "radio" - @answer_options = ANSWER_OPTIONS - @conditional_for = { - "postcode_full" => [0], - } - @hidden_in_check_answers = { - "depends_on" => [ - { - "pcodenk" => 0, - }, - { - "pcodenk" => 1, - }, - ], - } - @disable_clearing_if_not_routed_or_dynamic_answer_options = true - end - - ANSWER_OPTIONS = { - "0" => { "value" => "Yes" }, - "1" => { "value" => "No" }, - }.freeze -end diff --git a/app/models/form/sales/questions/property_building_type.rb b/app/models/form/sales/questions/property_building_type.rb index f8f7e3905..42b65a57a 100644 --- a/app/models/form/sales/questions/property_building_type.rb +++ b/app/models/form/sales/questions/property_building_type.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::PropertyBuildingType < ::Form::Question def initialize(id, hsh, page) super @id = "builtype" - @check_answer_label = "Type of building" - @header = "What type of building is the property?" + @copy_key = "sales.property_information.builtype" @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] diff --git a/app/models/form/sales/questions/property_local_authority.rb b/app/models/form/sales/questions/property_local_authority.rb index 2a8d3cc69..053ee8fde 100644 --- a/app/models/form/sales/questions/property_local_authority.rb +++ b/app/models/form/sales/questions/property_local_authority.rb @@ -2,8 +2,6 @@ class Form::Sales::Questions::PropertyLocalAuthority < ::Form::Question def initialize(id, hsh, page) super @id = "la" - @check_answer_label = "Local authority" - @header = "What is the property’s local authority?" @type = "select" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @disable_clearing_if_not_routed_or_dynamic_answer_options = true diff --git a/app/models/form/sales/questions/property_local_authority_known.rb b/app/models/form/sales/questions/property_local_authority_known.rb deleted file mode 100644 index b18486c6a..000000000 --- a/app/models/form/sales/questions/property_local_authority_known.rb +++ /dev/null @@ -1,26 +0,0 @@ -class Form::Sales::Questions::PropertyLocalAuthorityKnown < ::Form::Question - def initialize(id, hsh, page) - super - @id = "la_known" - @check_answer_label = "Local authority known" - @header = "Do you know the property’s local authority?" - @type = "radio" - @answer_options = ANSWER_OPTIONS - @conditional_for = { "la" => [1] } - @hidden_in_check_answers = { - "depends_on" => [ - { - "la_known" => 1, - }, - ], - } - @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] - end - - ANSWER_OPTIONS = { - "1" => { "value" => "Yes" }, - "0" => { "value" => "No" }, - }.freeze - - QUESTION_NUMBER_FROM_YEAR = { 2023 => 16, 2024 => 17 }.freeze -end diff --git a/app/models/form/sales/questions/property_number_of_bedrooms.rb b/app/models/form/sales/questions/property_number_of_bedrooms.rb index b8462b6fa..c394fe334 100644 --- a/app/models/form/sales/questions/property_number_of_bedrooms.rb +++ b/app/models/form/sales/questions/property_number_of_bedrooms.rb @@ -2,9 +2,7 @@ class Form::Sales::Questions::PropertyNumberOfBedrooms < ::Form::Question def initialize(id, hsh, page) super @id = "beds" - @check_answer_label = "Number of bedrooms" - @header = "How many bedrooms does the property have?" - @hint_text = "A bedsit has 1 bedroom" + @copy_key = "sales.property_information.beds" @type = "numeric" @width = 2 @min = 1 diff --git a/app/models/form/sales/questions/property_unit_type.rb b/app/models/form/sales/questions/property_unit_type.rb index 1622473ec..45e935941 100644 --- a/app/models/form/sales/questions/property_unit_type.rb +++ b/app/models/form/sales/questions/property_unit_type.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::PropertyUnitType < ::Form::Question def initialize(id, hsh, page) super @id = "proptype" - @check_answer_label = "Type of unit" - @header = "What type of unit is the property?" + @copy_key = "sales.property_information.proptype" @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] diff --git a/app/models/form/sales/questions/property_wheelchair_accessible.rb b/app/models/form/sales/questions/property_wheelchair_accessible.rb index 1569725c5..fd79bda9e 100644 --- a/app/models/form/sales/questions/property_wheelchair_accessible.rb +++ b/app/models/form/sales/questions/property_wheelchair_accessible.rb @@ -2,12 +2,10 @@ class Form::Sales::Questions::PropertyWheelchairAccessible < ::Form::Question def initialize(id, hsh, page) super @id = "wchair" - @check_answer_label = "Property built or adapted to wheelchair-user standards" - @header = "Is the property built or adapted to wheelchair-user standards?" + @copy_key = "sales.property_information.wchair" @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] - @hint_text = form.start_year_after_2024? ? "This is whether someone who uses a wheelchair is able to make full use of all of the property’s rooms and facilities, including use of both inside and outside space, and entering and exiting the property." : nil end ANSWER_OPTIONS = { diff --git a/app/models/form/sales/questions/town_or_city.rb b/app/models/form/sales/questions/town_or_city.rb index 18f6298f3..9536c024f 100644 --- a/app/models/form/sales/questions/town_or_city.rb +++ b/app/models/form/sales/questions/town_or_city.rb @@ -2,10 +2,9 @@ class Form::Sales::Questions::TownOrCity < ::Form::Question def initialize(id, hsh, page) super @id = "town_or_city" - @header = "Town or city" + @copy_key = "sales.property_information.address.town_or_city" @type = "text" @plain_label = true - @check_answer_label = "Town or city" @disable_clearing_if_not_routed_or_dynamic_answer_options = true @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @hide_question_number_on_page = true diff --git a/app/models/form/sales/questions/uprn.rb b/app/models/form/sales/questions/uprn.rb index 94aaccb43..ea0df85ab 100644 --- a/app/models/form/sales/questions/uprn.rb +++ b/app/models/form/sales/questions/uprn.rb @@ -2,8 +2,7 @@ class Form::Sales::Questions::Uprn < ::Form::Question def initialize(id, hsh, page) super @id = "uprn" - @check_answer_label = "UPRN" - @header = "What is the property's UPRN?" + @copy_key = "sales.property_information.uprn.uprn" @type = "text" @width = 10 @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] diff --git a/app/models/form/sales/questions/uprn_confirmation.rb b/app/models/form/sales/questions/uprn_confirmation.rb index 6954a6ea5..94c1afa36 100644 --- a/app/models/form/sales/questions/uprn_confirmation.rb +++ b/app/models/form/sales/questions/uprn_confirmation.rb @@ -2,9 +2,7 @@ class Form::Sales::Questions::UprnConfirmation < ::Form::Question def initialize(id, hsh, page) super @id = "uprn_confirmed" - @header = "Is this the property address?" @type = "radio" - @check_answer_label = "Is this the right address?" end def answer_options diff --git a/app/models/form/sales/questions/uprn_known.rb b/app/models/form/sales/questions/uprn_known.rb index fdd0c9e9a..e35642bee 100644 --- a/app/models/form/sales/questions/uprn_known.rb +++ b/app/models/form/sales/questions/uprn_known.rb @@ -2,13 +2,9 @@ class Form::Sales::Questions::UprnKnown < ::Form::Question def initialize(id, hsh, page) super @id = "uprn_known" - @check_answer_label = "UPRN known?" - @header = "Do you know the property's UPRN?" + @copy_key = "sales.property_information.uprn.uprn_known" @type = "radio" @answer_options = ANSWER_OPTIONS - @hint_text = "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.

- The UPRN may not be the same as the property reference assigned by your organisation.

- If you don’t know the UPRN you can enter the address of the property instead on the next screen." @conditional_for = { "uprn" => [1] } @inferred_check_answers_value = [ { diff --git a/app/models/form/sales/questions/uprn_selection.rb b/app/models/form/sales/questions/uprn_selection.rb index f916dcd47..282aed353 100644 --- a/app/models/form/sales/questions/uprn_selection.rb +++ b/app/models/form/sales/questions/uprn_selection.rb @@ -2,9 +2,7 @@ class Form::Sales::Questions::UprnSelection < ::Form::Question def initialize(id, hsh, page) super @id = "uprn_selection" - @header = "Select the correct address" @type = "radio" - @check_answer_label = "Select the correct address" @disable_clearing_if_not_routed_or_dynamic_answer_options = true end diff --git a/app/models/form/sales/subsections/property_information.rb b/app/models/form/sales/subsections/property_information.rb index 2c530ab60..c59c159ae 100644 --- a/app/models/form/sales/subsections/property_information.rb +++ b/app/models/form/sales/subsections/property_information.rb @@ -16,7 +16,6 @@ class Form::Sales::Subsections::PropertyInformation < ::Form::Subsection Form::Sales::Pages::PercentageDiscountValueCheck.new("percentage_discount_proptype_value_check", nil, self), Form::Sales::Pages::PropertyBuildingType.new(nil, nil, self), (uprn_questions if form.start_date.year == 2023), - (postcode_and_la_questions if form.start_date.year < 2023), Form::Sales::Pages::PropertyWheelchairAccessible.new(nil, nil, self), ].flatten.compact end @@ -49,15 +48,4 @@ class Form::Sales::Subsections::PropertyInformation < ::Form::Subsection ] end end - - def postcode_and_la_questions - [ - Form::Sales::Pages::Postcode.new(nil, nil, self), - Form::Sales::Pages::PropertyLocalAuthority.new(nil, nil, self), - Form::Sales::Pages::Buyer1IncomeMaxValueCheck.new("local_authority_buyer_1_income_max_value_check", nil, self, check_answers_card_number: nil), - Form::Sales::Pages::Buyer2IncomeMaxValueCheck.new("local_authority_buyer_2_income_max_value_check", nil, self, check_answers_card_number: nil), - Form::Sales::Pages::CombinedIncomeMaxValueCheck.new("local_authority_combined_income_max_value_check", nil, self, check_answers_card_number: nil), - Form::Sales::Pages::AboutPriceValueCheck.new("about_price_la_value_check", nil, self), - ] - end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 7ed8f42e8..a0d31fee5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -234,7 +234,7 @@ en: scheme_deleted: "%{service_name} has been deleted." user_deleted: "%{name} has been deleted." organisation_deleted: "%{name} has been deleted." - user_updated: + user_updated: self: "Your account details have been updated." other: "%{name}’s details have been updated." @@ -650,9 +650,6 @@ en: 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:" - purchase_price: - title_text: "You told us the purchase price is %{value}." - hint_text: "This is %{higher_or_lower} than we would expect." staircase_owned: title_text: one: "You told us that the buyer now owns %{stairowned} of the property." @@ -684,17 +681,11 @@ Make sure these answers are correct." staircase_bought_seems_high: title_text: "You told us that %{percentage}% was bought in this staircasing transaction." hint_text: "Most staircasing transactions are less than 50%" - monthly_charges_over_soft_max: - title_text: "You told us that the monthly charges were %{mscharge}." - hint_text: "This is higher than we would expect." 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." @@ -722,9 +713,6 @@ Make sure these answers are correct." must_be_less_than_3_years_from_saledate: "You told us practical completion or handover date is more than 3 years before sale completion date." saledate: must_be_less_than_3_years_from_hodate: "You told us sale completion date is more than 3 years after practical completion or handover date." - no_address_found: - title_text: "No address found." - informative_text: "We could not find an address that matches your search. You can search again or continue to enter the address manually." partner_under_16_lettings: title: "You told us this person is aged %{age} years and has 'Partner' relationship to the lead tenant." multiple_partners_lettings: diff --git a/config/locales/forms/2023/sales/property_information.en.yml b/config/locales/forms/2023/sales/property_information.en.yml new file mode 100644 index 000000000..c4dd84130 --- /dev/null +++ b/config/locales/forms/2023/sales/property_information.en.yml @@ -0,0 +1,74 @@ +en: + forms: + 2023: + sales: + property_information: + uprn: + page_header: "" + uprn_known: + check_answer_label: "UPRN known?" + hint_text: "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.

The UPRN may not be the same as the property reference assigned by your organisation.

If you don’t know the UPRN you can enter the address of the property instead on the next screen." + question_text: "Do you know the property's UPRN?" + uprn: + check_answer_label: "UPRN" + hint_text: "" + question_text: "What is the property's UPRN?" + + uprn_confirmed: + page_header: "We found an address that might be this property" + check_answer_label: "Is this the right address?" + hint_text: "" + question_text: "Is this the property address?" + + address: + page_header: "Q15 - What is the property's address?" + address_line1: + check_answer_label: "Address lines 1 and 2" + hint_text: "" + question_text: "Address line 1" + address_line2: + check_answer_label: "" + hint_text: "" + question_text: "Address line 2 (optional)" + town_or_city: + check_answer_label: "Town or city" + hint_text: "" + question_text: "Town or city" + county: + check_answer_label: "County" + hint_text: "" + question_text: "County (optional)" + postcode_full: + check_answer_label: "Postcode" + hint_text: "" + question_text: "Postcode" + + la: + page_header: "" + check_answer_label: "Local authority" + hint_text: "" + question_text: "What is the property’s local authority?" + + beds: + page_header: "" + check_answer_label: "Number of bedrooms" + hint_text: "A bedsit has 1 bedroom." + question_text: "How many bedrooms does the property have?" + + proptype: + page_header: "" + check_answer_label: "Type of unit" + hint_text: "" + question_text: "What type of unit is the property?" + + builtype: + page_header: "" + check_answer_label: "Type of building" + hint_text: "" + question_text: "What type of building is the property?" + + wchair: + page_header: "" + check_answer_label: "Property built or adapted to wheelchair-user standards" + hint_text: "" + question_text: "Is the property built or adapted to wheelchair-user standards?" diff --git a/config/locales/forms/2023/sales/soft_validations.en.yml b/config/locales/forms/2023/sales/soft_validations.en.yml index 3467b9432..11a7406e4 100644 --- a/config/locales/forms/2023/sales/soft_validations.en.yml +++ b/config/locales/forms/2023/sales/soft_validations.en.yml @@ -38,6 +38,7 @@ en: max: page_header: "" title_text: "You told us the income of buyer 1 is %{income}. This seems high. Are you sure this is correct?" + income2_value_check: check_answer_label: "Buyer 2 income confirmation" hint_text: "" @@ -49,12 +50,22 @@ en: max: page_header: "" title_text: "You told us the income of buyer 2 is %{income}. This seems high. Are you sure this is correct?" + combined_income_value_check: page_header: "" check_answer_label: "Combined income confirmation" hint_text: "" question_text: "Are you sure this is correct?" title_text: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?" + + value_value_check: + page_header: "" + check_answer_label: "Purchase price confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us the purchase price is %{value}." + informative_text: "This is %{higher_or_lower} than we would expect." + mortgage_value_check: page_header: "" check_answer_label: "Mortgage confirmation" @@ -62,18 +73,36 @@ en: question_text: "Are you sure that the mortgage is more than 5 times the income used for the mortgage application?" title_text: "You told us that the mortgage amount is %{mortgage}." informative_text: "This is more than 5 times the income, which is higher than we would expect." + + monthly_charges_value_check: + page_header: "" + check_answer_label: "Monthly charges confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the monthly charges were %{mscharge}." + informative_text: "This is higher than we would expect." + + percentage_discount_value_check: + page_header: "" + check_answer_label: "Percentage discount confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the percentage discount is %{discount}." + informative_text: "This is higher than we would expect." + savings_value_check: page_header: "" check_answer_label: "Savings confirmation" hint_text: "" question_text: "Are you sure the savings are higher than £100,000?" joint_purchase: - title_text: You told us the buyers’ savings were %{savings}." + title_text: "You told us the buyers’ savings were %{savings}." informative_text: "This is higher than we would expect." not_joint_purchase: title_text: "You told us the buyer’s savings were %{savings}." informative_text: "This is higher than we would expect." - deposit_value_check:: + + deposit_value_check: page_header: "" check_answer_label: "Deposit confirmation" hint_text: "" diff --git a/config/locales/forms/2024/sales/property_information.en.yml b/config/locales/forms/2024/sales/property_information.en.yml new file mode 100644 index 000000000..269f4fdca --- /dev/null +++ b/config/locales/forms/2024/sales/property_information.en.yml @@ -0,0 +1,91 @@ +en: + forms: + 2024: + sales: + property_information: + uprn: + page_header: "" + uprn_known: + check_answer_label: "UPRN known?" + hint_text: "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.

The UPRN may not be the same as the property reference assigned by your organisation.

If you don’t know the UPRN you can enter the address of the property instead on the next screen." + question_text: "Do you know the property's UPRN?" + uprn: + check_answer_label: "UPRN" + hint_text: "" + question_text: "What is the property's UPRN?" + + uprn_confirmed: + page_header: "We found an address that might be this property" + check_answer_label: "Is this the right address?" + hint_text: "" + question_text: "Is this the property address?" + + address_matcher: + page_header: "Find an address" + address_line1_input: + check_answer_label: "Find address" + hint_text: "" + question_text: "Address line 1" + postcode_full_input: + check_answer_label: "" + hint_text: "" + question_text: "Postcode" + + uprn_selection: + page_header: "We found an address that might be this property" + check_answer_label: "Select the correct address" + hint_text: "" + question_text: "Select the correct address" + + address: + page_header: "Q12 - What is the property's address?" + address_line1: + check_answer_label: "Address lines 1 and 2" + hint_text: "" + question_text: "Address line 1" + address_line2: + check_answer_label: "" + hint_text: "" + question_text: "Address line 2 (optional)" + town_or_city: + check_answer_label: "Town or city" + hint_text: "" + question_text: "Town or city" + county: + check_answer_label: "County" + hint_text: "" + question_text: "County (optional)" + postcode_full: + check_answer_label: "Postcode" + hint_text: "" + question_text: "Postcode" + + la: + page_header: "" + check_answer_label: "Local authority" + hint_text: "" + question_text: "What is the property’s local authority?" + + beds: + page_header: "" + check_answer_label: "Number of bedrooms" + hint_text: "A bedsit has 1 bedroom." + question_text: "How many bedrooms does the property have?" + + proptype: + page_header: "" + check_answer_label: "Type of unit" + hint_text: "" + question_text: "What type of unit is the property?" + + builtype: + page_header: "" + check_answer_label: "Type of building" + hint_text: "" + question_text: "What type of building is the property?" + + wchair: + page_header: "" + check_answer_label: "Property built or adapted to wheelchair-user standards" + hint_text: "This is whether someone who uses a wheelchair is able to make full use of all of the property’s rooms and facilities, including use of both inside and outside space, and entering and exiting the property." + question_text: "Is the property built or adapted to wheelchair-user standards?" diff --git a/config/locales/forms/2024/sales/soft_validations.en.yml b/config/locales/forms/2024/sales/soft_validations.en.yml index 39af6cb38..872db4679 100644 --- a/config/locales/forms/2024/sales/soft_validations.en.yml +++ b/config/locales/forms/2024/sales/soft_validations.en.yml @@ -38,6 +38,7 @@ en: max: page_header: "" title_text: "You told us the income of buyer 1 is %{income}. This seems high. Are you sure this is correct?" + income2_value_check: check_answer_label: "Buyer 2 income confirmation" hint_text: "" @@ -49,12 +50,23 @@ en: max: page_header: "" title_text: "You told us the income of buyer 2 is %{income}. This seems high. Are you sure this is correct?" + combined_income_value_check: page_header: "" check_answer_label: "Combined income confirmation" hint_text: "" question_text: "Are you sure this is correct?" title_text: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?" + informative_text: "" + + value_value_check: + page_header: "" + check_answer_label: "Purchase price confirmation" + hint_text: "" + question_text: "Are you sure?" + title_text: "You told us the purchase price is %{value}." + informative_text: "This is %{higher_or_lower} than we would expect." + mortgage_value_check: page_header: "" check_answer_label: "Mortgage confirmation" @@ -62,17 +74,35 @@ en: question_text: "Are you sure that the mortgage is more than 5 times the income used for the mortgage application?" title_text: "You told us that the mortgage amount is %{mortgage}." informative_text: "This is more than 5 times the income, which is higher than we would expect." + + monthly_charges_value_check: + page_header: "" + check_answer_label: "Monthly charges confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the monthly charges were %{mscharge}." + informative_text: "This is higher than we would expect." + + percentage_discount_value_check: + page_header: "" + check_answer_label: "Percentage discount confirmation" + hint_text: "" + question_text: "Are you sure this is correct?" + title_text: "You told us that the percentage discount is %{discount}." + informative_text: "This is higher than we would expect." + savings_value_check: page_header: "" check_answer_label: "Savings confirmation" hint_text: "" question_text: "Are you sure the savings are higher than £100,000?" joint_purchase: - title_text: You told us the buyers’ savings were %{savings}." + title_text: "You told us the buyers’ savings were %{savings}." informative_text: "This is higher than we would expect." not_joint_purchase: title_text: "You told us the buyer’s savings were %{savings}." informative_text: "This is higher than we would expect." + deposit_value_check: page_header: "" check_answer_label: "Deposit confirmation" @@ -84,6 +114,15 @@ en: not_joint_purchase: title_text: "You told us the buyer’s deposit was %{deposit} and their savings were %{savings}." informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." + + address_search_value_check: + page_header: "" + check_answer_label: "" + hint_text: "" + question_text: "" + title_text: "No address found." + informative_text: "We could not find an address that matches your search. You can search again or continue to enter the address manually." + wheel_value_check: page_header: "" check_answer_label: "Does anyone in the household use a wheelchair?" diff --git a/spec/models/form/sales/pages/about_price_value_check_spec.rb b/spec/models/form/sales/pages/about_price_value_check_spec.rb index 7d3c31537..1193768db 100644 --- a/spec/models/form/sales/pages/about_price_value_check_spec.rb +++ b/spec/models/form/sales/pages/about_price_value_check_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::AboutPriceValueCheck, type: :model do let(:page_id) { "savings_value_check" } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:subsection) { instance_double(Form::Subsection, form:) } it "has correct subsection" do expect(page.subsection).to eq(subsection) @@ -28,12 +29,12 @@ RSpec.describe Form::Sales::Pages::AboutPriceValueCheck, type: :model do end it "has the correct title_text" do - expect(page.title_text).to eq({ "arguments" => [{ "i18n_template" => "value", "key" => "value", "label" => true }], "translation" => "soft_validations.purchase_price.title_text" }) + expect(page.title_text).to eq({ "arguments" => [{ "i18n_template" => "value", "key" => "value", "label" => true }], "translation" => "forms.2024.sales.soft_validations.value_value_check.title_text" }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.purchase_price.hint_text", + "translation" => "forms.2024.sales.soft_validations.value_value_check.informative_text", "arguments" => [ { "key" => "field_formatted_as_currency", diff --git a/spec/models/form/sales/pages/monthly_charges_value_check_spec.rb b/spec/models/form/sales/pages/monthly_charges_value_check_spec.rb index cb187ecfd..ce72bbda8 100644 --- a/spec/models/form/sales/pages/monthly_charges_value_check_spec.rb +++ b/spec/models/form/sales/pages/monthly_charges_value_check_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::MonthlyChargesValueCheck, type: :model do let(:page_id) { "monthly_charges_value_check" } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:subsection) { instance_double(Form::Subsection, form:) } it "has correct subsection" do expect(page.subsection).to eq(subsection) @@ -33,13 +34,13 @@ RSpec.describe Form::Sales::Pages::MonthlyChargesValueCheck, type: :model do it "has correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.monthly_charges_over_soft_max.title_text", + "translation" => "forms.2024.sales.soft_validations.monthly_charges_value_check.title_text", "arguments" => [{ "arguments_for_key" => "mscharge", "i18n_template" => "mscharge", "key" => "field_formatted_as_currency" }], }) end it "has correct informative_text" do - expect(page.informative_text).to eq({ "arguments" => [], "translation" => "soft_validations.monthly_charges_over_soft_max.hint_text" }) + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.sales.soft_validations.monthly_charges_value_check.informative_text" }) end it "has correct interruption_screen_question_ids" do diff --git a/spec/models/form/sales/pages/no_address_found_spec.rb b/spec/models/form/sales/pages/no_address_found_spec.rb index 1a40abba4..b6dbd677e 100644 --- a/spec/models/form/sales/pages/no_address_found_spec.rb +++ b/spec/models/form/sales/pages/no_address_found_spec.rb @@ -5,8 +5,9 @@ RSpec.describe Form::Sales::Pages::NoAddressFound, type: :model do let(:page_id) { nil } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection) } let(:log) { create(:sales_log) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:subsection) { instance_double(Form::Subsection, form:) } it "has correct subsection" do expect(page.subsection).to eq(subsection) @@ -31,11 +32,11 @@ RSpec.describe Form::Sales::Pages::NoAddressFound, type: :model do end it "has the correct title_text" do - expect(page.title_text).to eq({ "arguments" => [], "translation" => "soft_validations.no_address_found.title_text" }) + expect(page.title_text).to eq({ "arguments" => [], "translation" => "forms.2024.sales.soft_validations.address_search_value_check.title_text" }) end it "has the correct informative_text" do - expect(page.informative_text).to eq({ "arguments" => [], "translation" => "soft_validations.no_address_found.informative_text" }) + expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.sales.soft_validations.address_search_value_check.informative_text" }) end it "has the correct interruption_screen_question_ids" do diff --git a/spec/models/form/sales/pages/percentage_discount_value_check_spec.rb b/spec/models/form/sales/pages/percentage_discount_value_check_spec.rb index 5fc3e05ad..0b8cf0152 100644 --- a/spec/models/form/sales/pages/percentage_discount_value_check_spec.rb +++ b/spec/models/form/sales/pages/percentage_discount_value_check_spec.rb @@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::PercentageDiscountValueCheck, type: :model do let(:page_id) { "percentage_discount_value_check" } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + let(:subsection) { instance_double(Form::Subsection, form:) } it "has correct subsection" do expect(page.subsection).to eq(subsection) @@ -21,14 +22,14 @@ RSpec.describe Form::Sales::Pages::PercentageDiscountValueCheck, type: :model do it "has the correct title_text" do expect(page.title_text).to eq({ - "translation" => "soft_validations.percentage_discount_value.title_text", + "translation" => "forms.2024.sales.soft_validations.percentage_discount_value_check.title_text", "arguments" => [{ "key" => "discount", "label" => true, "i18n_template" => "discount" }], }) end it "has the correct informative_text" do expect(page.informative_text).to eq({ - "translation" => "soft_validations.percentage_discount_value.hint_text", + "translation" => "forms.2024.sales.soft_validations.percentage_discount_value_check.informative_text", "arguments" => [], }) end diff --git a/spec/models/form/sales/pages/postcode_spec.rb b/spec/models/form/sales/pages/postcode_spec.rb deleted file mode 100644 index 8f9c7273c..000000000 --- a/spec/models/form/sales/pages/postcode_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Sales::Pages::Postcode, type: :model do - subject(:page) { described_class.new(page_id, page_definition, subsection) } - - let(:page_id) { nil } - let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection) } - - it "has correct subsection" do - expect(page.subsection).to eq(subsection) - end - - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[pcodenk postcode_full]) - end - - it "has the correct id" do - expect(page.id).to eq("property_postcode") - end - - it "has the correct description" do - expect(page.description).to be_nil - end - - it "has correct depends_on" do - expect(page.depends_on).to be_nil - end -end diff --git a/spec/models/form/sales/pages/property_local_authority_spec.rb b/spec/models/form/sales/pages/property_local_authority_spec.rb index 016d0534d..faba75665 100644 --- a/spec/models/form/sales/pages/property_local_authority_spec.rb +++ b/spec/models/form/sales/pages/property_local_authority_spec.rb @@ -18,19 +18,6 @@ RSpec.describe Form::Sales::Pages::PropertyLocalAuthority, type: :model do end describe "has correct questions" do - context "when 2022" do - let(:start_date) { Time.utc(2022, 2, 8) } - - it "has correct questions" do - expect(page.questions.map(&:id)).to eq( - %w[ - la_known - la - ], - ) - end - end - context "when 2023" do let(:start_date) { Time.utc(2023, 2, 8) } diff --git a/spec/models/form/sales/questions/postcode_known_spec.rb b/spec/models/form/sales/questions/postcode_known_spec.rb deleted file mode 100644 index 794c981d4..000000000 --- a/spec/models/form/sales/questions/postcode_known_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Sales::Questions::PostcodeKnown, type: :model do - subject(:question) { described_class.new(question_id, question_definition, page) } - - let(:question_id) { nil } - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct id" do - expect(question.id).to eq("pcodenk") - end - - it "has the correct type" do - expect(question.type).to eq("radio") - end - - it "is not marked as derived" do - expect(question.derived?(nil)).to be false - end - - it "has the correct answer_options" do - expect(question.answer_options).to eq({ - "0" => { "value" => "Yes" }, - "1" => { "value" => "No" }, - }) - end - - it "has correct conditional for" do - expect(question.conditional_for).to eq({ - "postcode_full" => [0], - }) - end - - it "has the correct hidden_in_check_answers" do - expect(question.hidden_in_check_answers).to eq({ - "depends_on" => [ - { "pcodenk" => 0 }, - { "pcodenk" => 1 }, - ], - }) - end -end diff --git a/spec/models/form/sales/questions/postcode_spec.rb b/spec/models/form/sales/questions/postcode_spec.rb deleted file mode 100644 index 480d6af60..000000000 --- a/spec/models/form/sales/questions/postcode_spec.rb +++ /dev/null @@ -1,46 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Sales::Questions::Postcode, type: :model do - subject(:question) { described_class.new(question_id, question_definition, page) } - - let(:question_id) { nil } - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct id" do - expect(question.id).to eq("postcode_full") - end - - it "has the correct type" do - expect(question.type).to eq("text") - end - - it "is not marked as derived" do - expect(question.derived?(nil)).to be false - end - - it "has the correct width" do - expect(question.width).to eq(5) - end - - it "has the correct inferred_answers" do - expect(question.inferred_answers).to eq({ - "la" => { - "is_la_inferred" => true, - }, - }) - end - - it "has the correct inferred_check_answers_value" do - expect(question.inferred_check_answers_value).to eq([{ - "condition" => { - "pcodenk" => 1, - }, - "value" => "Not known", - }]) - end -end diff --git a/spec/models/form/sales/questions/uprn_confirmation_spec.rb b/spec/models/form/sales/questions/uprn_confirmation_spec.rb index ddb047937..0e54155b6 100644 --- a/spec/models/form/sales/questions/uprn_confirmation_spec.rb +++ b/spec/models/form/sales/questions/uprn_confirmation_spec.rb @@ -1,11 +1,13 @@ require "rails_helper" RSpec.describe Form::Sales::Questions::UprnConfirmation, type: :model do + include FormattingHelper + subject(:question) { described_class.new(question_id, question_definition, page) } let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 4), type: "sales"), id: "property_information")) } it "has correct page" do expect(question.page).to eq(page) @@ -24,7 +26,7 @@ RSpec.describe Form::Sales::Questions::UprnConfirmation, type: :model do end it "has the correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must answer is this the right address?") + expect(question.unanswered_error_message).to eq("You must answer #{format_ending(I18n.t('forms.2023.sales.property_information.uprn_confirmed.check_answer_label'))}") end describe "notification_banner" do diff --git a/spec/models/form/sales/questions/uprn_known_spec.rb b/spec/models/form/sales/questions/uprn_known_spec.rb index d3a91a3ef..e551ca430 100644 --- a/spec/models/form/sales/questions/uprn_known_spec.rb +++ b/spec/models/form/sales/questions/uprn_known_spec.rb @@ -1,6 +1,8 @@ require "rails_helper" RSpec.describe Form::Sales::Questions::UprnKnown, type: :model do + include FormattingHelper + subject(:question) { described_class.new(question_id, question_definition, page) } let(:question_id) { nil } @@ -35,7 +37,7 @@ RSpec.describe Form::Sales::Questions::UprnKnown, type: :model do end it "has the correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must answer UPRN known?") + expect(question.unanswered_error_message).to eq("You must answer #{format_ending(I18n.t('forms.2023.sales.property_information.uprn.uprn_known.check_answer_label'))}") end it "has the correct hidden_in_check_answers" do diff --git a/spec/models/form/sales/subsections/property_information_spec.rb b/spec/models/form/sales/subsections/property_information_spec.rb index e0bf51e11..6e181f738 100644 --- a/spec/models/form/sales/subsections/property_information_spec.rb +++ b/spec/models/form/sales/subsections/property_information_spec.rb @@ -17,30 +17,6 @@ RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do allow(form).to receive(:start_year_after_2024?).and_return(false) end - context "when 2022" do - let(:start_date) { Time.utc(2022, 2, 8) } - - it "has correct pages" do - expect(property_information.pages.compact.map(&:id)).to eq( - %w[ - property_number_of_bedrooms - about_price_bedrooms_value_check - property_unit_type - monthly_charges_property_type_value_check - percentage_discount_proptype_value_check - property_building_type - property_postcode - property_local_authority - local_authority_buyer_1_income_max_value_check - local_authority_buyer_2_income_max_value_check - local_authority_combined_income_max_value_check - about_price_la_value_check - property_wheelchair_accessible - ], - ) - end - end - context "when 2023" do let(:start_date) { Time.utc(2023, 2, 8) }