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 |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "number_of_others_in_property" |
||||
def initialize(id, hsh, subsection, joint_purchase:) |
||||
super(id, hsh, subsection) |
||||
@depends_on = [ |
||||
{ |
||||
"privacynotice" => 1, |
||||
"jointpur" => joint_purchase ? 1 : 2, |
||||
}, |
||||
{ |
||||
"noint" => 1, |
||||
"jointpur" => joint_purchase ? 1 : 2, |
||||
}, |
||||
] |
||||
@joint_purchase = joint_purchase |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::NumberOfOthersInProperty.new(nil, nil, self), |
||||
Form::Sales::Questions::NumberOfOthersInProperty.new(nil, nil, self, joint_purchase: @joint_purchase), |
||||
] |
||||
end |
||||
end |
||||
|
@ -1,13 +1,23 @@
|
||||
class Form::Sales::Questions::NumberOfOthersInProperty < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
def initialize(id, hsh, page, joint_purchase:) |
||||
super(id, hsh, page) |
||||
@id = "hholdcount" |
||||
@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?" |
||||
@type = "numeric" |
||||
@hint_text = "You can provide details for a maximum of 4 other people." |
||||
@hint_text = hint(joint_purchase) |
||||
@width = 2 |
||||
@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 |
||||
|
@ -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