Browse Source
* Display the correct hint text depending on joint purchase * update validation for non joint purchase * Add person 6 questions and refactor check_answers_card_title * update hint text * Reuse join purchase pagepull/1361/head v0.3.1
kosiakkatrina
2 years ago
committed by
GitHub
8 changed files with 114 additions and 28 deletions
@ -1,20 +1,22 @@ |
|||||||
class Form::Sales::Pages::NumberOfOthersInProperty < ::Form::Page |
class Form::Sales::Pages::NumberOfOthersInProperty < ::Form::Page |
||||||
def initialize(id, hsh, subsection) |
def initialize(id, hsh, subsection, joint_purchase:) |
||||||
super |
super(id, hsh, subsection) |
||||||
@id = "number_of_others_in_property" |
|
||||||
@depends_on = [ |
@depends_on = [ |
||||||
{ |
{ |
||||||
"privacynotice" => 1, |
"privacynotice" => 1, |
||||||
|
"jointpur" => joint_purchase ? 1 : 2, |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
"noint" => 1, |
"noint" => 1, |
||||||
|
"jointpur" => joint_purchase ? 1 : 2, |
||||||
}, |
}, |
||||||
] |
] |
||||||
|
@joint_purchase = joint_purchase |
||||||
end |
end |
||||||
|
|
||||||
def questions |
def questions |
||||||
@questions ||= [ |
@questions ||= [ |
||||||
Form::Sales::Questions::NumberOfOthersInProperty.new(nil, nil, self), |
Form::Sales::Questions::NumberOfOthersInProperty.new(nil, nil, self, joint_purchase: @joint_purchase), |
||||||
] |
] |
||||||
end |
end |
||||||
end |
end |
||||||
|
@ -1,13 +1,23 @@ |
|||||||
class Form::Sales::Questions::NumberOfOthersInProperty < ::Form::Question |
class Form::Sales::Questions::NumberOfOthersInProperty < ::Form::Question |
||||||
def initialize(id, hsh, page) |
def initialize(id, hsh, page, joint_purchase:) |
||||||
super |
super(id, hsh, page) |
||||||
@id = "hholdcount" |
@id = "hholdcount" |
||||||
@check_answer_label = "Number of other people living in the property" |
@check_answer_label = "Number of other people living in the property" |
||||||
@header = "Besides the buyer(s), how many other people live or will live in the property?" |
@header = "Besides the buyer(s), how many other people live or will live in the property?" |
||||||
@type = "numeric" |
@type = "numeric" |
||||||
@hint_text = "You can provide details for a maximum of 4 other people." |
@hint_text = hint(joint_purchase) |
||||||
@width = 2 |
@width = 2 |
||||||
@min = 0 |
@min = 0 |
||||||
@max = 4 |
@max = joint_purchase ? 4 : 5 |
||||||
|
end |
||||||
|
|
||||||
|
private |
||||||
|
|
||||||
|
def hint(joint_purchase) |
||||||
|
if joint_purchase |
||||||
|
"You can provide details for a maximum of 4 other people for a joint purchase." |
||||||
|
else |
||||||
|
"You can provide details for a maximum of 5 other people if there is only one buyer." |
||||||
|
end |
||||||
end |
end |
||||||
end |
end |
||||||
|
@ -0,0 +1 @@ |
|||||||
|
You have given us the details for <%= log.joint_purchase? ? 3 : 4 %> of the <%= log.hholdcount %> other people in the household |
Loading…
Reference in new issue