4 changed files with 59 additions and 0 deletions
@ -0,0 +1,14 @@ |
|||||||
|
class Form::Sales::Pages::ServiceChargeChanged < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "service_charge_changed" |
||||||
|
@copy_key = "sales.sale_information.servicecharges_changed" |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::HasServiceChargesChanged.new(nil, nil, self), |
||||||
|
Form::Sales::Questions::NewServiceCharges.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,27 @@ |
|||||||
|
class Form::Sales::Questions::HasServiceChargesChanged < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "hasservicechargeschanged" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@conditional_for = { |
||||||
|
"newservicecharges" => [1], |
||||||
|
} |
||||||
|
@hidden_in_check_answers = { |
||||||
|
"depends_on" => [ |
||||||
|
{ |
||||||
|
"hasservicechargeschanged" => 1, |
||||||
|
}, |
||||||
|
], |
||||||
|
} |
||||||
|
@copy_key = "sales.sale_information.servicecharges_changed.has_service_charges_changed" |
||||||
|
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"1" => { "value" => "Yes" }, |
||||||
|
"2" => { "value" => "No" }, |
||||||
|
}.freeze |
||||||
|
|
||||||
|
QUESTION_NUMBER_FROM_YEAR = { 2026 => 0 }.freeze |
||||||
|
end |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
class Form::Sales::Questions::NewServiceCharges < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "newservicecharges" |
||||||
|
@type = "numeric" |
||||||
|
@min = 0 |
||||||
|
@max = 9999.99 |
||||||
|
@step = 0.01 |
||||||
|
@width = 5 |
||||||
|
@prefix = "£" |
||||||
|
@copy_key = "sales.sale_information.servicecharges_changed.new_service_charges" |
||||||
|
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] |
||||||
|
@strip_commas = true |
||||||
|
end |
||||||
|
|
||||||
|
QUESTION_NUMBER_FROM_YEAR = { 2026 => 0 }.freeze |
||||||
|
end |
||||||
Loading…
Reference in new issue