Browse Source

Merge branch 'main' into CLDC-3688-extract-financial-validations

pull/2740/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
37606e63f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      app/components/create_log_actions_component.html.erb
  2. 2
      app/constants/global_constants.rb
  3. 6
      app/helpers/filters_helper.rb
  4. 3
      app/helpers/formatting_helper.rb
  5. 1
      app/helpers/interruption_screen_helper.rb
  6. 2
      app/helpers/merge_requests_helper.rb
  7. 2
      app/models/bulk_upload.rb
  8. 4
      app/models/derived_variables/lettings_log_variables.rb
  9. 4
      app/models/derived_variables/sales_log_variables.rb
  10. 6
      app/models/form.rb
  11. 2
      app/models/form/lettings/pages/address.rb
  12. 2
      app/models/form/lettings/pages/address_fallback.rb
  13. 2
      app/models/form/lettings/pages/address_matcher.rb
  14. 8
      app/models/form/lettings/pages/care_home_charges_value_check.rb
  15. 1
      app/models/form/lettings/pages/care_home_weekly.rb
  16. 9
      app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_age_value_check.rb
  17. 9
      app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check.rb
  18. 9
      app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_value_check.rb
  19. 21
      app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check.rb
  20. 22
      app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check.rb
  21. 9
      app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_value_check.rb
  22. 2
      app/models/form/lettings/pages/income_amount.rb
  23. 1
      app/models/form/lettings/pages/income_known.rb
  24. 1
      app/models/form/lettings/pages/lead_tenant_age.rb
  25. 1
      app/models/form/lettings/pages/lead_tenant_ethnic_background_arab.rb
  26. 1
      app/models/form/lettings/pages/lead_tenant_ethnic_background_asian.rb
  27. 1
      app/models/form/lettings/pages/lead_tenant_ethnic_background_black.rb
  28. 1
      app/models/form/lettings/pages/lead_tenant_ethnic_background_mixed.rb
  29. 1
      app/models/form/lettings/pages/lead_tenant_ethnic_background_white.rb
  30. 3
      app/models/form/lettings/pages/lead_tenant_nationality.rb
  31. 6
      app/models/form/lettings/pages/lead_tenant_over_retirement_value_check.rb
  32. 8
      app/models/form/lettings/pages/lead_tenant_under_retirement_value_check.rb
  33. 24
      app/models/form/lettings/pages/max_rent_value_check.rb
  34. 24
      app/models/form/lettings/pages/min_rent_value_check.rb
  35. 8
      app/models/form/lettings/pages/multiple_partners_value_check.rb
  36. 5
      app/models/form/lettings/pages/net_income_value_check.rb
  37. 9
      app/models/form/lettings/pages/no_females_pregnant_household_lead_age_value_check.rb
  38. 9
      app/models/form/lettings/pages/no_females_pregnant_household_lead_hhmemb_value_check.rb
  39. 9
      app/models/form/lettings/pages/no_females_pregnant_household_lead_value_check.rb
  40. 9
      app/models/form/lettings/pages/no_females_pregnant_household_person_age_value_check.rb
  41. 9
      app/models/form/lettings/pages/no_females_pregnant_household_person_value_check.rb
  42. 9
      app/models/form/lettings/pages/no_females_pregnant_household_value_check.rb
  43. 8
      app/models/form/lettings/pages/partner_under_16_value_check.rb
  44. 9
      app/models/form/lettings/pages/person_age.rb
  45. 1
      app/models/form/lettings/pages/person_known.rb
  46. 6
      app/models/form/lettings/pages/person_over_retirement_value_check.rb
  47. 8
      app/models/form/lettings/pages/person_under_retirement_value_check.rb
  48. 1
      app/models/form/lettings/pages/previous_housing_situation.rb
  49. 1
      app/models/form/lettings/pages/previous_housing_situation_renewal.rb
  50. 1
      app/models/form/lettings/pages/previous_local_authority.rb
  51. 1
      app/models/form/lettings/pages/previous_postcode.rb
  52. 4
      app/models/form/lettings/pages/property_local_authority.rb
  53. 1
      app/models/form/lettings/pages/property_major_repairs.rb
  54. 5
      app/models/form/lettings/pages/property_major_repairs_value_check.rb
  55. 14
      app/models/form/lettings/pages/property_postcode.rb
  56. 8
      app/models/form/lettings/pages/pscharge_value_check.rb
  57. 1
      app/models/form/lettings/pages/reason_for_leaving_last_settled_home.rb
  58. 1
      app/models/form/lettings/pages/reason_for_leaving_last_settled_home_renewal.rb
  59. 5
      app/models/form/lettings/pages/reasonother_value_check.rb
  60. 1
      app/models/form/lettings/pages/referral.rb
  61. 1
      app/models/form/lettings/pages/referral_prp.rb
  62. 1
      app/models/form/lettings/pages/referral_supported_housing.rb
  63. 1
      app/models/form/lettings/pages/referral_supported_housing_prp.rb
  64. 5
      app/models/form/lettings/pages/referral_value_check.rb
  65. 2
      app/models/form/lettings/pages/rent_4_weekly.rb
  66. 2
      app/models/form/lettings/pages/rent_bi_weekly.rb
  67. 2
      app/models/form/lettings/pages/rent_monthly.rb
  68. 36
      app/models/form/lettings/pages/rent_value_check.rb
  69. 2
      app/models/form/lettings/pages/rent_weekly.rb
  70. 8
      app/models/form/lettings/pages/scharge_value_check.rb
  71. 1
      app/models/form/lettings/pages/starter_tenancy_type.rb
  72. 8
      app/models/form/lettings/pages/supcharg_value_check.rb
  73. 1
      app/models/form/lettings/pages/tenancy_length.rb
  74. 1
      app/models/form/lettings/pages/tenancy_length_affordable_rent.rb
  75. 1
      app/models/form/lettings/pages/tenancy_length_intermediate_rent.rb
  76. 1
      app/models/form/lettings/pages/tenancy_length_periodic.rb
  77. 1
      app/models/form/lettings/pages/tenancy_type.rb
  78. 5
      app/models/form/lettings/pages/uprn.rb
  79. 1
      app/models/form/lettings/pages/uprn_selection.rb
  80. 1
      app/models/form/lettings/pages/void_date.rb
  81. 5
      app/models/form/lettings/pages/void_date_value_check.rb
  82. 3
      app/models/form/lettings/questions/address_line1.rb
  83. 3
      app/models/form/lettings/questions/address_line1_for_address_matcher.rb
  84. 2
      app/models/form/lettings/questions/address_line2.rb
  85. 10
      app/models/form/lettings/questions/age.rb
  86. 3
      app/models/form/lettings/questions/age1.rb
  87. 11
      app/models/form/lettings/questions/age1_known.rb
  88. 4
      app/models/form/lettings/questions/age_known.rb
  89. 6
      app/models/form/lettings/questions/beds.rb
  90. 3
      app/models/form/lettings/questions/benefits.rb
  91. 4
      app/models/form/lettings/questions/brent_4_weekly.rb
  92. 4
      app/models/form/lettings/questions/brent_bi_weekly.rb
  93. 4
      app/models/form/lettings/questions/brent_monthly.rb
  94. 4
      app/models/form/lettings/questions/brent_weekly.rb
  95. 3
      app/models/form/lettings/questions/builtype.rb
  96. 3
      app/models/form/lettings/questions/care_home_charges_value_check.rb
  97. 4
      app/models/form/lettings/questions/chcharge_4_weekly.rb
  98. 4
      app/models/form/lettings/questions/chcharge_bi_weekly.rb
  99. 4
      app/models/form/lettings/questions/chcharge_monthly.rb
  100. 4
      app/models/form/lettings/questions/chcharge_weekly.rb
  101. Some files were not shown because too many files have changed in this diff Show More

6
app/components/create_log_actions_component.html.erb

