diff --git a/app/models/form/sales/pages/resale.rb b/app/models/form/sales/pages/resale.rb new file mode 100644 index 000000000..39e5b12a3 --- /dev/null +++ b/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 diff --git a/app/models/form/sales/questions/resale.rb b/app/models/form/sales/questions/resale.rb new file mode 100644 index 000000000..8da7d8abd --- /dev/null +++ b/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 diff --git a/app/models/form/sales/subsections/shared_ownership_scheme.rb b/app/models/form/sales/subsections/shared_ownership_scheme.rb index 03cb88de4..6b990742c 100644 --- a/app/models/form/sales/subsections/shared_ownership_scheme.rb +++ b/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), diff --git a/db/schema.rb b/db/schema.rb index 0b5b66908..9b00a3a78 100644 --- a/db/schema.rb +++ b/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"