6 changed files with 68 additions and 0 deletions
@ -0,0 +1,16 @@ |
|||||||
|
class Form::Sales::Pages::PropertyLocalAuthority < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "property_local_authority" |
||||||
|
@header = "" |
||||||
|
@description = "" |
||||||
|
@subsection = subsection |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::PropertyLocalAuthorityKnown.new(nil, nil, self), |
||||||
|
Form::Sales::Questions::PropertyLocalAuthority.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
class Form::Sales::Questions::PropertyLocalAuthority < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "la" |
||||||
|
@check_answer_label = "Local authority" |
||||||
|
@header = "What is the local authority of the property?" |
||||||
|
@type = "select" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@page = page |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"test" => "Location", |
||||||
|
"test2" => "Other location", |
||||||
|
"foo" => "bar", |
||||||
|
}.freeze |
||||||
|
end |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
class Form::Sales::Questions::PropertyLocalAuthorityKnown < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "la_known" |
||||||
|
@check_answer_label = "Local authority known" |
||||||
|
@header = "Do you know the local authority of the property?" |
||||||
|
@type = "radio" |
||||||
|
@answer_options = ANSWER_OPTIONS |
||||||
|
@conditional_for = { "la" => [1] } |
||||||
|
@hidden_in_check_answers = { |
||||||
|
"depends_on" => [ |
||||||
|
{ |
||||||
|
"la_known" => 1, |
||||||
|
}, |
||||||
|
], |
||||||
|
} |
||||||
|
@page = page |
||||||
|
end |
||||||
|
|
||||||
|
ANSWER_OPTIONS = { |
||||||
|
"1" => { "value" => "Yes" }, |
||||||
|
"0" => { "value" => "No" }, |
||||||
|
}.freeze |
||||||
|
end |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
class AddLaToSalesLog < ActiveRecord::Migration[7.0] |
||||||
|
def change |
||||||
|
change_table :sales_logs do |t| |
||||||
|
t.column :la, :string |
||||||
|
t.column :la_known, :integer |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
Loading…
Reference in new issue