8 changed files with 72 additions and 0 deletions
@ -0,0 +1,13 @@ |
|||||||
|
class Form::Sales::Pages::EstateManagementFee < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@copy_key = "sales.sale_information.management_fee" |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::HasManagementFee.new(nil, nil, self), |
||||||
|
Form::Sales::Questions::ManagementFee.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,24 @@ |
|||||||
|
class Form::Sales::Questions::HasManagementFee < ::Form::Question |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "has_management_fee" |
||||||
|
@copy_key = "sales.sale_information.management_fee.has_management_fee" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@conditional_for = { |
||||||
|
"management_fee" => [1], |
||||||
|
} |
||||||
|
@hidden_in_check_answers = { |
||||||
|
"depends_on" => [ |
||||||
|
{ |
||||||
|
"has_management_fee" => 1, |
||||||
|
}, |
||||||
|
], |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"1" => { "value" => "Yes" }, |
||||||
|
"0" => { "value" => "No" }, |
||||||
|
}.freeze |
||||||
|
end |
@ -0,0 +1,12 @@ |
|||||||
|
class Form::Sales::Questions::ManagementFee < ::Form::Question |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "management_fee" |
||||||
|
@copy_key = "sales.sale_information.management_fee.management_fee" |
||||||
|
@type = "numeric" |
||||||
|
@min = 1 |
||||||
|
@step = 0.01 |
||||||
|
@width = 5 |
||||||
|
@prefix = "£" |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,8 @@ |
|||||||
|
class AddManagementFeeFields < ActiveRecord::Migration[7.0] |
||||||
|
def change |
||||||
|
change_table :sales_logs, bulk: true do |t| |
||||||
|
t.column :has_management_fee, :integer |
||||||
|
t.column :management_fee, :decimal, precision: 10, scale: 2 |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue