diff --git a/app/models/form/sales/pages/buyer2_relationship_to_buyer1.rb b/app/models/form/sales/pages/buyer2_relationship_to_buyer1.rb new file mode 100644 index 000000000..d78199381 --- /dev/null +++ b/app/models/form/sales/pages/buyer2_relationship_to_buyer1.rb @@ -0,0 +1,16 @@ +class Form::Sales::Pages::Buyer2RelationshipToBuyer1 < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_2_relationship_to_buyer_1" + @header = "" + @description = "" + @subsection = subsection + end + + def questions + @questions ||= [ + Form::Sales::Questions::Buyer2RelationshipToBuyer1.new(nil, nil, self), + Form::Sales::Questions::OtherBuyer2RelationshipToBuyer1.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb b/app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb new file mode 100644 index 000000000..d8ed5898e --- /dev/null +++ b/app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb @@ -0,0 +1,29 @@ +class Form::Sales::Questions::Buyer2RelationshipToBuyer1 < ::Form::Question + def initialize(id, hsh, page) + super + @id = "relat2" + @check_answer_label = "Buyer 2's relationship to buyer 1" + @header = "What is buyer 2's relationship to buyer 1?" + @type = "radio" + @hint_text = "" + @page = page + @answer_options = ANSWER_OPTIONS + @conditional_for = { + "otherrelat2" => ["X"], + } + @hidden_in_check_answers = { + "depends_on" => [ + { + "relat2" => "X", + }, + ], + } + end + + ANSWER_OPTIONS = { + "P" => { "value" => "Parent" }, + "C" => { "value" => "Child" }, + "X" => { "value" => "Other" }, + "R" => { "value" => "Buyer prefers not to say" }, + }.freeze +end diff --git a/app/models/form/sales/questions/other_buyer2_relationship_to_buyer1.rb b/app/models/form/sales/questions/other_buyer2_relationship_to_buyer1.rb new file mode 100644 index 000000000..f9959e3bd --- /dev/null +++ b/app/models/form/sales/questions/other_buyer2_relationship_to_buyer1.rb @@ -0,0 +1,10 @@ +class Form::Sales::Questions::OtherBuyer2RelationshipToBuyer1 < ::Form::Question + def initialize(id, hsh, page) + super + @id = "otherrelat2" + @check_answer_label = "Buyer 2's relationship to buyer 1" + @header = "Buyer 2's relationship to buyer 1" + @type = "text" + @page = page + end +end diff --git a/app/models/form/sales/subsections/household_characteristics.rb b/app/models/form/sales/subsections/household_characteristics.rb index 4612a80f2..0bda9c47b 100644 --- a/app/models/form/sales/subsections/household_characteristics.rb +++ b/app/models/form/sales/subsections/household_characteristics.rb @@ -12,6 +12,7 @@ class Form::Sales::Subsections::HouseholdCharacteristics < ::Form::Subsection Form::Sales::Pages::Age1.new(nil, nil, self), Form::Sales::Pages::GenderIdentity1.new(nil, nil, self), Form::Sales::Pages::Buyer1LiveInProperty.new(nil, nil, self), + Form::Sales::Pages::Buyer2RelationshipToBuyer1.new(nil, nil, self), ] end end