natdeanlewissoftwire
2 years ago
20 changed files with 129 additions and 440 deletions
@ -1,19 +0,0 @@
|
||||
class Form::Sales::Pages::Person1Age < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "person_1_age" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [ |
||||
{ "details_known_1" => 1, "jointpur" => 2 }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::Person1AgeKnown.new("age2_known", nil, self), |
||||
Form::Sales::Questions::Person1Age.new("age2", nil, self), |
||||
] |
||||
end |
||||
end |
@ -1,19 +0,0 @@
|
||||
class Form::Sales::Pages::Person1AgeJointPurchase < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "person_1_age_joint_purchase" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [ |
||||
{ "details_known_1" => 1, "jointpur" => 1 }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::Person1AgeKnown.new("age3_known", nil, self), |
||||
Form::Sales::Questions::Person1Age.new("age3", nil, self), |
||||
] |
||||
end |
||||
end |
@ -1,19 +0,0 @@
|
||||
class Form::Sales::Pages::Person2Age < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "person_2_age" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [ |
||||
{ "details_known_2" => 1, "jointpur" => 2 }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::Person2AgeKnown.new("age3_known", nil, self), |
||||
Form::Sales::Questions::Person2Age.new("age3", nil, self), |
||||
] |
||||
end |
||||
end |
@ -1,19 +0,0 @@
|
||||
class Form::Sales::Pages::Person2AgeJointPurchase < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "person_2_age_joint_purchase" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [ |
||||
{ "details_known_2" => 1, "jointpur" => 1 }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::Person2AgeKnown.new("age4_known", nil, self), |
||||
Form::Sales::Questions::Person2Age.new("age4", nil, self), |
||||
] |
||||
end |
||||
end |
@ -1,19 +0,0 @@
|
||||
class Form::Sales::Pages::Person3Age < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "person_3_age" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [ |
||||
{ "details_known_3" => 1, "jointpur" => 2 }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::Person3AgeKnown.new("age4_known", nil, self), |
||||
Form::Sales::Questions::Person3Age.new("age4", nil, self), |
||||
] |
||||
end |
||||
end |
@ -1,19 +0,0 @@
|
||||
class Form::Sales::Pages::Person3AgeJointPurchase < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "person_3_age_joint_purchase" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [ |
||||
{ "details_known_3" => 1, "jointpur" => 1 }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::Person3AgeKnown.new("age5_known", nil, self), |
||||
Form::Sales::Questions::Person3Age.new("age5", nil, self), |
||||
] |
||||
end |
||||
end |
@ -1,19 +0,0 @@
|
||||
class Form::Sales::Pages::Person4Age < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "person_4_age" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [ |
||||
{ "details_known_4" => 1, "jointpur" => 2 }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::Person4AgeKnown.new("age5_known", nil, self), |
||||
Form::Sales::Questions::Person4Age.new("age5", nil, self), |
||||
] |
||||
end |
||||
end |
@ -1,19 +0,0 @@
|
||||
class Form::Sales::Pages::Person4AgeJointPurchase < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "person_4_age_joint_purchase" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [ |
||||
{ "details_known_4" => 1, "jointpur" => 1 }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::Person4AgeKnown.new("age6_known", nil, self), |
||||
Form::Sales::Questions::Person4Age.new("age6", nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,41 @@
|
||||
class Form::Sales::Pages::PersonAge < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [ |
||||
{ "details_known_#{person_display_number}" => 1, "jointpur" => joint_purchase? ? 1 : 2 }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::PersonAgeKnown.new("age#{person_database_number}_known", nil, self), |
||||
Form::Sales::Questions::PersonAge.new("age#{person_database_number}", nil, self), |
||||
] |
||||
end |
||||
|
||||
def person_database_number |
||||
PERSON_INDEX[id] |
||||
end |
||||
|
||||
def person_display_number |
||||
joint_purchase? ? PERSON_INDEX[id] - 2 : PERSON_INDEX[id] - 1 |
||||
end |
||||
|
||||
def joint_purchase? |
||||
id.include?("_joint_purchase") |
||||
end |
||||
|
||||
PERSON_INDEX = { |
||||
"person_1_age" => 2, |
||||
"person_2_age" => 3, |
||||
"person_3_age" => 4, |
||||
"person_4_age" => 5, |
||||
"person_1_age_joint_purchase" => 3, |
||||
"person_2_age_joint_purchase" => 4, |
||||
"person_3_age_joint_purchase" => 5, |
||||
"person_4_age_joint_purchase" => 6, |
||||
}.freeze |
||||
end |
@ -1,21 +0,0 @@
|
||||
class Form::Sales::Questions::Person1Age < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@check_answer_label = "Person 1’s age" |
||||
@header = "Age" |
||||
@type = "numeric" |
||||
@page = page |
||||
@width = 3 |
||||
@inferred_check_answers_value = if id == "age2" |
||||
{ "condition" => { "age2_known" => 1 }, "value" => "Not known" } |
||||
else |
||||
{ "condition" => { "age3_known" => 1 }, "value" => "Not known" } |
||||
end |
||||
@hidden_in_check_answers = if id == "age2" |
||||
{ "depends_on" => [{ "jointpur" => 1 }] } |
||||
else |
||||
{ "depends_on" => [{ "jointpur" => 2 }] } |
||||
end |
||||
@check_answers_card_number = id == "age2" ? 2 : 3 |
||||
end |
||||
end |
@ -1,49 +0,0 @@
|
||||
class Form::Sales::Questions::Person1AgeKnown < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@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 = if id == "age2_known" |
||||
{ |
||||
"age2" => [0], |
||||
} |
||||
else |
||||
{ |
||||
"age3" => [0], |
||||
} |
||||
end |
||||
@hidden_in_check_answers = if id == "age2_known" |
||||
{ |
||||
"depends_on" => [ |
||||
{ |
||||
"age2_known" => 0, |
||||
}, |
||||
{ |
||||
"age2_known" => 1, |
||||
}, |
||||
], |
||||
} |
||||
else |
||||
{ |
||||
"depends_on" => [ |
||||
{ |
||||
"age3_known" => 0, |
||||
}, |
||||
{ |
||||
"age3_known" => 1, |
||||
}, |
||||
], |
||||
} |
||||
end |
||||
@check_answers_card_number = id == "age2_known" ? 2 : 3 |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { |
||||
"0" => { "value" => "Yes" }, |
||||
"1" => { "value" => "No" }, |
||||
}.freeze |
||||
end |
@ -1,21 +0,0 @@
|
||||
class Form::Sales::Questions::Person2Age < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@check_answer_label = "Person 2’s age" |
||||
@header = "Age" |
||||
@type = "numeric" |
||||
@page = page |
||||
@width = 3 |
||||
@inferred_check_answers_value = if id == "age3" |
||||
{ "condition" => { "age3_known" => 1 }, "value" => "Not known" } |
||||
else |
||||
{ "condition" => { "age4_known" => 1 }, "value" => "Not known" } |
||||
end |
||||
@hidden_in_check_answers = if id == "age3" |
||||
{ "depends_on" => [{ "jointpur" => 1 }] } |
||||
else |
||||
{ "depends_on" => [{ "jointpur" => 2 }] } |
||||
end |
||||
@check_answers_card_number = id == "age3" ? 3 : 4 |
||||
end |
||||
end |
@ -1,49 +0,0 @@
|
||||
class Form::Sales::Questions::Person2AgeKnown < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@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 = if id == "age3_known" |
||||
{ |
||||
"age3" => [0], |
||||
} |
||||
else |
||||
{ |
||||
"age4" => [0], |
||||
} |
||||
end |
||||
@hidden_in_check_answers = if id == "age3_known" |
||||
{ |
||||
"depends_on" => [ |
||||
{ |
||||
"age3_known" => 0, |
||||
}, |
||||
{ |
||||
"age3_known" => 1, |
||||
}, |
||||
], |
||||
} |
||||
else |
||||
{ |
||||
"depends_on" => [ |
||||
{ |
||||
"age4_known" => 0, |
||||
}, |
||||
{ |
||||
"age4_known" => 1, |
||||
}, |
||||
], |
||||
} |
||||
end |
||||
@check_answers_card_number = id == "age3_known" ? 3 : 4 |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { |
||||
"0" => { "value" => "Yes" }, |
||||
"1" => { "value" => "No" }, |
||||
}.freeze |
||||
end |
@ -1,21 +0,0 @@
|
||||
class Form::Sales::Questions::Person3Age < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@check_answer_label = "Person 3’s age" |
||||
@header = "Age" |
||||
@type = "numeric" |
||||
@page = page |
||||
@width = 3 |
||||
@inferred_check_answers_value = if id == "age4" |
||||
{ "condition" => { "age4_known" => 1 }, "value" => "Not known" } |
||||
else |
||||
{ "condition" => { "age5_known" => 1 }, "value" => "Not known" } |
||||
end |
||||
@hidden_in_check_answers = if id == "age4" |
||||
{ "depends_on" => [{ "jointpur" => 1 }] } |
||||
else |
||||
{ "depends_on" => [{ "jointpur" => 2 }] } |
||||
end |
||||
@check_answers_card_number = id == "age4" ? 4 : 5 |
||||
end |
||||
end |
@ -1,49 +0,0 @@
|
||||
class Form::Sales::Questions::Person3AgeKnown < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@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 = if id == "age4_known" |
||||
{ |
||||
"age4" => [0], |
||||
} |
||||
else |
||||
{ |
||||
"age5" => [0], |
||||
} |
||||
end |
||||
@hidden_in_check_answers = if id == "age4_known" |
||||
{ |
||||
"depends_on" => [ |
||||
{ |
||||
"age4_known" => 0, |
||||
}, |
||||
{ |
||||
"age4_known" => 1, |
||||
}, |
||||
], |
||||
} |
||||
else |
||||
{ |
||||
"depends_on" => [ |
||||
{ |
||||
"age5_known" => 0, |
||||
}, |
||||
{ |
||||
"age5_known" => 1, |
||||
}, |
||||
], |
||||
} |
||||
end |
||||
@check_answers_card_number = id == "age4_known" ? 4 : 5 |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { |
||||
"0" => { "value" => "Yes" }, |
||||
"1" => { "value" => "No" }, |
||||
}.freeze |
||||
end |
@ -1,21 +0,0 @@
|
||||
class Form::Sales::Questions::Person4Age < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@check_answer_label = "Person 4’s age" |
||||
@header = "Age" |
||||
@type = "numeric" |
||||
@page = page |
||||
@width = 3 |
||||
@inferred_check_answers_value = if id == "age5" |
||||
{ "condition" => { "age5_known" => 1 }, "value" => "Not known" } |
||||
else |
||||
{ "condition" => { "age6_known" => 1 }, "value" => "Not known" } |
||||
end |
||||
@hidden_in_check_answers = if id == "age5" |
||||
{ "depends_on" => [{ "jointpur" => 1 }] } |
||||
else |
||||
{ "depends_on" => [{ "jointpur" => 2 }] } |
||||
end |
||||
@check_answers_card_number = id == "age5" ? 5 : 6 |
||||
end |
||||
end |
@ -1,49 +0,0 @@
|
||||
class Form::Sales::Questions::Person4AgeKnown < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@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 = if id == "age5_known" |
||||
{ |
||||
"age5" => [0], |
||||
} |
||||
else |
||||
{ |
||||
"age6" => [0], |
||||
} |
||||
end |
||||
@hidden_in_check_answers = if id == "age5_known" |
||||
{ |
||||
"depends_on" => [ |
||||
{ |
||||
"age5_known" => 0, |
||||
}, |
||||
{ |
||||
"age5_known" => 1, |
||||
}, |
||||
], |
||||
} |
||||
else |
||||
{ |
||||
"depends_on" => [ |
||||
{ |
||||
"age6_known" => 0, |
||||
}, |
||||
{ |
||||
"age6_known" => 1, |
||||
}, |
||||
], |
||||
} |
||||
end |
||||
@check_answers_card_number = id == "age5_known" ? 5 : 6 |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { |
||||
"0" => { "value" => "Yes" }, |
||||
"1" => { "value" => "No" }, |
||||
}.freeze |
||||
end |
@ -0,0 +1,32 @@
|
||||
class Form::Sales::Questions::PersonAge < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@check_answer_label = "Person #{person_display_number}’s age" |
||||
@header = "Age" |
||||
@type = "numeric" |
||||
@page = page |
||||
@width = 3 |
||||
@inferred_check_answers_value = { "condition" => { "age#{PERSON_INDEX[id]}_known" => 1 }, "value" => "Not known" } |
||||
@check_answers_card_number = person_database_number |
||||
end |
||||
|
||||
def person_database_number |
||||
PERSON_INDEX[id] |
||||
end |
||||
|
||||
PERSON_INDEX = { |
||||
"age2" => 2, |
||||
"age3" => 3, |
||||
"age4" => 4, |
||||
"age5" => 5, |
||||
"age6" => 6, |
||||
}.freeze |
||||
|
||||
def person_display_number |
||||
joint_purchase? ? PERSON_INDEX[id] - 2 : PERSON_INDEX[id] - 1 |
||||
end |
||||
|
||||
def joint_purchase? |
||||
page.id.include?("_joint_purchase") |
||||
end |
||||
end |
@ -0,0 +1,48 @@
|
||||
class Form::Sales::Questions::PersonAgeKnown < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@check_answer_label = "Person #{person_display_number}’s age known?" |
||||
@header = "Do you know person #{person_display_number}’s age?" |
||||
@type = "radio" |
||||
@answer_options = ANSWER_OPTIONS |
||||
@page = page |
||||
@hint_text = "" |
||||
@conditional_for = { "age#{PERSON_INDEX[id]}" => [0] } |
||||
@hidden_in_check_answers = { |
||||
"depends_on" => [ |
||||
{ |
||||
"age#{PERSON_INDEX[id]}_known" => 0, |
||||
}, |
||||
{ |
||||
"age#{PERSON_INDEX[id]}_known" => 1, |
||||
}, |
||||
], |
||||
} |
||||
@check_answers_card_number = PERSON_INDEX[id] |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { |
||||
"0" => { "value" => "Yes" }, |
||||
"1" => { "value" => "No" }, |
||||
}.freeze |
||||
|
||||
def person_database_number |
||||
PERSON_INDEX[id] |
||||
end |
||||
|
||||
PERSON_INDEX = { |
||||
"age2_known" => 2, |
||||
"age3_known" => 3, |
||||
"age4_known" => 4, |
||||
"age5_known" => 5, |
||||
"age6_known" => 6, |
||||
}.freeze |
||||
|
||||
def person_display_number |
||||
joint_purchase? ? PERSON_INDEX[id] - 2 : PERSON_INDEX[id] - 1 |
||||
end |
||||
|
||||
def joint_purchase? |
||||
page.id.include?("_joint_purchase") |
||||
end |
||||
end |
Loading…
Reference in new issue