Manny Dinssa
3 months ago
committed by
GitHub
57 changed files with 298 additions and 408 deletions
@ -1,14 +0,0 @@ |
|||||||
class Form::Lettings::Pages::PropertyPostcode < ::Form::Page |
|
||||||
def initialize(id, hsh, subsection) |
|
||||||
super |
|
||||||
@id = "property_postcode" |
|
||||||
@depends_on = [{ "is_general_needs?" => true }] |
|
||||||
end |
|
||||||
|
|
||||||
def questions |
|
||||||
@questions ||= [ |
|
||||||
Form::Lettings::Questions::PostcodeKnown.new(nil, nil, self), |
|
||||||
Form::Lettings::Questions::PostcodeFull.new(nil, nil, self), |
|
||||||
] |
|
||||||
end |
|
||||||
end |
|
@ -1,15 +0,0 @@ |
|||||||
class Form::Lettings::Questions::PostcodeFull < ::Form::Question |
|
||||||
def initialize(id, hsh, page) |
|
||||||
super |
|
||||||
@id = "postcode_full" |
|
||||||
@check_answer_label = "Postcode" |
|
||||||
@header = "What is the property’s postcode?" |
|
||||||
@type = "text" |
|
||||||
@width = 5 |
|
||||||
@inferred_check_answers_value = [{ "condition" => { "postcode_known" => 0 }, "value" => "Not known" }] |
|
||||||
@check_answers_card_number = 0 |
|
||||||
@hint_text = "" |
|
||||||
@inferred_answers = { "la" => { "is_la_inferred" => true } } |
|
||||||
@disable_clearing_if_not_routed_or_dynamic_answer_options = true |
|
||||||
end |
|
||||||
end |
|
@ -1,17 +0,0 @@ |
|||||||
class Form::Lettings::Questions::PostcodeKnown < ::Form::Question |
|
||||||
def initialize(id, hsh, page) |
|
||||||
super |
|
||||||
@id = "postcode_known" |
|
||||||
@check_answer_label = "Do you know the property postcode?" |
|
||||||
@header = "Do you know the property’s postcode?" |
|
||||||
@type = "radio" |
|
||||||
@check_answers_card_number = 0 |
|
||||||
@hint_text = "" |
|
||||||
@answer_options = ANSWER_OPTIONS |
|
||||||
@disable_clearing_if_not_routed_or_dynamic_answer_options = true |
|
||||||
@conditional_for = { "postcode_full" => [1] } |
|
||||||
@hidden_in_check_answers = { "depends_on" => [{ "postcode_known" => 0 }, { "postcode_known" => 1 }] } |
|
||||||
end |
|
||||||
|
|
||||||
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze |
|
||||||
end |
|
@ -1,13 +0,0 @@ |
|||||||
class Form::Sales::Pages::Postcode < ::Form::Page |
|
||||||
def initialize(id, hsh, subsection) |
|
||||||
super |
|
||||||
@id = "property_postcode" |
|
||||||
end |
|
||||||
|
|
||||||
def questions |
|
||||||
@questions ||= [ |
|
||||||
Form::Sales::Questions::PostcodeKnown.new(nil, nil, self), |
|
||||||
Form::Sales::Questions::Postcode.new(nil, nil, self), |
|
||||||
] |
|
||||||
end |
|
||||||
end |
|
@ -1,22 +0,0 @@ |
|||||||
class Form::Sales::Questions::Postcode < ::Form::Question |
|
||||||
def initialize(id, hsh, page) |
|
||||||
super |
|
||||||
@id = "postcode_full" |
|
||||||
@check_answer_label = "Property’s postcode" |
|
||||||
@header = "Postcode" |
|
||||||
@type = "text" |
|
||||||
@width = 5 |
|
||||||
@inferred_check_answers_value = [{ |
|
||||||
"condition" => { |
|
||||||
"pcodenk" => 1, |
|
||||||
}, |
|
||||||
"value" => "Not known", |
|
||||||
}] |
|
||||||
@inferred_answers = { |
|
||||||
"la" => { |
|
||||||
"is_la_inferred" => true, |
|
||||||
}, |
|
||||||
} |
|
||||||
@disable_clearing_if_not_routed_or_dynamic_answer_options = true |
|
||||||
end |
|
||||||
end |
|
@ -1,29 +0,0 @@ |
|||||||
class Form::Sales::Questions::PostcodeKnown < ::Form::Question |
|
||||||
def initialize(id, hsh, page) |
|
||||||
super |
|
||||||
@id = "pcodenk" |
|
||||||
@check_answer_label = "Property’s postcode" |
|
||||||
@header = "Do you know the property’s postcode?" |
|
||||||
@type = "radio" |
|
||||||
@answer_options = ANSWER_OPTIONS |
|
||||||
@conditional_for = { |
|
||||||
"postcode_full" => [0], |
|
||||||
} |
|
||||||
@hidden_in_check_answers = { |
|
||||||
"depends_on" => [ |
|
||||||
{ |
|
||||||
"pcodenk" => 0, |
|
||||||
}, |
|
||||||
{ |
|
||||||
"pcodenk" => 1, |
|
||||||
}, |
|
||||||
], |
|
||||||
} |
|
||||||
@disable_clearing_if_not_routed_or_dynamic_answer_options = true |
|
||||||
end |
|
||||||
|
|
||||||
ANSWER_OPTIONS = { |
|
||||||
"0" => { "value" => "Yes" }, |
|
||||||
"1" => { "value" => "No" }, |
|
||||||
}.freeze |
|
||||||
end |
|
@ -1,26 +0,0 @@ |
|||||||
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 property’s local authority?" |
|
||||||
@type = "radio" |
|
||||||
@answer_options = ANSWER_OPTIONS |
|
||||||
@conditional_for = { "la" => [1] } |
|
||||||
@hidden_in_check_answers = { |
|
||||||
"depends_on" => [ |
|
||||||
{ |
|
||||||
"la_known" => 1, |
|
||||||
}, |
|
||||||
], |
|
||||||
} |
|
||||||
@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" }, |
|
||||||
"0" => { "value" => "No" }, |
|
||||||
}.freeze |
|
||||||
|
|
||||||
QUESTION_NUMBER_FROM_YEAR = { 2023 => 16, 2024 => 17 }.freeze |
|
||||||
end |
|
@ -0,0 +1,74 @@ |
|||||||
|
en: |
||||||
|
forms: |
||||||
|
2023: |
||||||
|
sales: |
||||||
|
property_information: |
||||||
|
uprn: |
||||||
|
page_header: "" |
||||||
|
uprn_known: |
||||||
|
check_answer_label: "UPRN known?" |
||||||
|
hint_text: "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.<br><br>The UPRN may not be the same as the property reference assigned by your organisation.<br><br>If you don’t know the UPRN you can enter the address of the property instead on the next screen." |
||||||
|
question_text: "Do you know the property's UPRN?" |
||||||
|
uprn: |
||||||
|
check_answer_label: "UPRN" |
||||||
|
hint_text: "" |
||||||
|
question_text: "What is the property's UPRN?" |
||||||
|
|
||||||
|
uprn_confirmed: |
||||||
|
page_header: "We found an address that might be this property" |
||||||
|
check_answer_label: "Is this the right address?" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Is this the property address?" |
||||||
|
|
||||||
|
address: |
||||||
|
page_header: "Q15 - What is the property's address?" |
||||||
|
address_line1: |
||||||
|
check_answer_label: "Address lines 1 and 2" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Address line 1" |
||||||
|
address_line2: |
||||||
|
check_answer_label: "" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Address line 2 (optional)" |
||||||
|
town_or_city: |
||||||
|
check_answer_label: "Town or city" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Town or city" |
||||||
|
county: |
||||||
|
check_answer_label: "County" |
||||||
|
hint_text: "" |
||||||
|
question_text: "County (optional)" |
||||||
|
postcode_full: |
||||||
|
check_answer_label: "Postcode" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Postcode" |
||||||
|
|
||||||
|
la: |
||||||
|
page_header: "" |
||||||
|
check_answer_label: "Local authority" |
||||||
|
hint_text: "" |
||||||
|
question_text: "What is the property’s local authority?" |
||||||
|
|
||||||
|
beds: |
||||||
|
page_header: "" |
||||||
|
check_answer_label: "Number of bedrooms" |
||||||
|
hint_text: "A bedsit has 1 bedroom." |
||||||
|
question_text: "How many bedrooms does the property have?" |
||||||
|
|
||||||
|
proptype: |
||||||
|
page_header: "" |
||||||
|
check_answer_label: "Type of unit" |
||||||
|
hint_text: "" |
||||||
|
question_text: "What type of unit is the property?" |
||||||
|
|
||||||
|
builtype: |
||||||
|
page_header: "" |
||||||
|
check_answer_label: "Type of building" |
||||||
|
hint_text: "" |
||||||
|
question_text: "What type of building is the property?" |
||||||
|
|
||||||
|
wchair: |
||||||
|
page_header: "" |
||||||
|
check_answer_label: "Property built or adapted to wheelchair-user standards" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Is the property built or adapted to wheelchair-user standards?" |
@ -0,0 +1,91 @@ |
|||||||
|
en: |
||||||
|
forms: |
||||||
|
2024: |
||||||
|
sales: |
||||||
|
property_information: |
||||||
|
uprn: |
||||||
|
page_header: "" |
||||||
|
uprn_known: |
||||||
|
check_answer_label: "UPRN known?" |
||||||
|
hint_text: "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355.<br><br>The UPRN may not be the same as the property reference assigned by your organisation.<br><br>If you don’t know the UPRN you can enter the address of the property instead on the next screen." |
||||||
|
question_text: "Do you know the property's UPRN?" |
||||||
|
uprn: |
||||||
|
check_answer_label: "UPRN" |
||||||
|
hint_text: "" |
||||||
|
question_text: "What is the property's UPRN?" |
||||||
|
|
||||||
|
uprn_confirmed: |
||||||
|
page_header: "We found an address that might be this property" |
||||||
|
check_answer_label: "Is this the right address?" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Is this the property address?" |
||||||
|
|
||||||
|
address_matcher: |
||||||
|
page_header: "Find an address" |
||||||
|
address_line1_input: |
||||||
|
check_answer_label: "Find address" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Address line 1" |
||||||
|
postcode_full_input: |
||||||
|
check_answer_label: "" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Postcode" |
||||||
|
|
||||||
|
uprn_selection: |
||||||
|
page_header: "We found an address that might be this property" |
||||||
|
check_answer_label: "Select the correct address" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Select the correct address" |
||||||
|
|
||||||
|
address: |
||||||
|
page_header: "Q12 - What is the property's address?" |
||||||
|
address_line1: |
||||||
|
check_answer_label: "Address lines 1 and 2" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Address line 1" |
||||||
|
address_line2: |
||||||
|
check_answer_label: "" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Address line 2 (optional)" |
||||||
|
town_or_city: |
||||||
|
check_answer_label: "Town or city" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Town or city" |
||||||
|
county: |
||||||
|
check_answer_label: "County" |
||||||
|
hint_text: "" |
||||||
|
question_text: "County (optional)" |
||||||
|
postcode_full: |
||||||
|
check_answer_label: "Postcode" |
||||||
|
hint_text: "" |
||||||
|
question_text: "Postcode" |
||||||
|
|
||||||
|
la: |
||||||
|
page_header: "" |
||||||
|
check_answer_label: "Local authority" |
||||||
|
hint_text: "" |
||||||
|
question_text: "What is the property’s local authority?" |
||||||
|
|
||||||
|
beds: |
||||||
|
page_header: "" |
||||||
|
check_answer_label: "Number of bedrooms" |
||||||
|
hint_text: "A bedsit has 1 bedroom." |
||||||
|
question_text: "How many bedrooms does the property have?" |
||||||
|
|
||||||
|
proptype: |
||||||
|
page_header: "" |
||||||
|
check_answer_label: "Type of unit" |
||||||
|
hint_text: "" |
||||||
|
question_text: "What type of unit is the property?" |
||||||
|
|
||||||
|
builtype: |
||||||
|
page_header: "" |
||||||
|
check_answer_label: "Type of building" |
||||||
|
hint_text: "" |
||||||
|
question_text: "What type of building is the property?" |
||||||
|
|
||||||
|
wchair: |
||||||
|
page_header: "" |
||||||
|
check_answer_label: "Property built or adapted to wheelchair-user standards" |
||||||
|
hint_text: "This is whether someone who uses a wheelchair is able to make full use of all of the property’s rooms and facilities, including use of both inside and outside space, and entering and exiting the property." |
||||||
|
question_text: "Is the property built or adapted to wheelchair-user standards?" |
@ -1,29 +0,0 @@ |
|||||||
require "rails_helper" |
|
||||||
|
|
||||||
RSpec.describe Form::Sales::Pages::Postcode, type: :model do |
|
||||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
|
||||||
|
|
||||||
let(:page_id) { nil } |
|
||||||
let(:page_definition) { nil } |
|
||||||
let(:subsection) { instance_double(Form::Subsection) } |
|
||||||
|
|
||||||
it "has correct subsection" do |
|
||||||
expect(page.subsection).to eq(subsection) |
|
||||||
end |
|
||||||
|
|
||||||
it "has correct questions" do |
|
||||||
expect(page.questions.map(&:id)).to eq(%w[pcodenk postcode_full]) |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct id" do |
|
||||||
expect(page.id).to eq("property_postcode") |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct description" do |
|
||||||
expect(page.description).to be_nil |
|
||||||
end |
|
||||||
|
|
||||||
it "has correct depends_on" do |
|
||||||
expect(page.depends_on).to be_nil |
|
||||||
end |
|
||||||
end |
|
@ -1,47 +0,0 @@ |
|||||||
require "rails_helper" |
|
||||||
|
|
||||||
RSpec.describe Form::Sales::Questions::PostcodeKnown, type: :model do |
|
||||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
|
||||||
|
|
||||||
let(:question_id) { nil } |
|
||||||
let(:question_definition) { nil } |
|
||||||
let(:page) { instance_double(Form::Page) } |
|
||||||
|
|
||||||
it "has correct page" do |
|
||||||
expect(question.page).to eq(page) |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct id" do |
|
||||||
expect(question.id).to eq("pcodenk") |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct type" do |
|
||||||
expect(question.type).to eq("radio") |
|
||||||
end |
|
||||||
|
|
||||||
it "is not marked as derived" do |
|
||||||
expect(question.derived?(nil)).to be false |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct answer_options" do |
|
||||||
expect(question.answer_options).to eq({ |
|
||||||
"0" => { "value" => "Yes" }, |
|
||||||
"1" => { "value" => "No" }, |
|
||||||
}) |
|
||||||
end |
|
||||||
|
|
||||||
it "has correct conditional for" do |
|
||||||
expect(question.conditional_for).to eq({ |
|
||||||
"postcode_full" => [0], |
|
||||||
}) |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct hidden_in_check_answers" do |
|
||||||
expect(question.hidden_in_check_answers).to eq({ |
|
||||||
"depends_on" => [ |
|
||||||
{ "pcodenk" => 0 }, |
|
||||||
{ "pcodenk" => 1 }, |
|
||||||
], |
|
||||||
}) |
|
||||||
end |
|
||||||
end |
|
@ -1,46 +0,0 @@ |
|||||||
require "rails_helper" |
|
||||||
|
|
||||||
RSpec.describe Form::Sales::Questions::Postcode, type: :model do |
|
||||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
|
||||||
|
|
||||||
let(:question_id) { nil } |
|
||||||
let(:question_definition) { nil } |
|
||||||
let(:page) { instance_double(Form::Page) } |
|
||||||
|
|
||||||
it "has correct page" do |
|
||||||
expect(question.page).to eq(page) |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct id" do |
|
||||||
expect(question.id).to eq("postcode_full") |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct type" do |
|
||||||
expect(question.type).to eq("text") |
|
||||||
end |
|
||||||
|
|
||||||
it "is not marked as derived" do |
|
||||||
expect(question.derived?(nil)).to be false |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct width" do |
|
||||||
expect(question.width).to eq(5) |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct inferred_answers" do |
|
||||||
expect(question.inferred_answers).to eq({ |
|
||||||
"la" => { |
|
||||||
"is_la_inferred" => true, |
|
||||||
}, |
|
||||||
}) |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct inferred_check_answers_value" do |
|
||||||
expect(question.inferred_check_answers_value).to eq([{ |
|
||||||
"condition" => { |
|
||||||
"pcodenk" => 1, |
|
||||||
}, |
|
||||||
"value" => "Not known", |
|
||||||
}]) |
|
||||||
end |
|
||||||
end |
|
Loading…
Reference in new issue