@ -1,11 +1,11 @@
<div class="govuk-button-group app-filter-toggle <%= "govuk-!-margin-bottom-6" if display_actions? %>">
<% if display_actions? %> <% if display_actions? %>
<div class="govuk-button-group app-filter-toggle govuk-!-margin-bottom-6"> <%= govuk_button_to create_button_copy, create_button_href, class: "govuk-!-margin-right-3" %>
<%= govuk_button_to create_button_copy, create_button_href, class: "govuk-!-margin-right-6" %>
<% unless user.support? %> <% unless user.support? %>
<%= govuk_button_link_to upload_button_copy, upload_button_href, secondary: true %> <%= govuk_button_link_to upload_button_copy, upload_button_href, secondary: true %>
<% end %> <% end %>
<% if user.support? %> <% if user.support? %>
<%= govuk_button_link_to view_uploads_button_copy, view_uploads_button_href, secondary: true %> <%= govuk_button_link_to view_uploads_button_copy, view_uploads_button_href, secondary: true %>
<% end %> <% end %>
</div>
<% end %> <% end %>
</div>

2
app/constants/global_constants.rb

@ -1,5 +1,5 @@
module GlobalConstants module GlobalConstants
HELPDESK_URL = "https://dluhcdigital.atlassian.net/servicedesk/customer/portal/6/group/11".freeze HELPDESK_URL = "https://mhclgdigital.atlassian.net/servicedesk/customer/portal/6/group/11".freeze
COUNTRIES_ANSWER_OPTIONS = { COUNTRIES_ANSWER_OPTIONS = {
"" => "Select an option", "" => "Select an option",

6
app/helpers/filters_helper.rb

@ -143,7 +143,11 @@ module FiltersHelper
} }
if FormHandler.instance.in_crossover_period? if FormHandler.instance.in_crossover_period?
return years.merge({ archived_collection_start_year.to_s => year_combo(archived_collection_start_year) }) years = years.merge({ archived_collection_start_year.to_s => year_combo(archived_collection_start_year) })
end
if FeatureToggle.allow_future_form_use?
years = { next_collection_start_year.to_s => year_combo(next_collection_start_year) }.merge(years)
end end
years years

3
app/helpers/formatting_helper.rb

@ -2,7 +2,8 @@ module FormattingHelper
def format_ending(text) def format_ending(text)
return text if text.blank? 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) ensure_sentence_ending(modified_text)
end end

1
app/helpers/interruption_screen_helper.rb

@ -1,6 +1,7 @@
module InterruptionScreenHelper module InterruptionScreenHelper
def display_informative_text(informative_text, log) def display_informative_text(informative_text, log)
return informative_text if informative_text.is_a? String return informative_text if informative_text.is_a? String
return "" if informative_text.blank?
return "" unless informative_text["arguments"] return "" unless informative_text["arguments"]
translation_params = {} translation_params = {}

2
app/helpers/merge_requests_helper.rb

@ -9,7 +9,7 @@ module MergeRequestsHelper
def request_details(merge_request) def request_details(merge_request)
[ [
{ label: "Requester", value: display_value_or_placeholder(merge_request.requester&.name) }, { label: "Requester", value: display_value_or_placeholder(merge_request.requester&.name) },
{ label: "Helpdesk ticket", value: merge_request.helpdesk_ticket.present? ? link_to("#{merge_request.helpdesk_ticket} (opens in a new tab)", "https://dluhcdigital.atlassian.net/browse/#{merge_request.helpdesk_ticket}", target: "_blank", rel: "noopener noreferrer") : display_value_or_placeholder(nil), action: merge_request_action(merge_request, "helpdesk_ticket") }, { label: "Helpdesk ticket", value: merge_request.helpdesk_ticket.present? ? link_to("#{merge_request.helpdesk_ticket} (opens in a new tab)", "https://mhclgdigital.atlassian.net/browse/#{merge_request.helpdesk_ticket}", target: "_blank", rel: "noopener noreferrer") : display_value_or_placeholder(nil), action: merge_request_action(merge_request, "helpdesk_ticket") },
{ label: "Status", value: status_tag(merge_request.status) }, { label: "Status", value: status_tag(merge_request.status) },
] ]
end end

2
app/models/bulk_upload.rb

@ -32,6 +32,8 @@ class BulkUpload < ApplicationRecord
scope :filter_by_user, ->(user_id, _user = nil) { user_id.present? ? where(user_id:) : all } scope :filter_by_user, ->(user_id, _user = nil) { user_id.present? ? where(user_id:) : all }
scope :filter_by_uploading_organisation, ->(organisation_id, _user = nil) { where(organisation_id:) } scope :filter_by_uploading_organisation, ->(organisation_id, _user = nil) { where(organisation_id:) }
has_paper_trail
def completed? def completed?
incomplete_logs = logs.where.not(status: "completed") incomplete_logs = logs.where.not(status: "completed")
!incomplete_logs.exists? !incomplete_logs.exists?

4
app/models/derived_variables/lettings_log_variables.rb

@ -65,7 +65,7 @@ module DerivedVariables::LettingsLogVariables
self.has_benefits = get_has_benefits self.has_benefits = get_has_benefits
self.tshortfall_known = 0 if tshortfall self.tshortfall_known = 0 if tshortfall
self.nocharge = household_charge&.zero? ? 1 : 0 self.nocharge = household_charge&.zero? ? 1 : 0
if form.start_year_after_2024? && is_bedsit? if form.start_year_2024_or_later? && is_bedsit?
self.beds = 1 self.beds = 1
end end
@ -186,7 +186,7 @@ private
self.wchair = nil self.wchair = nil
self.location_id = nil self.location_id = nil
end end
if form.start_year_after_2024? && (unittype_gn_changed? && unittype_gn_was == 2) if form.start_year_2024_or_later? && (unittype_gn_changed? && unittype_gn_was == 2)
self.beds = nil self.beds = nil
end end
end end

4
app/models/derived_variables/sales_log_variables.rb

@ -29,7 +29,7 @@ module DerivedVariables::SalesLogVariables
end end
end end
if saledate && form.start_year_after_2024? && discounted_ownership_sale? if saledate && form.start_year_2024_or_later? && discounted_ownership_sale?
self.ppostcode_full = postcode_full self.ppostcode_full = postcode_full
self.ppcodenk = pcodenk self.ppcodenk = pcodenk
self.prevloc = la self.prevloc = la
@ -44,7 +44,7 @@ module DerivedVariables::SalesLogVariables
self.hhmemb = number_of_household_members self.hhmemb = number_of_household_members
self.hhtype = household_type self.hhtype = household_type
if saledate && form.start_year_after_2024? if saledate && form.start_year_2024_or_later?
self.soctenant = soctenant_from_prevten_values self.soctenant = soctenant_from_prevten_values
child_under_16_constraints! child_under_16_constraints!
end end

6
app/models/form.rb

@ -334,7 +334,11 @@ class Form
type == "sales" || (start_year && start_year.to_i > 2022) type == "sales" || (start_year && start_year.to_i > 2022)
end end
def start_year_after_2024? def start_year_2024_or_later?
start_date && start_date.year >= 2024 start_date && start_date.year >= 2024
end end
def start_year_2025_or_later?
start_date && start_date.year >= 2025
end
end end

2
app/models/form/lettings/pages/address.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::Address < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "address" @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 = "lettings.property_information.address"
@depends_on = [ @depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil }, { "is_supported_housing?" => false, "uprn_known" => nil },
{ "is_supported_housing?" => false, "uprn_known" => 0 }, { "is_supported_housing?" => false, "uprn_known" => 0 },

2
app/models/form/lettings/pages/address_fallback.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::AddressFallback < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "address" @id = "address"
@header = "Q12 - What is the property's address?" @copy_key = "lettings.property_information.address"
@depends_on = [ @depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil, "uprn_selection" => "uprn_not_listed" }, { "is_supported_housing?" => false, "uprn_known" => nil, "uprn_selection" => "uprn_not_listed" },
{ "is_supported_housing?" => false, "uprn_known" => 0, "uprn_selection" => "uprn_not_listed" }, { "is_supported_housing?" => false, "uprn_known" => 0, "uprn_selection" => "uprn_not_listed" },

2
app/models/form/lettings/pages/address_matcher.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::AddressMatcher < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "address_matcher" @id = "address_matcher"
@header = "Find an address" @copy_key = "lettings.property_information.address_matcher"
@depends_on = [ @depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil }, { "is_supported_housing?" => false, "uprn_known" => nil },
{ "is_supported_housing?" => false, "uprn_known" => 0 }, { "is_supported_housing?" => false, "uprn_known" => 0 },

8
app/models/form/lettings/pages/care_home_charges_value_check.rb

@ -2,11 +2,15 @@ class Form::Lettings::Pages::CareHomeChargesValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "care_home_charges_value_check" @id = "care_home_charges_value_check"
@copy_key = "lettings.soft_validations.care_home_charges_value_check"
@depends_on = [{ "care_home_charge_expected_not_provided?" => true }] @depends_on = [{ "care_home_charge_expected_not_provided?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.care_home_charges.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
}
@informative_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
} }
@informative_text = ""
end end
def questions def questions

1
app/models/form/lettings/pages/care_home_weekly.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::CareHomeWeekly < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "care_home_weekly" @id = "care_home_weekly"
@copy_key = "lettings.income_and_benefits.care_home"
@depends_on = [ @depends_on = [
{ "rent_and_charges_paid_weekly?" => true, "is_supported_housing?" => true, "household_charge" => 0 }, { "rent_and_charges_paid_weekly?" => true, "is_supported_housing?" => true, "household_charge" => 0 },
{ "rent_and_charges_paid_weekly?" => true, "is_supported_housing?" => true, "household_charge" => nil }, { "rent_and_charges_paid_weekly?" => true, "is_supported_housing?" => true, "household_charge" => nil },

9
app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_age_value_check.rb

@ -2,14 +2,15 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadAgeValu
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super(id, hsh, subsection) super(id, hsh, subsection)
@id = "females_in_soft_age_range_in_pregnant_household_lead_age_value_check" @id = "females_in_soft_age_range_in_pregnant_household_lead_age_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check"
@depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }] @depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.pregnancy.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
end end

9
app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check.rb

@ -2,14 +2,15 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadHhmembV
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super(id, hsh, subsection) super(id, hsh, subsection)
@id = "females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check" @id = "females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check"
@depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }] @depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.pregnancy.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
end end

9
app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_value_check.rb

@ -2,14 +2,15 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadValueCh
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "females_in_soft_age_range_in_pregnant_household_lead_value_check" @id = "females_in_soft_age_range_in_pregnant_household_lead_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check"
@depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }] @depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.pregnancy.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
end end

21
app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonAgeVa
def initialize(id, hsh, subsection, person_index:) def initialize(id, hsh, subsection, person_index:)
super(id, hsh, subsection) super(id, hsh, subsection)
@id = "females_in_soft_age_range_in_pregnant_household_person_#{person_index}_age_value_check" @id = "females_in_soft_age_range_in_pregnant_household_person_#{person_index}_age_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check"
@depends_on = [ @depends_on = [
{ {
"female_in_pregnant_household_in_soft_validation_range?" => true, "female_in_pregnant_household_in_soft_validation_range?" => true,
@ -9,24 +10,12 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonAgeVa
}, },
] ]
@title_text = { @title_text = {
"translation" => "soft_validations.pregnancy.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [],
{
"key" => "sex1",
"label" => true,
"i18n_template" => "sex1",
},
],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [ "arguments" => [],
{
"key" => "sex1",
"label" => true,
"i18n_template" => "sex1",
},
],
} }
@person_index = person_index @person_index = person_index
end end

22
app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check.rb

@ -2,6 +2,8 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValue
def initialize(id, hsh, subsection, person_index:) def initialize(id, hsh, subsection, person_index:)
super(id, hsh, subsection) super(id, hsh, subsection)
@id = "females_in_soft_age_range_in_pregnant_household_person_#{person_index}_value_check" @id = "females_in_soft_age_range_in_pregnant_household_person_#{person_index}_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check"
@depends_on = [ @depends_on = [
{ {
"female_in_pregnant_household_in_soft_validation_range?" => true, "female_in_pregnant_household_in_soft_validation_range?" => true,
@ -9,24 +11,12 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValue
}, },
] ]
@title_text = { @title_text = {
"translation" => "soft_validations.pregnancy.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [],
{
"key" => "sex1",
"label" => true,
"i18n_template" => "sex1",
},
],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [ "arguments" => [],
{
"key" => "sex1",
"label" => true,
"i18n_template" => "sex1",
},
],
} }
@person_index = person_index @person_index = person_index
end end

9
app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_value_check.rb

@ -2,14 +2,15 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdValueCheck
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "females_in_soft_age_range_in_pregnant_household_value_check" @id = "females_in_soft_age_range_in_pregnant_household_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check"
@depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }] @depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.pregnancy.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.pregnancy.females_not_in_soft_age_range", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
end end

2
app/models/form/lettings/pages/income_amount.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::IncomeAmount < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "income_amount" @id = "income_amount"
@header = "Total household income" @copy_key = "lettings.income_and_benefits.income_amount"
@depends_on = [{ "net_income_known" => 0 }] @depends_on = [{ "net_income_known" => 0 }]
end end

1
app/models/form/lettings/pages/income_known.rb

@ -2,7 +2,6 @@ class Form::Lettings::Pages::IncomeKnown < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "income_known" @id = "income_known"
@header = "Household’s combined income after tax"
end end
def questions def questions

1
app/models/form/lettings/pages/lead_tenant_age.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::LeadTenantAge < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "lead_tenant_age" @id = "lead_tenant_age"
@copy_key = "lettings.household_characteristics.age1"
@depends_on = [{ "declaration" => 1 }] @depends_on = [{ "declaration" => 1 }]
end end

1
app/models/form/lettings/pages/lead_tenant_ethnic_background_arab.rb

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

1
app/models/form/lettings/pages/lead_tenant_ethnic_background_asian.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::LeadTenantEthnicBackgroundAsian < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "lead_tenant_ethnic_background_asian" @id = "lead_tenant_ethnic_background_asian"
@copy_key = "lettings.household_characteristics.ethnic.ethnic_background_asian"
@depends_on = [{ "ethnic_group" => 2 }] @depends_on = [{ "ethnic_group" => 2 }]
end end

1
app/models/form/lettings/pages/lead_tenant_ethnic_background_black.rb

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

1
app/models/form/lettings/pages/lead_tenant_ethnic_background_mixed.rb

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

1
app/models/form/lettings/pages/lead_tenant_ethnic_background_white.rb

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

3
app/models/form/lettings/pages/lead_tenant_nationality.rb

@ -2,11 +2,12 @@ class Form::Lettings::Pages::LeadTenantNationality < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "lead_tenant_nationality" @id = "lead_tenant_nationality"
@copy_key = "lettings.household_characteristics.#{form.start_year_2024_or_later? ? 'nationality_all' : 'national'}"
@depends_on = [{ "declaration" => 1 }] @depends_on = [{ "declaration" => 1 }]
end end
def questions def questions
@questions ||= if form.start_year_after_2024? @questions ||= if form.start_year_2024_or_later?
[ [
Form::Lettings::Questions::NationalityAllGroup.new(nil, nil, self), Form::Lettings::Questions::NationalityAllGroup.new(nil, nil, self),
Form::Lettings::Questions::NationalityAll.new(nil, nil, self), Form::Lettings::Questions::NationalityAll.new(nil, nil, self),

6
app/models/form/lettings/pages/lead_tenant_over_retirement_value_check.rb

@ -2,11 +2,13 @@ class Form::Lettings::Pages::LeadTenantOverRetirementValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@depends_on = [{ "person_1_not_retired_over_soft_max_age?" => true }] @depends_on = [{ "person_1_not_retired_over_soft_max_age?" => true }]
@copy_key = "lettings.soft_validations.retirement_value_check"
@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

8
app/models/form/lettings/pages/lead_tenant_under_retirement_value_check.rb

@ -2,8 +2,9 @@ class Form::Lettings::Pages::LeadTenantUnderRetirementValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@depends_on = [{ "person_1_retired_under_soft_min_age?" => true }] @depends_on = [{ "person_1_retired_under_soft_min_age?" => true }]
@copy_key = "lettings.soft_validations.no_retirement_value_check"
@title_text = { @title_text = {
"translation" => "soft_validations.retirement.min.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "age1", "key" => "age1",
@ -12,7 +13,10 @@ class Form::Lettings::Pages::LeadTenantUnderRetirementValueCheck < ::Form::Page
}, },
], ],
} }
@informative_text = {} @informative_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
}
end end
def questions def questions

24
app/models/form/lettings/pages/max_rent_value_check.rb

@ -1,24 +0,0 @@
class Form::Lettings::Pages::MaxRentValueCheck < ::Form::Page
def initialize(id, hsh, subsection, check_answers_card_number: nil)
super(id, hsh, subsection)
@depends_on = [{ "rent_in_soft_max_range?" => true }]
@title_text = {
"translation" => "soft_validations.rent.outside_range_title",
"arguments" => [{
"key" => "brent",
"label" => true,
"i18n_template" => "brent",
}],
}
@informative_text = I18n.t("soft_validations.rent.informative_text", higher_or_lower: "higher")
@check_answers_card_number = check_answers_card_number
end
def questions
@questions ||= [Form::Lettings::Questions::MaxRentValueCheck.new(nil, nil, self, check_answers_card_number: @check_answers_card_number)]
end
def interruption_screen_question_ids
%w[brent period startdate uprn postcode_full la beds rent_type needstype]
end
end

24
app/models/form/lettings/pages/min_rent_value_check.rb

@ -1,24 +0,0 @@
class Form::Lettings::Pages::MinRentValueCheck < ::Form::Page
def initialize(id, hsh, subsection, check_answers_card_number: nil)
super(id, hsh, subsection)
@depends_on = [{ "rent_in_soft_min_range?" => true }]
@title_text = {
"translation" => "soft_validations.rent.outside_range_title",
"arguments" => [{
"key" => "brent",
"label" => true,
"i18n_template" => "brent",
}],
}
@informative_text = I18n.t("soft_validations.rent.informative_text", higher_or_lower: "lower")
@check_answers_card_number = check_answers_card_number
end
def questions
@questions ||= [Form::Lettings::Questions::MinRentValueCheck.new(nil, nil, self, check_answers_card_number: @check_answers_card_number)]
end
def interruption_screen_question_ids
%w[brent period startdate uprn postcode_full la beds rent_type needstype]
end
end

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

@ -6,12 +6,16 @@ class Form::Lettings::Pages::MultiplePartnersValueCheck < Form::Page
"multiple_partners?" => true, "multiple_partners?" => true,
}, },
] ]
@copy_key = "lettings.soft_validations.multiple_partners_value_check"
@person_index = person_index @person_index = person_index
@title_text = { @title_text = {
"translation" => "soft_validations.multiple_partners_lettings.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

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

@ -2,9 +2,10 @@ class Form::Lettings::Pages::NetIncomeValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "net_income_value_check" @id = "net_income_value_check"
@copy_key = "lettings.soft_validations.net_income_value_check"
@depends_on = [{ "net_income_soft_validation_triggered?" => true }] @depends_on = [{ "net_income_soft_validation_triggered?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.net_income.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [ "arguments" => [
{ {
"key" => "incfreq", "key" => "incfreq",
@ -20,7 +21,7 @@ class Form::Lettings::Pages::NetIncomeValueCheck < ::Form::Page
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.net_income.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [ "arguments" => [
{ {
"key" => "net_income_higher_or_lower_text", "key" => "net_income_higher_or_lower_text",

9
app/models/form/lettings/pages/no_females_pregnant_household_lead_age_value_check.rb

@ -2,14 +2,15 @@ class Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadAgeValueCheck < ::For
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super(id, hsh, subsection) super(id, hsh, subsection)
@id = "no_females_pregnant_household_lead_age_value_check" @id = "no_females_pregnant_household_lead_age_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check"
@depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true }] @depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.pregnancy.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.pregnancy.all_male_tenants", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
end end

9
app/models/form/lettings/pages/no_females_pregnant_household_lead_hhmemb_value_check.rb

@ -2,14 +2,15 @@ class Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadHhmembValueCheck < ::
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "no_females_pregnant_household_lead_hhmemb_value_check" @id = "no_females_pregnant_household_lead_hhmemb_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check"
@depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true }] @depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.pregnancy.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.pregnancy.all_male_tenants", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
end end

9
app/models/form/lettings/pages/no_females_pregnant_household_lead_value_check.rb

@ -2,14 +2,15 @@ class Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadValueCheck < ::Form::
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "no_females_pregnant_household_lead_value_check" @id = "no_females_pregnant_household_lead_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check"
@depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true }] @depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.pregnancy.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.pregnancy.all_male_tenants", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
end end

9
app/models/form/lettings/pages/no_females_pregnant_household_person_age_value_check.rb

@ -2,14 +2,15 @@ class Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck < ::F
def initialize(id, hsh, subsection, person_index:) def initialize(id, hsh, subsection, person_index:)
super(id, hsh, subsection) super(id, hsh, subsection)
@id = "no_females_pregnant_household_person_#{person_index}_age_value_check" @id = "no_females_pregnant_household_person_#{person_index}_age_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check"
@depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true, "age#{person_index}_known" => 0 }] @depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true, "age#{person_index}_known" => 0 }]
@title_text = { @title_text = {
"translation" => "soft_validations.pregnancy.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.pregnancy.all_male_tenants", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
@person_index = person_index @person_index = person_index
end end

9
app/models/form/lettings/pages/no_females_pregnant_household_person_value_check.rb

@ -2,14 +2,15 @@ class Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck < ::Form
def initialize(id, hsh, subsection, person_index:) def initialize(id, hsh, subsection, person_index:)
super(id, hsh, subsection) super(id, hsh, subsection)
@id = "no_females_pregnant_household_person_#{person_index}_value_check" @id = "no_females_pregnant_household_person_#{person_index}_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check"
@depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true, "details_known_#{person_index}" => 0 }] @depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true, "details_known_#{person_index}" => 0 }]
@title_text = { @title_text = {
"translation" => "soft_validations.pregnancy.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.pregnancy.all_male_tenants", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
@person_index = person_index @person_index = person_index
end end

9
app/models/form/lettings/pages/no_females_pregnant_household_value_check.rb

@ -2,14 +2,15 @@ class Form::Lettings::Pages::NoFemalesPregnantHouseholdValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "no_females_pregnant_household_value_check" @id = "no_females_pregnant_household_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.no_females_pregnant_household_value_check"
@depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true }] @depends_on = [{ "all_male_tenants_in_a_pregnant_household?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.pregnancy.title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.pregnancy.all_male_tenants", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }], "arguments" => [],
} }
end end

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

@ -6,9 +6,10 @@ class Form::Lettings::Pages::PartnerUnder16ValueCheck < Form::Page
"person_#{person_index}_partner_under_16?" => true, "person_#{person_index}_partner_under_16?" => true,
}, },
] ]
@copy_key = "lettings.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_lettings.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::Lettings::Pages::PartnerUnder16ValueCheck < Form::Page
}, },
], ],
} }
@informative_text = {} @informative_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
}
end end
def questions def questions

9
app/models/form/lettings/pages/person_age.rb

@ -1,13 +1,12 @@
class Form::Lettings::Pages::PersonAge < ::Form::Page class Form::Lettings::Pages::PersonAge < ::Form::Page
def initialize(id, hsh, subsection, person_index:, person_type: "non_child") def initialize(id, hsh, subsection, person_index:)
super(id, hsh, subsection) super(id, hsh, subsection)
@id = "person_#{person_index}_age_#{person_type}" @id = "person_#{person_index}_age"
@copy_key = "lettings.household_characteristics.age#{person_index}"
@person_index = person_index @person_index = person_index
@person_type = person_type
@depends_on = [ @depends_on = [
{ {
"details_known_#{person_index}" => 0, "details_known_#{person_index}" => 0,
"person_#{person_index}_child_relation?" => (person_type == "child"),
}, },
] ]
end end
@ -15,7 +14,7 @@ class Form::Lettings::Pages::PersonAge < ::Form::Page
def questions def questions
@questions ||= [ @questions ||= [
Form::Lettings::Questions::AgeKnown.new(nil, nil, self, person_index: @person_index), Form::Lettings::Questions::AgeKnown.new(nil, nil, self, person_index: @person_index),
Form::Lettings::Questions::Age.new(nil, nil, self, person_index: @person_index, person_type: @person_type), Form::Lettings::Questions::Age.new(nil, nil, self, person_index: @person_index),
] ]
end end
end end

1
app/models/form/lettings/pages/person_known.rb

@ -2,7 +2,6 @@ class Form::Lettings::Pages::PersonKnown < ::Form::Page
def initialize(id, hsh, subsection, person_index:) def initialize(id, hsh, subsection, person_index:)
super(id, hsh, subsection) super(id, hsh, subsection)
@id = "person_#{person_index}_known" @id = "person_#{person_index}_known"
@header = "You’ve given us the details for #{person_index - 1} person in the household"
@depends_on = (person_index..8).map { |index| { "hhmemb" => index } } @depends_on = (person_index..8).map { |index| { "hhmemb" => index } }
@person_index = person_index @person_index = person_index
end end

6
app/models/form/lettings/pages/person_over_retirement_value_check.rb

@ -2,11 +2,13 @@ class Form::Lettings::Pages::PersonOverRetirementValueCheck < ::Form::Page
def initialize(id, hsh, subsection, person_index:) def initialize(id, hsh, subsection, person_index:)
super(id, hsh, subsection) super(id, hsh, subsection)
@depends_on = [{ "person_#{person_index}_not_retired_over_soft_max_age?" => true }] @depends_on = [{ "person_#{person_index}_not_retired_over_soft_max_age?" => true }]
@copy_key = "lettings.soft_validations.retirement_value_check"
@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" => [],
} }
@person_index = person_index @person_index = person_index
end end

8
app/models/form/lettings/pages/person_under_retirement_value_check.rb

@ -2,8 +2,9 @@ class Form::Lettings::Pages::PersonUnderRetirementValueCheck < ::Form::Page
def initialize(id, hsh, subsection, person_index:) def initialize(id, hsh, subsection, person_index:)
super(id, hsh, subsection) super(id, hsh, subsection)
@depends_on = [{ "person_#{person_index}_retired_under_soft_min_age?" => true }] @depends_on = [{ "person_#{person_index}_retired_under_soft_min_age?" => true }]
@copy_key = "lettings.soft_validations.no_retirement_value_check"
@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}",
@ -12,7 +13,10 @@ class Form::Lettings::Pages::PersonUnderRetirementValueCheck < ::Form::Page
}, },
], ],
} }
@informative_text = {} @informative_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
}
@person_index = person_index @person_index = person_index
end end

1
app/models/form/lettings/pages/previous_housing_situation.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::PreviousHousingSituation < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "previous_housing_situation" @id = "previous_housing_situation"
@copy_key = "lettings.household_situation.prevten.not_renewal"
@depends_on = [{ "is_renewal?" => false }] @depends_on = [{ "is_renewal?" => false }]
end end

1
app/models/form/lettings/pages/previous_housing_situation_renewal.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::PreviousHousingSituationRenewal < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "previous_housing_situation_renewal" @id = "previous_housing_situation_renewal"
@copy_key = "lettings.household_situation.prevten.renewal"
@depends_on = [{ "is_renewal?" => true, "is_supported_housing?" => true }] @depends_on = [{ "is_renewal?" => true, "is_supported_housing?" => true }]
end end

1
app/models/form/lettings/pages/previous_local_authority.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::PreviousLocalAuthority < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "previous_local_authority" @id = "previous_local_authority"
@copy_key = "lettings.household_situation.previous_local_authority"
@depends_on = [{ "is_previous_la_inferred" => false, "renewal" => 0 }] @depends_on = [{ "is_previous_la_inferred" => false, "renewal" => 0 }]
end end

1
app/models/form/lettings/pages/previous_postcode.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::PreviousPostcode < ::Form::Page
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@depends_on = [{ "renewal" => 0 }] @depends_on = [{ "renewal" => 0 }]
@copy_key = "lettings.household_situation.previous_postcode"
end end
def questions def questions

4
app/models/form/lettings/pages/property_local_authority.rb

@ -3,8 +3,8 @@ class Form::Lettings::Pages::PropertyLocalAuthority < ::Form::Page
super super
@id = "property_local_authority" @id = "property_local_authority"
@depends_on = [ @depends_on = [
{ "is_la_inferred" => false, "is_general_needs?" => true, "form.start_year_after_2024?" => false }, { "is_la_inferred" => false, "is_general_needs?" => true, "form.start_year_2024_or_later?" => false },
{ "is_la_inferred" => false, "is_general_needs?" => true, "form.start_year_after_2024?" => true, "address_search_given?" => true }, { "is_la_inferred" => false, "is_general_needs?" => true, "form.start_year_2024_or_later?" => true, "address_search_given?" => true },
] ]
end end

1
app/models/form/lettings/pages/property_major_repairs.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::PropertyMajorRepairs < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "property_major_repairs" @id = "property_major_repairs"
@copy_key = "lettings.property_information.property_major_repairs"
@depends_on = [{ "is_renewal?" => false, "vacancy_reason_not_renewal_or_first_let?" => true }] @depends_on = [{ "is_renewal?" => false, "vacancy_reason_not_renewal_or_first_let?" => true }]
end end

5
app/models/form/lettings/pages/property_major_repairs_value_check.rb

@ -2,10 +2,11 @@ class Form::Lettings::Pages::PropertyMajorRepairsValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "property_major_repairs_value_check" @id = "property_major_repairs_value_check"
@copy_key = "lettings.soft_validations.major_repairs_date_value_check"
@depends_on = [{ "major_repairs_date_in_soft_range?" => true }] @depends_on = [{ "major_repairs_date_in_soft_range?" => true }]
@title_text = { "translation" => "soft_validations.major_repairs_date.title_text" } @title_text = { "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text" }
@informative_text = { @informative_text = {
"translation" => "soft_validations.major_repairs_date.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [], "arguments" => [],
} }
end end

14
app/models/form/lettings/pages/property_postcode.rb

@ -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

8
app/models/form/lettings/pages/pscharge_value_check.rb

@ -2,16 +2,20 @@ class Form::Lettings::Pages::PschargeValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "pscharge_value_check" @id = "pscharge_value_check"
@copy_key = "lettings.soft_validations.pscharge_value_check"
@depends_on = [{ "pscharge_in_soft_max_range?" => true }] @depends_on = [{ "pscharge_in_soft_max_range?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.pscharge.over_soft_max_title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "arguments" => [{
"key" => "pscharge", "key" => "pscharge",
"label" => true, "label" => true,
"i18n_template" => "pscharge", "i18n_template" => "pscharge",
}], }],
} }
@informative_text = I18n.t("soft_validations.charges.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/lettings/pages/reason_for_leaving_last_settled_home.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::ReasonForLeavingLastSettledHome < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "reason_for_leaving_last_settled_home" @id = "reason_for_leaving_last_settled_home"
@copy_key = "lettings.household_situation.reason.reason_for_leaving_last_settled_home"
@depends_on = [{ "renewal" => 0 }] @depends_on = [{ "renewal" => 0 }]
end end

1
app/models/form/lettings/pages/reason_for_leaving_last_settled_home_renewal.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::ReasonForLeavingLastSettledHomeRenewal < ::Form::Pa
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "reason_for_leaving_last_settled_home_renewal" @id = "reason_for_leaving_last_settled_home_renewal"
@copy_key = "lettings.household_situation.reason.reason_for_leaving_last_settled_home_renewal"
@depends_on = [{ "renewal" => 1 }] @depends_on = [{ "renewal" => 1 }]
end end

5
app/models/form/lettings/pages/reasonother_value_check.rb

@ -2,13 +2,14 @@ class Form::Lettings::Pages::ReasonotherValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "reasonother_value_check" @id = "reasonother_value_check"
@copy_key = "lettings.soft_validations.reasonother_value_check"
@depends_on = [{ "reasonother_might_be_existing_category?" => true }] @depends_on = [{ "reasonother_might_be_existing_category?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.reasonother.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "key" => "reasonother", "i18n_template" => "reasonother" }], "arguments" => [{ "key" => "reasonother", "i18n_template" => "reasonother" }],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.reasonother.informative_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [], "arguments" => [],
} }
end end

1
app/models/form/lettings/pages/referral.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::Referral < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "referral" @id = "referral"
@copy_key = "lettings.household_situation.referral.general_needs.la"
@depends_on = [{ "owning_organisation_provider_type" => "LA", "needstype" => 1, "renewal" => 0 }] @depends_on = [{ "owning_organisation_provider_type" => "LA", "needstype" => 1, "renewal" => 0 }]
end end

1
app/models/form/lettings/pages/referral_prp.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::ReferralPrp < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "referral_prp" @id = "referral_prp"
@copy_key = "lettings.household_situation.referral.general_needs.prp"
@depends_on = [{ "owning_organisation_provider_type" => "PRP", "needstype" => 1, "renewal" => 0 }] @depends_on = [{ "owning_organisation_provider_type" => "PRP", "needstype" => 1, "renewal" => 0 }]
end end

1
app/models/form/lettings/pages/referral_supported_housing.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::ReferralSupportedHousing < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "referral_supported_housing" @id = "referral_supported_housing"
@copy_key = "lettings.household_situation.referral.supported_housing.la"
@depends_on = [{ "owning_organisation_provider_type" => "LA", "needstype" => 2, "renewal" => 0 }] @depends_on = [{ "owning_organisation_provider_type" => "LA", "needstype" => 2, "renewal" => 0 }]
end end

1
app/models/form/lettings/pages/referral_supported_housing_prp.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::ReferralSupportedHousingPrp < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "referral_supported_housing_prp" @id = "referral_supported_housing_prp"
@copy_key = "lettings.household_situation.referral.supported_housing.prp"
@depends_on = [{ "owning_organisation_provider_type" => "PRP", "needstype" => 2, "renewal" => 0 }] @depends_on = [{ "owning_organisation_provider_type" => "PRP", "needstype" => 2, "renewal" => 0 }]
end end

5
app/models/form/lettings/pages/referral_value_check.rb

@ -2,12 +2,13 @@ class Form::Lettings::Pages::ReferralValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "referral_value_check" @id = "referral_value_check"
@copy_key = "lettings.soft_validations.referral_value_check"
@depends_on = [{ "la_referral_for_general_needs?" => true }] @depends_on = [{ "la_referral_for_general_needs?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.referral.title_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.referral.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [], "arguments" => [],
} }
end end

2
app/models/form/lettings/pages/rent_4_weekly.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::Rent4Weekly < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "rent_4_weekly" @id = "rent_4_weekly"
@header = "Household rent and charges" @copy_key = "lettings.income_and_benefits.rent_and_charges"
@depends_on = [ @depends_on = [
{ "household_charge" => 0, "rent_and_charges_paid_every_4_weeks?" => true, "is_carehome?" => false }, { "household_charge" => 0, "rent_and_charges_paid_every_4_weeks?" => true, "is_carehome?" => false },
{ "household_charge" => nil, "rent_and_charges_paid_every_4_weeks?" => true, "is_carehome?" => false }, { "household_charge" => nil, "rent_and_charges_paid_every_4_weeks?" => true, "is_carehome?" => false },

2
app/models/form/lettings/pages/rent_bi_weekly.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::RentBiWeekly < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "rent_bi_weekly" @id = "rent_bi_weekly"
@header = "Household rent and charges" @copy_key = "lettings.income_and_benefits.rent_and_charges"
@depends_on = [ @depends_on = [
{ "household_charge" => nil, "rent_and_charges_paid_every_2_weeks?" => true, "is_carehome?" => false }, { "household_charge" => nil, "rent_and_charges_paid_every_2_weeks?" => true, "is_carehome?" => false },
{ "household_charge" => 0, "rent_and_charges_paid_every_2_weeks?" => true, "is_carehome?" => false }, { "household_charge" => 0, "rent_and_charges_paid_every_2_weeks?" => true, "is_carehome?" => false },

2
app/models/form/lettings/pages/rent_monthly.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::RentMonthly < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "rent_monthly" @id = "rent_monthly"
@header = "Household rent and charges" @copy_key = "lettings.income_and_benefits.rent_and_charges"
@depends_on = [ @depends_on = [
{ "household_charge" => nil, "rent_and_charges_paid_monthly?" => true, "is_carehome?" => false }, { "household_charge" => nil, "rent_and_charges_paid_monthly?" => true, "is_carehome?" => false },
{ "household_charge" => 0, "rent_and_charges_paid_monthly?" => true, "is_carehome?" => false }, { "household_charge" => 0, "rent_and_charges_paid_monthly?" => true, "is_carehome?" => false },

36
app/models/form/lettings/pages/rent_value_check.rb

@ -0,0 +1,36 @@
class Form::Lettings::Pages::RentValueCheck < ::Form::Page
def initialize(id, hsh, subsection, check_answers_card_number: nil)
super(id, hsh, subsection)
@depends_on = [{ "rent_soft_validation_triggered?" => true }]
@copy_key = "lettings.soft_validations.rent_value_check"
@title_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [
{
"key" => "brent",
"label" => true,
"i18n_template" => "brent",
},
],
}
@informative_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [
{
"key" => "rent_soft_validation_higher_or_lower_text",
"label" => false,
"i18n_template" => "higher_or_lower",
},
],
}
@check_answers_card_number = check_answers_card_number
end
def questions
@questions ||= [Form::Lettings::Questions::RentValueCheck.new(nil, nil, self, check_answers_card_number: @check_answers_card_number)]
end
def interruption_screen_question_ids
%w[brent period startdate uprn postcode_full la beds rent_type needstype]
end
end

2
app/models/form/lettings/pages/rent_weekly.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::RentWeekly < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "rent_weekly" @id = "rent_weekly"
@header = "Household rent and charges" @copy_key = "lettings.income_and_benefits.rent_and_charges"
@depends_on = [ @depends_on = [
{ "rent_and_charges_paid_weekly?" => true, "household_charge" => 0, "is_carehome?" => false }, { "rent_and_charges_paid_weekly?" => true, "household_charge" => 0, "is_carehome?" => false },
{ "rent_and_charges_paid_weekly?" => true, "household_charge" => nil, "is_carehome?" => false }, { "rent_and_charges_paid_weekly?" => true, "household_charge" => nil, "is_carehome?" => false },

8
app/models/form/lettings/pages/scharge_value_check.rb

@ -2,16 +2,20 @@ class Form::Lettings::Pages::SchargeValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "scharge_value_check" @id = "scharge_value_check"
@copy_key = "lettings.soft_validations.scharge_value_check"
@depends_on = [{ "scharge_in_soft_max_range?" => true }] @depends_on = [{ "scharge_in_soft_max_range?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.scharge.over_soft_max_title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "arguments" => [{
"key" => "scharge", "key" => "scharge",
"label" => true, "label" => true,
"i18n_template" => "scharge", "i18n_template" => "scharge",
}], }],
} }
@informative_text = I18n.t("soft_validations.charges.informative_text") @title_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
}
end end
def questions def questions

1
app/models/form/lettings/pages/starter_tenancy_type.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::StarterTenancyType < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "starter_tenancy_type" @id = "starter_tenancy_type"
@copy_key = "lettings.tenancy_information.tenancy.starter_tenancy_type"
@depends_on = [{ "starter_tenancy?" => true }] @depends_on = [{ "starter_tenancy?" => true }]
end end

8
app/models/form/lettings/pages/supcharg_value_check.rb

@ -2,16 +2,20 @@ class Form::Lettings::Pages::SupchargValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "supcharg_value_check" @id = "supcharg_value_check"
@copy_key = "lettings.soft_validations.supcharg_value_check"
@depends_on = [{ "supcharg_in_soft_max_range?" => true }] @depends_on = [{ "supcharg_in_soft_max_range?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.supcharg.over_soft_max_title", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [{ "arguments" => [{
"key" => "supcharg", "key" => "supcharg",
"label" => true, "label" => true,
"i18n_template" => "supcharg", "i18n_template" => "supcharg",
}], }],
} }
@informative_text = I18n.t("soft_validations.charges.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/lettings/pages/tenancy_length.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLength < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "tenancy_length" @id = "tenancy_length"
@copy_key = "lettings.tenancy_information.tenancylength.tenancy_length"
@depends_on = [{ "tenancy_type_fixed_term?" => true, "needstype" => 2 }] @depends_on = [{ "tenancy_type_fixed_term?" => true, "needstype" => 2 }]
end end

1
app/models/form/lettings/pages/tenancy_length_affordable_rent.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLengthAffordableRent < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "tenancy_length_affordable_rent" @id = "tenancy_length_affordable_rent"
@copy_key = "lettings.tenancy_information.tenancylength.tenancy_length_affordable_rent"
@depends_on = [{ "tenancy_type_fixed_term?" => true, "affordable_or_social_rent?" => true, "needstype" => 1 }] @depends_on = [{ "tenancy_type_fixed_term?" => true, "affordable_or_social_rent?" => true, "needstype" => 1 }]
end end

1
app/models/form/lettings/pages/tenancy_length_intermediate_rent.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLengthIntermediateRent < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "tenancy_length_intermediate_rent" @id = "tenancy_length_intermediate_rent"
@copy_key = "lettings.tenancy_information.tenancylength.tenancy_length_intermediate_rent"
@depends_on = [{ "tenancy_type_fixed_term?" => true, "affordable_or_social_rent?" => false, "needstype" => 1 }] @depends_on = [{ "tenancy_type_fixed_term?" => true, "affordable_or_social_rent?" => false, "needstype" => 1 }]
end end

1
app/models/form/lettings/pages/tenancy_length_periodic.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLengthPeriodic < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "tenancy_length_periodic" @id = "tenancy_length_periodic"
@copy_key = "lettings.tenancy_information.tenancylength.tenancy_length_periodic"
@depends_on = [{ "tenancy_type_periodic?" => true }] @depends_on = [{ "tenancy_type_periodic?" => true }]
end end

1
app/models/form/lettings/pages/tenancy_type.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyType < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "tenancy_type" @id = "tenancy_type"
@copy_key = "lettings.tenancy_information.tenancy.tenancy_type"
@depends_on = [{ "starter_tenancy?" => false }] @depends_on = [{ "starter_tenancy?" => false }]
end end

5
app/models/form/lettings/pages/uprn.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::Uprn < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "uprn" @id = "uprn"
@copy_key = "lettings.property_information.uprn"
@depends_on = [{ "is_supported_housing?" => false }] @depends_on = [{ "is_supported_housing?" => false }]
end end
@ -13,7 +14,7 @@ class Form::Lettings::Pages::Uprn < ::Form::Page
end end
def skip_text def skip_text
if form.start_year_after_2024? if form.start_year_2024_or_later?
"Search for address instead" "Search for address instead"
else else
"Enter address instead" "Enter address instead"
@ -23,7 +24,7 @@ class Form::Lettings::Pages::Uprn < ::Form::Page
def skip_href(log = nil) def skip_href(log = nil)
return unless log return unless log
if form.start_year_after_2024? if form.start_year_2024_or_later?
"address-matcher" "address-matcher"
else else
"address" "address"

1
app/models/form/lettings/pages/uprn_selection.rb

@ -2,7 +2,6 @@ class Form::Lettings::Pages::UprnSelection < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "uprn_selection" @id = "uprn_selection"
@header = "We found some addresses that might be this property"
@depends_on = [ @depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil, "address_options_present?" => true }, { "is_supported_housing?" => false, "uprn_known" => nil, "address_options_present?" => true },
{ "is_supported_housing?" => false, "uprn_known" => 0, "address_options_present?" => true }, { "is_supported_housing?" => false, "uprn_known" => 0, "address_options_present?" => true },

1
app/models/form/lettings/pages/void_date.rb

@ -2,7 +2,6 @@ class Form::Lettings::Pages::VoidDate < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "void_date" @id = "void_date"
@header = "Void date"
@depends_on = [{ "is_renewal?" => false }] @depends_on = [{ "is_renewal?" => false }]
end end

5
app/models/form/lettings/pages/void_date_value_check.rb

@ -2,10 +2,11 @@ class Form::Lettings::Pages::VoidDateValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "void_date_value_check" @id = "void_date_value_check"
@copy_key = "lettings.soft_validations.void_date_value_check"
@depends_on = [{ "voiddate_in_soft_range?" => true }] @depends_on = [{ "voiddate_in_soft_range?" => true }]
@title_text = { "translation" => "soft_validations.void_date.title_text" } @title_text = { "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text" }
@informative_text = { @informative_text = {
"translation" => "soft_validations.void_date.hint_text", "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [], "arguments" => [],
} }
end end

3
app/models/form/lettings/questions/address_line1.rb

@ -2,11 +2,10 @@ class Form::Lettings::Questions::AddressLine1 < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "address_line1" @id = "address_line1"
@header = "Address line 1" @copy_key = "lettings.property_information.address.address_line1"
@error_label = "Address line 1" @error_label = "Address line 1"
@type = "text" @type = "text"
@plain_label = true @plain_label = true
@check_answer_label = "Address lines 1 and 2"
@disable_clearing_if_not_routed_or_dynamic_answer_options = true @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] @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 @hide_question_number_on_page = true

3
app/models/form/lettings/questions/address_line1_for_address_matcher.rb

@ -2,11 +2,10 @@ class Form::Lettings::Questions::AddressLine1ForAddressMatcher < ::Form::Questio
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "address_line1_input" @id = "address_line1_input"
@header = "Address line 1" @copy_key = "lettings.property_information.address_matcher.address_line1_input"
@error_label = "Address line 1" @error_label = "Address line 1"
@type = "text" @type = "text"
@plain_label = true @plain_label = true
@check_answer_label = "Find address"
@disable_clearing_if_not_routed_or_dynamic_answer_options = true @disable_clearing_if_not_routed_or_dynamic_answer_options = true
@hide_question_number_on_page = true @hide_question_number_on_page = true
end end

2
app/models/form/lettings/questions/address_line2.rb

@ -2,7 +2,7 @@ class Form::Lettings::Questions::AddressLine2 < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "address_line2" @id = "address_line2"
@header = "Address line 2 (optional)" @copy_key = "lettings.property_information.address.address_line2"
@type = "text" @type = "text"
@plain_label = true @plain_label = true
@disable_clearing_if_not_routed_or_dynamic_answer_options = true @disable_clearing_if_not_routed_or_dynamic_answer_options = true

10
app/models/form/lettings/questions/age.rb

@ -1,9 +1,8 @@
class Form::Lettings::Questions::Age < ::Form::Question class Form::Lettings::Questions::Age < ::Form::Question
def initialize(id, hsh, page, person_index:, person_type:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@id = "age#{person_index}" @id = "age#{person_index}"
@check_answer_label = "Person #{person_index}’s age" @copy_key = "lettings.household_characteristics.age#{person_index}.age#{person_index}"
@header = "Age"
@type = "numeric" @type = "numeric"
@width = 2 @width = 2
@inferred_check_answers_value = [{ "condition" => { "age#{person_index}_known" => 1 }, "value" => "Not known" }] @inferred_check_answers_value = [{ "condition" => { "age#{person_index}_known" => 1 }, "value" => "Not known" }]
@ -13,7 +12,6 @@ class Form::Lettings::Questions::Age < ::Form::Question
@step = 1 @step = 1
@person_index = person_index @person_index = person_index
@question_number = question_number @question_number = question_number
@person_type = person_type
@hint_text = hint_text @hint_text = hint_text
end end
@ -29,10 +27,8 @@ class Form::Lettings::Questions::Age < ::Form::Question
end end
def hint_text def hint_text
if form.start_year_after_2024? if form.start_year_2024_or_later?
"Answer 1 for children aged under 1 year old" "Answer 1 for children aged under 1 year old"
elsif @person_type == "child"
"For a child under 1, enter 1"
end end
end end
end end

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

@ -2,8 +2,7 @@ class Form::Lettings::Questions::Age1 < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "age1" @id = "age1"
@check_answer_label = "Lead tenant’s age" @copy_key = "lettings.household_characteristics.age1.age1"
@header = "Age"
@type = "numeric" @type = "numeric"
@width = 2 @width = 2
@inferred_check_answers_value = [{ "condition" => { "age1_known" => 1 }, "value" => "Not known" }] @inferred_check_answers_value = [{ "condition" => { "age1_known" => 1 }, "value" => "Not known" }]

11
app/models/form/lettings/questions/age1_known.rb

@ -2,8 +2,7 @@ class Form::Lettings::Questions::Age1Known < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "age1_known" @id = "age1_known"
@check_answer_label = "" @copy_key = "lettings.household_characteristics.age1.age1_known"
@header = "Do you know the lead tenant’s age?"
@type = "radio" @type = "radio"
@check_answers_card_number = 1 @check_answers_card_number = 1
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@ -14,13 +13,5 @@ class Form::Lettings::Questions::Age1Known < ::Form::Question
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze
def hint_text
if form.start_year_after_2024?
"The ’lead’ or ’main’ tenant is the person in the household who does the most paid work. If several people do the same amount of paid work, the lead tenant is whoever is the oldest."
else
"The ’lead’ or ’main’ tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
end
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 32, 2024 => 31 }.freeze QUESTION_NUMBER_FROM_YEAR = { 2023 => 32, 2024 => 31 }.freeze
end end

4
app/models/form/lettings/questions/age_known.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::AgeKnown < ::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 = "age#{person_index}_known" @id = "age#{person_index}_known"
@check_answer_label = "" @copy_key = "lettings.household_characteristics.age#{person_index}.age#{person_index}_known"
@header = "Do you know person #{person_index}’s age?"
@type = "radio" @type = "radio"
@check_answers_card_number = person_index @check_answers_card_number = person_index
@hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@conditional_for = { "age#{person_index}" => [0] } @conditional_for = { "age#{person_index}" => [0] }
@hidden_in_check_answers = { @hidden_in_check_answers = {

6
app/models/form/lettings/questions/beds.rb

@ -2,8 +2,6 @@ class Form::Lettings::Questions::Beds < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "beds" @id = "beds"
@check_answer_label = "Number of bedrooms"
@header = "How many bedrooms does the property have?"
@type = "numeric" @type = "numeric"
@width = 2 @width = 2
@check_answers_card_number = 0 @check_answers_card_number = 0
@ -17,9 +15,5 @@ class Form::Lettings::Questions::Beds < ::Form::Question
log.is_bedsit? log.is_bedsit?
end end
def hint_text
form.start_year_after_2024? ? "If shared accommodation, enter the number of bedrooms occupied by this household." : "If shared accommodation, enter the number of bedrooms occupied by this household. A bedsit has 1 bedroom."
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 22 }.freeze QUESTION_NUMBER_FROM_YEAR = { 2023 => 22 }.freeze
end end

3
app/models/form/lettings/questions/benefits.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Benefits < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "benefits" @id = "benefits"
@check_answer_label = "Household income from Universal Credit, state pension or benefits"
@header = "How much of the household’s income is from Universal Credit, state pensions or benefits?"
@type = "radio" @type = "radio"
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "This excludes child and housing benefit, council tax support and tax credits."
@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

4
app/models/form/lettings/questions/brent_4_weekly.rb

@ -2,13 +2,11 @@ class Form::Lettings::Questions::Brent4Weekly < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "brent" @id = "brent"
@check_answer_label = "Basic rent" @copy_key = "lettings.income_and_benefits.rent_and_charges.brent"
@header = "What is the basic rent?"
@type = "numeric" @type = "numeric"
@width = 5 @width = 5
@check_answers_card_number = 0 @check_answers_card_number = 0
@min = 0 @min = 0
@hint_text = "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent."
@step = 0.01 @step = 0.01
@fields_to_add = %w[brent scharge pscharge supcharg] @fields_to_add = %w[brent scharge pscharge supcharg]
@result_field = "tcharge" @result_field = "tcharge"

4
app/models/form/lettings/questions/brent_bi_weekly.rb

@ -2,13 +2,11 @@ class Form::Lettings::Questions::BrentBiWeekly < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "brent" @id = "brent"
@check_answer_label = "Basic rent" @copy_key = "lettings.income_and_benefits.rent_and_charges.brent"
@header = "What is the basic rent?"
@type = "numeric" @type = "numeric"
@width = 5 @width = 5
@check_answers_card_number = 0 @check_answers_card_number = 0
@min = 0 @min = 0
@hint_text = "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent."
@step = 0.01 @step = 0.01
@fields_to_add = %w[brent scharge pscharge supcharg] @fields_to_add = %w[brent scharge pscharge supcharg]
@result_field = "tcharge" @result_field = "tcharge"

4
app/models/form/lettings/questions/brent_monthly.rb

@ -2,13 +2,11 @@ class Form::Lettings::Questions::BrentMonthly < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "brent" @id = "brent"
@check_answer_label = "Basic rent" @copy_key = "lettings.income_and_benefits.rent_and_charges.brent"
@header = "What is the basic rent?"
@type = "numeric" @type = "numeric"
@width = 5 @width = 5
@check_answers_card_number = 0 @check_answers_card_number = 0
@min = 0 @min = 0
@hint_text = "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent."
@step = 0.01 @step = 0.01
@fields_to_add = %w[brent scharge pscharge supcharg] @fields_to_add = %w[brent scharge pscharge supcharg]
@result_field = "tcharge" @result_field = "tcharge"

4
app/models/form/lettings/questions/brent_weekly.rb

@ -2,13 +2,11 @@ class Form::Lettings::Questions::BrentWeekly < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "brent" @id = "brent"
@check_answer_label = "Basic rent" @copy_key = "lettings.income_and_benefits.rent_and_charges.brent"
@header = "What is the basic rent?"
@type = "numeric" @type = "numeric"
@width = 5 @width = 5
@check_answers_card_number = 0 @check_answers_card_number = 0
@min = 0 @min = 0
@hint_text = "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent."
@step = 0.01 @step = 0.01
@fields_to_add = %w[brent scharge pscharge supcharg] @fields_to_add = %w[brent scharge pscharge supcharg]
@result_field = "tcharge" @result_field = "tcharge"

3
app/models/form/lettings/questions/builtype.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Builtype < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "builtype" @id = "builtype"
@check_answer_label = "Type of building"
@header = "What type of building is the property?"
@type = "radio" @type = "radio"
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = ""
@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

3
app/models/form/lettings/questions/care_home_charges_value_check.rb

@ -2,8 +2,7 @@ class Form::Lettings::Questions::CareHomeChargesValueCheck < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "carehome_charges_value_check" @id = "carehome_charges_value_check"
@check_answer_label = "Care home charges confirmation" @copy_key = "lettings.soft_validations.care_home_charges_value_check"
@header = "Are you sure there are no care home charges?"
@type = "interruption_screen" @type = "interruption_screen"
@check_answers_card_number = 0 @check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS

4
app/models/form/lettings/questions/chcharge_4_weekly.rb

@ -2,12 +2,10 @@ class Form::Lettings::Questions::Chcharge4Weekly < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "chcharge" @id = "chcharge"
@check_answer_label = "Care home charges" @copy_key = "lettings.income_and_benefits.care_home.chcharge_4_weekly"
@header = "How much does the household pay every 4 weeks?"
@type = "numeric" @type = "numeric"
@width = 5 @width = 5
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = ""
@step = 0.01 @step = 0.01
@prefix = "£" @prefix = "£"
@suffix = " every 4 weeks" @suffix = " every 4 weeks"

4
app/models/form/lettings/questions/chcharge_bi_weekly.rb

@ -2,12 +2,10 @@ class Form::Lettings::Questions::ChchargeBiWeekly < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "chcharge" @id = "chcharge"
@check_answer_label = "Care home charges" @copy_key = "lettings.income_and_benefits.care_home.chcharge_bi_weekly"
@header = "How much does the household pay every 2 weeks?"
@type = "numeric" @type = "numeric"
@width = 5 @width = 5
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = ""
@step = 0.01 @step = 0.01
@prefix = "£" @prefix = "£"
@suffix = " every 2 weeks" @suffix = " every 2 weeks"

4
app/models/form/lettings/questions/chcharge_monthly.rb

@ -2,12 +2,10 @@ class Form::Lettings::Questions::ChchargeMonthly < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "chcharge" @id = "chcharge"
@check_answer_label = "Care home charges" @copy_key = "lettings.income_and_benefits.care_home.chcharge_monthly"
@header = "How much does the household pay every month?"
@type = "numeric" @type = "numeric"
@width = 5 @width = 5
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = ""
@step = 0.01 @step = 0.01
@prefix = "£" @prefix = "£"
@suffix = " every month" @suffix = " every month"

4
app/models/form/lettings/questions/chcharge_weekly.rb

@ -2,12 +2,10 @@ class Form::Lettings::Questions::ChchargeWeekly < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "chcharge" @id = "chcharge"
@check_answer_label = "Care home charges" @copy_key = "lettings.income_and_benefits.care_home.chcharge_weekly"
@header = "How much does the household pay every week?"
@type = "numeric" @type = "numeric"
@width = 5 @width = 5
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = ""
@step = 0.01 @step = 0.01
@prefix = "£" @prefix = "£"
@suffix = " every week" @suffix = " every week"

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

Loading…
Cancel
Save