Browse Source

Merge branch 'main' into CLDC-1751-extra-borrowing

# Conflicts:
#	db/schema.rb
#	spec/factories/sales_log.rb
#	spec/models/form_handler_spec.rb
pull/1165/head
natdeanlewissoftwire 3 years ago
parent
commit
c087249519
  1. 33
      app/components/bulk_upload_error_row_component.html.erb
  2. 48
      app/components/bulk_upload_error_row_component.rb
  3. 2
      app/components/log_summary_component.html.erb
  4. 9
      app/controllers/bulk_upload_lettings_results_controller.rb
  5. 9
      app/controllers/bulk_upload_sales_results_controller.rb
  6. 4
      app/controllers/organisations_controller.rb
  7. 5
      app/helpers/filters_helper.rb
  8. 7
      app/jobs/process_bulk_upload_job.rb
  9. 5
      app/models/bulk_upload.rb
  10. 3
      app/models/bulk_upload_error.rb
  11. 1
      app/models/derived_variables/sales_log_variables.rb
  12. 2
      app/models/form.rb
  13. 3
      app/models/form/common/pages/created_by.rb
  14. 3
      app/models/form/common/pages/organisation.rb
  15. 2
      app/models/form/common/questions/created_by_id.rb
  16. 2
      app/models/form/common/questions/owning_organisation_id.rb
  17. 3
      app/models/form/lettings/pages/created_by.rb
  18. 2
      app/models/form/lettings/pages/location.rb
  19. 3
      app/models/form/lettings/pages/managing_organisation.rb
  20. 3
      app/models/form/lettings/pages/needs_type.rb
  21. 3
      app/models/form/lettings/pages/property_reference.rb
  22. 3
      app/models/form/lettings/pages/renewal.rb
  23. 2
      app/models/form/lettings/pages/rent_type.rb
  24. 2
      app/models/form/lettings/pages/scheme.rb
  25. 3
      app/models/form/lettings/pages/stock_owner.rb
  26. 2
      app/models/form/lettings/pages/tenancy_start_date.rb
  27. 3
      app/models/form/lettings/pages/tenant_code.rb
  28. 2
      app/models/form/lettings/questions/created_by_id.rb
  29. 1
      app/models/form/lettings/questions/irproduct_other.rb
  30. 1
      app/models/form/lettings/questions/location_id.rb
  31. 1
      app/models/form/lettings/questions/managing_organisation.rb
  32. 1
      app/models/form/lettings/questions/needs_type.rb
  33. 1
      app/models/form/lettings/questions/property_reference.rb
  34. 2
      app/models/form/lettings/questions/renewal.rb
  35. 2
      app/models/form/lettings/questions/rent_type.rb
  36. 1
      app/models/form/lettings/questions/stock_owner.rb
  37. 1
      app/models/form/lettings/questions/tenancy_start_date.rb
  38. 1
      app/models/form/lettings/questions/tenant_code.rb
  39. 2
      app/models/form/sales/pages/about_deposit_with_discount.rb
  40. 2
      app/models/form/sales/pages/about_deposit_without_discount.rb
  41. 2
      app/models/form/sales/pages/about_price_not_rtb.rb
  42. 2
      app/models/form/sales/pages/about_price_rtb.rb
  43. 2
      app/models/form/sales/pages/about_price_shared_ownership.rb
  44. 2
      app/models/form/sales/pages/about_staircase.rb
  45. 3
      app/models/form/sales/pages/age1.rb
  46. 3
      app/models/form/sales/pages/age2.rb
  47. 3
      app/models/form/sales/pages/armed_forces.rb
  48. 3
      app/models/form/sales/pages/armed_forces_spouse.rb
  49. 3
      app/models/form/sales/pages/buyer1_ethnic_background_arab.rb
  50. 3
      app/models/form/sales/pages/buyer1_ethnic_background_asian.rb
  51. 3
      app/models/form/sales/pages/buyer1_ethnic_background_black.rb
  52. 3
      app/models/form/sales/pages/buyer1_ethnic_background_mixed.rb
  53. 3
      app/models/form/sales/pages/buyer1_ethnic_background_white.rb
  54. 3
      app/models/form/sales/pages/buyer1_ethnic_group.rb
  55. 3
      app/models/form/sales/pages/buyer1_income.rb
  56. 3
      app/models/form/sales/pages/buyer1_income_value_check.rb
  57. 3
      app/models/form/sales/pages/buyer1_live_in_property.rb
  58. 3
      app/models/form/sales/pages/buyer1_mortgage.rb
  59. 3
      app/models/form/sales/pages/buyer1_previous_tenure.rb
  60. 3
      app/models/form/sales/pages/buyer1_working_situation.rb
  61. 3
      app/models/form/sales/pages/buyer2_income.rb
  62. 3
      app/models/form/sales/pages/buyer2_live_in_property.rb
  63. 3
      app/models/form/sales/pages/buyer2_mortgage.rb
  64. 3
      app/models/form/sales/pages/buyer2_relationship_to_buyer1.rb
  65. 3
      app/models/form/sales/pages/buyer2_working_situation.rb
  66. 3
      app/models/form/sales/pages/buyer_company.rb
  67. 3
      app/models/form/sales/pages/buyer_interview.rb
  68. 3
      app/models/form/sales/pages/buyer_live.rb
  69. 3
      app/models/form/sales/pages/buyer_previous.rb
  70. 3
      app/models/form/sales/pages/buyer_still_serving.rb
  71. 3
      app/models/form/sales/pages/buyers_organisations.rb
  72. 3
      app/models/form/sales/pages/deposit_value_check.rb
  73. 3
      app/models/form/sales/pages/discounted_ownership_type.rb
  74. 3
      app/models/form/sales/pages/exchange_date.rb
  75. 3
      app/models/form/sales/pages/gender_identity1.rb
  76. 3
      app/models/form/sales/pages/gender_identity2.rb
  77. 3
      app/models/form/sales/pages/handover_date.rb
  78. 3
      app/models/form/sales/pages/household_disability.rb
  79. 3
      app/models/form/sales/pages/household_wheelchair.rb
  80. 3
      app/models/form/sales/pages/household_wheelchair_check.rb
  81. 3
      app/models/form/sales/pages/housing_benefits.rb
  82. 3
      app/models/form/sales/pages/joint_purchase.rb
  83. 3
      app/models/form/sales/pages/la_nominations.rb
  84. 3
      app/models/form/sales/pages/last_accommodation.rb
  85. 3
      app/models/form/sales/pages/last_accommodation_la.rb
  86. 7
      app/models/form/sales/pages/leasehold_charges.rb
  87. 7
      app/models/form/sales/pages/living_before_purchase.rb
  88. 3
      app/models/form/sales/pages/monthly_rent.rb
  89. 2
      app/models/form/sales/pages/mortgage_amount.rb
  90. 14
      app/models/form/sales/pages/mortgage_lender.rb
  91. 17
      app/models/form/sales/pages/mortgage_lender_other.rb
  92. 7
      app/models/form/sales/pages/mortgage_length.rb
  93. 3
      app/models/form/sales/pages/mortgage_value_check.rb
  94. 7
      app/models/form/sales/pages/mortgageused.rb
  95. 3
      app/models/form/sales/pages/nationality1.rb
  96. 3
      app/models/form/sales/pages/number_joint_buyers.rb
  97. 3
      app/models/form/sales/pages/number_of_others_in_property.rb
  98. 3
      app/models/form/sales/pages/outright_ownership_type.rb
  99. 3
      app/models/form/sales/pages/ownership_scheme.rb
  100. 3
      app/models/form/sales/pages/person_age.rb
  101. Some files were not shown because too many files have changed in this diff Show More

33
app/components/bulk_upload_error_row_component.html.erb

@ -0,0 +1,33 @@
<div class="x-govuk-summary-card govuk-!-margin-bottom-6">
<div class="x-govuk-summary-card__header">
<% if lettings? %>
<h3 class="x-govuk-summary-card__title"><strong>Row <%= row %></strong> <span class="govuk-!-margin-left-3">Tenant code: <%= tenant_code %></span> <span class="govuk-!-margin-left-3">Property reference: <%= property_ref %></span></h3>
<% else %>
<h3 class="x-govuk-summary-card__title"><strong>Row <%= row %></strong> <span class="govuk-!-margin-left-3">Purchaser code: <%= purchaser_code %></span></h3>
<% end %>
</div>
<div class="x-govuk-summary-card__body">
<%= govuk_table do |table| %>
<% table.head do |head| %>
<% head.row do |row| %>
<% row.cell(header: true, text: "Cell") %>
<% row.cell(header: true, text: "Question") %>
<% row.cell(header: true, text: "Error") %>
<% row.cell(header: true, text: "Specification") %>
<% end %>
<% table.body do |body| %>
<% bulk_upload_errors.each do |error| %>
<% body.row do |row| %>
<% row.cell(header: true, text: error.cell) %>
<% row.cell(text: question_for_field(error.field)) %>
<% row.cell(text: error.error) %>
<% row.cell(text: error.field.humanize) %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
</div>
</div>

48
app/components/bulk_upload_error_row_component.rb

@ -0,0 +1,48 @@
class BulkUploadErrorRowComponent < ViewComponent::Base
attr_reader :bulk_upload_errors
def initialize(bulk_upload_errors:)
@bulk_upload_errors = bulk_upload_errors
super
end
def row
bulk_upload_errors.first.row
end
def tenant_code
bulk_upload_errors.first.tenant_code
end
def purchaser_code
bulk_upload_errors.first.purchaser_code
end
def property_ref
bulk_upload_errors.first.property_ref
end
def question_for_field(field)
case bulk_upload.log_type
when "lettings"
BulkUpload::Lettings::Validator.question_for_field(field.to_sym)
when "sales"
BulkUpload::Sales::Validator.question_for_field(field.to_sym)
else
"Unknown question"
end
end
def bulk_upload
bulk_upload_errors.first.bulk_upload
end
def lettings?
bulk_upload.log_type == "lettings"
end
def sales?
bulk_upload.log_type == "sales"
end
end

2
app/components/log_summary_component.html.erb

@ -36,7 +36,7 @@
</p>
<% end %>
<% if current_user.support? %>
<% if current_user.support? || current_user.organisation.has_managing_agents? %>
<% if log.owning_organisation or log.managing_organisation %>
<dl class="app-metadata">
<div class="app-metadata__item">

9
app/controllers/bulk_upload_lettings_results_controller.rb

@ -0,0 +1,9 @@
class BulkUploadLettingsResultsController < ApplicationController
before_action :authenticate_user!
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found
def show
@bulk_upload = current_user.bulk_uploads.lettings.find(params[:id])
end
end

9
app/controllers/bulk_upload_sales_results_controller.rb

@ -0,0 +1,9 @@
class BulkUploadSalesResultsController < ApplicationController
before_action :authenticate_user!
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found
def show
@bulk_upload = current_user.bulk_uploads.sales.find(params[:id])
end
end

4
app/controllers/organisations_controller.rb

@ -6,8 +6,8 @@ class OrganisationsController < ApplicationController
before_action :authenticate_user!
before_action :find_resource, except: %i[index new create]
before_action :authenticate_scope!, except: [:index]
before_action -> { session_filters(specific_org: true) }, if: -> { current_user.support? }
before_action :set_session_filters, if: -> { current_user.support? }
before_action -> { session_filters(specific_org: true) }, if: -> { current_user.support? || current_user.organisation.has_managing_agents? }
before_action :set_session_filters, if: -> { current_user.support? || current_user.organisation.has_managing_agents? }
def index
redirect_to organisation_path(current_user.organisation) unless current_user.support?

5
app/helpers/filters_helper.rb

@ -22,4 +22,9 @@ module FiltersHelper
JSON.parse(session[:logs_filters])[filter] || ""
end
def organisations_filter_options(user)
organisation_options = user.support? ? Organisation.all : [user.organisation] + user.organisation.managing_agents
[OpenStruct.new(id: "", name: "Select an option")] + organisation_options.map { |org| OpenStruct.new(id: org.id, name: org.name) }
end
end

7
app/jobs/process_bulk_upload_job.rb

@ -0,0 +1,7 @@
class ProcessBulkUploadJob < ApplicationJob
queue_as :default
def perform(bulk_upload:)
BulkUpload::Processor.new(bulk_upload:).call
end
end

5
app/models/bulk_upload.rb

@ -2,9 +2,14 @@ class BulkUpload < ApplicationRecord
enum log_type: { lettings: "lettings", sales: "sales" }
belongs_to :user
has_many :bulk_upload_errors
after_initialize :generate_identifier, unless: :identifier
def year_combo
"#{year}/#{year - 2000 + 1}"
end
private
def generate_identifier

3
app/models/bulk_upload_error.rb

@ -0,0 +1,3 @@
class BulkUploadError < ApplicationRecord
belongs_to :bulk_upload
end

1
app/models/derived_variables/sales_log_variables.rb

@ -15,5 +15,6 @@ module DerivedVariables::SalesLogVariables
if mscharge_known.present? && mscharge_known.zero?
self.mscharge = 0
end
self.pcode1, self.pcode2 = postcode_full.split(" ") if postcode_full.present?
end
end

2
app/models/form.rb

@ -167,10 +167,12 @@ class Form
if %w[radio checkbox].include?(question.type)
enabled_answer_options = enabled_question_ids.include?(question.id) ? enabled_questions.find { |q| q.id == question.id }.answer_options : {}
current_answer_option_valid = enabled_answer_options.present? ? enabled_answer_options.key?(log.public_send(question.id).to_s) : false
if !current_answer_option_valid && log.respond_to?(question.id.to_s)
Rails.logger.debug("Cleared #{question.id} value")
log.public_send("#{question.id}=", nil)
else
(question.answer_options.keys - enabled_answer_options.keys).map do |invalid_answer_option|
Rails.logger.debug("Cleared #{invalid_answer_option} value")
log.public_send("#{invalid_answer_option}=", nil) if log.respond_to?(invalid_answer_option)

3
app/models/form/common/pages/created_by.rb

@ -2,9 +2,6 @@ class Form::Common::Pages::CreatedBy < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "created_by"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/common/pages/organisation.rb

@ -2,9 +2,6 @@ class Form::Common::Pages::Organisation < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "organisation"
@header = ""
@description = ""
@subsection = subsection
end
def questions

2
app/models/form/common/questions/created_by_id.rb

@ -4,9 +4,7 @@ class Form::Common::Questions::CreatedById < ::Form::Question
@id = "created_by_id"
@check_answer_label = "User"
@header = "Which user are you creating this log for?"
@hint_text = ""
@type = "select"
@page = page
end
def answer_options

2
app/models/form/common/questions/owning_organisation_id.rb

@ -4,9 +4,7 @@ class Form::Common::Questions::OwningOrganisationId < ::Form::Question
@id = "owning_organisation_id"
@check_answer_label = "Owning organisation"
@header = "Which organisation owns this log?"
@hint_text = ""
@type = "select"
@page = page
end
def answer_options

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

@ -2,9 +2,6 @@ class Form::Lettings::Pages::CreatedBy < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "created_by"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -1,8 +1,6 @@
class Form::Lettings::Pages::Location < ::Form::Page
def initialize(_id, hsh, subsection)
super("location", hsh, subsection)
@header = ""
@description = ""
@depends_on = [{
"needstype" => 2,
"scheme_has_multiple_locations?" => true,

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

@ -2,9 +2,6 @@ class Form::Lettings::Pages::ManagingOrganisation < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "managing_organisation"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -2,9 +2,6 @@ class Form::Lettings::Pages::NeedsType < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "needs_type"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -2,9 +2,6 @@ class Form::Lettings::Pages::PropertyReference < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "property_reference"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -2,9 +2,6 @@ class Form::Lettings::Pages::Renewal < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "renewal"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -1,8 +1,6 @@
class Form::Lettings::Pages::RentType < ::Form::Page
def initialize(_id, hsh, subsection)
super("rent_type", hsh, subsection)
@header = ""
@description = ""
@derived = true
end

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

@ -1,8 +1,6 @@
class Form::Lettings::Pages::Scheme < ::Form::Page
def initialize(_id, hsh, subsection)
super("scheme", hsh, subsection)
@header = ""
@description = ""
@depends_on = [{
"needstype" => 2,
}]

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

@ -2,9 +2,6 @@ class Form::Lettings::Pages::StockOwner < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "stock_owner"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -2,8 +2,6 @@ class Form::Lettings::Pages::TenancyStartDate < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_start_date"
@description = ""
@subsection = subsection
@next_unresolved_page_id = "scheme"
end

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

@ -2,9 +2,6 @@ class Form::Lettings::Pages::TenantCode < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenant_code"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -4,9 +4,7 @@ class Form::Lettings::Questions::CreatedById < ::Form::Question
@id = "created_by_id"
@check_answer_label = "Log owner"
@header = "Which user are you creating this log for?"
@hint_text = ""
@type = "select"
@page = page
end
def answer_options

1
app/models/form/lettings/questions/irproduct_other.rb

@ -5,6 +5,5 @@ class Form::Lettings::Questions::IrproductOther < ::Form::Question
@check_answer_label = "Product name"
@header = "Name of rent product"
@type = "text"
@page = page
end
end

1
app/models/form/lettings/questions/location_id.rb

@ -3,7 +3,6 @@ class Form::Lettings::Questions::LocationId < ::Form::Question
super("location_id", hsh, page)
@check_answer_label = "Location"
@header = "Which location is this log for?"
@hint_text = ""
@type = "radio"
@answer_options = answer_options
@inferred_answers = {

1
app/models/form/lettings/questions/managing_organisation.rb

@ -8,7 +8,6 @@ class Form::Lettings::Questions::ManagingOrganisation < ::Form::Question
@header = "Which organisation manages this letting?"
@type = "select"
@answer_options = answer_options
@page = page
end
def answer_options

1
app/models/form/lettings/questions/needs_type.rb

@ -7,7 +7,6 @@ class Form::Lettings::Questions::NeedsType < ::Form::Question
@hint_text = "General needs housing includes both self-contained and shared housing without support or specific adaptations. Supported housing can include direct access hostels, group homes, residential care and nursing homes."
@type = "radio"
@answer_options = ANSWER_OPTIONS
@page = page
end
ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/property_reference.rb

@ -7,6 +7,5 @@ class Form::Lettings::Questions::PropertyReference < ::Form::Question
@hint_text = "This is how you usually refer to this property on your own systems."
@type = "text"
@width = 10
@page = page
end
end

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

@ -4,10 +4,8 @@ class Form::Lettings::Questions::Renewal < ::Form::Question
@id = "renewal"
@check_answer_label = "Property renewal"
@header = "Is this letting a renewal?"
@hint_text = ""
@type = "radio"
@answer_options = ANSWER_OPTIONS
@page = page
end
ANSWER_OPTIONS = {

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

@ -4,11 +4,9 @@ class Form::Lettings::Questions::RentType < ::Form::Question
@id = "rent_type"
@check_answer_label = "Rent type"
@header = "What is the rent type?"
@hint_text = ""
@type = "radio"
@answer_options = ANSWER_OPTIONS
@conditional_for = { "irproduct_other" => [5] }
@page = page
end
ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/stock_owner.rb

@ -7,7 +7,6 @@ class Form::Lettings::Questions::StockOwner < ::Form::Question
@check_answer_label = "Stock owner"
@header = "Which organisation owns this property?"
@type = "select"
@page = page
end
def answer_options

1
app/models/form/lettings/questions/tenancy_start_date.rb

@ -6,6 +6,5 @@ class Form::Lettings::Questions::TenancyStartDate < ::Form::Question
@header = "What is the tenancy start date?"
@type = "date"
@unresolved_hint_text = "Some scheme details have changed, and now this log needs updating. Check that the tenancy start date is correct."
@page = page
end
end

1
app/models/form/lettings/questions/tenant_code.rb

@ -7,6 +7,5 @@ class Form::Lettings::Questions::TenantCode < ::Form::Question
@hint_text = "This is how you usually refer to this tenancy on your own systems."
@type = "text"
@width = 10
@page = page
end
end

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

@ -3,8 +3,6 @@ class Form::Sales::Pages::AboutDepositWithDiscount < ::Form::Page
super
@id = "about_deposit_with_discount"
@header = "About the deposit"
@description = ""
@subsection = subsection
@depends_on = [{ "is_type_discount?" => true }]
end

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

@ -2,8 +2,6 @@ class Form::Sales::Pages::AboutDepositWithoutDiscount < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = "About the deposit"
@description = ""
@subsection = subsection
@depends_on = [{ "is_type_discount?" => false }]
end

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

@ -3,8 +3,6 @@ class Form::Sales::Pages::AboutPriceNotRtb < ::Form::Page
super
@id = "about_price_not_rtb"
@header = "About the price of the property"
@description = ""
@subsection = subsection
@depends_on = [{
"right_to_buy?" => false,
}]

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

@ -3,8 +3,6 @@ class Form::Sales::Pages::AboutPriceRtb < ::Form::Page
super
@id = "about_price_rtb"
@header = "About the price of the property"
@description = ""
@subsection = subsection
@depends_on = [{
"right_to_buy?" => true,
}]

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

@ -3,8 +3,6 @@ class Form::Sales::Pages::AboutPriceSharedOwnership < ::Form::Page
super
@id = "about_price_shared_ownership"
@header = "About the price of the property"
@description = ""
@subsection = subsection
end
def questions

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

@ -3,8 +3,6 @@ class Form::Sales::Pages::AboutStaircase < ::Form::Page
super
@id = "about_staircasing"
@header = "About the staircasing transaction"
@description = ""
@subsection = subsection
@depends_on = [{
"staircase" => 1,
}]

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::Age1 < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_age"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::Age2 < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_age"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"jointpur" => 1,
}]

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::ArmedForces < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "armed_forces"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/armed_forces_spouse.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::ArmedForcesSpouse < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "armed_forces_spouse"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer1EthnicBackgroundArab < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_ethnic_background_arab"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"ethnic_group" => 4,
}]

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer1EthnicBackgroundAsian < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_ethnic_background_asian"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"ethnic_group" => 2,
}]

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer1EthnicBackgroundBlack < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_ethnic_background_black"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"ethnic_group" => 3,
}]

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer1EthnicBackgroundMixed < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_ethnic_background_mixed"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"ethnic_group" => 1,
}]

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer1EthnicBackgroundWhite < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_ethnic_background_white"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"ethnic_group" => 0,
}]

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer1EthnicGroup < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_ethnic_group"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/buyer1_income.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer1Income < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_income"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/buyer1_income_value_check.rb

@ -1,9 +1,6 @@
class Form::Sales::Pages::Buyer1IncomeValueCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = ""
@description = ""
@subsection = subsection
@depends_on = [
{
"income1_under_soft_min?" => true,

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer1LiveInProperty < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_live_in_property"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/buyer1_mortgage.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer1Mortgage < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_mortgage"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/buyer1_previous_tenure.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer1PreviousTenure < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer1_previous_tenure"
@header = "What was buyer 1's previous tenure?"
@description = ""
@subsection = subsection
end
def questions

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer1WorkingSituation < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_working_situation"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/buyer2_income.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer2Income < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_income"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"jointpur" => 1,
}]

3
app/models/form/sales/pages/buyer2_live_in_property.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer2LiveInProperty < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_live_in_property"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"jointpur" => 1,
}]

3
app/models/form/sales/pages/buyer2_mortgage.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer2Mortgage < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_mortgage"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{ "jointpur" => 1 }]
end

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer2RelationshipToBuyer1 < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_relationship_to_buyer_1"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"jointpur" => 1,
}]

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::Buyer2WorkingSituation < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_working_situation"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"jointpur" => 1,
}]

3
app/models/form/sales/pages/buyer_company.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::BuyerCompany < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_company"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"ownershipsch" => 3,
}]

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::BuyerInterview < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_interview"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/buyer_live.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::BuyerLive < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_live"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"companybuy" => 2,
}]

3
app/models/form/sales/pages/buyer_previous.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::BuyerPrevious < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_previous"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/buyer_still_serving.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::BuyerStillServing < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_still_serving"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"hhregres" => 1,
}]

3
app/models/form/sales/pages/buyers_organisations.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::BuyersOrganisations < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyers_organisations"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/deposit_value_check.rb

@ -1,9 +1,6 @@
class Form::Sales::Pages::DepositValueCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = ""
@description = ""
@subsection = subsection
@depends_on = [
{
"deposit_over_soft_max?" => true,

3
app/models/form/sales/pages/discounted_ownership_type.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::DiscountedOwnershipType < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "discounted_ownership_type"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"ownershipsch" => 2,
}]

3
app/models/form/sales/pages/exchange_date.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::ExchangeDate < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "exchange_contracts"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"resale" => 2,
}]

3
app/models/form/sales/pages/gender_identity1.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::GenderIdentity1 < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_gender_identity"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::GenderIdentity2 < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_gender_identity"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"jointpur" => 1,
}]

3
app/models/form/sales/pages/handover_date.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::HandoverDate < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "handover_date"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"ownershipsch" => 1,
}]

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

@ -2,9 +2,6 @@ class Form::Sales::Pages::HouseholdDisability < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "household_disability"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/household_wheelchair.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::HouseholdWheelchair < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "household_wheelchair"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -1,9 +1,6 @@
class Form::Sales::Pages::HouseholdWheelchairCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = ""
@description = ""
@subsection = subsection
@depends_on = [
{
"wheelchair_when_not_disabled?" => true,

3
app/models/form/sales/pages/housing_benefits.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::HousingBenefits < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "housing_benefits"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/joint_purchase.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::JointPurchase < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "joint_purchase"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [
{ "ownershipsch" => 1 },
{ "ownershipsch" => 2 },

3
app/models/form/sales/pages/la_nominations.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::LaNominations < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "la_nominations"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/last_accommodation.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::LastAccommodation < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "last_accommodation"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/last_accommodation_la.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::LastAccommodationLa < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "last_accommodation_la"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"is_previous_la_inferred" => false,
}]

7
app/models/form/sales/pages/leasehold_charges.rb

@ -1,11 +1,4 @@
class Form::Sales::Pages::LeaseholdCharges < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = ""
@description = ""
@subsection = subsection
end
def questions
@questions ||= [
Form::Sales::Questions::LeaseholdChargesKnown.new(nil, nil, self),

7
app/models/form/sales/pages/living_before_purchase.rb

@ -1,11 +1,4 @@
class Form::Sales::Pages::LivingBeforePurchase < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = ""
@description = ""
@subsection = subsection
end
def questions
@questions ||= [
Form::Sales::Questions::LivingBeforePurchase.new(nil, nil, self),

3
app/models/form/sales/pages/monthly_rent.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::MonthlyRent < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "monthly_rent"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -2,8 +2,6 @@ class Form::Sales::Pages::MortgageAmount < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = "Mortgage Amount"
@description = ""
@subsection = subsection
@depends_on = [{
"mortgageused" => 1,
}]

14
app/models/form/sales/pages/mortgage_lender.rb

@ -0,0 +1,14 @@
class Form::Sales::Pages::MortgageLender < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = ""
@description = ""
@subsection = subsection
end
def questions
@questions ||= [
Form::Sales::Questions::MortgageLender.new(nil, nil, self),
]
end
end

17
app/models/form/sales/pages/mortgage_lender_other.rb

@ -0,0 +1,17 @@
class Form::Sales::Pages::MortgageLenderOther < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"mortgagelender" => 40,
}]
end
def questions
@questions ||= [
Form::Sales::Questions::MortgageLenderOther.new(nil, nil, self),
]
end
end

7
app/models/form/sales/pages/mortgage_length.rb

@ -1,11 +1,4 @@
class Form::Sales::Pages::MortgageLength < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = ""
@description = ""
@subsection = subsection
end
def questions
@questions ||= [
Form::Sales::Questions::MortgageLength.new(nil, nil, self),

3
app/models/form/sales/pages/mortgage_value_check.rb

@ -1,9 +1,6 @@
class Form::Sales::Pages::MortgageValueCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = ""
@description = ""
@subsection = subsection
@depends_on = [
{
"mortgage_over_soft_max?" => true,

7
app/models/form/sales/pages/mortgageused.rb

@ -1,11 +1,4 @@
class Form::Sales::Pages::Mortgageused < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = ""
@description = ""
@subsection = subsection
end
def questions
@questions ||= [
Form::Sales::Questions::Mortgageused.new(nil, nil, self),

3
app/models/form/sales/pages/nationality1.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::Nationality1 < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_1_nationality"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/number_joint_buyers.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::NumberJointBuyers < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "number_joint_buyers"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"jointpur" => 1,
}]

3
app/models/form/sales/pages/number_of_others_in_property.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::NumberOfOthersInProperty < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "number_of_others_in_property"
@header = ""
@description = ""
@subsection = subsection
end
def questions

3
app/models/form/sales/pages/outright_ownership_type.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::OutrightOwnershipType < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "outright_ownership_type"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"ownershipsch" => 3,
}]

3
app/models/form/sales/pages/ownership_scheme.rb

@ -2,9 +2,6 @@ class Form::Sales::Pages::OwnershipScheme < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "ownership_scheme"
@header = ""
@description = ""
@subsection = subsection
end
def questions

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

@ -1,9 +1,6 @@
class Form::Sales::Pages::PersonAge < Form::Sales::Pages::Person
def initialize(id, hsh, subsection, person_index:)
super
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{ details_known_question_id => 1, "jointpur" => joint_purchase? ? 1 : 2 }]
end

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

Loading…
Cancel
Save