Browse Source
* Update optional hint text for deposit in 24/25 * Make deposit dynamically optional, update BU * Refactor conditional page * Add validationpull/2234/head
kosiakkatrina
11 months ago
committed by
GitHub
16 changed files with 237 additions and 21 deletions
@ -1,15 +1,22 @@
|
||||
class Form::Sales::Pages::AboutDepositWithDiscount < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "about_deposit_with_discount" |
||||
def initialize(id, hsh, subsection, optional:) |
||||
super(id, hsh, subsection) |
||||
@header = "About the deposit" |
||||
@depends_on = [{ "is_type_discount?" => true }] |
||||
@optional = optional |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::DepositAmount.new(nil, nil, self, ownershipsch: 1), |
||||
Form::Sales::Questions::DepositAmount.new(nil, nil, self, ownershipsch: 1, optional: @optional), |
||||
Form::Sales::Questions::DepositDiscount.new(nil, nil, self), |
||||
] |
||||
end |
||||
|
||||
def depends_on |
||||
if form.start_year_after_2024? |
||||
[{ "is_type_discount?" => true, "stairowned_100?" => @optional }] |
||||
else |
||||
[{ "is_type_discount?" => true }] |
||||
end |
||||
end |
||||
end |
||||
|
@ -1,16 +1,26 @@
|
||||
class Form::Sales::Pages::AboutDepositWithoutDiscount < ::Form::Page |
||||
def initialize(id, hsh, subsection, ownershipsch:) |
||||
def initialize(id, hsh, subsection, ownershipsch:, optional:) |
||||
super(id, hsh, subsection) |
||||
@header = "About the deposit" |
||||
@depends_on = [{ "is_type_discount?" => false, "ownershipsch" => 1 }, |
||||
{ "ownershipsch" => 2 }, |
||||
{ "ownershipsch" => 3, "mortgageused" => 1 }] |
||||
@ownershipsch = ownershipsch |
||||
@optional = optional |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::DepositAmount.new(nil, nil, self, ownershipsch: @ownershipsch), |
||||
Form::Sales::Questions::DepositAmount.new(nil, nil, self, ownershipsch: @ownershipsch, optional: @optional), |
||||
] |
||||
end |
||||
|
||||
def depends_on |
||||
if form.start_year_after_2024? |
||||
[{ "is_type_discount?" => false, "ownershipsch" => 1, "stairowned_100?" => @optional }, |
||||
{ "ownershipsch" => 2 }, |
||||
{ "ownershipsch" => 3, "mortgageused" => 1 }] |
||||
else |
||||
[{ "is_type_discount?" => false, "ownershipsch" => 1 }, |
||||
{ "ownershipsch" => 2 }, |
||||
{ "ownershipsch" => 3, "mortgageused" => 1 }] |
||||
end |
||||
end |
||||
end |
||||
|
Loading…
Reference in new issue