9 changed files with 137 additions and 1 deletions
@ -0,0 +1,20 @@ |
|||||||
|
class Form::Sales::Pages::Person3Age < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "person_3_age" |
||||||
|
@header = "" |
||||||
|
@description = "" |
||||||
|
@subsection = subsection |
||||||
|
@depends_on = [ |
||||||
|
{ "hholdcount" => 3 }, |
||||||
|
{ "hholdcount" => 4 }, |
||||||
|
] |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::Person3AgeKnown.new(nil, nil, self), |
||||||
|
Form::Sales::Questions::Person3Age.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,19 @@ |
|||||||
|
class Form::Sales::Pages::Person4Age < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "person_4_age" |
||||||
|
@header = "" |
||||||
|
@description = "" |
||||||
|
@subsection = subsection |
||||||
|
@depends_on = [ |
||||||
|
{ "hholdcount" => 4 }, |
||||||
|
] |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::Person4AgeKnown.new(nil, nil, self), |
||||||
|
Form::Sales::Questions::Person4Age.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,11 @@ |
|||||||
|
class Form::Sales::Questions::Person3Age < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "age5" |
||||||
|
@check_answer_label = "Person 3’s age" |
||||||
|
@header = "Age" |
||||||
|
@type = "numeric" |
||||||
|
@page = page |
||||||
|
@width = 3 |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,27 @@ |
|||||||
|
class Form::Sales::Questions::Person3AgeKnown < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "age5_known" |
||||||
|
@check_answer_label = "Person 3’s age known?" |
||||||
|
@header = "Do you know person 3’s age?" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@page = page |
||||||
|
@hint_text = "" |
||||||
|
@conditional_for = { |
||||||
|
"age5" => [0], |
||||||
|
} |
||||||
|
@hidden_in_check_answers = { |
||||||
|
"depends_on" => [ |
||||||
|
{ |
||||||
|
"age5_known" => 0, |
||||||
|
}, |
||||||
|
], |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"0" => { "value" => "Yes" }, |
||||||
|
"1" => { "value" => "No" }, |
||||||
|
}.freeze |
||||||
|
end |
@ -0,0 +1,11 @@ |
|||||||
|
class Form::Sales::Questions::Person4Age < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "age6" |
||||||
|
@check_answer_label = "Person 4’s age" |
||||||
|
@header = "Age" |
||||||
|
@type = "numeric" |
||||||
|
@page = page |
||||||
|
@width = 3 |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,27 @@ |
|||||||
|
class Form::Sales::Questions::Person4AgeKnown < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "age6_known" |
||||||
|
@check_answer_label = "Person 4’s age known?" |
||||||
|
@header = "Do you know person 4’s age?" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@page = page |
||||||
|
@hint_text = "" |
||||||
|
@conditional_for = { |
||||||
|
"age6" => [0], |
||||||
|
} |
||||||
|
@hidden_in_check_answers = { |
||||||
|
"depends_on" => [ |
||||||
|
{ |
||||||
|
"age6_known" => 0, |
||||||
|
}, |
||||||
|
], |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"0" => { "value" => "Yes" }, |
||||||
|
"1" => { "value" => "No" }, |
||||||
|
}.freeze |
||||||
|
end |
@ -0,0 +1,12 @@ |
|||||||
|
class AddMoreAgesToSalesLog < ActiveRecord::Migration[7.0] |
||||||
|
def change |
||||||
|
change_table :sales_logs, bulk: true do |t| |
||||||
|
t.column :age4, :integer |
||||||
|
t.column :age4_known, :integer |
||||||
|
t.column :age5, :integer |
||||||
|
t.column :age5_known, :integer |
||||||
|
t.column :age6, :integer |
||||||
|
t.column :age6_known, :integer |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue