6 changed files with 75 additions and 3 deletions
@ -0,0 +1,22 @@
|
||||
class Form::Sales::Pages::Person1Age < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "person_1_age" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [ |
||||
{ "hholdcount" => 1 }, |
||||
{ "hholdcount" => 2 }, |
||||
{ "hholdcount" => 3 }, |
||||
{ "hholdcount" => 4 }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::Person1AgeKnown.new(nil, nil, self), |
||||
Form::Sales::Questions::Person1Age.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,12 @@
|
||||
class Form::Sales::Questions::Person1Age < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "age3" |
||||
@check_answer_label = "Person 1’s age" |
||||
@header = "Age" |
||||
@type = "numeric" |
||||
@page = page |
||||
@width = 3 |
||||
end |
||||
end |
||||
|
@ -0,0 +1,28 @@
|
||||
class Form::Sales::Questions::Person1AgeKnown < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "age3_known" |
||||
@check_answer_label = "Person 1’s age known?" |
||||
@header = "Do you know person 1’s age?" |
||||
@type = "radio" |
||||
@answer_options = ANSWER_OPTIONS |
||||
@page = page |
||||
@hint_text = "" |
||||
@conditional_for = { |
||||
"age3" => [0], |
||||
} |
||||
@hidden_in_check_answers = { |
||||
"depends_on" => [ |
||||
{ |
||||
"age3_known" => 0, |
||||
}, |
||||
], |
||||
} |
||||
@hide |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { |
||||
"0" => { "value" => "Yes" }, |
||||
"1" => { "value" => "No" }, |
||||
}.freeze |
||||
end |
@ -0,0 +1,8 @@
|
||||
class AddPerson1AgeToSalesLog < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :age3, :integer |
||||
t.column :age3_known, :integer |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue