Browse Source

CLDC-4402: sales questions

CLDC-4402-audit-start-year-2024-or-later-usage
samyou-softwire 6 days ago
parent
commit
cfbd9812e3
  1. 23
      app/models/form/sales/questions/buyer1_ethnic_background_white.rb
  2. 23
      app/models/form/sales/questions/buyer2_ethnic_background_white.rb
  3. 21
      app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb
  4. 2
      app/models/form/sales/questions/buyer_previous.rb
  5. 2
      app/models/form/sales/questions/discount.rb
  6. 8
      app/models/form/sales/questions/ownership_scheme.rb
  7. 21
      app/models/form/sales/questions/person_relationship_to_buyer_1.rb
  8. 14
      app/models/form/sales/questions/privacy_notice.rb
  9. 15
      app/models/form/sales/questions/uprn_confirmation.rb
  10. 4
      config/locales/en.yml

23
app/models/form/sales/questions/buyer1_ethnic_background_white.rb

@ -9,22 +9,13 @@ class Form::Sales::Questions::Buyer1EthnicBackgroundWhite < ::Form::Question
end
def answer_options
if form.start_year_2024_or_later?
{
"1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" },
"2" => { "value" => "Irish" },
"18" => { "value" => "Gypsy or Irish Traveller" },
"20" => { "value" => "Roma" },
"3" => { "value" => "Any other White background" },
}.freeze
else
{
"1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" },
"2" => { "value" => "Irish" },
"18" => { "value" => "Gypsy or Irish Traveller" },
"3" => { "value" => "Any other White background" },
}.freeze
end
{
"1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" },
"2" => { "value" => "Irish" },
"18" => { "value" => "Gypsy or Irish Traveller" },
"20" => { "value" => "Roma" },
"3" => { "value" => "Any other White background" },
}.freeze
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 23, 2024 => 25, 2025 => 23, 2026 => 25 }.freeze

23
app/models/form/sales/questions/buyer2_ethnic_background_white.rb

@ -9,22 +9,13 @@ class Form::Sales::Questions::Buyer2EthnicBackgroundWhite < ::Form::Question
end
def answer_options
if form.start_year_2024_or_later?
{
"1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" },
"2" => { "value" => "Irish" },
"18" => { "value" => "Gypsy or Irish Traveller" },
"20" => { "value" => "Roma" },
"3" => { "value" => "Any other White background" },
}.freeze
else
{
"1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" },
"2" => { "value" => "Irish" },
"18" => { "value" => "Gypsy or Irish Traveller" },
"3" => { "value" => "Any other White background" },
}.freeze
end
{
"1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" },
"2" => { "value" => "Irish" },
"18" => { "value" => "Gypsy or Irish Traveller" },
"20" => { "value" => "Roma" },
"3" => { "value" => "Any other White background" },
}.freeze
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 31, 2024 => 33, 2025 => 31, 2026 => 34 }.freeze

21
app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb

@ -16,21 +16,12 @@ class Form::Sales::Questions::Buyer2RelationshipToBuyer1 < ::Form::Question
end
def answer_options
if form.start_year_2024_or_later?
{
"P" => { "value" => "Partner" },
"C" => { "value" => "Child" },
"X" => { "value" => "Other" },
"R" => { "value" => "Buyer prefers not to say" },
}
else
{
"P" => { "value" => "Partner" },
"C" => { "value" => "Child", "hint" => "Must be eligible for child benefit, aged under 16 or under 20 if still in full-time education." },
"X" => { "value" => "Other" },
"R" => { "value" => "Buyer prefers not to say" },
}
end
{
"P" => { "value" => "Partner" },
"C" => { "value" => "Child" },
"X" => { "value" => "Other" },
"R" => { "value" => "Buyer prefers not to say" },
}
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 27, 2024 => 29, 2025 => 27, 2026 => 29 }.freeze

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

@ -22,7 +22,7 @@ class Form::Sales::Questions::BuyerPrevious < ::Form::Question
end
def derived?(_log)
form.start_year_2024_or_later?
true
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 84 }.freeze

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

@ -4,7 +4,7 @@ class Form::Sales::Questions::Discount < ::Form::Question
@id = "discount"
@type = "numeric"
@min = 0
@max = form.start_year_2024_or_later? ? 70 : 100
@max = 70
@step = 0.1
@width = 5
@suffix = "%"

8
app/models/form/sales/questions/ownership_scheme.rb

@ -12,15 +12,9 @@ class Form::Sales::Questions::OwnershipScheme < ::Form::Question
"1" => { "value" => "Shared Ownership", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" },
"2" => { "value" => "Discounted Ownership" },
}.freeze
elsif form.start_year_2024_or_later?
{
"1" => { "value" => "Yes - a shared ownership scheme", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" },
"2" => { "value" => "Yes - a discounted ownership scheme" },
"3" => { "value" => "No - this is an outright or other sale" },
}.freeze
else
{
"1" => { "value" => "Yes - a shared ownership scheme" },
"1" => { "value" => "Yes - a shared ownership scheme", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" },
"2" => { "value" => "Yes - a discounted ownership scheme" },
"3" => { "value" => "No - this is an outright or other sale" },
}.freeze

21
app/models/form/sales/questions/person_relationship_to_buyer_1.rb

@ -16,21 +16,12 @@ class Form::Sales::Questions::PersonRelationshipToBuyer1 < ::Form::Question
end
def answer_options
if form.start_year_2024_or_later?
{
"P" => { "value" => "Partner" },
"C" => { "value" => "Child" },
"X" => { "value" => "Other" },
"R" => { "value" => "Person prefers not to say" },
}
else
{
"P" => { "value" => "Partner" },
"C" => { "value" => "Child", "hint" => "Must be eligible for child benefit, aged under 16 or under 20 if still in full-time education." },
"X" => { "value" => "Other" },
"R" => { "value" => "Person prefers not to say" },
}
end
{
"P" => { "value" => "Partner" },
"C" => { "value" => "Child" },
"X" => { "value" => "Other" },
"R" => { "value" => "Person prefers not to say" },
}
end
def question_number

14
app/models/form/sales/questions/privacy_notice.rb

@ -10,22 +10,12 @@ class Form::Sales::Questions::PrivacyNotice < ::Form::Question
end
def answer_options
declaration_text = if form.start_year_2024_or_later?
"The #{@joint_purchase ? 'buyers have' : 'buyer has'} seen or been given access to the MHCLG privacy notice"
else
"The #{@joint_purchase ? 'buyers have' : 'buyer has'} seen the MHCLG privacy notice"
end
{ "privacynotice" => { "value" => declaration_text } }.freeze
{ "privacynotice" => { "value" => "The #{@joint_purchase ? 'buyers have' : 'buyer has'} seen or been given access to the MHCLG privacy notice" } }.freeze
end
def unanswered_error_message
buyer_or_buyers = @joint_purchase ? "buyers" : "buyer"
if form.start_year_2024_or_later?
I18n.t("validations.privacynotice.missing.post_2024", buyer_or_buyers:)
else
I18n.t("validations.privacynotice.missing.pre_2024", buyer_or_buyers:)
end
I18n.t("validations.privacynotice.missing", buyer_or_buyers:)
end
def guidance

15
app/models/form/sales/questions/uprn_confirmation.rb

@ -6,17 +6,10 @@ class Form::Sales::Questions::UprnConfirmation < ::Form::Question
end
def answer_options
if form.start_year_2024_or_later?
{
"1" => { "value" => "Yes" },
"0" => { "value" => "No, I want to search for the address instead" },
}.freeze
else
{
"1" => { "value" => "Yes" },
"0" => { "value" => "No, I want to enter the address manually" },
}.freeze
end
{
"1" => { "value" => "Yes" },
"0" => { "value" => "No, I want to search for the address instead" },
}.freeze
end
def notification_banner(log = nil)

4
config/locales/en.yml

@ -339,9 +339,7 @@ en:
missing: "You must show or give the tenant access to the MHCLG privacy notice before you can submit this log."
privacynotice:
missing:
pre_2024: "You must show the MHCLG privacy notice to the %{buyer_or_buyers} before you can submit this log."
post_2024: "You must show or give the %{buyer_or_buyers} access to the MHCLG privacy notice before you can submit this log."
missing: "You must show or give the %{buyer_or_buyers} access to the MHCLG privacy notice before you can submit this log."
scheme:
toggle_date:

Loading…
Cancel
Save