diff --git a/app/frontend/controllers/conditional_question_controller.js b/app/frontend/controllers/conditional_question_controller.js index 974deeb2e..fb52d07c1 100644 --- a/app/frontend/controllers/conditional_question_controller.js +++ b/app/frontend/controllers/conditional_question_controller.js @@ -8,14 +8,16 @@ export default class extends Controller { displayConditional () { if (this.element.checked) { const selectedValue = this.element.value - const conditionalFor = JSON.parse(this.element.dataset.info) + const dataInfo = JSON.parse(this.element.dataset.info) + const conditionalFor = dataInfo.conditional_questions + const logType = dataInfo.log_type Object.entries(conditionalFor).forEach(([targetQuestion, conditions]) => { if (!conditions.map(String).includes(String(selectedValue))) { - const textNumericInput = document.getElementById(`lettings-log-${targetQuestion.replaceAll('_', '-')}-field`) + const textNumericInput = document.getElementById(`${logType}-log-${targetQuestion.replaceAll('_', '-')}-field`) if (textNumericInput == null) { const dateInputs = [1, 2, 3].map((idx) => { - return document.getElementById(`lettings_log_${targetQuestion}_${idx}i`) + return document.getElementById(`${logType}_log_${targetQuestion}_${idx}i`) }) this.clearDateInputs(dateInputs) } else { diff --git a/app/helpers/question_attribute_helper.rb b/app/helpers/question_attribute_helper.rb index f2f148568..857ce5eb1 100644 --- a/app/helpers/question_attribute_helper.rb +++ b/app/helpers/question_attribute_helper.rb @@ -27,7 +27,7 @@ private { "data-controller": "conditional-question", "data-action": "click->conditional-question#displayConditional", - "data-info": question.conditional_for.to_json, + "data-info": { conditional_questions: question.conditional_for, log_type: question.form.type }.to_json, } end end diff --git a/app/models/derived_variables/sales_log_variables.rb b/app/models/derived_variables/sales_log_variables.rb new file mode 100644 index 000000000..2b3542813 --- /dev/null +++ b/app/models/derived_variables/sales_log_variables.rb @@ -0,0 +1,5 @@ +module DerivedVariables::SalesLogVariables + def set_derived_fields! + self.ethnic = 17 if ethnic_refused? + end +end diff --git a/app/models/form/question.rb b/app/models/form/question.rb index 4478f63fd..227e6079e 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -50,9 +50,11 @@ class Form::Question answer = label_from_value(log[id]) if log[id].present? answer_label = [prefix, format_value(answer), suffix_label(log)].join("") if answer - return answer_label if answer_label - has_inferred_check_answers_value?(log) ? inferred_check_answers_value["value"] : "" + inferred = inferred_check_answers_value["value"] if inferred_check_answers_value && has_inferred_check_answers_value?(log) + return inferred if inferred.present? + + answer_label end def get_inferred_answers(log) diff --git a/app/models/form/sales/pages/buyer1_ethnic_background_arab.rb b/app/models/form/sales/pages/buyer1_ethnic_background_arab.rb new file mode 100644 index 000000000..93fb1afe0 --- /dev/null +++ b/app/models/form/sales/pages/buyer1_ethnic_background_arab.rb @@ -0,0 +1,18 @@ +class Form::Sales::Pages::Buyer1EthnicBackgroundArab < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_1_ethnic_background_arab" + @header = "" + @description = "" + @subsection = subsection + @depends_on = [{ + "ethnic_group" => 4, + }] + end + + def questions + @questions ||= [ + Form::Sales::Questions::Buyer1EthnicBackgroundArab.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/buyer1_ethnic_background_asian.rb b/app/models/form/sales/pages/buyer1_ethnic_background_asian.rb new file mode 100644 index 000000000..dd6802a99 --- /dev/null +++ b/app/models/form/sales/pages/buyer1_ethnic_background_asian.rb @@ -0,0 +1,18 @@ +class Form::Sales::Pages::Buyer1EthnicBackgroundAsian < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_1_ethnic_background_asian" + @header = "" + @description = "" + @subsection = subsection + @depends_on = [{ + "ethnic_group" => 2, + }] + end + + def questions + @questions ||= [ + Form::Sales::Questions::Buyer1EthnicBackgroundAsian.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/buyer1_ethnic_background_black.rb b/app/models/form/sales/pages/buyer1_ethnic_background_black.rb new file mode 100644 index 000000000..ce6cf3a0b --- /dev/null +++ b/app/models/form/sales/pages/buyer1_ethnic_background_black.rb @@ -0,0 +1,18 @@ +class Form::Sales::Pages::Buyer1EthnicBackgroundBlack < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_1_ethnic_background_black" + @header = "" + @description = "" + @subsection = subsection + @depends_on = [{ + "ethnic_group" => 3, + }] + end + + def questions + @questions ||= [ + Form::Sales::Questions::Buyer1EthnicBackgroundBlack.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/buyer1_ethnic_background_mixed.rb b/app/models/form/sales/pages/buyer1_ethnic_background_mixed.rb new file mode 100644 index 000000000..5225feed1 --- /dev/null +++ b/app/models/form/sales/pages/buyer1_ethnic_background_mixed.rb @@ -0,0 +1,18 @@ +class Form::Sales::Pages::Buyer1EthnicBackgroundMixed < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_1_ethnic_background_mixed" + @header = "" + @description = "" + @subsection = subsection + @depends_on = [{ + "ethnic_group" => 1, + }] + end + + def questions + @questions ||= [ + Form::Sales::Questions::Buyer1EthnicBackgroundMixed.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/buyer1_ethnic_background_white.rb b/app/models/form/sales/pages/buyer1_ethnic_background_white.rb new file mode 100644 index 000000000..6351e50d7 --- /dev/null +++ b/app/models/form/sales/pages/buyer1_ethnic_background_white.rb @@ -0,0 +1,18 @@ +class Form::Sales::Pages::Buyer1EthnicBackgroundWhite < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_1_ethnic_background_white" + @header = "" + @description = "" + @subsection = subsection + @depends_on = [{ + "ethnic_group" => 0, + }] + end + + def questions + @questions ||= [ + Form::Sales::Questions::Buyer1EthnicBackgroundWhite.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/buyer1_ethnic_group.rb b/app/models/form/sales/pages/buyer1_ethnic_group.rb new file mode 100644 index 000000000..4daad4f1d --- /dev/null +++ b/app/models/form/sales/pages/buyer1_ethnic_group.rb @@ -0,0 +1,15 @@ +class Form::Sales::Pages::Buyer1EthnicGroup < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_1_ethnic_group" + @header = "" + @description = "" + @subsection = subsection + end + + def questions + @questions ||= [ + Form::Sales::Questions::Buyer1EthnicGroup.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/buyer1_working_situation.rb b/app/models/form/sales/pages/buyer1_working_situation.rb new file mode 100644 index 000000000..caaa0e60f --- /dev/null +++ b/app/models/form/sales/pages/buyer1_working_situation.rb @@ -0,0 +1,15 @@ +class Form::Sales::Pages::Buyer1WorkingSituation < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_1_working_situation" + @header = "Which of these best describes buyer 1's working situation?" + @description = "" + @subsection = subsection + end + + def questions + @questions ||= [ + Form::Sales::Questions::Buyer1WorkingSituation.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/buyer2_live_in_property.rb b/app/models/form/sales/pages/buyer2_live_in_property.rb new file mode 100644 index 000000000..0d2393503 --- /dev/null +++ b/app/models/form/sales/pages/buyer2_live_in_property.rb @@ -0,0 +1,15 @@ +class Form::Sales::Pages::Buyer2LiveInProperty < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_2_live_in_property" + @header = "" + @description = "" + @subsection = subsection + end + + def questions + @questions ||= [ + Form::Sales::Questions::Buyer2LiveInProperty.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/buyer2_relationship_to_buyer1.rb b/app/models/form/sales/pages/buyer2_relationship_to_buyer1.rb index 7576e947c..8927ddd5a 100644 --- a/app/models/form/sales/pages/buyer2_relationship_to_buyer1.rb +++ b/app/models/form/sales/pages/buyer2_relationship_to_buyer1.rb @@ -13,7 +13,6 @@ class Form::Sales::Pages::Buyer2RelationshipToBuyer1 < ::Form::Page def questions @questions ||= [ Form::Sales::Questions::Buyer2RelationshipToBuyer1.new(nil, nil, self), - Form::Sales::Questions::OtherBuyer2RelationshipToBuyer1.new(nil, nil, self), ] end end diff --git a/app/models/form/sales/pages/buyer2_working_situation.rb b/app/models/form/sales/pages/buyer2_working_situation.rb new file mode 100644 index 000000000..e445a56c1 --- /dev/null +++ b/app/models/form/sales/pages/buyer2_working_situation.rb @@ -0,0 +1,15 @@ +class Form::Sales::Pages::Buyer2WorkingSituation < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_2_working_situation" + @header = "" + @description = "" + @subsection = subsection + end + + def questions + @questions ||= [ + Form::Sales::Questions::Buyer2WorkingSituation.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/buyer_interview.rb b/app/models/form/sales/pages/buyer_interview.rb new file mode 100644 index 000000000..a781d8a07 --- /dev/null +++ b/app/models/form/sales/pages/buyer_interview.rb @@ -0,0 +1,15 @@ +class Form::Sales::Pages::BuyerInterview < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_interview" + @header = "" + @description = "" + @subsection = subsection + end + + def questions + @questions ||= [ + Form::Sales::Questions::BuyerInterview.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/gender_identity2.rb b/app/models/form/sales/pages/gender_identity2.rb new file mode 100644 index 000000000..f5db5aecb --- /dev/null +++ b/app/models/form/sales/pages/gender_identity2.rb @@ -0,0 +1,18 @@ +class Form::Sales::Pages::GenderIdentity2 < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_2_gender_identity" + @header = "" + @description = "" + @subsection = subsection + @depends_on = [{ + "jointpur" => 1, + }] + end + + def questions + @questions ||= [ + Form::Sales::Questions::GenderIdentity2.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/household_wheelchair.rb b/app/models/form/sales/pages/household_wheelchair.rb new file mode 100644 index 000000000..97d4abc52 --- /dev/null +++ b/app/models/form/sales/pages/household_wheelchair.rb @@ -0,0 +1,15 @@ +class Form::Sales::Pages::HouseholdWheelchair < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "household_wheelchair" + @header = "" + @description = "" + @subsection = subsection + end + + def questions + @questions ||= [ + Form::Sales::Questions::HouseholdWheelchair.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/nationality1.rb b/app/models/form/sales/pages/nationality1.rb new file mode 100644 index 000000000..740aa694f --- /dev/null +++ b/app/models/form/sales/pages/nationality1.rb @@ -0,0 +1,16 @@ +class Form::Sales::Pages::Nationality1 < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "buyer_1_nationality" + @header = "" + @description = "" + @subsection = subsection + end + + def questions + @questions ||= [ + Form::Sales::Questions::Nationality1.new(nil, nil, self), + Form::Sales::Questions::OtherNationality1.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/number_of_others_in_property.rb b/app/models/form/sales/pages/number_of_others_in_property.rb new file mode 100644 index 000000000..b97c70775 --- /dev/null +++ b/app/models/form/sales/pages/number_of_others_in_property.rb @@ -0,0 +1,15 @@ +class Form::Sales::Pages::NumberOfOthersInProperty < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "number_of_others_in_property" + @header = "" + @description = "" + @subsection = subsection + end + + def questions + @questions ||= [ + Form::Sales::Questions::NumberOfOthersInProperty.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/privacy_notice.rb b/app/models/form/sales/pages/privacy_notice.rb new file mode 100644 index 000000000..a7e8ca219 --- /dev/null +++ b/app/models/form/sales/pages/privacy_notice.rb @@ -0,0 +1,18 @@ +class Form::Sales::Pages::PrivacyNotice < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "privacy_notice" + @header = "Department for Levelling Up, Housing and Communities privacy notice" + @description = "" + @subsection = subsection + @depends_on = [{ + "noint" => 1, + }] + end + + def questions + @questions ||= [ + Form::Sales::Questions::PrivacyNotice.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/building_type.rb b/app/models/form/sales/pages/property_building_type.rb similarity index 61% rename from app/models/form/sales/pages/building_type.rb rename to app/models/form/sales/pages/property_building_type.rb index 1005c7b9f..8f93b305c 100644 --- a/app/models/form/sales/pages/building_type.rb +++ b/app/models/form/sales/pages/property_building_type.rb @@ -1,4 +1,4 @@ -class Form::Sales::Pages::BuildingType < ::Form::Page +class Form::Sales::Pages::PropertyBuildingType < ::Form::Page def initialize(id, hsh, subsection) super @id = "property_building_type" @@ -9,7 +9,7 @@ class Form::Sales::Pages::BuildingType < ::Form::Page def questions @questions ||= [ - Form::Sales::Questions::BuildingType.new(nil, nil, self), + Form::Sales::Questions::PropertyBuildingType.new(nil, nil, self), ] end end diff --git a/app/models/form/sales/questions/buyer1_ethnic_background_arab.rb b/app/models/form/sales/questions/buyer1_ethnic_background_arab.rb new file mode 100644 index 000000000..f6bf163b0 --- /dev/null +++ b/app/models/form/sales/questions/buyer1_ethnic_background_arab.rb @@ -0,0 +1,17 @@ +class Form::Sales::Questions::Buyer1EthnicBackgroundArab < ::Form::Question + def initialize(id, hsh, page) + super + @id = "ethnic" + @check_answer_label = "Buyer 1’s ethnic background" + @header = "Which of the following best describes the buyer 1’s Arab background?" + @type = "radio" + @answer_options = ANSWER_OPTIONS + @page = page + @hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest." + end + + ANSWER_OPTIONS = { + "19" => { "value" => "Arab" }, + "16" => { "value" => "Other ethnic group" }, + }.freeze +end diff --git a/app/models/form/sales/questions/buyer1_ethnic_background_asian.rb b/app/models/form/sales/questions/buyer1_ethnic_background_asian.rb new file mode 100644 index 000000000..a6b8ea64f --- /dev/null +++ b/app/models/form/sales/questions/buyer1_ethnic_background_asian.rb @@ -0,0 +1,20 @@ +class Form::Sales::Questions::Buyer1EthnicBackgroundAsian < ::Form::Question + def initialize(id, hsh, page) + super + @id = "ethnic" + @check_answer_label = "Buyer 1’s ethnic background" + @header = "Which of the following best describes the buyer 1’s Asian or Asian British background?" + @type = "radio" + @answer_options = ANSWER_OPTIONS + @page = page + @hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest." + end + + ANSWER_OPTIONS = { + "10" => { "value" => "Bangladeshi" }, + "15" => { "value" => "Chinese" }, + "8" => { "value" => "Indian" }, + "9" => { "value" => "Pakistani" }, + "11" => { "value" => "Any other Asian or Asian British background" }, + }.freeze +end diff --git a/app/models/form/sales/questions/buyer1_ethnic_background_black.rb b/app/models/form/sales/questions/buyer1_ethnic_background_black.rb new file mode 100644 index 000000000..841086ec3 --- /dev/null +++ b/app/models/form/sales/questions/buyer1_ethnic_background_black.rb @@ -0,0 +1,18 @@ +class Form::Sales::Questions::Buyer1EthnicBackgroundBlack < ::Form::Question + def initialize(id, hsh, page) + super + @id = "ethnic" + @check_answer_label = "Buyer 1’s ethnic background" + @header = "Which of the following best describes the buyer 1’s Black, African, Caribbean or Black British background?" + @type = "radio" + @answer_options = ANSWER_OPTIONS + @page = page + @hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest." + end + + ANSWER_OPTIONS = { + "13" => { "value" => "African" }, + "12" => { "value" => "Caribbean" }, + "14" => { "value" => "Any other Black, African or Caribbean background" }, + }.freeze +end diff --git a/app/models/form/sales/questions/buyer1_ethnic_background_mixed.rb b/app/models/form/sales/questions/buyer1_ethnic_background_mixed.rb new file mode 100644 index 000000000..69451e9e9 --- /dev/null +++ b/app/models/form/sales/questions/buyer1_ethnic_background_mixed.rb @@ -0,0 +1,19 @@ +class Form::Sales::Questions::Buyer1EthnicBackgroundMixed < ::Form::Question + def initialize(id, hsh, page) + super + @id = "ethnic" + @check_answer_label = "Buyer 1’s ethnic background" + @header = "Which of the following best describes the buyer 1’s Mixed or Multiple ethnic groups background?" + @type = "radio" + @answer_options = ANSWER_OPTIONS + @page = page + @hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest." + end + + ANSWER_OPTIONS = { + "4" => { "value" => "White and Black Caribbean" }, + "5" => { "value" => "White and Black African" }, + "6" => { "value" => "White and Asian" }, + "7" => { "value" => "Any other Mixed or Multiple ethnic background" }, + }.freeze +end diff --git a/app/models/form/sales/questions/buyer1_ethnic_background_white.rb b/app/models/form/sales/questions/buyer1_ethnic_background_white.rb new file mode 100644 index 000000000..cb9f2918f --- /dev/null +++ b/app/models/form/sales/questions/buyer1_ethnic_background_white.rb @@ -0,0 +1,19 @@ +class Form::Sales::Questions::Buyer1EthnicBackgroundWhite < ::Form::Question + def initialize(id, hsh, page) + super + @id = "ethnic" + @check_answer_label = "Buyer 1’s ethnic background" + @header = "Which of the following best describes the buyer 1’s White background?" + @type = "radio" + @answer_options = ANSWER_OPTIONS + @page = page + @hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest." + end + + ANSWER_OPTIONS = { + "1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" }, + "2" => { "value" => "Irish" }, + "18" => { "value" => "Gypsy or Irish Traveller" }, + "3" => { "value" => "Any other White background" }, + }.freeze +end diff --git a/app/models/form/sales/questions/buyer1_ethnic_group.rb b/app/models/form/sales/questions/buyer1_ethnic_group.rb new file mode 100644 index 000000000..cb1a6da28 --- /dev/null +++ b/app/models/form/sales/questions/buyer1_ethnic_group.rb @@ -0,0 +1,28 @@ +class Form::Sales::Questions::Buyer1EthnicGroup < ::Form::Question + def initialize(id, hsh, page) + super + @id = "ethnic_group" + @check_answer_label = "Buyer 1’s ethnic group" + @header = "What is buyer 1’s ethnic group?" + @type = "radio" + @answer_options = ANSWER_OPTIONS + @page = page + @hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest." + @inferred_check_answers_value = { + "condition" => { + "ethnic_group" => 17, + }, + "value" => "Prefers not to say", + } + end + + ANSWER_OPTIONS = { + "0" => { "value" => "White" }, + "1" => { "value" => "Mixed or Multiple ethnic groups" }, + "2" => { "value" => "Asian or Asian British" }, + "3" => { "value" => "Black, African, Caribbean or Black British" }, + "4" => { "value" => "Arab or other ethnic group" }, + "divider" => { "value" => true }, + "17" => { "value" => "Buyer 1 prefers not to say" }, + }.freeze +end diff --git a/app/models/form/sales/questions/buyer1_working_situation.rb b/app/models/form/sales/questions/buyer1_working_situation.rb new file mode 100644 index 000000000..571ab7366 --- /dev/null +++ b/app/models/form/sales/questions/buyer1_working_situation.rb @@ -0,0 +1,26 @@ +class Form::Sales::Questions::Buyer1WorkingSituation < ::Form::Question + def initialize(id, hsh, page) + super + @id = "ecstat1" + @check_answer_label = "Buyer 1's working situation" + @header = "Which of these best describes buyer 1's working situation?" + @type = "radio" + @answer_options = ANSWER_OPTIONS + @page = page + @hint_text = "Buyer 1 is the person in the household who does the most paid work. If it's a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest." + end + + ANSWER_OPTIONS = { + "2" => { "value" => "Part-time - Less than 30 hours" }, + "1" => { "value" => "Full-time - 30 hours or more" }, + "3" => { "value" => "In government training into work, such as New Deal" }, + "4" => { "value" => "Jobseeker" }, + "6" => { "value" => "Not seeking work" }, + "8" => { "value" => "Unable to work due to long term sick or disability" }, + "5" => { "value" => "Retired" }, + "0" => { "value" => "Other" }, + "10" => { "value" => "Buyer prefers not to say" }, + "7" => { "value" => "Full-time student" }, + "9" => { "value" => "Child under 16" }, + }.freeze +end diff --git a/app/models/form/sales/questions/buyer2_live_in_property.rb b/app/models/form/sales/questions/buyer2_live_in_property.rb new file mode 100644 index 000000000..060f52afc --- /dev/null +++ b/app/models/form/sales/questions/buyer2_live_in_property.rb @@ -0,0 +1,17 @@ +class Form::Sales::Questions::Buyer2LiveInProperty < ::Form::Question + def initialize(id, hsh, page) + super + @id = "buy2livein" + @check_answer_label = "Will buyer 2 live in the property?" + @header = "Will buyer 2 live in the property?" + @type = "radio" + @hint_text = "" + @answer_options = ANSWER_OPTIONS + @page = page + end + + ANSWER_OPTIONS = { + "1" => { "value" => "Yes" }, + "2" => { "value" => "No" }, + }.freeze +end diff --git a/app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb b/app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb index 67db6677d..11c9717ba 100644 --- a/app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb +++ b/app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb @@ -8,16 +8,6 @@ class Form::Sales::Questions::Buyer2RelationshipToBuyer1 < ::Form::Question @hint_text = "" @page = page @answer_options = ANSWER_OPTIONS - @conditional_for = { - "otherrelat2" => %w[X], - } - @hidden_in_check_answers = { - "depends_on" => [ - { - "relat2" => "X", - }, - ], - } end ANSWER_OPTIONS = { diff --git a/app/models/form/sales/questions/buyer2_working_situation.rb b/app/models/form/sales/questions/buyer2_working_situation.rb new file mode 100644 index 000000000..11b587f92 --- /dev/null +++ b/app/models/form/sales/questions/buyer2_working_situation.rb @@ -0,0 +1,26 @@ +class Form::Sales::Questions::Buyer2WorkingSituation < ::Form::Question + def initialize(id, hsh, page) + super + @id = "ecstat2" + @check_answer_label = "Buyer 2's working situation" + @header = "Which of these best describes buyer 2's working situation?" + @type = "radio" + @hint_text = "" + @page = page + @answer_options = ANSWER_OPTIONS + end + + ANSWER_OPTIONS = { + "2" => { "value" => "Part-time - Less than 30 hours" }, + "1" => { "value" => "Full-time - 30 hours or more" }, + "3" => { "value" => "In government training into work, such as New Deal" }, + "4" => { "value" => "Jobseeker" }, + "6" => { "value" => "Not seeking work" }, + "8" => { "value" => "Unable to work due to long term sick or disability" }, + "5" => { "value" => "Retired" }, + "0" => { "value" => "Other" }, + "10" => { "value" => "Buyer prefers not to say" }, + "7" => { "value" => "Full-time student" }, + "9" => { "value" => "Child under 16" }, + }.freeze +end diff --git a/app/models/form/sales/questions/buyer_interview.rb b/app/models/form/sales/questions/buyer_interview.rb new file mode 100644 index 000000000..d270d9d33 --- /dev/null +++ b/app/models/form/sales/questions/buyer_interview.rb @@ -0,0 +1,17 @@ +class Form::Sales::Questions::BuyerInterview < ::Form::Question + def initialize(id, hsh, page) + super + @id = "noint" + @check_answer_label = "Buyer interviewed in person?" + @header = "Was the buyer interviewed for any of the answers you will provide on this log?" + @type = "radio" + @hint_text = "You should still try to answer all questions even if the buyer wasn't interviewed in person" + @page = page + @answer_options = ANSWER_OPTIONS + end + + ANSWER_OPTIONS = { + "1" => { "value" => "No" }, + "2" => { "value" => "Yes" }, + }.freeze +end diff --git a/app/models/form/sales/questions/gender_identity2.rb b/app/models/form/sales/questions/gender_identity2.rb new file mode 100644 index 000000000..2c0946edb --- /dev/null +++ b/app/models/form/sales/questions/gender_identity2.rb @@ -0,0 +1,18 @@ +class Form::Sales::Questions::GenderIdentity2 < ::Form::Question + def initialize(id, hsh, page) + super + @id = "sex2" + @check_answer_label = "Buyer 2’s gender identity" + @header = "Which of these best describes buyer 2’s gender identity?" + @type = "radio" + @page = page + @answer_options = ANSWER_OPTIONS + end + + ANSWER_OPTIONS = { + "F" => { "value" => "Female" }, + "M" => { "value" => "Male" }, + "X" => { "value" => "Non-binary" }, + "R" => { "value" => "Buyer prefers not to say" }, + }.freeze +end diff --git a/app/models/form/sales/questions/household_wheelchair.rb b/app/models/form/sales/questions/household_wheelchair.rb new file mode 100644 index 000000000..43acfcc24 --- /dev/null +++ b/app/models/form/sales/questions/household_wheelchair.rb @@ -0,0 +1,17 @@ +class Form::Sales::Questions::HouseholdWheelchair < ::Form::Question + def initialize(id, hsh, page) + super + @id = "wheel" + @header = "Does anyone in the household use a wheelchair?" + @type = "radio" + @answer_options = ANSWER_OPTIONS + @page = page + @hint_text = "This can be inside or outside the home" + end + + ANSWER_OPTIONS = { + "1" => { "value" => "Yes" }, + "2" => { "value" => "No" }, + "3" => { "value" => "Don't know" }, + }.freeze +end diff --git a/app/models/form/sales/questions/nationality1.rb b/app/models/form/sales/questions/nationality1.rb new file mode 100644 index 000000000..737bfc01e --- /dev/null +++ b/app/models/form/sales/questions/nationality1.rb @@ -0,0 +1,30 @@ +class Form::Sales::Questions::Nationality1 < ::Form::Question + def initialize(id, hsh, page) + super + @id = "national" + @check_answer_label = "Buyer 1’s nationality" + @header = "What is buyer 1’s nationality?" + @type = "radio" + @hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest." + @page = page + @answer_options = ANSWER_OPTIONS + @conditional_for = { + "othernational" => [12], + } + @hidden_in_check_answers = { + "depends_on" => [ + { + "national" => 12, + }, + ], + } + end + + ANSWER_OPTIONS = { + "18" => { "value" => "United Kingdom" }, + "17" => { "value" => "Republic of Ireland" }, + "19" => { "value" => "European Economic Area (EEA), excluding ROI" }, + "12" => { "value" => "Other" }, + "13" => { "value" => "Buyer prefers not to say" }, + }.freeze +end diff --git a/app/models/form/sales/questions/number_of_others_in_property.rb b/app/models/form/sales/questions/number_of_others_in_property.rb new file mode 100644 index 000000000..ddf2adb31 --- /dev/null +++ b/app/models/form/sales/questions/number_of_others_in_property.rb @@ -0,0 +1,12 @@ +class Form::Sales::Questions::NumberOfOthersInProperty < ::Form::Question + def initialize(id, hsh, page) + super + @id = "hholdcount" + @check_answer_label = "Number of other people living in the property" + @header = "Besides the buyers, how many other people live in the property?" + @type = "numeric" + @hint_text = "You can provide details for a maximum of 4 other people." + @page = page + @width = 2 + end +end diff --git a/app/models/form/sales/questions/other_buyer2_relationship_to_buyer1.rb b/app/models/form/sales/questions/other_buyer2_relationship_to_buyer1.rb deleted file mode 100644 index f9959e3bd..000000000 --- a/app/models/form/sales/questions/other_buyer2_relationship_to_buyer1.rb +++ /dev/null @@ -1,10 +0,0 @@ -class Form::Sales::Questions::OtherBuyer2RelationshipToBuyer1 < ::Form::Question - def initialize(id, hsh, page) - super - @id = "otherrelat2" - @check_answer_label = "Buyer 2's relationship to buyer 1" - @header = "Buyer 2's relationship to buyer 1" - @type = "text" - @page = page - end -end diff --git a/app/models/form/sales/questions/other_nationality1.rb b/app/models/form/sales/questions/other_nationality1.rb new file mode 100644 index 000000000..a779d4fc8 --- /dev/null +++ b/app/models/form/sales/questions/other_nationality1.rb @@ -0,0 +1,10 @@ +class Form::Sales::Questions::OtherNationality1 < ::Form::Question + def initialize(id, hsh, page) + super + @id = "othernational" + @check_answer_label = "Buyer 1’s nationality" + @header = "Nationality" + @type = "text" + @page = page + end +end diff --git a/app/models/form/sales/questions/privacy_notice.rb b/app/models/form/sales/questions/privacy_notice.rb new file mode 100644 index 000000000..e853b38de --- /dev/null +++ b/app/models/form/sales/questions/privacy_notice.rb @@ -0,0 +1,18 @@ +class Form::Sales::Questions::PrivacyNotice < ::Form::Question + def initialize(id, hsh, page) + super + @id = "privacynotice" + @check_answer_label = "Buyer has seen the privacy notice?" + @header = "Declaration" + @type = "checkbox" + @hint_text = "" + @page = page + @answer_options = ANSWER_OPTIONS + @guidance_position = GuidancePosition::TOP + @guidance_partial = "privacy_notice_buyer" + end + + ANSWER_OPTIONS = { + "privacynotice" => { "value" => "The buyer has seen the DLUHC privacy notice" }, + }.freeze +end diff --git a/app/models/form/sales/questions/building_type.rb b/app/models/form/sales/questions/property_building_type.rb similarity index 86% rename from app/models/form/sales/questions/building_type.rb rename to app/models/form/sales/questions/property_building_type.rb index 6673d5a6d..416c9928e 100644 --- a/app/models/form/sales/questions/building_type.rb +++ b/app/models/form/sales/questions/property_building_type.rb @@ -1,4 +1,4 @@ -class Form::Sales::Questions::BuildingType < ::Form::Question +class Form::Sales::Questions::PropertyBuildingType < ::Form::Question def initialize(id, hsh, page) super @id = "builtype" diff --git a/app/models/form/sales/sections/household.rb b/app/models/form/sales/sections/household.rb index b3432522e..e6f71a26d 100644 --- a/app/models/form/sales/sections/household.rb +++ b/app/models/form/sales/sections/household.rb @@ -5,6 +5,9 @@ class Form::Sales::Sections::Household < ::Form::Section @label = "About the household" @description = "" @form = form - @subsections = [Form::Sales::Subsections::HouseholdCharacteristics.new(nil, nil, self)] || [] + @subsections = [ + Form::Sales::Subsections::HouseholdCharacteristics.new(nil, nil, self), + Form::Sales::Subsections::HouseholdNeeds.new(nil, nil, self), + ] end end diff --git a/app/models/form/sales/subsections/household_characteristics.rb b/app/models/form/sales/subsections/household_characteristics.rb index 6a6cb2824..7af439221 100644 --- a/app/models/form/sales/subsections/household_characteristics.rb +++ b/app/models/form/sales/subsections/household_characteristics.rb @@ -9,11 +9,25 @@ class Form::Sales::Subsections::HouseholdCharacteristics < ::Form::Subsection def pages @pages ||= [ + Form::Sales::Pages::BuyerInterview.new(nil, nil, self), + Form::Sales::Pages::PrivacyNotice.new(nil, nil, self), Form::Sales::Pages::Age1.new(nil, nil, self), Form::Sales::Pages::GenderIdentity1.new(nil, nil, self), + Form::Sales::Pages::Buyer1EthnicGroup.new(nil, nil, self), + Form::Sales::Pages::Buyer1EthnicBackgroundBlack.new(nil, nil, self), + Form::Sales::Pages::Buyer1EthnicBackgroundAsian.new(nil, nil, self), + Form::Sales::Pages::Buyer1EthnicBackgroundArab.new(nil, nil, self), + Form::Sales::Pages::Buyer1EthnicBackgroundMixed.new(nil, nil, self), + Form::Sales::Pages::Buyer1EthnicBackgroundWhite.new(nil, nil, self), + Form::Sales::Pages::Nationality1.new(nil, nil, self), + Form::Sales::Pages::Buyer1WorkingSituation.new(nil, nil, self), Form::Sales::Pages::Buyer1LiveInProperty.new(nil, nil, self), Form::Sales::Pages::Buyer2RelationshipToBuyer1.new(nil, nil, self), Form::Sales::Pages::Age2.new(nil, nil, self), + Form::Sales::Pages::GenderIdentity2.new(nil, nil, self), + Form::Sales::Pages::Buyer2WorkingSituation.new(nil, nil, self), + Form::Sales::Pages::Buyer2LiveInProperty.new(nil, nil, self), + Form::Sales::Pages::NumberOfOthersInProperty.new(nil, nil, self), ] end end diff --git a/app/models/form/sales/subsections/household_needs.rb b/app/models/form/sales/subsections/household_needs.rb new file mode 100644 index 000000000..bf7a5df3a --- /dev/null +++ b/app/models/form/sales/subsections/household_needs.rb @@ -0,0 +1,15 @@ +class Form::Sales::Subsections::HouseholdNeeds < ::Form::Subsection + def initialize(id, hsh, section) + super + @id = "household_needs" + @label = "Household needs" + @section = section + @depends_on = [{ "setup" => "completed" }] + end + + def pages + @pages ||= [ + Form::Sales::Pages::HouseholdWheelchair.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/subsections/property_information.rb b/app/models/form/sales/subsections/property_information.rb index dee530487..3f09e03aa 100644 --- a/app/models/form/sales/subsections/property_information.rb +++ b/app/models/form/sales/subsections/property_information.rb @@ -10,6 +10,7 @@ class Form::Sales::Subsections::PropertyInformation < ::Form::Subsection def pages @pages ||= [ Form::Sales::Pages::PropertyNumberOfBedrooms.new(nil, nil, self), + Form::Sales::Pages::PropertyBuildingType.new(nil, nil, self), Form::Sales::Pages::PropertyUnitType.new(nil, nil, self), Form::Sales::Pages::BuildingType.new(nil, nil, self), ] diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index f97568f59..9e38138eb 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -372,10 +372,6 @@ class LettingsLog < Log hb == 7 end - def ethnic_refused? - ethnic_group == 17 - end - def receives_housing_related_benefits? if collection_start_year <= 2021 receives_housing_benefit_only? || receives_uc_with_housing_element_excl_housing_benefit? || diff --git a/app/models/log.rb b/app/models/log.rb index e24a205fc..54770515f 100644 --- a/app/models/log.rb +++ b/app/models/log.rb @@ -36,6 +36,10 @@ class Log < ApplicationRecord false end + def ethnic_refused? + ethnic_group == 17 + end + private def update_status! diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index 0f0ca54c7..e1458caa9 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -3,10 +3,15 @@ class SalesLogValidator < ActiveModel::Validator end class SalesLog < Log + include DerivedVariables::SalesLogVariables + self.inheritance_column = :_type_disabled + has_paper_trail validates_with SalesLogValidator + before_validation :set_derived_fields! + before_validation :reset_invalidated_dependent_fields! scope :filter_by_year, ->(year) { where(saledate: Time.zone.local(year.to_i, 4, 1)...Time.zone.local(year.to_i + 1, 4, 1)) } scope :search_by, ->(param) { filter_by_id(param) } diff --git a/app/views/form/guidance/_privacy_notice_buyer.erb b/app/views/form/guidance/_privacy_notice_buyer.erb new file mode 100644 index 000000000..fabe9ced1 --- /dev/null +++ b/app/views/form/guidance/_privacy_notice_buyer.erb @@ -0,0 +1 @@ +
Make sure the buyer has seen <%= govuk_link_to "the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice", privacy_notice_path, target: :_blank %> before completing this log.
diff --git a/app/views/form/guidance/_privacy_notice.erb b/app/views/form/guidance/_privacy_notice_tenant.erb similarity index 57% rename from app/views/form/guidance/_privacy_notice.erb rename to app/views/form/guidance/_privacy_notice_tenant.erb index c6e0b9adc..88b281730 100644 --- a/app/views/form/guidance/_privacy_notice.erb +++ b/app/views/form/guidance/_privacy_notice_tenant.erb @@ -1 +1 @@ -Make sure the tenant has seen <%= govuk_link_to "the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice", privacy_notice_path %> before completing this log.
+Make sure the tenant has seen <%= govuk_link_to "the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice", privacy_notice_path, target: :_blank %> before completing this log.
diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 2ed0f3fdc..801ab5717 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -32,15 +32,19 @@ } }, "conditional_for": { - "postcode_full": [1] + "postcode_full": [ + 1 + ] }, "hidden_in_check_answers": { - "depends_on": [{ - "postcode_known": 0 - }, - { - "postcode_known": 1 - }] + "depends_on": [ + { + "postcode_known": 0 + }, + { + "postcode_known": 1 + } + ] } }, "postcode_full": { @@ -772,7 +776,11 @@ ] }, "void_date_value_check": { - "depends_on": [{ "voiddate_in_soft_range?": true }], + "depends_on": [ + { + "voiddate_in_soft_range?": true + } + ], "title_text": { "translation": "soft_validations.void_date.title_text" }, @@ -839,7 +847,9 @@ } }, "conditional_for": { - "mrcdate": [1] + "mrcdate": [ + 1 + ] } }, "mrcdate": { @@ -901,7 +911,11 @@ ] }, "property_major_repairs_value_check": { - "depends_on": [{ "major_repairs_date_in_soft_range?": true }], + "depends_on": [ + { + "major_repairs_date_in_soft_range?": true + } + ], "title_text": { "translation": "soft_validations.major_repairs_date.title_text" }, @@ -989,7 +1003,9 @@ } }, "conditional_for": { - "tenancyother": [3] + "tenancyother": [ + 3 + ] } }, "tenancyother": { @@ -1031,7 +1047,9 @@ } }, "conditional_for": { - "tenancyother": [3] + "tenancyother": [ + 3 + ] } }, "tenancyother": { @@ -1125,7 +1143,7 @@ "questions": { "declaration": { "header": "", - "guidance_partial": "privacy_notice", + "guidance_partial": "privacy_notice_tenant", "check_answer_label": "Tenant has seen the privacy notice", "check_answers_card_number": 0, "type": "checkbox", @@ -1153,10 +1171,18 @@ "width": 2 } }, - "depends_on": [{ "declaration": 1 }] + "depends_on": [ + { + "declaration": 1 + } + ] }, "no_females_pregnant_household_lead_hhmemb_value_check": { - "depends_on": [{ "no_females_in_a_pregnant_household?": true }], + "depends_on": [ + { + "no_females_in_a_pregnant_household?": true + } + ], "title_text": { "translation": "soft_validations.pregnancy.title", "arguments": [ @@ -1255,7 +1281,9 @@ } }, "conditional_for": { - "age1": [0] + "age1": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -1285,10 +1313,18 @@ } } }, - "depends_on": [{ "declaration": 1 }] + "depends_on": [ + { + "declaration": 1 + } + ] }, "no_females_pregnant_household_lead_age_value_check": { - "depends_on": [{ "no_females_in_a_pregnant_household?": true }], + "depends_on": [ + { + "no_females_in_a_pregnant_household?": true + } + ], "title_text": { "translation": "soft_validations.pregnancy.title", "arguments": [ @@ -1398,10 +1434,18 @@ } } }, - "depends_on": [{ "declaration": 1 }] + "depends_on": [ + { + "declaration": 1 + } + ] }, "no_females_pregnant_household_lead_value_check": { - "depends_on": [{ "no_females_in_a_pregnant_household?": true }], + "depends_on": [ + { + "no_females_in_a_pregnant_household?": true + } + ], "title_text": { "translation": "soft_validations.pregnancy.title", "arguments": [ @@ -1517,7 +1561,11 @@ } } }, - "depends_on": [{ "declaration": 1 }] + "depends_on": [ + { + "declaration": 1 + } + ] }, "lead_tenant_ethnic_background_arab": { "header": "", @@ -1539,7 +1587,11 @@ } } }, - "depends_on": [{ "ethnic_group": 4 }] + "depends_on": [ + { + "ethnic_group": 4 + } + ] }, "lead_tenant_ethnic_background_asian": { "header": "", @@ -1570,7 +1622,11 @@ } } }, - "depends_on": [{ "ethnic_group": 2 }] + "depends_on": [ + { + "ethnic_group": 2 + } + ] }, "lead_tenant_ethnic_background_black": { "header": "", @@ -1595,7 +1651,11 @@ } } }, - "depends_on": [{ "ethnic_group": 3 }] + "depends_on": [ + { + "ethnic_group": 3 + } + ] }, "lead_tenant_ethnic_background_mixed": { "header": "", @@ -1623,7 +1683,11 @@ } } }, - "depends_on": [{ "ethnic_group": 1 }] + "depends_on": [ + { + "ethnic_group": 1 + } + ] }, "lead_tenant_ethnic_background_white": { "header": "", @@ -1651,7 +1715,11 @@ } } }, - "depends_on": [{ "ethnic_group": 0 }] + "depends_on": [ + { + "ethnic_group": 0 + } + ] }, "lead_tenant_nationality": { "header": "", @@ -1719,7 +1787,11 @@ } } }, - "depends_on": [{ "declaration": 1 }] + "depends_on": [ + { + "declaration": 1 + } + ] }, "lead_tenant_working_situation": { "header": "", @@ -1768,10 +1840,18 @@ } } }, - "depends_on": [{ "declaration": 1 }] + "depends_on": [ + { + "declaration": 1 + } + ] }, "lead_tenant_under_retirement_value_check": { - "depends_on": [{ "person_1_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_1_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -1826,7 +1906,9 @@ }, "lead_tenant_over_retirement_value_check": { "depends_on": [ - { "person_1_not_retired_over_soft_max_age?": true } + { + "person_1_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -1978,7 +2060,9 @@ } }, "conditional_for": { - "age2": [0] + "age2": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -2016,7 +2100,10 @@ }, "no_females_pregnant_household_person_2_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age2_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age2_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -2260,8 +2347,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age2_known": 1 }, - { "age2": { "operator": "<", "operand": 16 } } + { + "age2_known": 1 + }, + { + "age2": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -2291,7 +2385,11 @@ ] }, "person_2_under_retirement_value_check": { - "depends_on": [{ "person_2_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_2_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -2346,7 +2444,9 @@ }, "person_2_over_retirement_value_check": { "depends_on": [ - { "person_2_not_retired_over_soft_max_age?": true } + { + "person_2_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -2495,7 +2595,9 @@ } }, "conditional_for": { - "age3": [0] + "age3": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -2533,7 +2635,10 @@ }, "no_females_pregnant_household_person_3_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age3_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age3_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -2777,8 +2882,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age3_known": 1 }, - { "age3": { "operator": "<", "operand": 16 } } + { + "age3_known": 1 + }, + { + "age3": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -2808,7 +2920,11 @@ ] }, "person_3_under_retirement_value_check": { - "depends_on": [{ "person_3_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_3_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -2863,7 +2979,9 @@ }, "person_3_over_retirement_value_check": { "depends_on": [ - { "person_3_not_retired_over_soft_max_age?": true } + { + "person_3_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -3009,7 +3127,9 @@ } }, "conditional_for": { - "age4": [0] + "age4": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -3047,7 +3167,10 @@ }, "no_females_pregnant_household_person_4_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age4_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age4_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -3291,8 +3414,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age4_known": 1 }, - { "age4": { "operator": "<", "operand": 16 } } + { + "age4_known": 1 + }, + { + "age4": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -3322,7 +3452,11 @@ ] }, "person_4_under_retirement_value_check": { - "depends_on": [{ "person_4_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_4_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -3377,7 +3511,9 @@ }, "person_4_over_retirement_value_check": { "depends_on": [ - { "person_4_not_retired_over_soft_max_age?": true } + { + "person_4_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -3520,7 +3656,9 @@ } }, "conditional_for": { - "age5": [0] + "age5": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -3558,7 +3696,10 @@ }, "no_females_pregnant_household_person_5_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age5_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age5_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -3802,8 +3943,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age5_known": 1 }, - { "age5": { "operator": "<", "operand": 16 } } + { + "age5_known": 1 + }, + { + "age5": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -3833,7 +3981,11 @@ ] }, "person_5_under_retirement_value_check": { - "depends_on": [{ "person_5_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_5_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -3888,7 +4040,9 @@ }, "person_5_over_retirement_value_check": { "depends_on": [ - { "person_5_not_retired_over_soft_max_age?": true } + { + "person_5_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -4028,7 +4182,9 @@ } }, "conditional_for": { - "age6": [0] + "age6": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -4066,7 +4222,10 @@ }, "no_females_pregnant_household_person_6_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age6_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age6_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -4310,8 +4469,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age6_known": 1 }, - { "age6": { "operator": "<", "operand": 16 } } + { + "age6_known": 1 + }, + { + "age6": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -4341,7 +4507,11 @@ ] }, "person_6_under_retirement_value_check": { - "depends_on": [{ "person_6_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_6_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -4396,7 +4566,9 @@ }, "person_6_over_retirement_value_check": { "depends_on": [ - { "person_6_not_retired_over_soft_max_age?": true } + { + "person_6_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -4533,7 +4705,9 @@ } }, "conditional_for": { - "age7": [0] + "age7": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -4571,7 +4745,10 @@ }, "no_females_pregnant_household_person_7_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age7_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age7_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -4815,8 +4992,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age7_known": 1 }, - { "age7": { "operator": "<", "operand": 16 } } + { + "age7_known": 1 + }, + { + "age7": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -4846,7 +5030,11 @@ ] }, "person_7_under_retirement_value_check": { - "depends_on": [{ "person_7_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_7_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -4901,7 +5089,9 @@ }, "person_7_over_retirement_value_check": { "depends_on": [ - { "person_7_not_retired_over_soft_max_age?": true } + { + "person_7_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -5035,7 +5225,9 @@ } }, "conditional_for": { - "age8": [0] + "age8": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -5073,7 +5265,10 @@ }, "no_females_pregnant_household_person_8_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age8_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age8_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -5317,8 +5512,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age8_known": 1 }, - { "age8": { "operator": "<", "operand": 16 } } + { + "age8_known": 1 + }, + { + "age8": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -5348,7 +5550,11 @@ ] }, "person_8_under_retirement_value_check": { - "depends_on": [{ "person_8_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_8_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -5403,7 +5609,9 @@ }, "person_8_over_retirement_value_check": { "depends_on": [ - { "person_8_not_retired_over_soft_max_age?": true } + { + "person_8_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -5594,7 +5802,11 @@ } }, "no_females_pregnant_household_value_check": { - "depends_on": [{ "no_females_in_a_pregnant_household?": true }], + "depends_on": [ + { + "no_females_in_a_pregnant_household?": true + } + ], "title_text": { "translation": "soft_validations.pregnancy.title", "arguments": [ @@ -5662,7 +5874,8 @@ "pregnancy_value_check": { "check_answer_label": "Pregnancy confirmation", "hidden_in_check_answers": { - "depends_on": [{ + "depends_on": [ + { "pregnancy_value_check": 0 }, { @@ -6052,7 +6265,9 @@ } }, "conditional_for": { - "reasonother": [20] + "reasonother": [ + 20 + ] } }, "reasonother": { @@ -6283,7 +6498,9 @@ } }, "conditional_for": { - "ppostcode_full": [1] + "ppostcode_full": [ + 1 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -6344,7 +6561,9 @@ } }, "conditional_for": { - "prevloc": [1] + "prevloc": [ + 1 + ] } }, "prevloc": { @@ -7175,7 +7394,11 @@ } }, "net_income_value_check": { - "depends_on": [{ "net_income_soft_validation_triggered?": true }], + "depends_on": [ + { + "net_income_soft_validation_triggered?": true + } + ], "title_text": { "translation": "soft_validations.net_income.title_text" }, @@ -7376,7 +7599,9 @@ } }, "conditional_for": { - "chcharge": [1] + "chcharge": [ + 1 + ] } }, "chcharge": { @@ -7471,7 +7696,9 @@ } }, "conditional_for": { - "chcharge": [1] + "chcharge": [ + 1 + ] } }, "chcharge": { @@ -7516,7 +7743,9 @@ } }, "conditional_for": { - "chcharge": [1] + "chcharge": [ + 1 + ] } }, "chcharge": { @@ -7561,7 +7790,9 @@ } }, "conditional_for": { - "chcharge": [1] + "chcharge": [ + 1 + ] } }, "chcharge": { @@ -7602,7 +7833,12 @@ "width": 5, "prefix": "£", "suffix": " every week", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7616,7 +7852,12 @@ "width": 5, "prefix": "£", "suffix": " every week", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7630,7 +7871,12 @@ "width": 5, "prefix": "£", "suffix": " every week", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7644,7 +7890,12 @@ "width": 5, "prefix": "£", "suffix": " every week", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7660,7 +7911,12 @@ "suffix": " every week", "readonly": true, "requires_js": true, - "fields_added": ["brent", "scharge", "pscharge", "supcharg"] + "fields_added": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ] } }, "depends_on": [ @@ -7800,7 +8056,12 @@ "width": 5, "prefix": "£", "suffix": " every 2 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7814,7 +8075,12 @@ "width": 5, "prefix": "£", "suffix": " every 2 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7828,7 +8094,12 @@ "width": 5, "prefix": "£", "suffix": " every 2 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7842,7 +8113,12 @@ "width": 5, "prefix": "£", "suffix": " every 2 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7858,7 +8134,12 @@ "suffix": " every 2 weeks", "readonly": true, "requires_js": true, - "fields_added": ["brent", "scharge", "pscharge", "supcharg"] + "fields_added": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ] } }, "depends_on": [ @@ -7898,7 +8179,12 @@ "width": 5, "prefix": "£", "suffix": " every 4 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7912,7 +8198,12 @@ "width": 5, "prefix": "£", "suffix": " every 4 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7926,7 +8217,12 @@ "width": 5, "prefix": "£", "suffix": " every 4 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7940,7 +8236,12 @@ "width": 5, "prefix": "£", "suffix": " every 4 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7956,7 +8257,12 @@ "suffix": " every 4 weeks", "readonly": true, "requires_js": true, - "fields_added": ["brent", "scharge", "pscharge", "supcharg"] + "fields_added": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ] } }, "depends_on": [ @@ -7996,7 +8302,12 @@ "width": 5, "prefix": "£", "suffix": " every month", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -8010,7 +8321,12 @@ "width": 5, "prefix": "£", "suffix": " every month", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -8024,7 +8340,12 @@ "width": 5, "prefix": "£", "suffix": " every month", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -8038,7 +8359,12 @@ "width": 5, "prefix": "£", "suffix": " every month", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -8054,7 +8380,12 @@ "suffix": " every month", "readonly": true, "requires_js": true, - "fields_added": ["brent", "scharge", "pscharge", "supcharg"] + "fields_added": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ] } }, "depends_on": [ @@ -8081,7 +8412,11 @@ ] }, "min_rent_value_check": { - "depends_on": [{ "rent_in_soft_min_range?": true }], + "depends_on": [ + { + "rent_in_soft_min_range?": true + } + ], "title_text": { "translation": "soft_validations.rent.min.title_text", "arguments": [ @@ -8134,7 +8469,11 @@ } }, "max_rent_value_check": { - "depends_on": [{ "rent_in_soft_max_range?": true }], + "depends_on": [ + { + "rent_in_soft_max_range?": true + } + ], "title_text": { "translation": "soft_validations.rent.max.title_text", "arguments": [ @@ -8253,7 +8592,9 @@ } }, "conditional_for": { - "tshortfall": [0] + "tshortfall": [ + 0 + ] } }, "tshortfall": { @@ -8267,39 +8608,57 @@ "suffix": [ { "label": " every 2 weeks", - "depends_on": { "period": 2 } + "depends_on": { + "period": 2 + } }, { "label": " every 4 weeks", - "depends_on": { "period": 3 } + "depends_on": { + "period": 3 + } }, { "label": " every calendar month", - "depends_on": { "period": 4 } + "depends_on": { + "period": 4 + } }, { "label": " every week for 50 weeks", - "depends_on": { "period": 5 } + "depends_on": { + "period": 5 + } }, { "label": " every week for 49 weeks", - "depends_on": { "period": 6 } + "depends_on": { + "period": 6 + } }, { "label": " every week for 48 weeks", - "depends_on": { "period": 7 } + "depends_on": { + "period": 7 + } }, { "label": " every week for 47 weeks", - "depends_on": { "period": 8 } + "depends_on": { + "period": 8 + } }, { "label": " every week for 46 weeks", - "depends_on": { "period": 9 } + "depends_on": { + "period": 9 + } }, { "label": " every week for 52 weeks", - "depends_on": { "period": 1 } + "depends_on": { + "period": 1 + } } ] } diff --git a/config/forms/2022_2023.json b/config/forms/2022_2023.json index 190fa04bd..490d28e12 100644 --- a/config/forms/2022_2023.json +++ b/config/forms/2022_2023.json @@ -32,15 +32,19 @@ } }, "conditional_for": { - "postcode_full": [1] + "postcode_full": [ + 1 + ] }, "hidden_in_check_answers": { - "depends_on": [{ - "postcode_known": 0 - }, - { - "postcode_known": 1 - }] + "depends_on": [ + { + "postcode_known": 0 + }, + { + "postcode_known": 1 + } + ] } }, "postcode_full": { @@ -772,7 +776,11 @@ ] }, "void_date_value_check": { - "depends_on": [{ "voiddate_in_soft_range?": true }], + "depends_on": [ + { + "voiddate_in_soft_range?": true + } + ], "title_text": { "translation": "soft_validations.void_date.title_text" }, @@ -839,7 +847,9 @@ } }, "conditional_for": { - "mrcdate": [1] + "mrcdate": [ + 1 + ] } }, "mrcdate": { @@ -901,7 +911,11 @@ ] }, "property_major_repairs_value_check": { - "depends_on": [{ "major_repairs_date_in_soft_range?": true }], + "depends_on": [ + { + "major_repairs_date_in_soft_range?": true + } + ], "title_text": { "translation": "soft_validations.major_repairs_date.title_text" }, @@ -1018,7 +1032,9 @@ } }, "conditional_for": { - "tenancyother": [3] + "tenancyother": [ + 3 + ] } }, "tenancyother": { @@ -1063,7 +1079,9 @@ } }, "conditional_for": { - "tenancyother": [3] + "tenancyother": [ + 3 + ] } }, "tenancyother": { @@ -1160,7 +1178,7 @@ "questions": { "declaration": { "header": "", - "guidance_partial": "privacy_notice", + "guidance_partial": "privacy_notice_tenant", "check_answer_label": "Tenant has seen the privacy notice", "check_answers_card_number": 0, "type": "checkbox", @@ -1188,10 +1206,18 @@ "width": 2 } }, - "depends_on": [{ "declaration": 1 }] + "depends_on": [ + { + "declaration": 1 + } + ] }, "no_females_pregnant_household_lead_hhmemb_value_check": { - "depends_on": [{ "no_females_in_a_pregnant_household?": true }], + "depends_on": [ + { + "no_females_in_a_pregnant_household?": true + } + ], "title_text": { "translation": "soft_validations.pregnancy.title", "arguments": [ @@ -1290,7 +1316,9 @@ } }, "conditional_for": { - "age1": [0] + "age1": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -1320,10 +1348,18 @@ } } }, - "depends_on": [{ "declaration": 1 }] + "depends_on": [ + { + "declaration": 1 + } + ] }, "no_females_pregnant_household_lead_age_value_check": { - "depends_on": [{ "no_females_in_a_pregnant_household?": true }], + "depends_on": [ + { + "no_females_in_a_pregnant_household?": true + } + ], "title_text": { "translation": "soft_validations.pregnancy.title", "arguments": [ @@ -1433,10 +1469,18 @@ } } }, - "depends_on": [{ "declaration": 1 }] + "depends_on": [ + { + "declaration": 1 + } + ] }, "no_females_pregnant_household_lead_value_check": { - "depends_on": [{ "no_females_in_a_pregnant_household?": true }], + "depends_on": [ + { + "no_females_in_a_pregnant_household?": true + } + ], "title_text": { "translation": "soft_validations.pregnancy.title", "arguments": [ @@ -1552,7 +1596,11 @@ } } }, - "depends_on": [{ "declaration": 1 }] + "depends_on": [ + { + "declaration": 1 + } + ] }, "lead_tenant_ethnic_background_arab": { "header": "", @@ -1574,7 +1622,11 @@ } } }, - "depends_on": [{ "ethnic_group": 4 }] + "depends_on": [ + { + "ethnic_group": 4 + } + ] }, "lead_tenant_ethnic_background_asian": { "header": "", @@ -1605,7 +1657,11 @@ } } }, - "depends_on": [{ "ethnic_group": 2 }] + "depends_on": [ + { + "ethnic_group": 2 + } + ] }, "lead_tenant_ethnic_background_black": { "header": "", @@ -1630,7 +1686,11 @@ } } }, - "depends_on": [{ "ethnic_group": 3 }] + "depends_on": [ + { + "ethnic_group": 3 + } + ] }, "lead_tenant_ethnic_background_mixed": { "header": "", @@ -1658,7 +1718,11 @@ } } }, - "depends_on": [{ "ethnic_group": 1 }] + "depends_on": [ + { + "ethnic_group": 1 + } + ] }, "lead_tenant_ethnic_background_white": { "header": "", @@ -1686,7 +1750,11 @@ } } }, - "depends_on": [{ "ethnic_group": 0 }] + "depends_on": [ + { + "ethnic_group": 0 + } + ] }, "lead_tenant_nationality": { "header": "", @@ -1718,7 +1786,11 @@ } } }, - "depends_on": [{ "declaration": 1 }] + "depends_on": [ + { + "declaration": 1 + } + ] }, "lead_tenant_working_situation": { "header": "", @@ -1767,10 +1839,18 @@ } } }, - "depends_on": [{ "declaration": 1 }] + "depends_on": [ + { + "declaration": 1 + } + ] }, "lead_tenant_under_retirement_value_check": { - "depends_on": [{ "person_1_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_1_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -1825,7 +1905,9 @@ }, "lead_tenant_over_retirement_value_check": { "depends_on": [ - { "person_1_not_retired_over_soft_max_age?": true } + { + "person_1_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -1977,7 +2059,9 @@ } }, "conditional_for": { - "age2": [0] + "age2": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -2015,7 +2099,10 @@ }, "no_females_pregnant_household_person_2_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age2_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age2_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -2259,8 +2346,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age2_known": 1 }, - { "age2": { "operator": "<", "operand": 16 } } + { + "age2_known": 1 + }, + { + "age2": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -2290,7 +2384,11 @@ ] }, "person_2_under_retirement_value_check": { - "depends_on": [{ "person_2_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_2_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -2345,7 +2443,9 @@ }, "person_2_over_retirement_value_check": { "depends_on": [ - { "person_2_not_retired_over_soft_max_age?": true } + { + "person_2_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -2494,7 +2594,9 @@ } }, "conditional_for": { - "age3": [0] + "age3": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -2532,7 +2634,10 @@ }, "no_females_pregnant_household_person_3_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age3_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age3_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -2776,8 +2881,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age3_known": 1 }, - { "age3": { "operator": "<", "operand": 16 } } + { + "age3_known": 1 + }, + { + "age3": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -2807,7 +2919,11 @@ ] }, "person_3_under_retirement_value_check": { - "depends_on": [{ "person_3_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_3_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -2862,7 +2978,9 @@ }, "person_3_over_retirement_value_check": { "depends_on": [ - { "person_3_not_retired_over_soft_max_age?": true } + { + "person_3_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -3008,7 +3126,9 @@ } }, "conditional_for": { - "age4": [0] + "age4": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -3046,7 +3166,10 @@ }, "no_females_pregnant_household_person_4_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age4_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age4_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -3290,8 +3413,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age4_known": 1 }, - { "age4": { "operator": "<", "operand": 16 } } + { + "age4_known": 1 + }, + { + "age4": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -3321,7 +3451,11 @@ ] }, "person_4_under_retirement_value_check": { - "depends_on": [{ "person_4_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_4_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -3376,7 +3510,9 @@ }, "person_4_over_retirement_value_check": { "depends_on": [ - { "person_4_not_retired_over_soft_max_age?": true } + { + "person_4_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -3519,7 +3655,9 @@ } }, "conditional_for": { - "age5": [0] + "age5": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -3557,7 +3695,10 @@ }, "no_females_pregnant_household_person_5_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age5_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age5_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -3801,8 +3942,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age5_known": 1 }, - { "age5": { "operator": "<", "operand": 16 } } + { + "age5_known": 1 + }, + { + "age5": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -3832,7 +3980,11 @@ ] }, "person_5_under_retirement_value_check": { - "depends_on": [{ "person_5_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_5_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -3887,7 +4039,9 @@ }, "person_5_over_retirement_value_check": { "depends_on": [ - { "person_5_not_retired_over_soft_max_age?": true } + { + "person_5_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -4027,7 +4181,9 @@ } }, "conditional_for": { - "age6": [0] + "age6": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -4065,7 +4221,10 @@ }, "no_females_pregnant_household_person_6_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age6_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age6_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -4309,8 +4468,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age6_known": 1 }, - { "age6": { "operator": "<", "operand": 16 } } + { + "age6_known": 1 + }, + { + "age6": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -4340,7 +4506,11 @@ ] }, "person_6_under_retirement_value_check": { - "depends_on": [{ "person_6_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_6_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -4395,7 +4565,9 @@ }, "person_6_over_retirement_value_check": { "depends_on": [ - { "person_6_not_retired_over_soft_max_age?": true } + { + "person_6_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -4532,7 +4704,9 @@ } }, "conditional_for": { - "age7": [0] + "age7": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -4570,7 +4744,10 @@ }, "no_females_pregnant_household_person_7_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age7_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age7_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -4814,8 +4991,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age7_known": 1 }, - { "age7": { "operator": "<", "operand": 16 } } + { + "age7_known": 1 + }, + { + "age7": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -4845,7 +5029,11 @@ ] }, "person_7_under_retirement_value_check": { - "depends_on": [{ "person_7_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_7_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -4900,7 +5088,9 @@ }, "person_7_over_retirement_value_check": { "depends_on": [ - { "person_7_not_retired_over_soft_max_age?": true } + { + "person_7_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -5034,7 +5224,9 @@ } }, "conditional_for": { - "age8": [0] + "age8": [ + 0 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -5072,7 +5264,10 @@ }, "no_females_pregnant_household_person_8_age_value_check": { "depends_on": [ - { "no_females_in_a_pregnant_household?": true, "age8_known": 0 } + { + "no_females_in_a_pregnant_household?": true, + "age8_known": 0 + } ], "title_text": { "translation": "soft_validations.pregnancy.title", @@ -5316,8 +5511,15 @@ "9": { "value": "Child under 16", "depends_on": [ - { "age8_known": 1 }, - { "age8": { "operator": "<", "operand": 16 } } + { + "age8_known": 1 + }, + { + "age8": { + "operator": "<", + "operand": 16 + } + } ] }, "0": { @@ -5347,7 +5549,11 @@ ] }, "person_8_under_retirement_value_check": { - "depends_on": [{ "person_8_retired_under_soft_min_age?": true }], + "depends_on": [ + { + "person_8_retired_under_soft_min_age?": true + } + ], "title_text": { "translation": "soft_validations.retirement.min.title", "arguments": [ @@ -5402,7 +5608,9 @@ }, "person_8_over_retirement_value_check": { "depends_on": [ - { "person_8_not_retired_over_soft_max_age?": true } + { + "person_8_not_retired_over_soft_max_age?": true + } ], "title_text": { "translation": "soft_validations.retirement.max.title", @@ -5596,7 +5804,11 @@ } }, "no_females_pregnant_household_value_check": { - "depends_on": [{ "no_females_in_a_pregnant_household?": true }], + "depends_on": [ + { + "no_females_in_a_pregnant_household?": true + } + ], "title_text": { "translation": "soft_validations.pregnancy.title", "arguments": [ @@ -5664,7 +5876,8 @@ "pregnancy_value_check": { "check_answer_label": "Pregnancy confirmation", "hidden_in_check_answers": { - "depends_on": [{ + "depends_on": [ + { "pregnancy_value_check": 0 }, { @@ -6051,7 +6264,9 @@ } }, "conditional_for": { - "reasonother": [20] + "reasonother": [ + 20 + ] } }, "reasonother": { @@ -6242,7 +6457,9 @@ } }, "conditional_for": { - "ppostcode_full": [1] + "ppostcode_full": [ + 1 + ] }, "hidden_in_check_answers": { "depends_on": [ @@ -6303,7 +6520,9 @@ } }, "conditional_for": { - "prevloc": [1] + "prevloc": [ + 1 + ] } }, "prevloc": { @@ -7134,8 +7353,14 @@ } }, "net_income_value_check": { - "depends_on": [{ "net_income_soft_validation_triggered?": true }], - "title_text": { "translation": "soft_validations.net_income.title_text" }, + "depends_on": [ + { + "net_income_soft_validation_triggered?": true + } + ], + "title_text": { + "translation": "soft_validations.net_income.title_text" + }, "informative_text": { "translation": "soft_validations.net_income.hint_text", "arguments": [ @@ -7330,7 +7555,9 @@ } }, "conditional_for": { - "chcharge": [1] + "chcharge": [ + 1 + ] } }, "chcharge": { @@ -7425,7 +7652,9 @@ } }, "conditional_for": { - "chcharge": [1] + "chcharge": [ + 1 + ] } }, "chcharge": { @@ -7470,7 +7699,9 @@ } }, "conditional_for": { - "chcharge": [1] + "chcharge": [ + 1 + ] } }, "chcharge": { @@ -7515,7 +7746,9 @@ } }, "conditional_for": { - "chcharge": [1] + "chcharge": [ + 1 + ] } }, "chcharge": { @@ -7556,7 +7789,12 @@ "width": 5, "prefix": "£", "suffix": " every week", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7570,7 +7808,12 @@ "width": 5, "prefix": "£", "suffix": " every week", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7584,7 +7827,12 @@ "width": 5, "prefix": "£", "suffix": " every week", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7598,7 +7846,12 @@ "width": 5, "prefix": "£", "suffix": " every week", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7614,7 +7867,12 @@ "suffix": " every week", "readonly": true, "requires_js": true, - "fields_added": ["brent", "scharge", "pscharge", "supcharg"] + "fields_added": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ] } }, "depends_on": [ @@ -7754,7 +8012,12 @@ "width": 5, "prefix": "£", "suffix": " every 2 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7768,7 +8031,12 @@ "width": 5, "prefix": "£", "suffix": " every 2 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7782,7 +8050,12 @@ "width": 5, "prefix": "£", "suffix": " every 2 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7796,7 +8069,12 @@ "width": 5, "prefix": "£", "suffix": " every 2 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7812,7 +8090,12 @@ "suffix": " every 2 weeks", "readonly": true, "requires_js": true, - "fields_added": ["brent", "scharge", "pscharge", "supcharg"] + "fields_added": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ] } }, "depends_on": [ @@ -7852,7 +8135,12 @@ "width": 5, "prefix": "£", "suffix": " every 4 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7866,7 +8154,12 @@ "width": 5, "prefix": "£", "suffix": " every 4 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7880,7 +8173,12 @@ "width": 5, "prefix": "£", "suffix": " every 4 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7894,7 +8192,12 @@ "width": 5, "prefix": "£", "suffix": " every 4 weeks", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7910,7 +8213,12 @@ "suffix": " every 4 weeks", "readonly": true, "requires_js": true, - "fields_added": ["brent", "scharge", "pscharge", "supcharg"] + "fields_added": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ] } }, "depends_on": [ @@ -7950,7 +8258,12 @@ "width": 5, "prefix": "£", "suffix": " every month", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7964,7 +8277,12 @@ "width": 5, "prefix": "£", "suffix": " every month", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7978,7 +8296,12 @@ "width": 5, "prefix": "£", "suffix": " every month", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -7992,7 +8315,12 @@ "width": 5, "prefix": "£", "suffix": " every month", - "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"], + "fields-to-add": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ], "result-field": "tcharge", "hidden_in_check_answers": true }, @@ -8008,7 +8336,12 @@ "suffix": " every month", "readonly": true, "requires_js": true, - "fields_added": ["brent", "scharge", "pscharge", "supcharg"] + "fields_added": [ + "brent", + "scharge", + "pscharge", + "supcharg" + ] } }, "depends_on": [ @@ -8035,7 +8368,11 @@ ] }, "min_rent_value_check": { - "depends_on": [{ "rent_in_soft_min_range?": true }], + "depends_on": [ + { + "rent_in_soft_min_range?": true + } + ], "title_text": { "translation": "soft_validations.rent.min.title_text", "arguments": [ @@ -8088,7 +8425,11 @@ } }, "max_rent_value_check": { - "depends_on": [{ "rent_in_soft_max_range?": true }], + "depends_on": [ + { + "rent_in_soft_max_range?": true + } + ], "title_text": { "translation": "soft_validations.rent.max.title_text", "arguments": [ @@ -8199,7 +8540,9 @@ } }, "conditional_for": { - "tshortfall": [0] + "tshortfall": [ + 0 + ] } }, "tshortfall": { @@ -8213,39 +8556,57 @@ "suffix": [ { "label": " every 2 weeks", - "depends_on": { "period": 2 } + "depends_on": { + "period": 2 + } }, { "label": " every 4 weeks", - "depends_on": { "period": 3 } + "depends_on": { + "period": 3 + } }, { "label": " every calendar month", - "depends_on": { "period": 4 } + "depends_on": { + "period": 4 + } }, { "label": " every week for 50 weeks", - "depends_on": { "period": 5 } + "depends_on": { + "period": 5 + } }, { "label": " every week for 49 weeks", - "depends_on": { "period": 6 } + "depends_on": { + "period": 6 + } }, { "label": " every week for 48 weeks", - "depends_on": { "period": 7 } + "depends_on": { + "period": 7 + } }, { "label": " every week for 47 weeks", - "depends_on": { "period": 8 } + "depends_on": { + "period": 8 + } }, { "label": " every week for 46 weeks", - "depends_on": { "period": 9 } + "depends_on": { + "period": 9 + } }, { "label": " every week for 52 weeks", - "depends_on": { "period": 1 } + "depends_on": { + "period": 1 + } } ] } diff --git a/config/forms/schema/2021_2022.json b/config/forms/schema/2021_2022.json index d91600c4d..326394391 100644 --- a/config/forms/schema/2021_2022.json +++ b/config/forms/schema/2021_2022.json @@ -4,7 +4,12 @@ "title": "Form", "description": "A form", "type": "object", - "required": ["form_type", "start_year", "end_year", "sections"], + "required": [ + "form_type", + "start_year", + "end_year", + "sections" + ], "properties": { "form_type": { "description": "", @@ -35,7 +40,9 @@ "[a-z_]+": { "description": "", "type": "object", - "required": ["label"], + "required": [ + "label" + ], "properties": { "label": { "description": "", @@ -62,7 +69,10 @@ "[a-z_]+": { "description": "", "type": "object", - "required": ["header", "check_answer_label"], + "required": [ + "header", + "check_answer_label" + ], "properties": { "check_answer_label": { "description": "", diff --git a/config/forms/schema/generic.json b/config/forms/schema/generic.json index 7535ca339..97552a5f4 100644 --- a/config/forms/schema/generic.json +++ b/config/forms/schema/generic.json @@ -4,7 +4,12 @@ "title": "Form", "description": "A form", "type": "object", - "required": ["form_type", "start_year", "end_year", "sections"], + "required": [ + "form_type", + "start_year", + "end_year", + "sections" + ], "properties": { "form_type": { "description": "", @@ -35,7 +40,9 @@ "[a-z_]+": { "description": "SubSection Name", "type": "object", - "required": ["label"], + "required": [ + "label" + ], "properties": { "label": { "description": "", @@ -47,7 +54,10 @@ "^(?!(depends_on))[a-z_]+$": { "description": "Page Name", "type": "object", - "required": ["header", "questions"], + "required": [ + "header", + "questions" + ], "properties": { "header": { "description": "", @@ -63,7 +73,10 @@ "[a-z_]+": { "description": "Question Name", "type": "object", - "required": ["header", "type"], + "required": [ + "header", + "type" + ], "properties": { "header": { "description": "", diff --git a/db/migrate/20220927082602_add_national_column.rb b/db/migrate/20220927082602_add_national_column.rb new file mode 100644 index 000000000..d794bc858 --- /dev/null +++ b/db/migrate/20220927082602_add_national_column.rb @@ -0,0 +1,8 @@ +class AddNationalColumn < ActiveRecord::Migration[7.0] + def change + change_table :sales_logs, bulk: true do |t| + t.column :national, :integer + t.column :othernational, :string + end + end +end diff --git a/db/migrate/20220927100350_add_background_to_sales_log.rb b/db/migrate/20220927100350_add_background_to_sales_log.rb new file mode 100644 index 000000000..21dc70d82 --- /dev/null +++ b/db/migrate/20220927100350_add_background_to_sales_log.rb @@ -0,0 +1,6 @@ +class AddBackgroundToSalesLog < ActiveRecord::Migration[7.0] + change_table :sales_logs, bulk: true do |t| + t.column :ethnic, :integer + t.column :ethnic_group, :integer + end +end diff --git a/db/migrate/20220930134358_add_buyer2_sex_to_sales_log.rb b/db/migrate/20220930134358_add_buyer2_sex_to_sales_log.rb new file mode 100644 index 000000000..5d45f147e --- /dev/null +++ b/db/migrate/20220930134358_add_buyer2_sex_to_sales_log.rb @@ -0,0 +1,5 @@ +class AddBuyer2SexToSalesLog < ActiveRecord::Migration[7.0] + def change + add_column :sales_logs, :sex2, :string + end +end diff --git a/db/migrate/20221003092048_add_noint_to_sales_log.rb b/db/migrate/20221003092048_add_noint_to_sales_log.rb new file mode 100644 index 000000000..ab21aead6 --- /dev/null +++ b/db/migrate/20221003092048_add_noint_to_sales_log.rb @@ -0,0 +1,7 @@ +class AddNointToSalesLog < ActiveRecord::Migration[7.0] + def change + change_table :sales_logs, bulk: true do |t| + t.column :noint, :int + end + end +end diff --git a/db/migrate/20221003134554_add_buy2livein_to_sales_log.rb b/db/migrate/20221003134554_add_buy2livein_to_sales_log.rb new file mode 100644 index 000000000..ac8d4fbd7 --- /dev/null +++ b/db/migrate/20221003134554_add_buy2livein_to_sales_log.rb @@ -0,0 +1,7 @@ +class AddBuy2liveinToSalesLog < ActiveRecord::Migration[7.0] + def change + change_table :sales_logs, bulk: true do |t| + t.column :buy2livein, :int + end + end +end diff --git a/db/migrate/20221003150610_add_ecstat2_to_sales_log.rb b/db/migrate/20221003150610_add_ecstat2_to_sales_log.rb new file mode 100644 index 000000000..e6efb825b --- /dev/null +++ b/db/migrate/20221003150610_add_ecstat2_to_sales_log.rb @@ -0,0 +1,7 @@ +class AddEcstat2ToSalesLog < ActiveRecord::Migration[7.0] + def change + change_table :sales_logs, bulk: true do |t| + t.column :ecstat2, :int + end + end +end diff --git a/db/migrate/20221004095132_add_privacy_notice_to_sales_log.rb b/db/migrate/20221004095132_add_privacy_notice_to_sales_log.rb new file mode 100644 index 000000000..f60b00823 --- /dev/null +++ b/db/migrate/20221004095132_add_privacy_notice_to_sales_log.rb @@ -0,0 +1,7 @@ +class AddPrivacyNoticeToSalesLog < ActiveRecord::Migration[7.0] + def change + change_table :sales_logs, bulk: true do |t| + t.column :privacynotice, :int + end + end +end diff --git a/db/migrate/20221004184301_add_ecstat1_to_sales_log.rb b/db/migrate/20221004184301_add_ecstat1_to_sales_log.rb new file mode 100644 index 000000000..989a4442a --- /dev/null +++ b/db/migrate/20221004184301_add_ecstat1_to_sales_log.rb @@ -0,0 +1,7 @@ +class AddEcstat1ToSalesLog < ActiveRecord::Migration[7.0] + def change + change_table :sales_logs, bulk: true do |t| + t.column :ecstat1, :int + end + end +end diff --git a/db/migrate/20221005090129_add_wheel_to_sales_log.rb b/db/migrate/20221005090129_add_wheel_to_sales_log.rb new file mode 100644 index 000000000..33f08d7ff --- /dev/null +++ b/db/migrate/20221005090129_add_wheel_to_sales_log.rb @@ -0,0 +1,7 @@ +class AddWheelToSalesLog < ActiveRecord::Migration[7.0] + def change + change_table :sales_logs, bulk: true do |t| + t.column :wheel, :int + end + end +end diff --git a/db/migrate/20221005125543_add_hholdcount_to_sales_log.rb b/db/migrate/20221005125543_add_hholdcount_to_sales_log.rb new file mode 100644 index 000000000..c21b6dd8c --- /dev/null +++ b/db/migrate/20221005125543_add_hholdcount_to_sales_log.rb @@ -0,0 +1,7 @@ +class AddHholdcountToSalesLog < ActiveRecord::Migration[7.0] + def change + change_table :sales_logs, bulk: true do |t| + t.column :hholdcount, :int + end + end +end diff --git a/db/migrate/20221005150022_remove_otherrelat2_from_sales_log.rb b/db/migrate/20221005150022_remove_otherrelat2_from_sales_log.rb new file mode 100644 index 000000000..9cc5a35cf --- /dev/null +++ b/db/migrate/20221005150022_remove_otherrelat2_from_sales_log.rb @@ -0,0 +1,5 @@ +class RemoveOtherrelat2FromSalesLog < ActiveRecord::Migration[7.0] + def change + remove_column :sales_logs, :otherrelat2, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index fa885644b..eec74a385 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2022_09_29_125204) do +ActiveRecord::Schema[7.0].define(version: 2022_10_05_150022) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -337,14 +337,26 @@ ActiveRecord::Schema[7.0].define(version: 2022_09_29_125204) do t.integer "age1" t.integer "age1_known" t.string "sex1" + t.integer "national" + t.string "othernational" + t.integer "ethnic" + t.integer "ethnic_group" t.integer "buy1livein" t.integer "buylivein" t.integer "builtype" t.integer "proptype" - t.string "relat2" - t.string "otherrelat2" t.integer "age2" t.integer "age2_known" + t.string "relat2" + t.string "otherrelat2" + t.string "sex2" + t.integer "noint" + t.integer "buy2livein" + t.integer "ecstat2" + t.integer "privacynotice" + t.integer "ecstat1" + t.integer "hholdcount" + t.integer "wheel" t.index ["created_by_id"], name: "index_sales_logs_on_created_by_id" t.index ["managing_organisation_id"], name: "index_sales_logs_on_managing_organisation_id" t.index ["owning_organisation_id"], name: "index_sales_logs_on_owning_organisation_id" diff --git a/spec/factories/sales_log.rb b/spec/factories/sales_log.rb index 0a8a56ee0..321c9800f 100644 --- a/spec/factories/sales_log.rb +++ b/spec/factories/sales_log.rb @@ -20,15 +20,25 @@ FactoryBot.define do jointpur { 1 } beds { 2 } jointmore { 1 } + noint { 2 } age1_known { 0 } age1 { 30 } sex1 { "X" } + national { 18 } buy1livein { 1 } relat2 { "P" } proptype { 1 } age2_known { 0 } age2 { 35 } builtype { 1 } + ethnic { 3 } + ethnic_group { 12 } + sex2 { "X" } + buy2livein { "1" } + ecstat1 { "1" } + ecstat2 { "1" } + hholdcount { "1" } + wheel { 1 } end end end diff --git a/spec/features/form/conditional_questions_spec.rb b/spec/features/form/conditional_questions_spec.rb index 4f3f44b5a..33d99955e 100644 --- a/spec/features/form/conditional_questions_spec.rb +++ b/spec/features/form/conditional_questions_spec.rb @@ -12,6 +12,14 @@ RSpec.describe "Form Conditional Questions" do managing_organisation: user.organisation, ) end + let(:sales_log) do + FactoryBot.create( + :sales_log, + :completed, + owning_organisation: user.organisation, + managing_organisation: user.organisation, + ) + end let(:id) { lettings_log.id } let(:fake_2021_2022_form) { Form.new("spec/fixtures/forms/2021_2022.json") } @@ -44,5 +52,15 @@ RSpec.describe "Form Conditional Questions" do visit("/lettings-logs/#{id}/property-postcode") expect(page).to have_field("lettings-log-postcode-full-field", with: "NW1 6RT") end + + it "gets cleared if the conditional question is hidden after editing the answer" do + sales_log.update!(national: 12, othernational: "other") + visit("/sales-logs/#{sales_log.id}/buyer-1-nationality") + expect(page).to have_field("sales-log-othernational-field", with: "other") + + choose("sales-log-national-18-field", allow_label_click: true) + choose("sales-log-national-12-field", allow_label_click: true) + expect(page).to have_field("sales-log-othernational-field", with: "") + end end end diff --git a/spec/fixtures/forms/2021_2022.json b/spec/fixtures/forms/2021_2022.json index 99b4d8713..ac02a62a2 100644 --- a/spec/fixtures/forms/2021_2022.json +++ b/spec/fixtures/forms/2021_2022.json @@ -1,638 +1,708 @@ { - "form_type": "lettings", - "start_date": "2021-04-01T00:00:00.000+01:00", - "end_date": "2022-07-01T00:00:00.000+01:00", - "sections": { - "household": { - "label": "About the household", - "description": "Make sure the tenant has seen the privacy notice.", - "subsections": { - "household_characteristics": { - "label": "Household characteristics", - "pages": { - "tenant_code_test": { - "questions": { - "tenancycode": { - "check_answers_card_number": 0, - "check_answer_label": "Tenant code", - "header": "What is the tenant code?", - "hint_text": "This is how you usually refer to this tenancy on your own systems.", - "type": "text", - "width": 10 - } - }, - "depends_on": [ - { - "housingneeds_a": 1 - }, - { - "housingneeds_a": null - } - ]}, - "person_1_age": { - "questions": { - "age1": { - "check_answers_card_number": 1, - "check_answer_label": "Lead tenant’s age", - "header": "What is the tenant’s age?", - "type": "numeric", - "min": 16, - "max": 120, - "step": 1, - "width": 2 - } + "form_type": "lettings", + "start_date": "2021-04-01T00:00:00.000+01:00", + "end_date": "2022-07-01T00:00:00.000+01:00", + "sections": { + "household": { + "label": "About the household", + "description": "Make sure the tenant has seen the privacy notice.", + "subsections": { + "household_characteristics": { + "label": "Household characteristics", + "pages": { + "tenant_code_test": { + "questions": { + "tenancycode": { + "check_answers_card_number": 0, + "check_answer_label": "Tenant code", + "header": "What is the tenant code?", + "hint_text": "This is how you usually refer to this tenancy on your own systems.", + "type": "text", + "width": 10 + } + }, + "depends_on": [ + { + "housingneeds_a": 1 }, - "depends_on": [ - { - "housingneeds_a": 1 - }, - { - "housingneeds_a": null - } - ] + { + "housingneeds_a": null + } + ] + }, + "person_1_age": { + "questions": { + "age1": { + "check_answers_card_number": 1, + "check_answer_label": "Lead tenant’s age", + "header": "What is the tenant’s age?", + "type": "numeric", + "min": 16, + "max": 120, + "step": 1, + "width": 2 + } }, - "person_1_gender": { - "questions": { - "sex1": { - "check_answers_card_number": 1, - "check_answer_label": "Lead tenant’s gender identity", - "header": "Which of these best describes the tenant’s gender identity?", - "type": "radio", - "answer_options": { - "F": { - "value": "Female" - }, - "M": { - "value": "Male" - }, - "X": { - "value": "Non-binary" - }, - "R": { - "value": "Prefer not to say" - } + "depends_on": [ + { + "housingneeds_a": 1 + }, + { + "housingneeds_a": null + } + ] + }, + "person_1_gender": { + "questions": { + "sex1": { + "check_answers_card_number": 1, + "check_answer_label": "Lead tenant’s gender identity", + "header": "Which of these best describes the tenant’s gender identity?", + "type": "radio", + "answer_options": { + "F": { + "value": "Female" + }, + "M": { + "value": "Male" + }, + "X": { + "value": "Non-binary" + }, + "R": { + "value": "Prefer not to say" } } } - }, - "person_1_working_situation": { - "header": "", - "description": "", - "questions": { - "ecstat1": { - "check_answers_card_number": 1, - "check_answer_label": "Lead tenant’s working situation", - "header": "Which of these best describes the lead tenant’s socks?", - "hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.", - "type": "radio", - "answer_options": { - "0": { - "value": "Part-time – Less than 30 hours" - }, - "1": { - "value": "Full-time – 30 hours or more" - }, - "2": { - "value": "Full-time student" - }, - "3": { - "value": "In government training into work, such as New Deal" - }, - "4": { - "value": "Jobseeker" - }, - "5": { - "value": "Not seeking work" - }, - "6": { - "value": "Unable to work because of long term sick or disability" - }, - "7": { - "value": "Retired" - }, - "8": { - "value": "Child under 16" - }, - "9": { - "value": "Other" - }, - "divider": { - "value": true - }, - "10": { - "value": "Tenant prefers not to say" - } + } + }, + "person_1_working_situation": { + "header": "", + "description": "", + "questions": { + "ecstat1": { + "check_answers_card_number": 1, + "check_answer_label": "Lead tenant’s working situation", + "header": "Which of these best describes the lead tenant’s socks?", + "hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.", + "type": "radio", + "answer_options": { + "0": { + "value": "Part-time – Less than 30 hours" + }, + "1": { + "value": "Full-time – 30 hours or more" + }, + "2": { + "value": "Full-time student" + }, + "3": { + "value": "In government training into work, such as New Deal" + }, + "4": { + "value": "Jobseeker" + }, + "5": { + "value": "Not seeking work" + }, + "6": { + "value": "Unable to work because of long term sick or disability" + }, + "7": { + "value": "Retired" + }, + "8": { + "value": "Child under 16" + }, + "9": { + "value": "Other" + }, + "divider": { + "value": true + }, + "10": { + "value": "Tenant prefers not to say" } } } - }, - "household_number_of_members": { - "questions": { - "hhmemb": { - "check_answers_card_number": 0, - "check_answer_label": "Number of Household Members", - "header": "How many people are there in the household?", - "hint_text": "The maximum number of members is 8", - "type": "numeric", - "min": 0, - "max": 8, - "step": 1, - "width": 2, - "conditional_for": { - "relat2": ">1", - "age2": ">1", - "sex2": ">1" - } - }, - "relat2": { - "check_answers_card_number": 2, - "check_answer_label": "Person 2’s relationship to lead tenant", - "header": "What is person 2’s relationship to lead tenant", - "type": "radio", - "answer_options": { - "X": { - "value": "Other" - }, - "R": { - "value": "Prefer not to say" - } + } + }, + "household_number_of_members": { + "questions": { + "hhmemb": { + "check_answers_card_number": 0, + "check_answer_label": "Number of Household Members", + "header": "How many people are there in the household?", + "hint_text": "The maximum number of members is 8", + "type": "numeric", + "min": 0, + "max": 8, + "step": 1, + "width": 2, + "conditional_for": { + "relat2": ">1", + "age2": ">1", + "sex2": ">1" + } + }, + "relat2": { + "check_answers_card_number": 2, + "check_answer_label": "Person 2’s relationship to lead tenant", + "header": "What is person 2’s relationship to lead tenant", + "type": "radio", + "answer_options": { + "X": { + "value": "Other" + }, + "R": { + "value": "Prefer not to say" } - }, - "age2": { - "check_answers_card_number": 2, - "check_answer_label": "Person 2’s age", - "header": "Do you know person 2’s age?", - "type": "numeric", - "min": 1, - "max": 120, - "step": 1, - "width": 2 - }, - "sex2": { - "check_answers_card_number": 2, - "check_answer_label": "Person 2’s gender identity", - "header": "Which of these best describes person 2’s gender identity?", - "type": "radio", - "answer_options": { - "F": { - "value": "Female" - }, - "M": { - "value": "Male" - }, - "X": { - "value": "Non-binary" - }, - "R": { - "value": "Prefer not to say" - } + } + }, + "age2": { + "check_answers_card_number": 2, + "check_answer_label": "Person 2’s age", + "header": "Do you know person 2’s age?", + "type": "numeric", + "min": 1, + "max": 120, + "step": 1, + "width": 2 + }, + "sex2": { + "check_answers_card_number": 2, + "check_answer_label": "Person 2’s gender identity", + "header": "Which of these best describes person 2’s gender identity?", + "type": "radio", + "answer_options": { + "F": { + "value": "Female" + }, + "M": { + "value": "Male" + }, + "X": { + "value": "Non-binary" + }, + "R": { + "value": "Prefer not to say" } } } - }, - "retirement_value_check": { - "questions": { - "retirement_value_check": { - "check_answer_label": "Retirement age soft validation", - "hidden_in_check_answers": true, - "header": "Are you sure this person is retired?", - "type": "radio", - "answer_options": { - "0": { - "value": "Yes" - }, - "1": { - "value": "No" - } + } + }, + "retirement_value_check": { + "questions": { + "retirement_value_check": { + "check_answer_label": "Retirement age soft validation", + "hidden_in_check_answers": true, + "header": "Are you sure this person is retired?", + "type": "radio", + "answer_options": { + "0": { + "value": "Yes" + }, + "1": { + "value": "No" } } - }, - "depends_on": [ - { - "age2": { "operator": ">", "operand": 50 } - } - ] + } }, - "person_2_working_situation": { - "header": "", - "description": "", - "questions": { - "ecstat2": { - "check_answers_card_number": 2, - "check_answer_label": "Person 2’s Work", - "header": "Which of these best describes person 2’s working situation?", - "type": "radio", - "answer_options": { - "0": { - "value": "Other" - }, - "9": { - "value": "Child under 16", - "depends_on": [ - { "age2_known": 1 }, - { "age2": { "operator": "<", "operand": 16 } } - ] - }, - "1": { - "value": "Prefer not to say" - } - } + "depends_on": [ + { + "age2": { + "operator": ">", + "operand": 50 } - }, - "depends_on": [ - { - "age2": { "operator": ">", "operand": 15 } + } + ] + }, + "person_2_working_situation": { + "header": "", + "description": "", + "questions": { + "ecstat2": { + "check_answers_card_number": 2, + "check_answer_label": "Person 2’s Work", + "header": "Which of these best describes person 2’s working situation?", + "type": "radio", + "answer_options": { + "0": { + "value": "Other" + }, + "9": { + "value": "Child under 16", + "depends_on": [ + { + "age2_known": 1 + }, + { + "age2": { + "operator": "<", + "operand": 16 + } + } + ] + }, + "1": { + "value": "Prefer not to say" + } } - ] + } }, - "propcode": { - "questions": { - "propcode": { - "check_answers_card_number": 0, - "check_answer_label": "", - "header": "property reference?", - "type": "text" + "depends_on": [ + { + "age2": { + "operator": ">", + "operand": 15 } } + ] + }, + "propcode": { + "questions": { + "propcode": { + "check_answers_card_number": 0, + "check_answer_label": "", + "header": "property reference?", + "type": "text" + } } } - }, - "household_needs": { - "label": "Household needs", - "pages": { - "armed_forces": { - "header": "Experience of the UK Armed Forces", - "questions": { - "armedforces": { - "header": "Does anybody in the household have any links to the UK armed forces?", - "hint_text": "This excludes national service. If there are several people in the household with links to the UK armed forces, you should answer for the regular. If there’s no regular, answer for the reserve. If there’s no reserve, answer for the spouse or civil partner.", - "type": "radio", - "check_answer_label": "Household links to UK armed forces", - "answer_options": { - "1": { - "value": "Yes, the person is a current or former regular" - }, - "4": { - "value": "Yes, the person is a current or former reserve" - }, - "5": { - "value": "Yes, the tenant is a spouse or civil partner of a UK armed forces member and has been bereaved or separated from them within the last 2 years" - }, - "2": { - "value": "No" - }, - "3": { - "value": "Person prefers not to say" - } + } + }, + "household_needs": { + "label": "Household needs", + "pages": { + "armed_forces": { + "header": "Experience of the UK Armed Forces", + "questions": { + "armedforces": { + "header": "Does anybody in the household have any links to the UK armed forces?", + "hint_text": "This excludes national service. If there are several people in the household with links to the UK armed forces, you should answer for the regular. If there’s no regular, answer for the reserve. If there’s no reserve, answer for the spouse or civil partner.", + "type": "radio", + "check_answer_label": "Household links to UK armed forces", + "answer_options": { + "1": { + "value": "Yes, the person is a current or former regular" + }, + "4": { + "value": "Yes, the person is a current or former reserve" }, - "conditional_for": { - "leftreg": [1] + "5": { + "value": "Yes, the tenant is a spouse or civil partner of a UK armed forces member and has been bereaved or separated from them within the last 2 years" + }, + "2": { + "value": "No" + }, + "3": { + "value": "Person prefers not to say" } }, - "leftreg": { - "header": "Are they still serving?", - "hint_text": "", - "type": "text", - "check_answer_label": "When did they leave the Armed Forces?" + "conditional_for": { + "leftreg": [ + 1 + ] + }, + "inferred_check_answers_value": { + "condition": { + "armedforces": 3 + }, + "value": "Prefers not to say" } + }, + "leftreg": { + "header": "Are they still serving?", + "hint_text": "", + "type": "text", + "check_answer_label": "When did they leave the Armed Forces?" } - }, - "medical_conditions": { - "questions": { - "illness": { - "header": "Does anyone in the household have any of the following that they expect to last for 12 months or more: