Browse Source

Merge branch 'main' into CLDC-3679-Copy-changes-lettings-setup-questions

pull/2723/head
Manny Dinssa 2 years ago committed by GitHub
parent
commit
529674cb50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      Gemfile.lock
  2. 2
      app/components/bulk_upload_summary_component.html.erb
  3. 2
      app/controllers/lettings_logs_controller.rb
  4. 2
      app/controllers/sales_logs_controller.rb
  5. 17
      app/controllers/users_controller.rb
  6. 2
      app/helpers/filters_helper.rb
  7. 8
      app/helpers/log_actions_helper.rb
  8. 2
      app/helpers/review_helper.rb
  9. 2
      app/helpers/tasklist_helper.rb
  10. 2
      app/models/bulk_upload.rb
  11. 1
      app/models/form/sales/pages/age1.rb
  12. 1
      app/models/form/sales/pages/age2.rb
  13. 1
      app/models/form/sales/pages/buyer1_ethnic_background_arab.rb
  14. 1
      app/models/form/sales/pages/buyer1_ethnic_background_asian.rb
  15. 1
      app/models/form/sales/pages/buyer1_ethnic_background_black.rb
  16. 1
      app/models/form/sales/pages/buyer1_ethnic_background_mixed.rb
  17. 1
      app/models/form/sales/pages/buyer1_ethnic_background_white.rb
  18. 1
      app/models/form/sales/pages/buyer2_ethnic_background_arab.rb
  19. 1
      app/models/form/sales/pages/buyer2_ethnic_background_asian.rb
  20. 1
      app/models/form/sales/pages/buyer2_ethnic_background_black.rb
  21. 1
      app/models/form/sales/pages/buyer2_ethnic_background_mixed.rb
  22. 1
      app/models/form/sales/pages/buyer2_ethnic_background_white.rb
  23. 1
      app/models/form/sales/pages/buyer2_relationship_to_buyer1.rb
  24. 1
      app/models/form/sales/pages/buyer2_working_situation.rb
  25. 2
      app/models/form/sales/pages/buyer_interview.rb
  26. 5
      app/models/form/sales/pages/buyer_live_in_value_check.rb
  27. 1
      app/models/form/sales/pages/gender_identity2.rb
  28. 4
      app/models/form/sales/pages/household_wheelchair_check.rb
  29. 8
      app/models/form/sales/pages/multiple_partners_value_check.rb
  30. 6
      app/models/form/sales/pages/not_retired_value_check.rb
  31. 5
      app/models/form/sales/pages/old_persons_shared_ownership_value_check.rb
  32. 8
      app/models/form/sales/pages/partner_under_16_value_check.rb
  33. 1
      app/models/form/sales/pages/person_age.rb
  34. 1
      app/models/form/sales/pages/person_gender_identity.rb
  35. 1
      app/models/form/sales/pages/person_relationship_to_buyer_1.rb
  36. 5
      app/models/form/sales/pages/person_student_not_child_value_check.rb
  37. 1
      app/models/form/sales/pages/person_working_situation.rb
  38. 2
      app/models/form/sales/pages/privacy_notice.rb
  39. 8
      app/models/form/sales/pages/retirement_value_check.rb
  40. 3
      app/models/form/sales/questions/age1.rb
  41. 3
      app/models/form/sales/questions/age2.rb
  42. 3
      app/models/form/sales/questions/armed_forces.rb
  43. 2
      app/models/form/sales/questions/armed_forces_spouse.rb
  44. 4
      app/models/form/sales/questions/buyer1_age_known.rb
  45. 4
      app/models/form/sales/questions/buyer1_ethnic_background_arab.rb
  46. 4
      app/models/form/sales/questions/buyer1_ethnic_background_asian.rb
  47. 4
      app/models/form/sales/questions/buyer1_ethnic_background_black.rb
  48. 4
      app/models/form/sales/questions/buyer1_ethnic_background_mixed.rb
  49. 4
      app/models/form/sales/questions/buyer1_ethnic_background_white.rb
  50. 3
      app/models/form/sales/questions/buyer1_ethnic_group.rb
  51. 3
      app/models/form/sales/questions/buyer1_live_in_property.rb
  52. 3
      app/models/form/sales/questions/buyer1_nationality.rb
  53. 3
      app/models/form/sales/questions/buyer1_working_situation.rb
  54. 3
      app/models/form/sales/questions/buyer2_age_known.rb
  55. 3
      app/models/form/sales/questions/buyer2_ethnic_background_arab.rb
  56. 3
      app/models/form/sales/questions/buyer2_ethnic_background_asian.rb
  57. 3
      app/models/form/sales/questions/buyer2_ethnic_background_black.rb
  58. 3
      app/models/form/sales/questions/buyer2_ethnic_background_mixed.rb
  59. 3
      app/models/form/sales/questions/buyer2_ethnic_background_white.rb
  60. 2
      app/models/form/sales/questions/buyer2_ethnic_group.rb
  61. 2
      app/models/form/sales/questions/buyer2_live_in_property.rb
  62. 2
      app/models/form/sales/questions/buyer2_nationality.rb
  63. 3
      app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb
  64. 3
      app/models/form/sales/questions/buyer2_working_situation.rb
  65. 2
      app/models/form/sales/questions/buyer_interview.rb
  66. 3
      app/models/form/sales/questions/buyer_live_in_value_check.rb
  67. 2
      app/models/form/sales/questions/buyer_still_serving.rb
  68. 10
      app/models/form/sales/questions/gender_identity1.rb
  69. 9
      app/models/form/sales/questions/gender_identity2.rb
  70. 3
      app/models/form/sales/questions/household_disability.rb
  71. 2
      app/models/form/sales/questions/household_wheelchair.rb
  72. 3
      app/models/form/sales/questions/household_wheelchair_check.rb
  73. 3
      app/models/form/sales/questions/multiple_partners_value_check.rb
  74. 2
      app/models/form/sales/questions/nationality_all.rb
  75. 3
      app/models/form/sales/questions/nationality_all_group.rb
  76. 3
      app/models/form/sales/questions/not_retired_value_check.rb
  77. 14
      app/models/form/sales/questions/number_of_others_in_property.rb
  78. 3
      app/models/form/sales/questions/old_persons_shared_ownership_value_check.rb
  79. 3
      app/models/form/sales/questions/partner_under_16_value_check.rb
  80. 9
      app/models/form/sales/questions/person_age.rb
  81. 3
      app/models/form/sales/questions/person_age_known.rb
  82. 9
      app/models/form/sales/questions/person_gender_identity.rb
  83. 2
      app/models/form/sales/questions/person_known.rb
  84. 3
      app/models/form/sales/questions/person_relationship_to_buyer_1.rb
  85. 3
      app/models/form/sales/questions/person_student_not_child_value_check.rb
  86. 3
      app/models/form/sales/questions/person_working_situation.rb
  87. 2
      app/models/form/sales/questions/privacy_notice.rb
  88. 3
      app/models/form/sales/questions/retirement_value_check.rb
  89. 2
      app/models/forms/bulk_upload_lettings/checking_file.rb
  90. 2
      app/models/forms/bulk_upload_lettings/needstype.rb
  91. 2
      app/models/forms/bulk_upload_lettings/prepare_your_file.rb
  92. 2
      app/models/forms/bulk_upload_lettings/upload_your_file.rb
  93. 2
      app/models/forms/bulk_upload_lettings/year.rb
  94. 2
      app/models/forms/bulk_upload_sales/checking_file.rb
  95. 2
      app/models/forms/bulk_upload_sales/prepare_your_file.rb
  96. 2
      app/models/forms/bulk_upload_sales/upload_your_file.rb
  97. 2
      app/models/forms/bulk_upload_sales/year.rb
  98. 6
      app/models/user.rb
  99. 10
      app/models/validations/sales/setup_validations.rb
  100. 10
      app/models/validations/setup_validations.rb
  101. Some files were not shown because too many files have changed in this diff Show More

4
Gemfile.lock

@ -377,8 +377,7 @@ GEM
responders (3.1.1) responders (3.1.1)
actionpack (>= 5.2) actionpack (>= 5.2)
railties (>= 5.2) railties (>= 5.2)
rexml (3.3.6) rexml (3.3.9)
strscan
roo (2.10.1) roo (2.10.1)
nokogiri (~> 1) nokogiri (~> 1)
rubyzip (>= 1.3.0, < 3.0.0) rubyzip (>= 1.3.0, < 3.0.0)
@ -463,7 +462,6 @@ GEM
smart_properties (1.17.0) smart_properties (1.17.0)
stimulus-rails (1.3.3) stimulus-rails (1.3.3)
railties (>= 6.0.0) railties (>= 6.0.0)
strscan (3.1.0)
thor (1.3.2) thor (1.3.2)
thread_safe (0.3.6) thread_safe (0.3.6)
timecop (0.9.8) timecop (0.9.8)

2
app/components/bulk_upload_summary_component.html.erb

@ -4,7 +4,7 @@
<header class="app-log-summary__header"> <header class="app-log-summary__header">
<h2 class="govuk-heading-m govuk-!-font-weight-regular govuk-!-margin-bottom-0 text-normal-break "> <h2 class="govuk-heading-m govuk-!-font-weight-regular govuk-!-margin-bottom-0 text-normal-break ">
<span class="govuk-!-margin-right-1"><%= bulk_upload.filename %></span> <span class="govuk-!-margin-right-1"><%= bulk_upload.filename %></span>
<span class="app-metadata app-log-summary__details" style="white-space: nowrap;"><%= bulk_upload.year %>/<%= bulk_upload.year + 1 %></span> <span class="app-metadata app-log-summary__details" style="white-space: nowrap;"><%= bulk_upload.year %> to <%= bulk_upload.year + 1 %></span>
</h2> </h2>
</header> </header>
<div class="govuk-!-margin-bottom-2"> <div class="govuk-!-margin-bottom-2">

2
app/controllers/lettings_logs_controller.rb

@ -65,7 +65,7 @@ class LettingsLogsController < LogsController
elsif @log.collection_closed_for_editing? elsif @log.collection_closed_for_editing?
redirect_to review_lettings_log_path(@log) redirect_to review_lettings_log_path(@log)
else else
render("logs/edit", locals: { current_user: }) render("logs/edit", locals: { current_user:, bulk_upload_filter_applied: session_filters["bulk_upload_id"].present? })
end end
end end

2
app/controllers/sales_logs_controller.rb

@ -39,7 +39,7 @@ class SalesLogsController < LogsController
if @log.collection_closed_for_editing? if @log.collection_closed_for_editing?
redirect_to review_sales_log_path(@log, sales_log: true) redirect_to review_sales_log_path(@log, sales_log: true)
else else
render "logs/edit", locals: { current_user: } render "logs/edit", locals: { current_user:, bulk_upload_filter_applied: session_filters["bulk_upload_id"].present? }
end end
end end

17
app/controllers/users_controller.rb

@ -257,13 +257,7 @@ private
def user_params def user_params
if @user == current_user if @user == current_user
if current_user.data_coordinator? current_user_params
params.require(:user).permit(:email, :phone, :phone_extension, :name, :password, :password_confirmation, :role, :is_dpo, :is_key_contact, :initial_confirmation_sent)
elsif current_user.support?
params.require(:user).permit(:email, :phone, :phone_extension, :name, :password, :password_confirmation, :role, :is_dpo, :is_key_contact, :initial_confirmation_sent, :organisation_id)
else
params.require(:user).permit(:email, :phone, :phone_extension, :name, :password, :password_confirmation, :initial_confirmation_sent)
end
elsif current_user.data_coordinator? elsif current_user.data_coordinator?
params.require(:user).permit(:email, :phone, :phone_extension, :name, :role, :is_dpo, :is_key_contact, :active, :initial_confirmation_sent) params.require(:user).permit(:email, :phone, :phone_extension, :name, :role, :is_dpo, :is_key_contact, :active, :initial_confirmation_sent)
elsif current_user.support? elsif current_user.support?
@ -271,6 +265,15 @@ private
end end
end end
def current_user_params
base_params = %i[email phone phone_extension name password password_confirmation initial_confirmation_sent]
return params.require(:user).permit(*(base_params + %i[role is_dpo is_key_contact])) if current_user.data_coordinator?
return params.require(:user).permit(*(base_params + %i[role is_dpo is_key_contact organisation_id])) if current_user.support?
return params.require(:user).permit(*(base_params + [:role])) if Rails.env.staging? && current_user.in_staging_role_update_email_allowlist?
params.require(:user).permit(*base_params)
end
def user_params_without_org def user_params_without_org
user_params.except(:organisation_id) user_params.except(:organisation_id)
end end

2
app/helpers/filters_helper.rb

@ -287,7 +287,7 @@ private
end end
def year_combo(year) def year_combo(year)
"#{year}/#{year - 2000 + 1}" "#{year} to #{year + 1}"
end end
def formatted_years_filter(session_filters) def formatted_years_filter(session_filters)

8
app/helpers/log_actions_helper.rb

@ -2,8 +2,8 @@ module LogActionsHelper
include GovukLinkHelper include GovukLinkHelper
include GovukVisuallyHiddenHelper include GovukVisuallyHiddenHelper
def edit_actions_for_log(log) def edit_actions_for_log(log, bulk_upload_filter_applied)
back = back_button_for(log) back = back_button_for(log, bulk_upload_filter_applied)
delete = delete_button_for_log(log) delete = delete_button_for_log(log)
return if back.nil? && delete.nil? return if back.nil? && delete.nil?
@ -15,9 +15,9 @@ module LogActionsHelper
private private
def back_button_for(log) def back_button_for(log, bulk_upload_filter_applied)
if log.completed? if log.completed?
if log.creation_method_bulk_upload? && log.bulk_upload.present? if log.creation_method_bulk_upload? && log.bulk_upload.present? && bulk_upload_filter_applied
if log.lettings? if log.lettings?
govuk_button_link_to "Back to uploaded logs", resume_bulk_upload_lettings_result_path(log.bulk_upload) govuk_button_link_to "Back to uploaded logs", resume_bulk_upload_lettings_result_path(log.bulk_upload)
else else

2
app/helpers/review_helper.rb

@ -6,7 +6,7 @@ module ReviewHelper
"You can review and make changes to this log until #{log.form.submission_deadline.to_formatted_s(:govuk_date)}.".html_safe "You can review and make changes to this log until #{log.form.submission_deadline.to_formatted_s(:govuk_date)}.".html_safe
else else
start_year = log.startdate ? collection_start_year_for_date(log.startdate) : log.form.start_date.year start_year = log.startdate ? collection_start_year_for_date(log.startdate) : log.form.start_date.year
"This log is from the #{start_year}/#{start_year + 1} collection window, which is now closed." "This log is from the #{start_year} to #{start_year + 1} collection window, which is now closed."
end end
end end

2
app/helpers/tasklist_helper.rb

@ -55,7 +55,7 @@ module TasklistHelper
else else
start_year = log.startdate ? collection_start_year_for_date(log.startdate) : log.form.start_date.year start_year = log.startdate ? collection_start_year_for_date(log.startdate) : log.form.start_date.year
"This log is from the #{start_year}/#{start_year + 1} collection window, which is now closed." "This log is from the #{start_year} to #{start_year + 1} collection window, which is now closed."
end end
end end

2
app/models/bulk_upload.rb

@ -59,7 +59,7 @@ class BulkUpload < ApplicationRecord
end end
def year_combo def year_combo
"#{year}/#{year - 2000 + 1}" "#{year} to #{year + 1}"
end end
def end_year def end_year

1
app/models/form/sales/pages/age1.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Age1 < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_1_age" @id = "buyer_1_age"
@copy_key = "sales.household_characteristics.age1"
@depends_on = [ @depends_on = [
{ {
"buyer_has_seen_privacy_notice?" => true, "buyer_has_seen_privacy_notice?" => true,

1
app/models/form/sales/pages/age2.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Age2 < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_2_age" @id = "buyer_2_age"
@copy_key = "sales.household_characteristics.age2.buyer"
@depends_on = [ @depends_on = [
{ {
"joint_purchase?" => true, "joint_purchase?" => true,

1
app/models/form/sales/pages/buyer1_ethnic_background_arab.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer1EthnicBackgroundArab < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_1_ethnic_background_arab" @id = "buyer_1_ethnic_background_arab"
@copy_key = "sales.household_characteristics.ethnic.ethnic_background_arab"
@depends_on = [{ @depends_on = [{
"ethnic_group" => 4, "ethnic_group" => 4,
}] }]

1
app/models/form/sales/pages/buyer1_ethnic_background_asian.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer1EthnicBackgroundAsian < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_1_ethnic_background_asian" @id = "buyer_1_ethnic_background_asian"
@copy_key = "sales.household_characteristics.ethnic.ethnic_background_asian"
@depends_on = [{ @depends_on = [{
"ethnic_group" => 2, "ethnic_group" => 2,
}] }]

1
app/models/form/sales/pages/buyer1_ethnic_background_black.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer1EthnicBackgroundBlack < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_1_ethnic_background_black" @id = "buyer_1_ethnic_background_black"
@copy_key = "sales.household_characteristics.ethnic.ethnic_background_black"
@depends_on = [{ @depends_on = [{
"ethnic_group" => 3, "ethnic_group" => 3,
}] }]

1
app/models/form/sales/pages/buyer1_ethnic_background_mixed.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer1EthnicBackgroundMixed < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_1_ethnic_background_mixed" @id = "buyer_1_ethnic_background_mixed"
@copy_key = "sales.household_characteristics.ethnic.ethnic_background_mixed"
@depends_on = [{ @depends_on = [{
"ethnic_group" => 1, "ethnic_group" => 1,
}] }]

1
app/models/form/sales/pages/buyer1_ethnic_background_white.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer1EthnicBackgroundWhite < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_1_ethnic_background_white" @id = "buyer_1_ethnic_background_white"
@copy_key = "sales.household_characteristics.ethnic.ethnic_background_white"
@depends_on = [{ @depends_on = [{
"ethnic_group" => 0, "ethnic_group" => 0,
}] }]

1
app/models/form/sales/pages/buyer2_ethnic_background_arab.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer2EthnicBackgroundArab < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_2_ethnic_background_arab" @id = "buyer_2_ethnic_background_arab"
@copy_key = "sales.household_characteristics.ethnicbuy2.ethnic_background_arab"
@depends_on = [{ @depends_on = [{
"ethnic_group2" => 4, "ethnic_group2" => 4,
}] }]

1
app/models/form/sales/pages/buyer2_ethnic_background_asian.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer2EthnicBackgroundAsian < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_2_ethnic_background_asian" @id = "buyer_2_ethnic_background_asian"
@copy_key = "sales.household_characteristics.ethnicbuy2.ethnic_background_asian"
@depends_on = [{ @depends_on = [{
"ethnic_group2" => 2, "ethnic_group2" => 2,
}] }]

1
app/models/form/sales/pages/buyer2_ethnic_background_black.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer2EthnicBackgroundBlack < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_2_ethnic_background_black" @id = "buyer_2_ethnic_background_black"
@copy_key = "sales.household_characteristics.ethnicbuy2.ethnic_background_black"
@depends_on = [{ @depends_on = [{
"ethnic_group2" => 3, "ethnic_group2" => 3,
}] }]

1
app/models/form/sales/pages/buyer2_ethnic_background_mixed.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer2EthnicBackgroundMixed < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_2_ethnic_background_mixed" @id = "buyer_2_ethnic_background_mixed"
@copy_key = "sales.household_characteristics.ethnicbuy2.ethnic_background_black"
@depends_on = [{ @depends_on = [{
"ethnic_group2" => 1, "ethnic_group2" => 1,
}] }]

1
app/models/form/sales/pages/buyer2_ethnic_background_white.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer2EthnicBackgroundWhite < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_2_ethnic_background_white" @id = "buyer_2_ethnic_background_white"
@copy_key = "sales.household_characteristics.ethnicbuy2.ethnic_background_white"
@depends_on = [{ @depends_on = [{
"ethnic_group2" => 0, "ethnic_group2" => 0,
}] }]

1
app/models/form/sales/pages/buyer2_relationship_to_buyer1.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer2RelationshipToBuyer1 < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_2_relationship_to_buyer_1" @id = "buyer_2_relationship_to_buyer_1"
@copy_key = "sales.household_characteristics.relat2.buyer"
@depends_on = [ @depends_on = [
{ {
"joint_purchase?" => true, "joint_purchase?" => true,

1
app/models/form/sales/pages/buyer2_working_situation.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::Buyer2WorkingSituation < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_2_working_situation" @id = "buyer_2_working_situation"
@copy_key = "sales.household_characteristics.ecstat2.buyer"
@depends_on = [ @depends_on = [
{ {
"joint_purchase?" => true, "joint_purchase?" => true,

2
app/models/form/sales/pages/buyer_interview.rb

@ -2,7 +2,7 @@ class Form::Sales::Pages::BuyerInterview < ::Form::Page
def initialize(id, hsh, subsection, joint_purchase:) def initialize(id, hsh, subsection, joint_purchase:)
super(id, hsh, subsection) super(id, hsh, subsection)
@joint_purchase = joint_purchase @joint_purchase = joint_purchase
@copy_key = "sales.setup.noint.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}" @copy_key = "sales.#{subsection.id}.noint.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
end end
def questions def questions

5
app/models/form/sales/pages/buyer_live_in_value_check.rb

@ -6,12 +6,13 @@ class Form::Sales::Pages::BuyerLiveInValueCheck < Form::Sales::Pages::Person
"buyer#{person_index}_livein_wrong_for_ownership_type?" => true, "buyer#{person_index}_livein_wrong_for_ownership_type?" => true,
}, },
] ]
@copy_key = "sales.soft_validations.buyer_livein_value_check.buyer#{person_index}"
@title_text = { @title_text = {
"translation" => "soft_validations.buyer#{person_index}_livein_wrong_for_ownership_type.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }], "arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.buyer#{person_index}_livein_wrong_for_ownership_type.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }], "arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }],
} }
end end

1
app/models/form/sales/pages/gender_identity2.rb

@ -2,6 +2,7 @@ class Form::Sales::Pages::GenderIdentity2 < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "buyer_2_gender_identity" @id = "buyer_2_gender_identity"
@copy_key = "sales.household_characteristics.sex2.buyer"
@depends_on = [ @depends_on = [
{ {
"joint_purchase?" => true, "joint_purchase?" => true,

4
app/models/form/sales/pages/household_wheelchair_check.rb

@ -6,8 +6,8 @@ class Form::Sales::Pages::HouseholdWheelchairCheck < ::Form::Page
"wheelchair_when_not_disabled?" => true, "wheelchair_when_not_disabled?" => true,
}, },
] ]
@informative_text = {} @copy_key = "sales.soft_validations.wheel_value_check"
@title_text = { "translation" => "soft_validations.wheelchair.title_text" } @title_text = { "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text" }
end end
def questions def questions

8
app/models/form/sales/pages/multiple_partners_value_check.rb

@ -6,12 +6,16 @@ class Form::Sales::Pages::MultiplePartnersValueCheck < Form::Sales::Pages::Perso
"multiple_partners?" => true, "multiple_partners?" => true,
}, },
] ]
@copy_key = "sales.soft_validations.multiple_partners_value_check"
@person_index = person_index @person_index = person_index
@title_text = { @title_text = {
"translation" => "soft_validations.multiple_partners_sales.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [],
}
@informative_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [], "arguments" => [],
} }
@informative_text = {}
end end
def questions def questions

6
app/models/form/sales/pages/not_retired_value_check.rb

@ -7,11 +7,13 @@ class Form::Sales::Pages::NotRetiredValueCheck < Form::Sales::Pages::Person
}, },
] ]
@person_index = person_index @person_index = person_index
@copy_key = "sales.soft_validations.retirement_value_check.max"
@title_text = { @title_text = {
"translation" => "soft_validations.retirement.max.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.retirement.max.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
} }
end end

5
app/models/form/sales/pages/old_persons_shared_ownership_value_check.rb

@ -1,12 +1,13 @@
class Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck < ::Form::Page class Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck < ::Form::Page
def initialize(id, hsh, subsection, joint_purchase:) def initialize(id, hsh, subsection, joint_purchase:)
super(id, hsh, subsection) super(id, hsh, subsection)
@copy_key = "sales.soft_validations.old_persons_shared_ownership_value_check"
@title_text = { @title_text = {
"translation" => "soft_validations.old_persons_shared_ownership.title_text.#{joint_purchase ? 'two' : 'one'}", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}",
"arguments" => [], "arguments" => [],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.old_persons_shared_ownership.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [], "arguments" => [],
} }
@joint_purchase = joint_purchase @joint_purchase = joint_purchase

8
app/models/form/sales/pages/partner_under_16_value_check.rb

@ -6,9 +6,10 @@ class Form::Sales::Pages::PartnerUnder16ValueCheck < Form::Sales::Pages::Person
"person_#{person_index}_partner_under_16?" => true, "person_#{person_index}_partner_under_16?" => true,
}, },
] ]
@copy_key = "sales.soft_validations.partner_under_16_value_check"
@person_index = person_index @person_index = person_index
@title_text = { @title_text = {
"translation" => "soft_validations.partner_under_16_sales.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "age#{person_index}", "key" => "age#{person_index}",
@ -17,7 +18,10 @@ class Form::Sales::Pages::PartnerUnder16ValueCheck < Form::Sales::Pages::Person
}, },
], ],
} }
@informative_text = {} @informative_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
}
end end
def questions def questions

1
app/models/form/sales/pages/person_age.rb

@ -1,6 +1,7 @@
class Form::Sales::Pages::PersonAge < Form::Sales::Pages::Person class Form::Sales::Pages::PersonAge < Form::Sales::Pages::Person
def initialize(id, hsh, subsection, person_index:) def initialize(id, hsh, subsection, person_index:)
super super
@copy_key = person_index == 2 ? "sales.household_characteristics.age2.person" : "sales.household_characteristics.age#{person_index}"
@depends_on = [{ "details_known_#{person_index}" => 1 }] @depends_on = [{ "details_known_#{person_index}" => 1 }]
end end

1
app/models/form/sales/pages/person_gender_identity.rb

@ -1,6 +1,7 @@
class Form::Sales::Pages::PersonGenderIdentity < Form::Sales::Pages::Person class Form::Sales::Pages::PersonGenderIdentity < Form::Sales::Pages::Person
def initialize(id, hsh, subsection, person_index:) def initialize(id, hsh, subsection, person_index:)
super super
@copy_key = "sales.household_characteristics.sex2.person" if person_index == 2
@depends_on = [ @depends_on = [
{ "details_known_#{person_index}" => 1 }, { "details_known_#{person_index}" => 1 },
] ]

1
app/models/form/sales/pages/person_relationship_to_buyer_1.rb

@ -1,6 +1,7 @@
class Form::Sales::Pages::PersonRelationshipToBuyer1 < ::Form::Sales::Pages::Person class Form::Sales::Pages::PersonRelationshipToBuyer1 < ::Form::Sales::Pages::Person
def initialize(id, hsh, subsection, person_index:) def initialize(id, hsh, subsection, person_index:)
super super
@copy_key = "sales.household_characteristics.relat2.person" if person_index == 2
@depends_on = [ @depends_on = [
{ "details_known_#{person_index}" => 1 }, { "details_known_#{person_index}" => 1 },
] ]

5
app/models/form/sales/pages/person_student_not_child_value_check.rb

@ -6,11 +6,12 @@ class Form::Sales::Pages::PersonStudentNotChildValueCheck < Form::Sales::Pages::
"person_#{person_index}_student_not_child?" => true, "person_#{person_index}_student_not_child?" => true,
}, },
] ]
@copy_key = "sales.soft_validations.student_not_child_value_check"
@person_index = person_index @person_index = person_index
@title_text = { @title_text = {
"translation" => "soft_validations.student_not_child.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
} }
@informative_text = {} @informative_text = { "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text", "arguments" => [] }
end end
def questions def questions

1
app/models/form/sales/pages/person_working_situation.rb

@ -1,6 +1,7 @@
class Form::Sales::Pages::PersonWorkingSituation < Form::Sales::Pages::Person class Form::Sales::Pages::PersonWorkingSituation < Form::Sales::Pages::Person
def initialize(id, hsh, subsection, person_index:) def initialize(id, hsh, subsection, person_index:)
super super
@copy_key = "sales.household_characteristics.ecstat2.person" if person_index == 2
@depends_on = [ @depends_on = [
{ {
"details_known_#{person_index}" => 1, "details_known_#{person_index}" => 1,

2
app/models/form/sales/pages/privacy_notice.rb

@ -1,7 +1,7 @@
class Form::Sales::Pages::PrivacyNotice < ::Form::Page class Form::Sales::Pages::PrivacyNotice < ::Form::Page
def initialize(id, hsh, subsection, joint_purchase:) def initialize(id, hsh, subsection, joint_purchase:)
super(id, hsh, subsection) super(id, hsh, subsection)
@copy_key = "sales.setup.privacynotice.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}" @copy_key = "sales.#{subsection.id}.privacynotice.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
@joint_purchase = joint_purchase @joint_purchase = joint_purchase
end end

8
app/models/form/sales/pages/retirement_value_check.rb

@ -7,8 +7,9 @@ class Form::Sales::Pages::RetirementValueCheck < Form::Sales::Pages::Person
}, },
] ]
@person_index = person_index @person_index = person_index
@copy_key = "sales.soft_validations.retirement_value_check.min"
@title_text = { @title_text = {
"translation" => "soft_validations.retirement.min.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "age#{person_index}", "key" => "age#{person_index}",
@ -17,7 +18,10 @@ class Form::Sales::Pages::RetirementValueCheck < Form::Sales::Pages::Person
}, },
], ],
} }
@informative_text = {} @informative_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
}
end end
def questions def questions

3
app/models/form/sales/questions/age1.rb

@ -2,10 +2,9 @@ class Form::Sales::Questions::Age1 < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "age1" @id = "age1"
@check_answer_label = "Buyer 1’s age"
@header = "Age"
@type = "numeric" @type = "numeric"
@width = 2 @width = 2
@copy_key = "sales.household_characteristics.age1.age1"
@inferred_check_answers_value = [ @inferred_check_answers_value = [
{ {
"condition" => { "age1_known" => 1 }, "condition" => { "age1_known" => 1 },

3
app/models/form/sales/questions/age2.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::Age2 < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "age2" @id = "age2"
@check_answer_label = "Buyer 2’s age" @copy_key = "sales.household_characteristics.age2.buyer.age2"
@header = "Age"
@type = "numeric" @type = "numeric"
@width = 2 @width = 2
@inferred_check_answers_value = [{ @inferred_check_answers_value = [{

3
app/models/form/sales/questions/armed_forces.rb

@ -2,10 +2,7 @@ class Form::Sales::Questions::ArmedForces < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "hhregres" @id = "hhregres"
@check_answer_label = "Have any of the buyers ever served as a regular in the UK armed forces?"
@header = "Have any of the buyers ever served as a regular in the UK armed forces?"
@type = "radio" @type = "radio"
@hint_text = "A regular is somebody who has served in the Royal Navy, the Royal Marines, the Royal Airforce or Army full time and does not include reserve forces"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end end

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

@ -2,8 +2,6 @@ class Form::Sales::Questions::ArmedForcesSpouse < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "armedforcesspouse" @id = "armedforcesspouse"
@check_answer_label = "Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?"
@header = "Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

4
app/models/form/sales/questions/buyer1_age_known.rb

@ -2,11 +2,9 @@ class Form::Sales::Questions::Buyer1AgeKnown < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "age1_known" @id = "age1_known"
@check_answer_label = "Buyer 1’s age"
@header = "Do you know buyer 1’s age?"
@type = "radio" @type = "radio"
@copy_key = "sales.household_characteristics.age1.age1_known"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@conditional_for = { @conditional_for = {
"age1" => [0], "age1" => [0],
} }

4
app/models/form/sales/questions/buyer1_ethnic_background_arab.rb

@ -2,11 +2,9 @@ class Form::Sales::Questions::Buyer1EthnicBackgroundArab < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ethnic" @id = "ethnic"
@check_answer_label = "Buyer 1’s ethnic background" @copy_key = "sales.household_characteristics.ethnic.ethnic_background_arab"
@header = "Which of the following best describes buyer 1’s Arab background?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@hint_text = form.start_year_after_2024? ? "" : "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1 @check_answers_card_number = 1
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end end

4
app/models/form/sales/questions/buyer1_ethnic_background_asian.rb

@ -2,11 +2,9 @@ class Form::Sales::Questions::Buyer1EthnicBackgroundAsian < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ethnic" @id = "ethnic"
@check_answer_label = "Buyer 1’s ethnic background" @copy_key = "sales.household_characteristics.ethnic.ethnic_background_asian"
@header = "Which of the following best describes buyer 1’s Asian or Asian British background?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@hint_text = form.start_year_after_2024? ? "" : "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1 @check_answers_card_number = 1
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end end

4
app/models/form/sales/questions/buyer1_ethnic_background_black.rb

@ -2,11 +2,9 @@ class Form::Sales::Questions::Buyer1EthnicBackgroundBlack < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ethnic" @id = "ethnic"
@check_answer_label = "Buyer 1’s ethnic background" @copy_key = "sales.household_characteristics.ethnic.ethnic_background_black"
@header = "Which of the following best describes buyer 1’s Black, African, Caribbean or Black British background?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@hint_text = form.start_year_after_2024? ? "" : "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1 @check_answers_card_number = 1
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end end

4
app/models/form/sales/questions/buyer1_ethnic_background_mixed.rb

@ -2,11 +2,9 @@ class Form::Sales::Questions::Buyer1EthnicBackgroundMixed < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ethnic" @id = "ethnic"
@check_answer_label = "Buyer 1’s ethnic background" @copy_key = "sales.household_characteristics.ethnic.ethnic_background_mixed"
@header = "Which of the following best describes buyer 1’s Mixed or Multiple ethnic groups background?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@hint_text = form.start_year_after_2024? ? "" : "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1 @check_answers_card_number = 1
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end end

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

@ -2,10 +2,8 @@ class Form::Sales::Questions::Buyer1EthnicBackgroundWhite < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ethnic" @id = "ethnic"
@check_answer_label = "Buyer 1’s ethnic background" @copy_key = "sales.household_characteristics.ethnic.ethnic_background_white"
@header = "Which of the following best describes buyer 1’s White background?"
@type = "radio" @type = "radio"
@hint_text = form.start_year_after_2024? ? "" : "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1 @check_answers_card_number = 1
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end end

3
app/models/form/sales/questions/buyer1_ethnic_group.rb

@ -2,11 +2,8 @@ class Form::Sales::Questions::Buyer1EthnicGroup < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ethnic_group" @id = "ethnic_group"
@check_answer_label = "Buyer 1’s ethnic group"
@header = "What is buyer 1’s ethnic group?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@hint_text = form.start_year_after_2024? ? "" : "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1 @check_answers_card_number = 1
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end end

3
app/models/form/sales/questions/buyer1_live_in_property.rb

@ -2,11 +2,8 @@ class Form::Sales::Questions::Buyer1LiveInProperty < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "buy1livein" @id = "buy1livein"
@check_answer_label = "Will buyer 1 live in the property?"
@header = "Will buyer 1 live in the property?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@hint_text = form.start_year_after_2024? ? "" : "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1 @check_answers_card_number = 1
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end end

3
app/models/form/sales/questions/buyer1_nationality.rb

@ -2,10 +2,7 @@ class Form::Sales::Questions::Buyer1Nationality < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "national" @id = "national"
@check_answer_label = "Buyer 1’s nationality"
@header = "What is buyer 1’s nationality?"
@type = "radio" @type = "radio"
@hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = 1 @check_answers_card_number = 1
@inferred_check_answers_value = [{ @inferred_check_answers_value = [{

3
app/models/form/sales/questions/buyer1_working_situation.rb

@ -2,11 +2,8 @@ class Form::Sales::Questions::Buyer1WorkingSituation < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ecstat1" @id = "ecstat1"
@check_answer_label = "Buyer 1's working situation"
@header = "Which of these best describes buyer 1's working situation?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@hint_text = form.start_year_after_2024? ? "" : "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1 @check_answers_card_number = 1
@inferred_check_answers_value = [{ @inferred_check_answers_value = [{
"condition" => { "condition" => {

3
app/models/form/sales/questions/buyer2_age_known.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::Buyer2AgeKnown < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "age2_known" @id = "age2_known"
@check_answer_label = "Buyer 2’s age" @copy_key = "sales.household_characteristics.age2.buyer.age2_known"
@header = "Do you know buyer 2’s age?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@conditional_for = { @conditional_for = {

3
app/models/form/sales/questions/buyer2_ethnic_background_arab.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::Buyer2EthnicBackgroundArab < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ethnicbuy2" @id = "ethnicbuy2"
@check_answer_label = "Buyer 2’s ethnic background" @copy_key = "sales.household_characteristics.ethnicbuy2.ethnic_background_arab"
@header = "Which of the following best describes buyer 2’s Arab background?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2 @check_answers_card_number = 2

3
app/models/form/sales/questions/buyer2_ethnic_background_asian.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::Buyer2EthnicBackgroundAsian < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ethnicbuy2" @id = "ethnicbuy2"
@check_answer_label = "Buyer 2’s ethnic background" @copy_key = "sales.household_characteristics.ethnicbuy2.ethnic_background_asian"
@header = "Which of the following best describes buyer 2’s Asian or Asian British background?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2 @check_answers_card_number = 2

3
app/models/form/sales/questions/buyer2_ethnic_background_black.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::Buyer2EthnicBackgroundBlack < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ethnicbuy2" @id = "ethnicbuy2"
@check_answer_label = "Buyer 2’s ethnic background" @copy_key = "sales.household_characteristics.ethnicbuy2.ethnic_background_black"
@header = "Which of the following best describes buyer 2’s Black, African, Caribbean or Black British background?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2 @check_answers_card_number = 2

3
app/models/form/sales/questions/buyer2_ethnic_background_mixed.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::Buyer2EthnicBackgroundMixed < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ethnicbuy2" @id = "ethnicbuy2"
@check_answer_label = "Buyer 2’s ethnic background" @copy_key = "sales.household_characteristics.ethnicbuy2.ethnic_background_mixed"
@header = "Which of the following best describes buyer 2’s Mixed or Multiple ethnic groups background?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2 @check_answers_card_number = 2

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

@ -2,8 +2,7 @@ class Form::Sales::Questions::Buyer2EthnicBackgroundWhite < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ethnicbuy2" @id = "ethnicbuy2"
@check_answer_label = "Buyer 2’s ethnic background" @copy_key = "sales.household_characteristics.ethnicbuy2.ethnic_background_white"
@header = "Which of the following best describes buyer 2’s White background?"
@type = "radio" @type = "radio"
@check_answers_card_number = 2 @check_answers_card_number = 2
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

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

@ -2,8 +2,6 @@ class Form::Sales::Questions::Buyer2EthnicGroup < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ethnic_group2" @id = "ethnic_group2"
@check_answer_label = "Buyer 2’s ethnic group"
@header = "What is buyer 2’s ethnic group?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2 @check_answers_card_number = 2

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

@ -2,8 +2,6 @@ class Form::Sales::Questions::Buyer2LiveInProperty < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "buy2livein" @id = "buy2livein"
@check_answer_label = "Will buyer 2 live in the property?"
@header = "Will buyer 2 live in the property?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2 @check_answers_card_number = 2

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

@ -2,8 +2,6 @@ class Form::Sales::Questions::Buyer2Nationality < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "nationalbuy2" @id = "nationalbuy2"
@check_answer_label = "Buyer 2’s nationality"
@header = "What is buyer 2’s nationality?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2 @check_answers_card_number = 2

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

@ -2,8 +2,7 @@ class Form::Sales::Questions::Buyer2RelationshipToBuyer1 < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "relat2" @id = "relat2"
@check_answer_label = "Buyer 2's relationship to buyer 1" @copy_key = "sales.household_characteristics.relat2.buyer"
@header = "What is buyer 2's relationship to buyer 1?"
@type = "radio" @type = "radio"
@answer_options = answer_options @answer_options = answer_options
@check_answers_card_number = 2 @check_answers_card_number = 2

3
app/models/form/sales/questions/buyer2_working_situation.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::Buyer2WorkingSituation < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "ecstat2" @id = "ecstat2"
@check_answer_label = "Buyer 2's working situation" @copy_key = "sales.household_characteristics.ecstat2.buyer"
@header = "Which of these best describes buyer 2's working situation?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2 @check_answers_card_number = 2

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

@ -2,7 +2,7 @@ class Form::Sales::Questions::BuyerInterview < ::Form::Question
def initialize(id, hsh, page, joint_purchase:) def initialize(id, hsh, page, joint_purchase:)
super(id, hsh, page) super(id, hsh, page)
@id = "noint" @id = "noint"
@copy_key = "sales.setup.noint.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}" @copy_key = "sales.#{subsection.id}.noint.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

3
app/models/form/sales/questions/buyer_live_in_value_check.rb

@ -2,7 +2,7 @@ class Form::Sales::Questions::BuyerLiveInValueCheck < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@id = "buyer_livein_value_check" @id = "buyer_livein_value_check"
@check_answer_label = "Buyer live in confirmation" @copy_key = "sales.soft_validations.buyer_livein_value_check.buyer#{person_index}"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },
@ -19,6 +19,5 @@ class Form::Sales::Questions::BuyerLiveInValueCheck < ::Form::Question
], ],
} }
@check_answers_card_number = person_index @check_answers_card_number = person_index
@header = "Are you sure this is correct?"
end end
end end

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

@ -2,8 +2,6 @@ class Form::Sales::Questions::BuyerStillServing < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "hhregresstill" @id = "hhregresstill"
@check_answer_label = "Are they still serving in the UK armed forces?"
@header = "Is the buyer still serving in the UK armed forces?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

10
app/models/form/sales/questions/gender_identity1.rb

@ -2,8 +2,6 @@ class Form::Sales::Questions::GenderIdentity1 < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "sex1" @id = "sex1"
@check_answer_label = "Buyer 1’s gender identity"
@header = "Which of these best describes buyer 1’s gender identity?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = 1 @check_answers_card_number = 1
@ -17,13 +15,5 @@ class Form::Sales::Questions::GenderIdentity1 < ::Form::Question
"R" => { "value" => "Prefers not to say" }, "R" => { "value" => "Prefers not to say" },
}.freeze }.freeze
def hint_text
if form.start_year_after_2024?
"This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
else
"Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
end
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 21, 2024 => 23 }.freeze QUESTION_NUMBER_FROM_YEAR = { 2023 => 21, 2024 => 23 }.freeze
end end

9
app/models/form/sales/questions/gender_identity2.rb

@ -2,9 +2,8 @@ class Form::Sales::Questions::GenderIdentity2 < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "sex2" @id = "sex2"
@check_answer_label = "Buyer 2’s gender identity"
@header = "Which of these best describes buyer 2’s gender identity?"
@type = "radio" @type = "radio"
@copy_key = "sales.household_characteristics.sex2.buyer"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2 @check_answers_card_number = 2
@inferred_check_answers_value = [{ @inferred_check_answers_value = [{
@ -23,11 +22,5 @@ class Form::Sales::Questions::GenderIdentity2 < ::Form::Question
"R" => { "value" => "Buyer prefers not to say" }, "R" => { "value" => "Buyer prefers not to say" },
}.freeze }.freeze
def hint_text
return unless form.start_year_after_2024?
"This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 29, 2024 => 31 }.freeze QUESTION_NUMBER_FROM_YEAR = { 2023 => 29, 2024 => 31 }.freeze
end end

3
app/models/form/sales/questions/household_disability.rb

@ -2,11 +2,8 @@ class Form::Sales::Questions::HouseholdDisability < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "disabled" @id = "disabled"
@header = "Does anyone in the household consider themselves to have a disability?"
@check_answer_label = "Does anyone in the household have a disability?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@hint_text = "This includes any long-term health condition that has an impact on the person's day-to-day life"
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end end

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

@ -2,10 +2,8 @@ class Form::Sales::Questions::HouseholdWheelchair < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "wheel" @id = "wheel"
@header = "Does anyone in the household use a wheelchair?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@hint_text = "This can be inside or outside the home"
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end end

3
app/models/form/sales/questions/household_wheelchair_check.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::HouseholdWheelchairCheck < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "wheel_value_check" @id = "wheel_value_check"
@check_answer_label = "Does anyone in the household use a wheelchair?" @copy_key = "sales.soft_validations.wheel_value_check"
@header = "You told us that someone in the household uses a wheelchair."
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },

3
app/models/form/sales/questions/multiple_partners_value_check.rb

@ -2,7 +2,7 @@ class Form::Sales::Questions::MultiplePartnersValueCheck < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@id = "multiple_partners_value_check" @id = "multiple_partners_value_check"
@check_answer_label = "Multiple partners confirmation" @copy_key = "sales.soft_validations.multiple_partners_value_check"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },
@ -19,6 +19,5 @@ class Form::Sales::Questions::MultiplePartnersValueCheck < ::Form::Question
], ],
} }
@check_answers_card_number = person_index @check_answers_card_number = person_index
@header = "Are you sure this is correct?"
end end
end end

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

@ -1,8 +1,6 @@
class Form::Sales::Questions::NationalityAll < ::Form::Question class Form::Sales::Questions::NationalityAll < ::Form::Question
def initialize(id, hsh, page, buyer_index) def initialize(id, hsh, page, buyer_index)
super(id, hsh, page) super(id, hsh, page)
@check_answer_label = "Buyer #{buyer_index}’s nationality"
@header = "Enter a nationality"
@type = "select" @type = "select"
@answer_options = GlobalConstants::COUNTRIES_ANSWER_OPTIONS @answer_options = GlobalConstants::COUNTRIES_ANSWER_OPTIONS
@check_answers_card_number = buyer_index @check_answers_card_number = buyer_index

3
app/models/form/sales/questions/nationality_all_group.rb

@ -1,10 +1,7 @@
class Form::Sales::Questions::NationalityAllGroup < ::Form::Question class Form::Sales::Questions::NationalityAllGroup < ::Form::Question
def initialize(id, hsh, page, buyer_index) def initialize(id, hsh, page, buyer_index)
super(id, hsh, page) super(id, hsh, page)
@check_answer_label = "Buyer #{buyer_index}’s nationality"
@header = "What is buyer #{buyer_index}’s nationality?"
@type = "radio" @type = "radio"
@hint_text = "If buyer #{buyer_index} is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the buyer should decide which country to enter."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = buyer_index @check_answers_card_number = buyer_index
@conditional_for = buyer_index == 1 ? { "nationality_all" => [12] } : { "nationality_all_buyer2" => [12] } @conditional_for = buyer_index == 1 ? { "nationality_all" => [12] } : { "nationality_all_buyer2" => [12] }

3
app/models/form/sales/questions/not_retired_value_check.rb

@ -2,7 +2,7 @@ class Form::Sales::Questions::NotRetiredValueCheck < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@id = "retirement_value_check" @id = "retirement_value_check"
@check_answer_label = "Retirement confirmation" @copy_key = "sales.soft_validations.retirement_value_check.max"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },
@ -19,6 +19,5 @@ class Form::Sales::Questions::NotRetiredValueCheck < ::Form::Question
], ],
} }
@check_answers_card_number = person_index @check_answers_card_number = person_index
@header = "Are you sure this person isn't retired?"
end end
end end

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

@ -2,10 +2,8 @@ class Form::Sales::Questions::NumberOfOthersInProperty < ::Form::Question
def initialize(id, hsh, page, joint_purchase:) def initialize(id, hsh, page, joint_purchase:)
super(id, hsh, page) super(id, hsh, page)
@id = "hholdcount" @id = "hholdcount"
@check_answer_label = "Number of other people living in the property" @copy_key = joint_purchase ? "sales.household_characteristics.hholdcount.joint_purchase" : "sales.household_characteristics.hholdcount.not_joint_purchase"
@header = "Besides the #{'buyer'.pluralize(joint_purchase ? 2 : 1)}, how many other people live or will live in the property?"
@type = "numeric" @type = "numeric"
@hint_text = hint(joint_purchase)
@width = 2 @width = 2
@min = 0 @min = 0
@max = 15 @max = 15
@ -13,15 +11,5 @@ class Form::Sales::Questions::NumberOfOthersInProperty < ::Form::Question
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end end
private
def hint(joint_purchase)
if joint_purchase
"You can provide details for a maximum of 4 other people for a joint purchase."
else
"You can provide details for a maximum of 5 other people if there is only one buyer."
end
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 35, 2024 => 37 }.freeze QUESTION_NUMBER_FROM_YEAR = { 2023 => 35, 2024 => 37 }.freeze
end end

3
app/models/form/sales/questions/old_persons_shared_ownership_value_check.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::OldPersonsSharedOwnershipValueCheck < ::Form::Ques
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "old_persons_shared_ownership_value_check" @id = "old_persons_shared_ownership_value_check"
@check_answer_label = "Shared ownership confirmation" @copy_key = "sales.soft_validations.old_persons_shared_ownership_value_check"
@header = "Are you sure this is correct?"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },

3
app/models/form/sales/questions/partner_under_16_value_check.rb

@ -2,7 +2,7 @@ class Form::Sales::Questions::PartnerUnder16ValueCheck < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@id = "partner_under_16_value_check" @id = "partner_under_16_value_check"
@check_answer_label = "Partner under 16 confirmation" @copy_key = "sales.soft_validations.partner_under_16_value_check"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },
@ -19,6 +19,5 @@ class Form::Sales::Questions::PartnerUnder16ValueCheck < ::Form::Question
], ],
} }
@check_answers_card_number = person_index @check_answers_card_number = person_index
@header = "Are you sure this is correct?"
end end
end end

9
app/models/form/sales/questions/person_age.rb

@ -1,9 +1,8 @@
class Form::Sales::Questions::PersonAge < ::Form::Question class Form::Sales::Questions::PersonAge < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@check_answer_label = "Person #{person_index}’s age"
@header = "Age"
@type = "numeric" @type = "numeric"
@copy_key = person_index == 2 ? "sales.household_characteristics.age2.person.age2" : "sales.household_characteristics.age#{person_index}.age#{person_index}"
@width = 3 @width = 3
@inferred_check_answers_value = [{ @inferred_check_answers_value = [{
"condition" => { "age#{person_index}_known" => 1 }, "condition" => { "age#{person_index}_known" => 1 },
@ -27,10 +26,4 @@ class Form::Sales::Questions::PersonAge < ::Form::Question
base_question_number + (4 * @person_index) base_question_number + (4 * @person_index)
end end
def hint_text
if form.start_year_after_2024?
"Answer 1 for children aged under 1 year old"
end
end
end end

3
app/models/form/sales/questions/person_age_known.rb

@ -1,10 +1,9 @@
class Form::Sales::Questions::PersonAgeKnown < ::Form::Question class Form::Sales::Questions::PersonAgeKnown < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@check_answer_label = "Person #{person_index}’s age known?"
@header = "Do you know person #{person_index}’s age?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@copy_key = person_index == 2 ? "sales.household_characteristics.age2.person.age2_known" : "sales.household_characteristics.age#{person_index}.age#{person_index}_known"
@conditional_for = { @conditional_for = {
"age#{person_index}" => [0], "age#{person_index}" => [0],
} }

9
app/models/form/sales/questions/person_gender_identity.rb

@ -1,9 +1,8 @@
class Form::Sales::Questions::PersonGenderIdentity < ::Form::Question class Form::Sales::Questions::PersonGenderIdentity < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@check_answer_label = "Person #{person_index}’s gender identity"
@header = "Which of these best describes Person #{person_index}’s gender identity?"
@type = "radio" @type = "radio"
@copy_key = "sales.household_characteristics.sex2.person" if person_index == 2
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = person_index @check_answers_card_number = person_index
@inferred_check_answers_value = [{ @inferred_check_answers_value = [{
@ -23,12 +22,6 @@ class Form::Sales::Questions::PersonGenderIdentity < ::Form::Question
"R" => { "value" => "Person prefers not to say" }, "R" => { "value" => "Person prefers not to say" },
}.freeze }.freeze
def hint_text
return unless form.start_year_after_2024?
"This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
end
def question_number def question_number
base_question_number = case form.start_date.year base_question_number = case form.start_date.year
when 2023 when 2023

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

@ -1,8 +1,6 @@
class Form::Sales::Questions::PersonKnown < ::Form::Question class Form::Sales::Questions::PersonKnown < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@check_answer_label = "Details known for person #{person_index}?"
@header = "Do you know the details for person #{person_index}?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = person_index @check_answers_card_number = person_index

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

@ -1,9 +1,8 @@
class Form::Sales::Questions::PersonRelationshipToBuyer1 < ::Form::Question class Form::Sales::Questions::PersonRelationshipToBuyer1 < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@check_answer_label = "Person #{person_index}’s relationship to Buyer 1"
@header = "What is Person #{person_index}’s relationship to Buyer 1?"
@type = "radio" @type = "radio"
@copy_key = "sales.household_characteristics.relat2.person" if person_index == 2
@answer_options = answer_options @answer_options = answer_options
@check_answers_card_number = person_index @check_answers_card_number = person_index
@inferred_check_answers_value = [{ @inferred_check_answers_value = [{

3
app/models/form/sales/questions/person_student_not_child_value_check.rb

@ -2,7 +2,7 @@ class Form::Sales::Questions::PersonStudentNotChildValueCheck < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@id = "student_not_child_value_check" @id = "student_not_child_value_check"
@check_answer_label = "Student not a child confirmation" @copy_key = "sales.soft_validations.student_not_child_value_check"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },
@ -19,6 +19,5 @@ class Form::Sales::Questions::PersonStudentNotChildValueCheck < ::Form::Question
], ],
} }
@check_answers_card_number = person_index @check_answers_card_number = person_index
@header = "Are you sure this person is not a child?"
end end
end end

3
app/models/form/sales/questions/person_working_situation.rb

@ -1,9 +1,8 @@
class Form::Sales::Questions::PersonWorkingSituation < ::Form::Question class Form::Sales::Questions::PersonWorkingSituation < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@check_answer_label = "Person #{person_index}’s working situation"
@header = "Which of these best describes Person #{person_index}’s working situation?"
@type = "radio" @type = "radio"
@copy_key = "sales.household_characteristics.ecstat2.person" if person_index == 2
@check_answers_card_number = person_index @check_answers_card_number = person_index
@inferred_check_answers_value = [{ @inferred_check_answers_value = [{
"condition" => { "condition" => {

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

@ -2,7 +2,7 @@ class Form::Sales::Questions::PrivacyNotice < ::Form::Question
def initialize(id, hsh, page, joint_purchase:) def initialize(id, hsh, page, joint_purchase:)
super(id, hsh, page) super(id, hsh, page)
@id = "privacynotice" @id = "privacynotice"
@copy_key = "sales.setup.privacynotice.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}" @copy_key = "sales.#{subsection.id}.privacynotice.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}"
@type = "checkbox" @type = "checkbox"
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
@joint_purchase = joint_purchase @joint_purchase = joint_purchase

3
app/models/form/sales/questions/retirement_value_check.rb

@ -2,7 +2,7 @@ class Form::Sales::Questions::RetirementValueCheck < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@id = "retirement_value_check" @id = "retirement_value_check"
@check_answer_label = "Retirement confirmation" @copy_key = "sales.soft_validations.retirement_value_check.min"
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },
@ -19,6 +19,5 @@ class Form::Sales::Questions::RetirementValueCheck < ::Form::Question
], ],
} }
@check_answers_card_number = person_index @check_answers_card_number = person_index
@header = "Are you sure this person is retired?"
end end
end end

2
app/models/forms/bulk_upload_lettings/checking_file.rb

@ -21,7 +21,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def save! def save!

2
app/models/forms/bulk_upload_lettings/needstype.rb

@ -28,7 +28,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def save! def save!

2
app/models/forms/bulk_upload_lettings/prepare_your_file.rb

@ -41,7 +41,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def save! def save!

2
app/models/forms/bulk_upload_lettings/upload_your_file.rb

@ -25,7 +25,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def next_path def next_path

2
app/models/forms/bulk_upload_lettings/year.rb

@ -16,7 +16,7 @@ module Forms
def options def options
possible_years.map do |year| possible_years.map do |year|
OpenStruct.new(id: year, name: "#{year}/#{year + 1}") OpenStruct.new(id: year, name: "#{year} to #{year + 1}")
end end
end end

2
app/models/forms/bulk_upload_sales/checking_file.rb

@ -21,7 +21,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def save! def save!

2
app/models/forms/bulk_upload_sales/prepare_your_file.rb

@ -40,7 +40,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def save! def save!

2
app/models/forms/bulk_upload_sales/upload_your_file.rb

@ -24,7 +24,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def next_path def next_path

2
app/models/forms/bulk_upload_sales/year.rb

@ -16,7 +16,7 @@ module Forms
def options def options
possible_years.map do |year| possible_years.map do |year|
OpenStruct.new(id: year, name: "#{year}/#{year + 1}") OpenStruct.new(id: year, name: "#{year} to #{year + 1}")
end end
end end

6
app/models/user.rb

@ -212,7 +212,7 @@ class User < ApplicationRecord
end end
def assignable_roles def assignable_roles
if Rails.env.staging? && Rails.application.credentials[:staging_role_update_email_allowlist].include?(email.split("@").last.downcase) if Rails.env.staging? && in_staging_role_update_email_allowlist?
return ROLES return ROLES
end end
@ -222,6 +222,10 @@ class User < ApplicationRecord
ROLES.except(:support) ROLES.except(:support)
end end
def in_staging_role_update_email_allowlist?
Rails.application.credentials[:staging_role_update_email_allowlist].include?(email.split("@").last.downcase)
end
def logs_filters(specific_org: false) def logs_filters(specific_org: false)
if (support? && !specific_org) || organisation.has_managing_agents? || organisation.has_stock_owners? if (support? && !specific_org) || organisation.has_managing_agents? || organisation.has_stock_owners?
%w[years status needstypes assigned_to user owning_organisation managing_organisation bulk_upload_id user_text_search owning_organisation_text_search managing_organisation_text_search] %w[years status needstypes assigned_to user owning_organisation managing_organisation bulk_upload_id user_text_search owning_organisation_text_search managing_organisation_text_search]

10
app/models/validations/sales/setup_validations.rb

@ -80,18 +80,18 @@ private
if FormHandler.instance.sales_in_crossover_period? if FormHandler.instance.sales_in_crossover_period?
I18n.t( I18n.t(
"validations.sales.setup.saledate.must_be_within.previous_and_current_collection_year", "validations.sales.setup.saledate.must_be_within.previous_and_current_collection_year",
previous_start_year_short: previous_collection_start_date.strftime("%y"), previous_start_year_short: previous_collection_start_date.strftime("%Y"),
previous_end_year_short: previous_collection_end_date.strftime("%y"), previous_end_year_short: previous_collection_end_date.strftime("%Y"),
previous_start_year_long: previous_collection_start_date.strftime("#{previous_collection_start_date.day.ordinalize} %B %Y"), previous_start_year_long: previous_collection_start_date.strftime("#{previous_collection_start_date.day.ordinalize} %B %Y"),
current_end_year_short: current_collection_end_date.strftime("%y"), current_end_year_short: current_collection_end_date.strftime("%Y"),
current_end_year_long: current_collection_end_date.strftime("#{current_collection_end_date.day.ordinalize} %B %Y"), current_end_year_long: current_collection_end_date.strftime("#{current_collection_end_date.day.ordinalize} %B %Y"),
) )
else else
I18n.t( I18n.t(
"validations.sales.setup.saledate.must_be_within.current_collection_year", "validations.sales.setup.saledate.must_be_within.current_collection_year",
current_start_year_short: current_collection_start_date.strftime("%y"), current_start_year_short: current_collection_start_date.strftime("%Y"),
current_start_year_long: current_collection_start_date.strftime("#{current_collection_start_date.day.ordinalize} %B %Y"), current_start_year_long: current_collection_start_date.strftime("#{current_collection_start_date.day.ordinalize} %B %Y"),
current_end_year_short: current_collection_end_date.strftime("%y"), current_end_year_short: current_collection_end_date.strftime("%Y"),
current_end_year_long: current_collection_end_date.strftime("#{current_collection_end_date.day.ordinalize} %B %Y"), current_end_year_long: current_collection_end_date.strftime("#{current_collection_end_date.day.ordinalize} %B %Y"),
) )
end end

10
app/models/validations/setup_validations.rb

@ -130,17 +130,17 @@ private
if FormHandler.instance.lettings_in_crossover_period? if FormHandler.instance.lettings_in_crossover_period?
I18n.t( I18n.t(
"validations.setup.startdate.previous_and_current_collection_year", "validations.setup.startdate.previous_and_current_collection_year",
previous_start_year_short: previous_collection_start_date.strftime("%y"), previous_start_year_short: previous_collection_start_date.strftime("%Y"),
previous_end_year_short: previous_collection_end_date.strftime("%y"), previous_end_year_short: previous_collection_end_date.strftime("%Y"),
previous_start_year_long: previous_collection_start_date.strftime("#{previous_collection_start_date.day.ordinalize} %B %Y"), previous_start_year_long: previous_collection_start_date.strftime("#{previous_collection_start_date.day.ordinalize} %B %Y"),
current_end_year_short: current_collection_end_date.strftime("%y"), current_end_year_short: current_collection_end_date.strftime("%Y"),
current_end_year_long:, current_end_year_long:,
) )
else else
I18n.t( I18n.t(
"validations.setup.startdate.current_collection_year", "validations.setup.startdate.current_collection_year",
current_start_year_short: current_collection_start_date.strftime("%y"), current_start_year_short: current_collection_start_date.strftime("%Y"),
current_end_year_short: current_collection_end_date.strftime("%y"), current_end_year_short: current_collection_end_date.strftime("%Y"),
current_start_year_long: current_collection_start_date.strftime("#{current_collection_start_date.day.ordinalize} %B %Y"), current_start_year_long: current_collection_start_date.strftime("#{current_collection_start_date.day.ordinalize} %B %Y"),
current_end_year_long:, current_end_year_long:,
) )

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save