diff --git a/app/models/form/sales/pages/buyers_organisations.rb b/app/models/form/sales/pages/buyers_organisations.rb new file mode 100644 index 000000000..cc6f82984 --- /dev/null +++ b/app/models/form/sales/pages/buyers_organisations.rb @@ -0,0 +1,15 @@ +class Form::Sales::Pages::BuyersOrganisations < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyers_organisations" + @header = "" + @description = "" + @subsection = subsection + end + + def questions + @questions ||= [ + Form::Sales::Questions::BuyersOrganisations.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/questions/buyers_organisations.rb b/app/models/form/sales/questions/buyers_organisations.rb new file mode 100644 index 000000000..1b932f02a --- /dev/null +++ b/app/models/form/sales/questions/buyers_organisations.rb @@ -0,0 +1,19 @@ +class Form::Sales::Questions::BuyersOrganisations < ::Form::Question + def initialize(id, hsh, page) + super + @id="organisations_buyers" + @check_answer_label = "Organisations buyers were registered with" + @header = "What organisations were the buyers registered with?" + @type = "checkbox" + @hint_text = "Select all that apply" + @page = page + @answer_options = ANSWER_OPTIONS + end + + ANSWER_OPTIONS = { + "pregyrha" => { "value" => "Their private registered provider (PRP)- housing association" }, + "pregother" => { "value" => "Other private registered provider (PRP)- housing association" }, + "pregla" => { "value" => "Local Authority" }, + "pregghb" => { "value" => "Help to Buy Agent" }, + }.freeze +end diff --git a/app/models/form/sales/sections/household.rb b/app/models/form/sales/sections/household.rb index e6f71a26d..3c7eae085 100644 --- a/app/models/form/sales/sections/household.rb +++ b/app/models/form/sales/sections/household.rb @@ -7,6 +7,7 @@ class Form::Sales::Sections::Household < ::Form::Section @form = form @subsections = [ Form::Sales::Subsections::HouseholdCharacteristics.new(nil, nil, self), + Form::Sales::Subsections::HouseholdSituation.new(nil, nil, self), Form::Sales::Subsections::HouseholdNeeds.new(nil, nil, self), ] end diff --git a/app/models/form/sales/subsections/household_situation.rb b/app/models/form/sales/subsections/household_situation.rb new file mode 100644 index 000000000..2be48f68c --- /dev/null +++ b/app/models/form/sales/subsections/household_situation.rb @@ -0,0 +1,15 @@ +class Form::Sales::Subsections::HouseholdSituation < ::Form::Subsection + def initialize(id, hsh, section) + super + @id = "household_situation" + @label = "Household situation" + @section = section + @depends_on = [{ "setup_completed?" => true }] + end + + def pages + @pages ||= [ + Form::Sales::Pages::BuyersOrganisations.new(nil, nil, self), + ] + end +end diff --git a/db/migrate/20221222153059_add_buyers_organisations_to_sales_log.rb b/db/migrate/20221222153059_add_buyers_organisations_to_sales_log.rb new file mode 100644 index 000000000..4781fd7b3 --- /dev/null +++ b/db/migrate/20221222153059_add_buyers_organisations_to_sales_log.rb @@ -0,0 +1,10 @@ +class AddBuyersOrganisationsToSalesLog < ActiveRecord::Migration[7.0] + def change + change_table :sales_logs, bulk: true do |t| + t.column :pregyrha, :int + t.column :pregla, :int + t.column :pregghb, :int + t.column :pregother, :integer + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 393022fd0..f13947a31 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2022_12_14_110208) do +ActiveRecord::Schema[7.0].define(version: 2022_12_22_153059) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -415,6 +415,23 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_14_110208) do t.integer "ecstat4" t.integer "ecstat5" t.integer "ecstat6" + t.integer "frombeds" + 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" + t.integer "exyear" + t.integer "resale" + t.decimal "deposit", precision: 10, scale: 2 + t.decimal "cashdis", precision: 10, scale: 2 + t.integer "lanomagr" + t.integer "pregyrha" + t.integer "pregla" + t.integer "pregghb" + t.integer "pregother" 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" t.index ["owning_organisation_id"], name: "index_sales_logs_on_owning_organisation_id"