5 changed files with 39 additions and 10 deletions
@ -0,0 +1,13 @@ |
|||||||
|
class Form::Sales::Pages::ServiceChargeStaircasing < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@copy_key = "sales.sale_information.servicecharges" |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::HasServiceCharge.new(nil, nil, self, staircasing: true), |
||||||
|
Form::Sales::Questions::ServiceCharge.new(nil, nil, self, staircasing: true), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
||||||
@ -1,16 +1,24 @@ |
|||||||
class Form::Sales::Questions::ServiceCharge < ::Form::Question |
class Form::Sales::Questions::ServiceCharge < ::Form::Question |
||||||
def initialize(id, hsh, subsection) |
def initialize(id, hsh, subsection, staircasing:) |
||||||
super |
super(id, hsh, subsection) |
||||||
@id = "mscharge" |
@id = "mscharge" |
||||||
@type = "numeric" |
@type = "numeric" |
||||||
@min = 1 |
@min = 1 |
||||||
|
@max = 9999.99 |
||||||
@step = 0.01 |
@step = 0.01 |
||||||
@width = 5 |
@width = 5 |
||||||
@prefix = "£" |
@prefix = "£" |
||||||
@copy_key = "sales.sale_information.servicecharges.servicecharge" |
@copy_key = "sales.sale_information.servicecharges.servicecharge" |
||||||
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] |
@staircasing = staircasing |
||||||
|
@question_number = question_number_from_year[form.start_date.year] || question_number_from_year[question_number_from_year.keys.max] |
||||||
@strip_commas = true |
@strip_commas = true |
||||||
end |
end |
||||||
|
|
||||||
QUESTION_NUMBER_FROM_YEAR = { 2025 => 88 }.freeze |
def question_number_from_year |
||||||
|
if @staircasing |
||||||
|
{ 2026 => 0 }.freeze |
||||||
|
else |
||||||
|
{ 2025 => 88 }.freeze |
||||||
|
end |
||||||
|
end |
||||||
end |
end |
||||||
|
|||||||
Loading…
Reference in new issue