Browse Source

feat: add resale question and page

pull/1118/head
natdeanlewissoftwire 2 years ago
parent
commit
0180d811bc
  1. 21
      app/models/form/sales/pages/resale.rb
  2. 17
      app/models/form/sales/questions/resale.rb
  3. 1
      app/models/form/sales/subsections/shared_ownership_scheme.rb
  4. 2
      db/schema.rb

21
app/models/form/sales/pages/resale.rb

@ -0,0 +1,21 @@
class Form::Sales::Pages::Resale < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "resale"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"staircase" => 2,
},
{
"staircase" => 3,
}]
end
def questions
@questions ||= [
Form::Sales::Questions::Resale.new(nil, nil, self),
]
end
end

17
app/models/form/sales/questions/resale.rb

@ -0,0 +1,17 @@
class Form::Sales::Questions::Resale < ::Form::Question
def initialize(id, hsh, page)
super
@id = "resale"
@check_answer_label = "Is this a resale?"
@header = "Is this a resale?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = "If the social landlord has previously sold the property to another buyer and is now reselling the property, select 'yes'. If this is the first time the property has been sold, select 'no'."
end
ANSWER_OPTIONS = {
"1" => { "value" => "Yes" },
"2" => { "value" => "No" },
}.freeze
end

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

@ -11,6 +11,7 @@ class Form::Sales::Subsections::SharedOwnershipScheme < ::Form::Subsection
@pages ||= [
Form::Sales::Pages::Staircase.new(nil, nil, self),
Form::Sales::Pages::AboutStaircase.new(nil, nil, self),
Form::Sales::Pages::Resale.new(nil, nil, self),
Form::Sales::Pages::LaNominations.new(nil, nil, self),
Form::Sales::Pages::PreviousBedrooms.new(nil, nil, self),
Form::Sales::Pages::AboutDeposit.new("about_deposit_shared_ownership", nil, self),

2
db/schema.rb

@ -419,6 +419,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_22_081402) do
t.integer "staircase"
t.integer "stairbought"
t.integer "stairowned"
t.decimal "mrent", precision: 10, scale: 2
t.datetime "exdate", precision: nil
t.integer "exday"
t.integer "exmonth"
@ -426,7 +427,6 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_22_081402) do
t.integer "resale"
t.decimal "deposit", precision: 10, scale: 2
t.decimal "cashdis", precision: 10, scale: 2
t.decimal "mrent", precision: 10, scale: 2
t.integer "lanomagr"
t.index ["created_by_id"], name: "index_sales_logs_on_created_by_id"
t.index ["managing_organisation_id"], name: "index_sales_logs_on_managing_organisation_id"

Loading…
Cancel
Save