13 changed files with 87 additions and 10 deletions
@ -0,0 +1,22 @@ |
|||||||
|
class Form::Sales::Pages::Person2Age < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "person_2_age" |
||||||
|
@header = "" |
||||||
|
@description = "" |
||||||
|
@subsection = subsection |
||||||
|
@depends_on = [ |
||||||
|
{ "hholdcount" => 1 }, |
||||||
|
{ "hholdcount" => 2 }, |
||||||
|
{ "hholdcount" => 3 }, |
||||||
|
{ "hholdcount" => 4 }, |
||||||
|
] |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::Person2AgeKnown.new(nil, nil, self), |
||||||
|
Form::Sales::Questions::Person2Age.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,11 @@ |
|||||||
|
class Form::Sales::Questions::Person2Age < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "age4" |
||||||
|
@check_answer_label = "Person 2’s age" |
||||||
|
@header = "Age" |
||||||
|
@type = "numeric" |
||||||
|
@page = page |
||||||
|
@width = 3 |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,27 @@ |
|||||||
|
class Form::Sales::Questions::Person2AgeKnown < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "age4_known" |
||||||
|
@check_answer_label = "Person 2’s age known?" |
||||||
|
@header = "Do you know person 2’s age?" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@page = page |
||||||
|
@hint_text = "" |
||||||
|
@conditional_for = { |
||||||
|
"age4" => [0], |
||||||
|
} |
||||||
|
@hidden_in_check_answers = { |
||||||
|
"depends_on" => [ |
||||||
|
{ |
||||||
|
"age4_known" => 0, |
||||||
|
}, |
||||||
|
], |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"0" => { "value" => "Yes" }, |
||||||
|
"1" => { "value" => "No" }, |
||||||
|
}.freeze |
||||||
|
end |
@ -1,9 +1,9 @@ |
|||||||
class Form::Sales::Questions::Person2Known < ::Form::Question |
class Form::Sales::Questions::PersonXKnown < ::Form::Question |
||||||
def initialize(id, hsh, page) |
def initialize(id, hsh, page) |
||||||
super |
super |
||||||
@id = "details_known_2" |
@id = "details_known_2" |
||||||
@check_answer_label = "Details known for person 2" |
@check_answer_label = "Details known for person X" |
||||||
@header = "Do you know the details for person 2?" |
@header = "Do you know the details for person X?" |
||||||
@type = "radio" |
@type = "radio" |
||||||
@answer_options = ANSWER_OPTIONS |
@answer_options = ANSWER_OPTIONS |
||||||
@page = page |
@page = page |
@ -0,0 +1 @@ |
|||||||
|
You have given us the details for X of the <%= hholdcount %> other people in the household |
@ -1 +0,0 @@ |
|||||||
You have given us the details for 1 of the <%= hholdcount %> other people in the household |
|
@ -0,0 +1,8 @@ |
|||||||
|
class AddPerson2AgeToSalesLog < ActiveRecord::Migration[7.0] |
||||||
|
def change |
||||||
|
change_table :sales_logs, bulk: true do |t| |
||||||
|
t.column :age4, :integer |
||||||
|
t.column :age4_known, :integer |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue