Browse Source

feat: shared, discount and outright numbering

pull/1381/head
natdeanlewissoftwire 3 years ago
parent
commit
eb7c30d0de
  1. 2
      app/models/form/sales/pages/about_deposit_with_discount.rb
  2. 7
      app/models/form/sales/pages/about_deposit_without_discount.rb
  3. 2
      app/models/form/sales/pages/about_price_not_rtb.rb
  4. 2
      app/models/form/sales/pages/about_price_rtb.rb
  5. 7
      app/models/form/sales/pages/extra_borrowing.rb
  6. 9
      app/models/form/sales/pages/leasehold_charges.rb
  7. 8
      app/models/form/sales/pages/living_before_purchase.rb
  8. 7
      app/models/form/sales/pages/mortgage_amount.rb
  9. 7
      app/models/form/sales/pages/mortgage_lender.rb
  10. 7
      app/models/form/sales/pages/mortgage_lender_other.rb
  11. 7
      app/models/form/sales/pages/mortgage_length.rb
  12. 7
      app/models/form/sales/pages/mortgageused.rb
  13. 7
      app/models/form/sales/pages/purchase_price_outright_ownership.rb
  14. 18
      app/models/form/sales/questions/deposit_amount.rb
  15. 1
      app/models/form/sales/questions/discount.rb
  16. 18
      app/models/form/sales/questions/extra_borrowing.rb
  17. 1
      app/models/form/sales/questions/grant.rb
  18. 18
      app/models/form/sales/questions/leasehold_charges.rb
  19. 18
      app/models/form/sales/questions/leasehold_charges_known.rb
  20. 16
      app/models/form/sales/questions/living_before_purchase.rb
  21. 16
      app/models/form/sales/questions/living_before_purchase_years.rb
  22. 19
      app/models/form/sales/questions/mortgage_amount.rb
  23. 18
      app/models/form/sales/questions/mortgage_lender.rb
  24. 18
      app/models/form/sales/questions/mortgage_lender_other.rb
  25. 18
      app/models/form/sales/questions/mortgage_length.rb
  26. 18
      app/models/form/sales/questions/mortgageused.rb
  27. 15
      app/models/form/sales/questions/purchase_price.rb
  28. 12
      app/models/form/sales/questions/purchase_price_outright_ownership.rb
  29. 20
      app/models/form/sales/subsections/discounted_ownership_scheme.rb
  30. 18
      app/models/form/sales/subsections/outright_sale.rb
  31. 18
      app/models/form/sales/subsections/shared_ownership_scheme.rb

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

@ -8,7 +8,7 @@ class Form::Sales::Pages::AboutDepositWithDiscount < ::Form::Page
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::DepositAmount.new(nil, nil, self), Form::Sales::Questions::DepositAmount.new(nil, nil, self, ownershipsch: 1),
Form::Sales::Questions::DepositDiscount.new(nil, nil, self), Form::Sales::Questions::DepositDiscount.new(nil, nil, self),
] ]
end end

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

@ -1,15 +1,16 @@
class Form::Sales::Pages::AboutDepositWithoutDiscount < ::Form::Page class Form::Sales::Pages::AboutDepositWithoutDiscount < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@header = "About the deposit" @header = "About the deposit"
@depends_on = [{ "is_type_discount?" => false, "ownershipsch" => 1 }, @depends_on = [{ "is_type_discount?" => false, "ownershipsch" => 1 },
{ "ownershipsch" => 2 }, { "ownershipsch" => 2 },
{ "ownershipsch" => 3, "mortgageused" => 1 }] { "ownershipsch" => 3, "mortgageused" => 1 }]
@ownershipsch = ownershipsch
end end
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::DepositAmount.new(nil, nil, self), Form::Sales::Questions::DepositAmount.new(nil, nil, self, ownershipsch: @ownershipsch),
] ]
end end
end end

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

@ -11,7 +11,7 @@ class Form::Sales::Pages::AboutPriceNotRtb < ::Form::Page
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::PurchasePrice.new(nil, nil, self), Form::Sales::Questions::PurchasePrice.new(nil, nil, self, ownershipsch: 2),
Form::Sales::Questions::Grant.new(nil, nil, self), Form::Sales::Questions::Grant.new(nil, nil, self),
] ]
end end

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

@ -10,7 +10,7 @@ class Form::Sales::Pages::AboutPriceRtb < ::Form::Page
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::PurchasePrice.new(nil, nil, self), Form::Sales::Questions::PurchasePrice.new(nil, nil, self, ownershipsch: 2),
Form::Sales::Questions::Discount.new(nil, nil, self), Form::Sales::Questions::Discount.new(nil, nil, self),
] ]
end end

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

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

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

@ -1,8 +1,13 @@
class Form::Sales::Pages::LeaseholdCharges < ::Form::Page class Form::Sales::Pages::LeaseholdCharges < ::Form::Page
def initialize(id, hsh, subsection, ownershipsch:)
super(id, hsh, subsection)
@ownershipsch = ownershipsch
end
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::LeaseholdChargesKnown.new(nil, nil, self), Form::Sales::Questions::LeaseholdChargesKnown.new(nil, nil, self, ownershipsch: @ownershipsch),
Form::Sales::Questions::LeaseholdCharges.new(nil, nil, self), Form::Sales::Questions::LeaseholdCharges.new(nil, nil, self, ownershipsch: @ownershipsch),
] ]
end end
end end

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

@ -1,14 +1,18 @@
class Form::Sales::Pages::LivingBeforePurchase < ::Form::Page class Form::Sales::Pages::LivingBeforePurchase < ::Form::Page
def initialize(id, hsh, subsection, ownershipsch:)
super(id, hsh, subsection)
@ownershipsch = ownershipsch
end
def questions def questions
@questions ||= [ @questions ||= [
living_before_purchase, living_before_purchase,
Form::Sales::Questions::LivingBeforePurchaseYears.new(nil, nil, self), Form::Sales::Questions::LivingBeforePurchaseYears.new(nil, nil, self, ownershipsch: @ownershipsch),
].compact ].compact
end end
def living_before_purchase def living_before_purchase
if form.start_date.year >= 2023 if form.start_date.year >= 2023
Form::Sales::Questions::LivingBeforePurchase.new(nil, nil, self) Form::Sales::Questions::LivingBeforePurchase.new(nil, nil, self, ownershipsch: @ownershipsch)
end end
end end
end end

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

@ -1,6 +1,7 @@
class Form::Sales::Pages::MortgageAmount < ::Form::Page class Form::Sales::Pages::MortgageAmount < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@ownershipsch = ownershipsch
@header = "Mortgage Amount" @header = "Mortgage Amount"
@depends_on = [{ @depends_on = [{
"mortgageused" => 1, "mortgageused" => 1,
@ -9,7 +10,7 @@ class Form::Sales::Pages::MortgageAmount < ::Form::Page
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::MortgageAmount.new(nil, nil, self), Form::Sales::Questions::MortgageAmount.new(nil, nil, self, ownershipsch: @ownershipsch),
] ]
end end
end end

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

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

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

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

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

@ -1,6 +1,7 @@
class Form::Sales::Pages::MortgageLength < ::Form::Page class Form::Sales::Pages::MortgageLength < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@ownershipsch = ownershipsch
@depends_on = [{ @depends_on = [{
"mortgageused" => 1, "mortgageused" => 1,
}] }]
@ -8,7 +9,7 @@ class Form::Sales::Pages::MortgageLength < ::Form::Page
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::MortgageLength.new(nil, nil, self), Form::Sales::Questions::MortgageLength.new(nil, nil, self, ownershipsch: @ownershipsch),
] ]
end end
end end

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

@ -1,7 +1,12 @@
class Form::Sales::Pages::Mortgageused < ::Form::Page class Form::Sales::Pages::Mortgageused < ::Form::Page
def initialize(id, hsh, subsection, ownershipsch:)
super(id, hsh, subsection)
@ownershipsch = ownershipsch
end
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::Mortgageused.new(nil, nil, self), Form::Sales::Questions::Mortgageused.new(nil, nil, self, ownershipsch: @ownershipsch),
] ]
end end
end end

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

@ -1,14 +1,15 @@
class Form::Sales::Pages::PurchasePriceOutrightOwnership < ::Form::Page class Form::Sales::Pages::PurchasePriceOutrightOwnership < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@depends_on = [ @depends_on = [
{ "outright_sale_or_discounted_with_full_ownership?" => true }, { "outright_sale_or_discounted_with_full_ownership?" => true },
] ]
@ownershipsch = ownershipsch
end end
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::PurchasePriceOutrightOwnership.new(nil, nil, self), Form::Sales::Questions::PurchasePrice.new(nil, nil, self, ownershipsch: @ownershipsch),
] ]
end end
end end

18
app/models/form/sales/questions/deposit_amount.rb

@ -1,6 +1,6 @@
class Form::Sales::Questions::DepositAmount < ::Form::Question class Form::Sales::Questions::DepositAmount < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@id = "deposit" @id = "deposit"
@check_answer_label = "Cash deposit" @check_answer_label = "Cash deposit"
@header = "How much cash deposit was paid on the property?" @header = "How much cash deposit was paid on the property?"
@ -11,10 +11,22 @@ class Form::Sales::Questions::DepositAmount < ::Form::Question
@prefix = "£" @prefix = "£"
@hint_text = "Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage" @hint_text = "Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage"
@derived = true @derived = true
@question_number = 95 @ownershipsch = ownershipsch
@question_number = question_number
end end
def selected_answer_option_is_derived?(_log) def selected_answer_option_is_derived?(_log)
true true
end end
def question_number
case @ownershipsch
when 1
95
when 2
108
when 3
116
end
end
end end

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

@ -12,5 +12,6 @@ class Form::Sales::Questions::Discount < ::Form::Question
@hint_text = "For Right to Buy (RTB), Preserved Right to Buy (PRTB), and Voluntary Right to Buy (VRTB)</br></br> @hint_text = "For Right to Buy (RTB), Preserved Right to Buy (PRTB), and Voluntary Right to Buy (VRTB)</br></br>
If discount capped, enter capped %</br></br> If discount capped, enter capped %</br></br>
If the property is being sold to an existing tenant under the RTB, PRTB, or VRTB schemes, enter the % discount from the full market value that is being given." If the property is being sold to an existing tenant under the RTB, PRTB, or VRTB schemes, enter the % discount from the full market value that is being given."
@question_number = 102
end end
end end

18
app/models/form/sales/questions/extra_borrowing.rb

@ -1,6 +1,6 @@
class Form::Sales::Questions::ExtraBorrowing < ::Form::Question class Form::Sales::Questions::ExtraBorrowing < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@id = "extrabor" @id = "extrabor"
@check_answer_label = "Any other borrowing?" @check_answer_label = "Any other borrowing?"
@header = "Does this include any extra borrowing?" @header = "Does this include any extra borrowing?"
@ -8,7 +8,8 @@ class Form::Sales::Questions::ExtraBorrowing < ::Form::Question
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@page = page @page = page
@hint_text = "" @hint_text = ""
@question_number = 94 @ownershipsch = ownershipsch
@question_number = question_number
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {
@ -16,4 +17,15 @@ class Form::Sales::Questions::ExtraBorrowing < ::Form::Question
"2" => { "value" => "No" }, "2" => { "value" => "No" },
"3" => { "value" => "Don't know" }, "3" => { "value" => "Don't know" },
}.freeze }.freeze
def question_number
case @ownershipsch
when 1
94
when 2
107
when 3
115
end
end
end end

1
app/models/form/sales/questions/grant.rb

@ -10,5 +10,6 @@ class Form::Sales::Questions::Grant < ::Form::Question
@width = 5 @width = 5
@prefix = "£" @prefix = "£"
@hint_text = "For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB)" @hint_text = "For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB)"
@question_number = 101
end end
end end

18
app/models/form/sales/questions/leasehold_charges.rb

@ -1,6 +1,6 @@
class Form::Sales::Questions::LeaseholdCharges < ::Form::Question class Form::Sales::Questions::LeaseholdCharges < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@id = "mscharge" @id = "mscharge"
@check_answer_label = "Monthly leasehold charges" @check_answer_label = "Monthly leasehold charges"
@header = "Enter the total monthly charge" @header = "Enter the total monthly charge"
@ -8,6 +8,18 @@ class Form::Sales::Questions::LeaseholdCharges < ::Form::Question
@min = 0 @min = 0
@width = 5 @width = 5
@prefix = "£" @prefix = "£"
@question_number = 98 @ownershipsch = ownershipsch
@question_number = question_number
end
def question_number
case @ownershipsch
when 1
98
when 2
109
when 3
117
end
end end
end end

18
app/models/form/sales/questions/leasehold_charges_known.rb

@ -1,6 +1,6 @@
class Form::Sales::Questions::LeaseholdChargesKnown < ::Form::Question class Form::Sales::Questions::LeaseholdChargesKnown < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@id = "mscharge_known" @id = "mscharge_known"
@check_answer_label = "Monthly leasehold charges known?" @check_answer_label = "Monthly leasehold charges known?"
@header = "Does the property have any monthly leasehold charges?" @header = "Does the property have any monthly leasehold charges?"
@ -17,11 +17,23 @@ class Form::Sales::Questions::LeaseholdChargesKnown < ::Form::Question
}, },
], ],
} }
@question_number = 98 @ownershipsch = ownershipsch
@question_number = question_number
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {
"1" => { "value" => "Yes" }, "1" => { "value" => "Yes" },
"0" => { "value" => "No" }, "0" => { "value" => "No" },
}.freeze }.freeze
def question_number
case @ownershipsch
when 1
98
when 2
109
when 3
117
end
end
end end

16
app/models/form/sales/questions/living_before_purchase.rb

@ -1,6 +1,6 @@
class Form::Sales::Questions::LivingBeforePurchase < ::Form::Question class Form::Sales::Questions::LivingBeforePurchase < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page, ownershipsch:)
super super(id, hsh, page)
@id = "proplen_asked" @id = "proplen_asked"
@check_answer_label = "Buyer lived in the property before purchasing" @check_answer_label = "Buyer lived in the property before purchasing"
@header = "Did the buyer live in the property before purchasing it?" @header = "Did the buyer live in the property before purchasing it?"
@ -17,11 +17,21 @@ class Form::Sales::Questions::LivingBeforePurchase < ::Form::Question
}, },
], ],
} }
@question_number = 75 @ownershipsch = ownershipsch
@question_number = question_number
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },
"1" => { "value" => "No" }, "1" => { "value" => "No" },
}.freeze }.freeze
def question_number
case @ownershipsch
when 1
75
when 2
99
end
end
end end

16
app/models/form/sales/questions/living_before_purchase_years.rb

@ -1,6 +1,6 @@
class Form::Sales::Questions::LivingBeforePurchaseYears < ::Form::Question class Form::Sales::Questions::LivingBeforePurchaseYears < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page, ownershipsch:)
super super(id, hsh, page)
@id = "proplen" @id = "proplen"
@check_answer_label = "Number of years living in the property before purchase" @check_answer_label = "Number of years living in the property before purchase"
@header = header_text @header = header_text
@ -11,7 +11,8 @@ class Form::Sales::Questions::LivingBeforePurchaseYears < ::Form::Question
@step = 1 @step = 1
@width = 5 @width = 5
@suffix = " years" @suffix = " years"
@question_number = 75 @ownershipsch = ownershipsch
@question_number = question_number
end end
def header_text def header_text
@ -29,4 +30,13 @@ class Form::Sales::Questions::LivingBeforePurchaseYears < ::Form::Question
"You should round this up to the nearest year. If the buyers haven't been living in the property, enter '0'" "You should round this up to the nearest year. If the buyers haven't been living in the property, enter '0'"
end end
end end
def question_number
case @ownershipsch
when 1
75
when 2
99
end
end
end end

19
app/models/form/sales/questions/mortgage_amount.rb

@ -1,6 +1,6 @@
class Form::Sales::Questions::MortgageAmount < ::Form::Question class Form::Sales::Questions::MortgageAmount < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@id = "mortgage" @id = "mortgage"
@check_answer_label = "Mortgage amount" @check_answer_label = "Mortgage amount"
@header = "What is the mortgage amount?" @header = "What is the mortgage amount?"
@ -9,6 +9,19 @@ class Form::Sales::Questions::MortgageAmount < ::Form::Question
@width = 5 @width = 5
@prefix = "£" @prefix = "£"
@hint_text = "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound." @hint_text = "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound."
@question_number = 91 @ownershipsch = ownershipsch
@question_number = question_number
end
def question_number
case @ownershipsch
when 1
91
when 2
104
when 3
112
end
end end
end end

18
app/models/form/sales/questions/mortgage_lender.rb

@ -1,6 +1,6 @@
class Form::Sales::Questions::MortgageLender < ::Form::Question class Form::Sales::Questions::MortgageLender < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@id = "mortgagelender" @id = "mortgagelender"
@check_answer_label = "Mortgage Lender" @check_answer_label = "Mortgage Lender"
@header = "What is the name of the mortgage lender?" @header = "What is the name of the mortgage lender?"
@ -10,7 +10,8 @@ class Form::Sales::Questions::MortgageLender < ::Form::Question
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@guidance_position = GuidancePosition::BOTTOM @guidance_position = GuidancePosition::BOTTOM
@guidance_partial = "mortgage_lender" @guidance_partial = "mortgage_lender"
@question_number = 92 @ownershipsch = ownershipsch
@question_number = question_number
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {
@ -56,4 +57,15 @@ class Form::Sales::Questions::MortgageLender < ::Form::Question
"39" => "Yorkshire Building Society", "39" => "Yorkshire Building Society",
"40" => "Other", "40" => "Other",
}.freeze }.freeze
def question_number
case @ownershipsch
when 1
92
when 2
105
when 3
113
end
end
end end

18
app/models/form/sales/questions/mortgage_lender_other.rb

@ -1,11 +1,23 @@
class Form::Sales::Questions::MortgageLenderOther < ::Form::Question class Form::Sales::Questions::MortgageLenderOther < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@id = "mortgagelenderother" @id = "mortgagelenderother"
@check_answer_label = "Other Mortgage Lender" @check_answer_label = "Other Mortgage Lender"
@header = "What is the other mortgage lender?" @header = "What is the other mortgage lender?"
@type = "text" @type = "text"
@page = page @page = page
@question_number = 92 @ownershipsch = ownershipsch
@question_number = question_number
end
def question_number
case @ownershipsch
when 1
92
when 2
105
when 3
113
end
end end
end end

18
app/models/form/sales/questions/mortgage_length.rb

@ -1,6 +1,6 @@
class Form::Sales::Questions::MortgageLength < ::Form::Question class Form::Sales::Questions::MortgageLength < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@id = "mortlen" @id = "mortlen"
@check_answer_label = "Length of mortgage" @check_answer_label = "Length of mortgage"
@header = "What is the length of the mortgage?" @header = "What is the length of the mortgage?"
@ -10,6 +10,18 @@ class Form::Sales::Questions::MortgageLength < ::Form::Question
@width = 5 @width = 5
@suffix = " years" @suffix = " years"
@hint_text = "You should round up to the nearest year. Value should not exceed 60 years." @hint_text = "You should round up to the nearest year. Value should not exceed 60 years."
@question_number = 93 @ownershipsch = ownershipsch
@question_number = question_number
end
def question_number
case @ownershipsch
when 1
93
when 2
106
when 3
114
end
end end
end end

18
app/models/form/sales/questions/mortgageused.rb

@ -1,12 +1,13 @@
class Form::Sales::Questions::Mortgageused < ::Form::Question class Form::Sales::Questions::Mortgageused < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, subsection, ownershipsch:)
super super(id, hsh, subsection)
@id = "mortgageused" @id = "mortgageused"
@check_answer_label = "Mortgage used" @check_answer_label = "Mortgage used"
@header = "Was a mortgage used for the purchase of this property?" @header = "Was a mortgage used for the purchase of this property?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 90 @ownershipsch = ownershipsch
@question_number = question_number
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {
@ -21,4 +22,15 @@ class Form::Sales::Questions::Mortgageused < ::Form::Question
"2" => { "value" => "No" }, "2" => { "value" => "No" },
} }
end end
def question_number
case @ownershipsch
when 1
90
when 2
103
when 3
111
end
end
end end

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

@ -1,6 +1,6 @@
class Form::Sales::Questions::PurchasePrice < ::Form::Question class Form::Sales::Questions::PurchasePrice < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page, ownershipsch:)
super super(id, hsh, page)
@id = "value" @id = "value"
@check_answer_label = "Purchase price" @check_answer_label = "Purchase price"
@header = "What is the full purchase price?" @header = "What is the full purchase price?"
@ -9,5 +9,16 @@ class Form::Sales::Questions::PurchasePrice < ::Form::Question
@width = 5 @width = 5
@prefix = "£" @prefix = "£"
@hint_text = "For all schemes, including Right to Acquire (RTA), Right to Buy (RTB), Voluntary Right to Buy (VRTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount" @hint_text = "For all schemes, including Right to Acquire (RTA), Right to Buy (RTB), Voluntary Right to Buy (VRTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount"
@ownership_sch = ownershipsch
@question_number = question_number
end
def question_number
case @ownership_sch
when 2
100
when 3
110
end
end end
end end

12
app/models/form/sales/questions/purchase_price_outright_ownership.rb

@ -1,12 +0,0 @@
class Form::Sales::Questions::PurchasePriceOutrightOwnership < ::Form::Question
def initialize(id, hsh, page)
super
@id = "value"
@check_answer_label = "Purchase price"
@header = "What is the full purchase price?"
@type = "numeric"
@min = 0
@width = 5
@prefix = "£"
end
end

20
app/models/form/sales/subsections/discounted_ownership_scheme.rb

@ -8,30 +8,30 @@ class Form::Sales::Subsections::DiscountedOwnershipScheme < ::Form::Subsection
def pages def pages
@pages ||= [ @pages ||= [
Form::Sales::Pages::LivingBeforePurchase.new("living_before_purchase_discounted_ownership", nil, self), Form::Sales::Pages::LivingBeforePurchase.new("living_before_purchase_discounted_ownership", nil, self, ownershipsch: 2),
Form::Sales::Pages::AboutPriceRtb.new(nil, nil, self), Form::Sales::Pages::AboutPriceRtb.new(nil, nil, self),
Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_price_value_check", nil, self), Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_price_value_check", nil, self),
Form::Sales::Pages::AboutPriceNotRtb.new(nil, nil, self), Form::Sales::Pages::AboutPriceNotRtb.new(nil, nil, self),
Form::Sales::Pages::GrantValueCheck.new(nil, nil, self), Form::Sales::Pages::GrantValueCheck.new(nil, nil, self),
Form::Sales::Pages::PurchasePriceOutrightOwnership.new("purchase_price_outright_ownership", nil, self), Form::Sales::Pages::PurchasePriceOutrightOwnership.new("purchase_price_discounted_ownership", nil, self, ownershipsch: 2),
Form::Sales::Pages::AboutPriceValueCheck.new("about_price_discounted_ownership_value_check", nil, self), Form::Sales::Pages::AboutPriceValueCheck.new("about_price_discounted_ownership_value_check", nil, self),
Form::Sales::Pages::DepositAndMortgageValueCheck.new("discounted_ownership_deposit_and_mortgage_value_check_after_value_and_discount", nil, self), Form::Sales::Pages::DepositAndMortgageValueCheck.new("discounted_ownership_deposit_and_mortgage_value_check_after_value_and_discount", nil, self),
Form::Sales::Pages::Mortgageused.new("mortgage_used_discounted_ownership", nil, self), Form::Sales::Pages::Mortgageused.new("mortgage_used_discounted_ownership", nil, self, ownershipsch: 2),
Form::Sales::Pages::MortgageValueCheck.new("discounted_ownership_mortgage_used_mortgage_value_check", nil, self), Form::Sales::Pages::MortgageValueCheck.new("discounted_ownership_mortgage_used_mortgage_value_check", nil, self),
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_discounted_ownership", nil, self), Form::Sales::Pages::MortgageAmount.new("mortgage_amount_discounted_ownership", nil, self, ownershipsch: 2),
Form::Sales::Pages::MortgageValueCheck.new("discounted_ownership_mortgage_amount_mortgage_value_check", nil, self), Form::Sales::Pages::MortgageValueCheck.new("discounted_ownership_mortgage_amount_mortgage_value_check", nil, self),
Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_mortgage_value_check", nil, self), Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_mortgage_value_check", nil, self),
Form::Sales::Pages::DepositAndMortgageValueCheck.new("discounted_ownership_deposit_and_mortgage_value_check_after_mortgage", nil, self), Form::Sales::Pages::DepositAndMortgageValueCheck.new("discounted_ownership_deposit_and_mortgage_value_check_after_mortgage", nil, self),
Form::Sales::Pages::MortgageLender.new("mortgage_lender_discounted_ownership", nil, self), Form::Sales::Pages::MortgageLender.new("mortgage_lender_discounted_ownership", nil, self, ownershipsch: 2),
Form::Sales::Pages::MortgageLenderOther.new("mortgage_lender_other_discounted_ownership", nil, self), Form::Sales::Pages::MortgageLenderOther.new("mortgage_lender_other_discounted_ownership", nil, self, ownershipsch: 2),
Form::Sales::Pages::MortgageLength.new("mortgage_length_discounted_ownership", nil, self), Form::Sales::Pages::MortgageLength.new("mortgage_length_discounted_ownership", nil, self, ownershipsch: 2),
Form::Sales::Pages::ExtraBorrowing.new("extra_borrowing_discounted_ownership", nil, self), Form::Sales::Pages::ExtraBorrowing.new("extra_borrowing_discounted_ownership", nil, self, ownershipsch: 2),
Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_value_check", nil, self), Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_value_check", nil, self),
Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_discounted_ownership", nil, self), Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_discounted_ownership", nil, self, ownershipsch: 2),
Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_deposit_value_check", nil, self), Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_deposit_value_check", nil, self),
Form::Sales::Pages::DepositValueCheck.new("discounted_ownership_deposit_value_check", nil, self), Form::Sales::Pages::DepositValueCheck.new("discounted_ownership_deposit_value_check", nil, self),
Form::Sales::Pages::DepositAndMortgageValueCheck.new("discounted_ownership_deposit_and_mortgage_value_check_after_deposit", nil, self), Form::Sales::Pages::DepositAndMortgageValueCheck.new("discounted_ownership_deposit_and_mortgage_value_check_after_deposit", nil, self),
Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_discounted_ownership", nil, self), Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_discounted_ownership", nil, self, ownershipsch: 2),
Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_discounted_ownership_value_check", nil, self), Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_discounted_ownership_value_check", nil, self),
] ]
end end

18
app/models/form/sales/subsections/outright_sale.rb

@ -8,17 +8,17 @@ class Form::Sales::Subsections::OutrightSale < ::Form::Subsection
def pages def pages
@pages ||= [ @pages ||= [
Form::Sales::Pages::PurchasePriceOutrightOwnership.new("purchase_price_outright_sale", nil, self), Form::Sales::Pages::PurchasePriceOutrightOwnership.new("purchase_price_outright_sale", nil, self, ownershipsch: 3),
Form::Sales::Pages::AboutPriceValueCheck.new("about_price_outright_sale_value_check", nil, self), Form::Sales::Pages::AboutPriceValueCheck.new("about_price_outright_sale_value_check", nil, self),
Form::Sales::Pages::Mortgageused.new("mortgage_used_outright_sale", nil, self), Form::Sales::Pages::Mortgageused.new("mortgage_used_outright_sale", nil, self, ownershipsch: 3),
Form::Sales::Pages::MortgageValueCheck.new("outright_sale_mortgage_used_mortgage_value_check", nil, self), Form::Sales::Pages::MortgageValueCheck.new("outright_sale_mortgage_used_mortgage_value_check", nil, self),
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_outright_sale", nil, self), Form::Sales::Pages::MortgageAmount.new("mortgage_amount_outright_sale", nil, self, ownershipsch: 3),
Form::Sales::Pages::MortgageValueCheck.new("outright_sale_mortgage_amount_mortgage_value_check", nil, self), Form::Sales::Pages::MortgageValueCheck.new("outright_sale_mortgage_amount_mortgage_value_check", nil, self),
Form::Sales::Pages::MortgageLender.new("mortgage_lender_outright_sale", nil, self), Form::Sales::Pages::MortgageLender.new("mortgage_lender_outright_sale", nil, self, ownershipsch: 3),
Form::Sales::Pages::MortgageLenderOther.new("mortgage_lender_other_outright_sale", nil, self), Form::Sales::Pages::MortgageLenderOther.new("mortgage_lender_other_outright_sale", nil, self, ownershipsch: 3),
Form::Sales::Pages::MortgageLength.new("mortgage_length_outright_sale", nil, self), Form::Sales::Pages::MortgageLength.new("mortgage_length_outright_sale", nil, self, ownershipsch: 3),
Form::Sales::Pages::ExtraBorrowing.new("extra_borrowing_outright_sale", nil, self), Form::Sales::Pages::ExtraBorrowing.new("extra_borrowing_outright_sale", nil, self, ownershipsch: 3),
Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_outright_sale", nil, self), Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_outright_sale", nil, self, ownershipsch: 3),
Form::Sales::Pages::DepositValueCheck.new("outright_sale_deposit_value_check", nil, self), Form::Sales::Pages::DepositValueCheck.new("outright_sale_deposit_value_check", nil, self),
leasehold_charge_pages, leasehold_charge_pages,
Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_outright_sale_value_check", nil, self), Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_outright_sale_value_check", nil, self),
@ -31,7 +31,7 @@ class Form::Sales::Subsections::OutrightSale < ::Form::Subsection
def leasehold_charge_pages def leasehold_charge_pages
if form.start_date.year >= 2023 if form.start_date.year >= 2023
Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_outright_sale", nil, self) Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_outright_sale", nil, self, ownershipsch: 3)
end end
end end
end end

18
app/models/form/sales/subsections/shared_ownership_scheme.rb

@ -8,7 +8,7 @@ class Form::Sales::Subsections::SharedOwnershipScheme < ::Form::Subsection
def pages def pages
@pages ||= [ @pages ||= [
Form::Sales::Pages::LivingBeforePurchase.new("living_before_purchase_shared_ownership", nil, self), Form::Sales::Pages::LivingBeforePurchase.new("living_before_purchase_shared_ownership", nil, self, ownershipsch: 1),
Form::Sales::Pages::Staircase.new(nil, nil, self), Form::Sales::Pages::Staircase.new(nil, nil, self),
Form::Sales::Pages::AboutStaircase.new(nil, nil, self), Form::Sales::Pages::AboutStaircase.new(nil, nil, self),
Form::Sales::Pages::StaircaseBoughtValueCheck.new(nil, nil, self), Form::Sales::Pages::StaircaseBoughtValueCheck.new(nil, nil, self),
@ -24,21 +24,21 @@ class Form::Sales::Subsections::SharedOwnershipScheme < ::Form::Subsection
Form::Sales::Pages::AboutPriceSharedOwnership.new(nil, nil, self), Form::Sales::Pages::AboutPriceSharedOwnership.new(nil, nil, self),
Form::Sales::Pages::AboutPriceValueCheck.new("about_price_shared_ownership_value_check", nil, self), Form::Sales::Pages::AboutPriceValueCheck.new("about_price_shared_ownership_value_check", nil, self),
Form::Sales::Pages::SharedOwnershipDepositValueCheck.new("shared_ownership_equity_value_check", nil, self), Form::Sales::Pages::SharedOwnershipDepositValueCheck.new("shared_ownership_equity_value_check", nil, self),
Form::Sales::Pages::Mortgageused.new("mortgage_used_shared_ownership", nil, self), Form::Sales::Pages::Mortgageused.new("mortgage_used_shared_ownership", nil, self, ownershipsch: 1),
Form::Sales::Pages::MortgageValueCheck.new("mortgage_used_mortgage_value_check", nil, self), Form::Sales::Pages::MortgageValueCheck.new("mortgage_used_mortgage_value_check", nil, self),
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_shared_ownership", nil, self), Form::Sales::Pages::MortgageAmount.new("mortgage_amount_shared_ownership", nil, self, ownershipsch: 1),
Form::Sales::Pages::SharedOwnershipDepositValueCheck.new("shared_ownership_mortgage_amount_value_check", nil, self), Form::Sales::Pages::SharedOwnershipDepositValueCheck.new("shared_ownership_mortgage_amount_value_check", nil, self),
Form::Sales::Pages::MortgageValueCheck.new("mortgage_amount_mortgage_value_check", nil, self), Form::Sales::Pages::MortgageValueCheck.new("mortgage_amount_mortgage_value_check", nil, self),
Form::Sales::Pages::MortgageLender.new("mortgage_lender_shared_ownership", nil, self), Form::Sales::Pages::MortgageLender.new("mortgage_lender_shared_ownership", nil, self, ownershipsch: 1),
Form::Sales::Pages::MortgageLenderOther.new("mortgage_lender_other_shared_ownership", nil, self), Form::Sales::Pages::MortgageLenderOther.new("mortgage_lender_other_shared_ownership", nil, self, ownershipsch: 1),
Form::Sales::Pages::MortgageLength.new("mortgage_length_shared_ownership", nil, self), Form::Sales::Pages::MortgageLength.new("mortgage_length_shared_ownership", nil, self, ownershipsch: 1),
Form::Sales::Pages::ExtraBorrowing.new("extra_borrowing_shared_ownership", nil, self), Form::Sales::Pages::ExtraBorrowing.new("extra_borrowing_shared_ownership", nil, self, ownershipsch: 1),
Form::Sales::Pages::AboutDepositWithDiscount.new(nil, nil, self), Form::Sales::Pages::AboutDepositWithDiscount.new(nil, nil, self),
Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_shared_ownership", nil, self), Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_shared_ownership", nil, self, ownershipsch: 1),
Form::Sales::Pages::DepositValueCheck.new("deposit_value_check", nil, self), Form::Sales::Pages::DepositValueCheck.new("deposit_value_check", nil, self),
Form::Sales::Pages::SharedOwnershipDepositValueCheck.new("shared_ownership_deposit_value_check", nil, self), Form::Sales::Pages::SharedOwnershipDepositValueCheck.new("shared_ownership_deposit_value_check", nil, self),
Form::Sales::Pages::MonthlyRent.new(nil, nil, self), Form::Sales::Pages::MonthlyRent.new(nil, nil, self),
Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_shared_ownership", nil, self), Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_shared_ownership", nil, self, ownershipsch: 1),
Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_shared_ownership_value_check", nil, self), Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_shared_ownership_value_check", nil, self),
] ]
end end

Loading…
Cancel
Save