- <% if current_page?(:controller => 'lettings_logs', :action => 'index') %>
+ <% if current_page?(controller: 'lettings_logs', action: 'index') %>
<%= govuk_button_to "Create a new lettings log", lettings_logs_path %>
<% end %>
- <% if FeatureToggle.sales_log_enabled? && current_page?(:controller => 'sales_logs', :action => 'index') %>
+ <% if FeatureToggle.sales_log_enabled? && current_page?(controller: 'sales_logs', action: 'index') %>
<%= govuk_button_to "Create a new sales log", sales_logs_path %>
<% end %>
<%#= govuk_link_to "Upload logs", bulk_upload_lettings_logs_path %>
diff --git a/app/views/organisations/logs.html.erb b/app/views/organisations/logs.html.erb
index 3b03e55e4..f954a0839 100644
--- a/app/views/organisations/logs.html.erb
+++ b/app/views/organisations/logs.html.erb
@@ -14,7 +14,12 @@
- <%= govuk_button_to "Create a new lettings log for this organisation", lettings_logs_path(lettings_log: { owning_organisation_id: @organisation.id }, method: :post) %>
+ <% if current_page?(controller: 'organisations', action: 'lettings_logs') %>
+ <%= govuk_button_to "Create a new lettings log for this organisation", lettings_logs_path(lettings_log: { owning_organisation_id: @organisation.id }, method: :post) %>
+ <% end %>
+ <% if current_page?(controller: 'organisations', action: 'sales_logs') %>
+ <%= govuk_button_to "Create a new sales log for this organisation", sales_logs_path(sales_log: { owning_organisation_id: @organisation.id }, method: :post) %>
+ <% end %>
<%= render partial: "logs/log_filters" %>
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/schema.rb b/db/schema.rb
index fa885644b..9e0ceb71e 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_04_184301) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -333,18 +333,28 @@ ActiveRecord::Schema[7.0].define(version: 2022_09_29_125204) do
t.integer "jointmore"
t.integer "jointpur"
t.integer "beds"
- t.integer "companybuy"
t.integer "age1"
t.integer "age1_known"
+ t.integer "companybuy"
t.string "sex1"
+ 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 "ecstat1"
+ t.integer "national"
+ t.string "othernational"
+ t.integer "privacynotice"
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 670131681..a091030bc 100644
--- a/spec/factories/sales_log.rb
+++ b/spec/factories/sales_log.rb
@@ -16,18 +16,27 @@ FactoryBot.define do
ownershipsch { 2 }
type { 8 }
saledate { Time.utc(2022, 2, 2, 10, 36, 49) }
+ companybuy { 1 }
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" }
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/features/organisation_spec.rb b/spec/features/organisation_spec.rb
index a0558d167..09d6130e4 100644
--- a/spec/features/organisation_spec.rb
+++ b/spec/features/organisation_spec.rb
@@ -134,7 +134,7 @@ RSpec.describe "User Features" do
click_button("Submit")
end
- context "when viewing logs for specific organisation" do
+ context "when viewing lettings logs for specific organisation" do
let(:first_log) { organisation.lettings_logs.first }
let!(:log_to_search) { FactoryBot.create(:lettings_log, owning_organisation: user.organisation, managing_organisation_id: organisation.id) }
let!(:other_logs) { FactoryBot.create_list(:lettings_log, 4, owning_organisation_id: organisation.id, managing_organisation_id: organisation.id) }
@@ -189,7 +189,7 @@ RSpec.describe "User Features" do
expect(page).to have_link("Clear search")
end
- it "displays the logs belonging to the same organisation after I clear the search result after I clear the search resultss" do
+ it "displays the logs belonging to the same organisation after I clear the search result after I clear the search results" do
click_link("Clear search")
expect(page).to have_link(log_to_search.id.to_s)
end
@@ -210,6 +210,39 @@ RSpec.describe "User Features" do
end
end
+ context "when viewing sales logs for specific organisation" do
+ let(:first_log) { organisation.sales_logs.first }
+ let(:number_of_sales_logs) { SalesLog.count }
+
+ before do
+ FactoryBot.create_list(:sales_log, 4, owning_organisation_id: organisation.id, managing_organisation_id: organisation.id)
+ visit("/organisations/#{org_id}/sales-logs")
+ end
+
+ it "shows a create button for that organisation" do
+ expect(page).to have_button("Create a new sales log for this organisation")
+ end
+
+ context "when creating a log for that organisation" do
+ it "pre-fills the value for owning organisation for that log" do
+ click_button("Create a new sales log for this organisation")
+ click_link("Set up this sales log")
+ expect(page).to have_content(org_name)
+ end
+ end
+
+ it "can filter sales logs" do
+ expect(page).to have_content("#{number_of_sales_logs} total logs")
+ organisation.sales_logs.map(&:id).each do |sales_log_id|
+ expect(page).to have_link sales_log_id.to_s, href: "/sales-logs/#{sales_log_id}"
+ end
+ check("years-2021-field")
+ click_button("Apply filters")
+ expect(page).to have_current_path("/organisations/#{org_id}/sales-logs?years[]=&years[]=2021&status[]=&user=all")
+ expect(page).not_to have_link first_log.id.to_s, href: "/sales-logs/#{first_log.id}"
+ end
+ end
+
context "when I search for users belonging to a specific organisation" do
context "when I am signed in and there are users in the database" do
let!(:user_list) { FactoryBot.create_list(:user, 4, organisation: user.organisation) }
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:
- Physical Condition
- Mental Health Condition
- Other Illness
",
- "type": "radio",
- "check_answer_label": "Physical, mental health or illness in the household",
- "answer_options": {
- "1": {
- "value": "Yes"
- },
- "2": {
- "value": "No"
- },
- "3": {
- "value": "Don’t know"
- }
+ }
+ },
+ "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:
- Physical Condition
- Mental Health Condition
- Other Illness
",
+ "type": "radio",
+ "check_answer_label": "Physical, mental health or illness in the household",
+ "answer_options": {
+ "1": {
+ "value": "Yes"
+ },
+ "2": {
+ "value": "No"
+ },
+ "3": {
+ "value": "Don’t know"
}
}
}
- },
- "accessibility_requirements": {
- "questions": {
- "accessibility_requirements": {
- "header": "Are any of these affected by their condition or illness?",
- "hint_text": "Select all that apply",
- "type": "checkbox",
- "check_answer_label": "Disability requirements",
- "answer_options": {
- "housingneeds_a": {
- "value": "Fully wheelchair accessible housing"
- },
- "housingneeds_b": {
- "value": "Wheelchair access to essential rooms"
- },
- "housingneeds_c": {
- "value": "Level access housing"
- },
- "divider": {
- "value": true
- },
- "housingneeds_h": {
- "value": "Don’t know"
- }
+ }
+ },
+ "accessibility_requirements": {
+ "questions": {
+ "accessibility_requirements": {
+ "header": "Are any of these affected by their condition or illness?",
+ "hint_text": "Select all that apply",
+ "type": "checkbox",
+ "check_answer_label": "Disability requirements",
+ "answer_options": {
+ "housingneeds_a": {
+ "value": "Fully wheelchair accessible housing"
+ },
+ "housingneeds_b": {
+ "value": "Wheelchair access to essential rooms"
+ },
+ "housingneeds_c": {
+ "value": "Level access housing"
+ },
+ "divider": {
+ "value": true
+ },
+ "housingneeds_h": {
+ "value": "Don’t know"
}
}
}
- },
- "accessible_select": {
- "questions": {
- "prevloc": {
- "header": "Select options",
- "hint_text": "Type ahead to filter the options",
- "type": "select",
- "check_answer_label": "Accessible Select",
- "answer_options": {
- "" : "Select an option",
- "E07000223": "Adur",
- "E09000023": "Lewisham",
- "E08000003": "Manchester",
- "E07000178": "Oxford",
- "E07000114": "Thanet",
- "E09000033": "Westminster",
- "E06000014": "The one and only york town"
- }
- }
- },
- "depends_on": [
- {
- "previous_la_known": 1,
- "is_previous_la_inferred": false
+ }
+ },
+ "accessible_select": {
+ "questions": {
+ "prevloc": {
+ "header": "Select options",
+ "hint_text": "Type ahead to filter the options",
+ "type": "select",
+ "check_answer_label": "Accessible Select",
+ "answer_options": {
+ "": "Select an option",
+ "E07000223": "Adur",
+ "E09000023": "Lewisham",
+ "E08000003": "Manchester",
+ "E07000178": "Oxford",
+ "E07000114": "Thanet",
+ "E09000033": "Westminster",
+ "E06000014": "The one and only york town"
}
- ]
+ }
},
- "condition_effects": {
- "questions": {
- "condition_effects": {
- "header": "Are any of these affected by their condition or illness?",
- "hint_text": "Select all that apply",
- "type": "checkbox",
- "check_answer_label": "Conditions or illnesses",
- "answer_options": {
- "illness_type_1": {
- "value": "Vision - such as blindness or partial sight"
- },
- "illness_type_2": {
- "value": "Hearing - such as deafness or partial hearing"
- }
+ "depends_on": [
+ {
+ "previous_la_known": 1,
+ "is_previous_la_inferred": false
+ }
+ ]
+ },
+ "condition_effects": {
+ "questions": {
+ "condition_effects": {
+ "header": "Are any of these affected by their condition or illness?",
+ "hint_text": "Select all that apply",
+ "type": "checkbox",
+ "check_answer_label": "Conditions or illnesses",
+ "answer_options": {
+ "illness_type_1": {
+ "value": "Vision - such as blindness or partial sight"
+ },
+ "illness_type_2": {
+ "value": "Hearing - such as deafness or partial hearing"
}
}
+ }
+ },
+ "depends_on": [
+ {
+ "illness": 1
},
- "depends_on": [
- {
- "illness": 1
- },
- {
- "illness": 100
- }
- ]
- }
+ {
+ "illness": 100
+ }
+ ]
}
}
}
- },
- "tenancy_and_property": {
- "label": "Tenancy and property information",
- "subsections": {
- "property_information": {
- "label": "Property information",
- "pages": {
- "accessible_select_too": {
- "questions": {
- "la": {
- "header": "Select options",
- "hint_text": "Type ahead to filter the options",
- "type": "select",
- "check_answer_label": "Accessible Select",
- "answer_options": {
- "" : "Select an option",
- "E07000223": "Adur",
- "E09000023": "Lewisham",
- "E08000003": "Manchester",
- "E07000178": "Oxford",
- "E07000114": "Thanet",
- "E09000033": "Westminster",
- "E06000014": "York"
- }
- }
- },
- "depends_on": [
- {
- "is_la_inferred": false
+ }
+ },
+ "tenancy_and_property": {
+ "label": "Tenancy and property information",
+ "subsections": {
+ "property_information": {
+ "label": "Property information",
+ "pages": {
+ "accessible_select_too": {
+ "questions": {
+ "la": {
+ "header": "Select options",
+ "hint_text": "Type ahead to filter the options",
+ "type": "select",
+ "check_answer_label": "Accessible Select",
+ "answer_options": {
+ "": "Select an option",
+ "E07000223": "Adur",
+ "E09000023": "Lewisham",
+ "E08000003": "Manchester",
+ "E07000178": "Oxford",
+ "E07000114": "Thanet",
+ "E09000033": "Westminster",
+ "E06000014": "York"
}
- ]
+ }
},
- "property_postcode": {
- "header": "",
- "description": "",
- "questions": {
- "postcode_known": {
- "check_answer_label": "Do you know the property postcode?",
- "header": "Do you know the property’s postcode?",
- "hint_text": "",
- "type": "radio",
- "answer_options": {
- "1": {
- "value": "Yes"
- },
- "0": {
- "value": "No"
- }
- },
- "conditional_for": {
- "postcode_full": [
- 1
- ]
+ "depends_on": [
+ {
+ "is_la_inferred": false
+ }
+ ]
+ },
+ "property_postcode": {
+ "header": "",
+ "description": "",
+ "questions": {
+ "postcode_known": {
+ "check_answer_label": "Do you know the property postcode?",
+ "header": "Do you know the property’s postcode?",
+ "hint_text": "",
+ "type": "radio",
+ "answer_options": {
+ "1": {
+ "value": "Yes"
},
- "hidden_in_check_answers": true
+ "0": {
+ "value": "No"
+ }
},
- "postcode_full": {
- "check_answer_label": "Postcode",
- "header": "",
- "hint_text": "",
- "type": "text",
- "width": 5,
- "inferred_answers": { "la": { "is_la_inferred": true } },
- "inferred_check_answers_value": {
- "condition": { "postcode_known": 0 },
- "value": "Not known"
+ "conditional_for": {
+ "postcode_full": [
+ 1
+ ]
+ },
+ "hidden_in_check_answers": true
+ },
+ "postcode_full": {
+ "check_answer_label": "Postcode",
+ "header": "",
+ "hint_text": "",
+ "type": "text",
+ "width": 5,
+ "inferred_answers": {
+ "la": {
+ "is_la_inferred": true
}
+ },
+ "inferred_check_answers_value": {
+ "condition": {
+ "postcode_known": 0
+ },
+ "value": "Not known"
}
}
- },
- "do_you_know_the_local_authority": {
- "header": "",
- "description": "",
- "questions": {
- "previous_la_known": {
- "check_answer_label": "Do you know what local authority the property is located in?",
- "header": "Do you know what local authority the property is located in?",
- "hint_text": "",
- "type": "radio",
- "answer_options": {
- "0": {
- "value": "No"
- },
- "1": {
- "value": "Yes"
- }
+ }
+ },
+ "do_you_know_the_local_authority": {
+ "header": "",
+ "description": "",
+ "questions": {
+ "previous_la_known": {
+ "check_answer_label": "Do you know what local authority the property is located in?",
+ "header": "Do you know what local authority the property is located in?",
+ "hint_text": "",
+ "type": "radio",
+ "answer_options": {
+ "0": {
+ "value": "No"
+ },
+ "1": {
+ "value": "Yes"
}
}
- },
- "depends_on": [{"is_la_inferred": false}]
+ }
},
- "property_wheelchair_accessible": {
- "questions": {
- "wchair": {
- "check_answer_label": "Wheelchair adaptation",
- "header": "Is the property built or adapted to wheelchair-user standards?",
- "type": "radio",
- "answer_options": {
- "0": {
- "value": "Yes"
- },
- "1": {
- "value": "No"
- }
+ "depends_on": [
+ {
+ "is_la_inferred": false
+ }
+ ]
+ },
+ "property_wheelchair_accessible": {
+ "questions": {
+ "wchair": {
+ "check_answer_label": "Wheelchair adaptation",
+ "header": "Is the property built or adapted to wheelchair-user standards?",
+ "type": "radio",
+ "answer_options": {
+ "0": {
+ "value": "Yes"
+ },
+ "1": {
+ "value": "No"
}
}
}
}
}
- },
- "conditional_question": {
- "label": "Conditional question",
- "pages": {
- "conditional_question": {
- "questions": {
- "preg_occ": {
- "check_answer_label": "Has the condition been met?",
- "header": "Has the condition been met?",
- "type": "radio",
- "answer_options": {
- "1": {
- "value": "Yes"
- },
- "2": {
- "value": "No"
- }
+ }
+ },
+ "conditional_question": {
+ "label": "Conditional question",
+ "pages": {
+ "conditional_question": {
+ "questions": {
+ "preg_occ": {
+ "check_answer_label": "Has the condition been met?",
+ "header": "Has the condition been met?",
+ "type": "radio",
+ "answer_options": {
+ "1": {
+ "value": "Yes"
+ },
+ "2": {
+ "value": "No"
}
}
}
- },
- "conditional_question_yes_page": {
- "questions": {
- "cbl": {
- "check_answer_label": "Has the next condition been met?",
- "header": "Has the next condition been met?",
- "type": "radio",
- "answer_options": {
- "0": {
- "value": "Yes"
- }
+ }
+ },
+ "conditional_question_yes_page": {
+ "questions": {
+ "cbl": {
+ "check_answer_label": "Has the next condition been met?",
+ "header": "Has the next condition been met?",
+ "type": "radio",
+ "answer_options": {
+ "0": {
+ "value": "Yes"
}
}
- },
- "depends_on": [{ "preg_occ": 1 }, { "wchair" : 1 }]
+ }
},
- "conditional_question_no_page": {
- "questions": {
- "cbl": {
- "check_answer_label": "Has the condition not been met?",
- "header": "Has the next condition not been met?",
- "type": "radio",
- "answer_options": {
- "0": {
- "value": "Yes"
- },
- "1": {
- "value": "No"
- }
+ "depends_on": [
+ {
+ "preg_occ": 1
+ },
+ {
+ "wchair": 1
+ }
+ ]
+ },
+ "conditional_question_no_page": {
+ "questions": {
+ "cbl": {
+ "check_answer_label": "Has the condition not been met?",
+ "header": "Has the next condition not been met?",
+ "type": "radio",
+ "answer_options": {
+ "0": {
+ "value": "Yes"
+ },
+ "1": {
+ "value": "No"
}
}
- },
- "depends_on": [{ "preg_occ": 2 }]
+ }
},
- "conditional_question_no_second_page": {
- "questions": {
- "conditional_question_no_second_question": {
- "check_answer_label": "Has the condition not been met again?",
- "header": "Has the next condition not been met again?",
- "type": "radio",
- "answer_options": {
- "0": {
- "value": "Yes"
- },
- "1": {
- "value": "No"
- }
+ "depends_on": [
+ {
+ "preg_occ": 2
+ }
+ ]
+ },
+ "conditional_question_no_second_page": {
+ "questions": {
+ "conditional_question_no_second_question": {
+ "check_answer_label": "Has the condition not been met again?",
+ "header": "Has the next condition not been met again?",
+ "type": "radio",
+ "answer_options": {
+ "0": {
+ "value": "Yes"
+ },
+ "1": {
+ "value": "No"
}
}
- },
- "depends_on": [{ "preg_occ": 2, "sex1": "M" }]
- }
+ }
+ },
+ "depends_on": [
+ {
+ "preg_occ": 2,
+ "sex1": "M"
+ }
+ ]
}
}
}
- },
- "rent_and_charges": {
- "label": "Rent and charges",
- "subsections": {
- "income_and_benefits": {
- "label": "Income and benefits",
- "pages": {
- "net_income": {
- "header": "Test header",
- "description": "Some extra text for the page",
- "questions": {
- "earnings": {
- "check_answer_label": "Income",
- "header": "What is the tenant’s /and partner’s combined income after tax?",
- "guidance_partial": "what_counts_as_income",
- "type": "numeric",
- "min": 0,
- "step": 1,
- "width": 5,
- "prefix": "£",
- "suffix": [
- { "label": " every week", "depends_on" : { "incfreq": 1 } },
- { "label": " every month", "depends_on" : { "incfreq": 2 } },
- { "label": " every year", "depends_on" : { "incfreq": 3 } }
- ]
- },
- "incfreq": {
- "check_answer_label": "Income Frequency",
- "header": "How often do they receive this income?",
- "type": "radio",
- "answer_options": {
- "1": {
- "value": "Weekly"
- },
- "2": {
- "value": "Monthly"
- },
- "3": {
- "value": "Yearly"
+ }
+ },
+ "rent_and_charges": {
+ "label": "Rent and charges",
+ "subsections": {
+ "income_and_benefits": {
+ "label": "Income and benefits",
+ "pages": {
+ "net_income": {
+ "header": "Test header",
+ "description": "Some extra text for the page",
+ "questions": {
+ "earnings": {
+ "check_answer_label": "Income",
+ "header": "What is the tenant’s /and partner’s combined income after tax?",
+ "guidance_partial": "what_counts_as_income",
+ "type": "numeric",
+ "min": 0,
+ "step": 1,
+ "width": 5,
+ "prefix": "£",
+ "suffix": [
+ {
+ "label": " every week",
+ "depends_on": {
+ "incfreq": 1
+ }
+ },
+ {
+ "label": " every month",
+ "depends_on": {
+ "incfreq": 2
+ }
+ },
+ {
+ "label": " every year",
+ "depends_on": {
+ "incfreq": 3
}
}
+ ]
+ },
+ "incfreq": {
+ "check_answer_label": "Income Frequency",
+ "header": "How often do they receive this income?",
+ "type": "radio",
+ "answer_options": {
+ "1": {
+ "value": "Weekly"
+ },
+ "2": {
+ "value": "Monthly"
+ },
+ "3": {
+ "value": "Yearly"
+ }
}
}
+ }
+ },
+ "net_income_value_check": {
+ "depends_on": [
+ {
+ "net_income_soft_validation_triggered?": true
+ }
+ ],
+ "title_text": {
+ "translation": "soft_validations.net_income.title_text"
},
- "net_income_value_check": {
- "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": [{
+ "informative_text": {
+ "translation": "soft_validations.net_income.hint_text",
+ "arguments": [
+ {
"key": "ecstat1",
"label": true,
"i18n_template": "ecstat1"
@@ -693,7 +763,9 @@
}
},
"conditional_for": {
- "conditional_question": [0]
+ "conditional_question": [
+ 0
+ ]
}
},
"conditional_question": {
@@ -712,7 +784,11 @@
}
},
"dependent_page": {
- "depends_on": [{ "incfreq": 1 }],
+ "depends_on": [
+ {
+ "incfreq": 1
+ }
+ ],
"questions": {
"dependent_question": {
"check_answer_label": "Dependent Question",
@@ -757,7 +833,12 @@
"min": 0,
"step": 1,
"width": 4,
- "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
+ "fields-to-add": [
+ "brent",
+ "scharge",
+ "pscharge",
+ "supcharg"
+ ],
"result-field": "tcharge"
},
"scharge": {
@@ -768,7 +849,12 @@
"min": 0,
"step": 1,
"width": 4,
- "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
+ "fields-to-add": [
+ "brent",
+ "scharge",
+ "pscharge",
+ "supcharg"
+ ],
"result-field": "tcharge"
},
"pscharge": {
@@ -779,7 +865,12 @@
"min": 0,
"step": 1,
"width": 4,
- "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
+ "fields-to-add": [
+ "brent",
+ "scharge",
+ "pscharge",
+ "supcharg"
+ ],
"result-field": "tcharge"
},
"supcharg": {
@@ -791,7 +882,12 @@
"max": 300,
"step": 1,
"width": 4,
- "fields-to-add": ["brent", "scharge", "pscharge", "supcharg"],
+ "fields-to-add": [
+ "brent",
+ "scharge",
+ "pscharge",
+ "supcharg"
+ ],
"result-field": "tcharge"
},
"tcharge": {
@@ -836,7 +932,11 @@
"width": 4
}
},
- "depends_on": [{ "period": 3 }]
+ "depends_on": [
+ {
+ "period": 3
+ }
+ ]
},
"care_home_charge_bi_weekly": {
"questions": {
@@ -850,7 +950,11 @@
"width": 4
}
},
- "depends_on": [{ "period": 2 }]
+ "depends_on": [
+ {
+ "period": 2
+ }
+ ]
}
}
}
@@ -898,11 +1002,22 @@
}
},
"hidden_in_check_answers": {
- "depends_on": [{ "layear": 0 }, { "layear": 1 }]
+ "depends_on": [
+ {
+ "layear": 0
+ },
+ {
+ "layear": 1
+ }
+ ]
}
}
},
- "depends_on": [{ "renewal": 0 }]
+ "depends_on": [
+ {
+ "renewal": 0
+ }
+ ]
},
"time_on_la_waiting_list": {
"questions": {
@@ -950,7 +1065,9 @@
"hint_text": "If the household has moved from settled accommodation immediately prior to being re-housed",
"type": "text",
"width": 5,
- "conditional_for": { "fake_key": "fake_condition" }
+ "conditional_for": {
+ "fake_key": "fake_condition"
+ }
},
"ppostcode_full": {
"check_answer_label": "Postcode of previous accommodation if the household has moved from settled accommodation",
diff --git a/spec/fixtures/forms/2022_2023.json b/spec/fixtures/forms/2022_2023.json
index 81c190a46..a704a9229 100644
--- a/spec/fixtures/forms/2022_2023.json
+++ b/spec/fixtures/forms/2022_2023.json
@@ -1,55 +1,57 @@
{
- "form_type": "lettings",
- "start_date": "2022-04-01T00:00:00.000+01:00",
- "end_date": "2023-07-01T00:00:00.000+01:00",
- "sections": {
- "household": {
- "label": "About the household",
- "subsections": {
- "household_characteristics": {
- "label": "Household characteristics",
- "pages": {
- "tenant_code_test": {
- "questions": {
- "tenancycode": {
- "check_answer_label": "Tenant code",
- "header": "Different question header text for this year - 2023",
- "type": "text",
- "width": 10
- }
+ "form_type": "lettings",
+ "start_date": "2022-04-01T00:00:00.000+01:00",
+ "end_date": "2023-07-01T00:00:00.000+01:00",
+ "sections": {
+ "household": {
+ "label": "About the household",
+ "subsections": {
+ "household_characteristics": {
+ "label": "Household characteristics",
+ "pages": {
+ "tenant_code_test": {
+ "questions": {
+ "tenancycode": {
+ "check_answer_label": "Tenant code",
+ "header": "Different question header text for this year - 2023",
+ "type": "text",
+ "width": 10
}
- },
- "outstanding_amount_known": {
- "header": "",
- "description": "",
- "questions": {
- "tshortfall_known": {
- "check_answer_label": "",
- "header": "",
- "hint_text": "",
- "hidden_in_check_answers": true,
- "type": "radio",
- "derived": true,
- "answer_options": {
- "0": {
- "value": "Yes"
- },
- "1": {
- "value": "No"
- }
- }
- }
- },
- "depends_on": [false]
}
},
- "depends_on": [
- {
- "setup": "completed"
- }
- ]
- }
+ "outstanding_amount_known": {
+ "header": "",
+ "description": "",
+ "questions": {
+ "tshortfall_known": {
+ "check_answer_label": "",
+ "header": "",
+ "hint_text": "",
+ "hidden_in_check_answers": true,
+ "type": "radio",
+ "derived": true,
+ "answer_options": {
+ "0": {
+ "value": "Yes"
+ },
+ "1": {
+ "value": "No"
+ }
+ }
+ }
+ },
+ "depends_on": [
+ false
+ ]
+ }
+ },
+ "depends_on": [
+ {
+ "setup": "completed"
+ }
+ ]
}
}
}
}
+}
diff --git a/spec/fixtures/forms/test_validator.json b/spec/fixtures/forms/test_validator.json
index 512298a5d..e6edc4d16 100644
--- a/spec/fixtures/forms/test_validator.json
+++ b/spec/fixtures/forms/test_validator.json
@@ -22,7 +22,11 @@
"type": "text"
}
},
- "depends_on": [{"test": "Yes"}]
+ "depends_on": [
+ {
+ "test": "Yes"
+ }
+ ]
},
"person_1_age": {
"header": "",
diff --git a/spec/helpers/question_attribute_helper_spec.rb b/spec/helpers/question_attribute_helper_spec.rb
index 96f2f7ef6..2be903535 100644
--- a/spec/helpers/question_attribute_helper_spec.rb
+++ b/spec/helpers/question_attribute_helper_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe QuestionAttributeHelper do
"conditional_for" => {
"next_question": ">1",
},
- }, nil)
+ }, form.get_page("rent"))
end
let(:expected_attribs) do
{
@@ -48,7 +48,7 @@ RSpec.describe QuestionAttributeHelper do
"data-action": "input->numeric-question#calculateFields click->conditional-question#displayConditional",
"data-target": "lettings-log-#{question.result_field.to_s.dasherize}-field",
"data-calculated": question.fields_to_add.to_json,
- "data-info": question.conditional_for.to_json,
+ "data-info": { conditional_questions: question.conditional_for, log_type: "lettings" }.to_json,
}
end
diff --git a/spec/models/form/question_spec.rb b/spec/models/form/question_spec.rb
index da59ad354..637407bc1 100644
--- a/spec/models/form/question_spec.rb
+++ b/spec/models/form/question_spec.rb
@@ -340,6 +340,29 @@ RSpec.describe Form::Question, type: :model do
expect(question.answer_label(lettings_log)).to eq("£500.00 every year")
end
end
+
+ context "with inferred_check_answers_value" do
+ context "when Lettings form" do
+ let(:section_id) { "household" }
+ let(:subsection_id) { "household_needs" }
+ let(:page_id) { "armed_forces" }
+ let(:question_id) { "armedforces" }
+
+ it "returns the inferred label value" do
+ lettings_log.armedforces = 3
+ expect(question.answer_label(lettings_log)).to eq("Prefers not to say")
+ end
+ end
+
+ context "when Sales form" do
+ let(:sales_log) { FactoryBot.create(:sales_log, :completed, ethnic_group: 17) }
+ let(:question) { sales_log.form.get_question("ethnic_group", sales_log) }
+
+ it "returns the inferred label value" do
+ expect(question.answer_label(sales_log)).to eq("Prefers not to say")
+ end
+ end
+ end
end
describe ".completed?" do
diff --git a/spec/models/form/sales/pages/buyer1_ethnic_background_arab_spec.rb b/spec/models/form/sales/pages/buyer1_ethnic_background_arab_spec.rb
new file mode 100644
index 000000000..821874a0f
--- /dev/null
+++ b/spec/models/form/sales/pages/buyer1_ethnic_background_arab_spec.rb
@@ -0,0 +1,33 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::Buyer1EthnicBackgroundArab, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[ethnic])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_1_ethnic_background_arab")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+
+ it "has correct depends_on" do
+ expect(page.depends_on).to eq([{ "ethnic_group" => 4 }])
+ end
+end
diff --git a/spec/models/form/sales/pages/buyer1_ethnic_background_asian_spec.rb b/spec/models/form/sales/pages/buyer1_ethnic_background_asian_spec.rb
new file mode 100644
index 000000000..ad8b47846
--- /dev/null
+++ b/spec/models/form/sales/pages/buyer1_ethnic_background_asian_spec.rb
@@ -0,0 +1,33 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::Buyer1EthnicBackgroundAsian, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[ethnic])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_1_ethnic_background_asian")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+
+ it "has correct depends_on" do
+ expect(page.depends_on).to eq([{ "ethnic_group" => 2 }])
+ end
+end
diff --git a/spec/models/form/sales/pages/buyer1_ethnic_background_black_spec.rb b/spec/models/form/sales/pages/buyer1_ethnic_background_black_spec.rb
new file mode 100644
index 000000000..1f5618a0b
--- /dev/null
+++ b/spec/models/form/sales/pages/buyer1_ethnic_background_black_spec.rb
@@ -0,0 +1,33 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::Buyer1EthnicBackgroundBlack, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[ethnic])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_1_ethnic_background_black")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+
+ it "has correct depends_on" do
+ expect(page.depends_on).to eq([{ "ethnic_group" => 3 }])
+ end
+end
diff --git a/spec/models/form/sales/pages/buyer1_ethnic_background_mixed_spec.rb b/spec/models/form/sales/pages/buyer1_ethnic_background_mixed_spec.rb
new file mode 100644
index 000000000..648734242
--- /dev/null
+++ b/spec/models/form/sales/pages/buyer1_ethnic_background_mixed_spec.rb
@@ -0,0 +1,33 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::Buyer1EthnicBackgroundMixed, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[ethnic])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_1_ethnic_background_mixed")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+
+ it "has correct depends_on" do
+ expect(page.depends_on).to eq([{ "ethnic_group" => 1 }])
+ end
+end
diff --git a/spec/models/form/sales/pages/buyer1_ethnic_background_white_spec.rb b/spec/models/form/sales/pages/buyer1_ethnic_background_white_spec.rb
new file mode 100644
index 000000000..620918b0e
--- /dev/null
+++ b/spec/models/form/sales/pages/buyer1_ethnic_background_white_spec.rb
@@ -0,0 +1,29 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::Buyer1EthnicBackgroundWhite, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[ethnic])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_1_ethnic_background_white")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+end
diff --git a/spec/models/form/sales/pages/buyer1_ethnic_group_spec.rb b/spec/models/form/sales/pages/buyer1_ethnic_group_spec.rb
new file mode 100644
index 000000000..406f78676
--- /dev/null
+++ b/spec/models/form/sales/pages/buyer1_ethnic_group_spec.rb
@@ -0,0 +1,33 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::Buyer1EthnicGroup, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[ethnic_group])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_1_ethnic_group")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+
+ it "has correct depends_on" do
+ expect(page.depends_on).to be_nil
+ end
+end
diff --git a/spec/models/form/sales/pages/buyer1_working_situation_spec.rb b/spec/models/form/sales/pages/buyer1_working_situation_spec.rb
new file mode 100644
index 000000000..2a48f0b0f
--- /dev/null
+++ b/spec/models/form/sales/pages/buyer1_working_situation_spec.rb
@@ -0,0 +1,25 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::Buyer1WorkingSituation, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[ecstat1])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_1_working_situation")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("Which of these best describes buyer 1's working situation?")
+ end
+end
diff --git a/spec/models/form/sales/pages/buyer2_live_in_property_spec.rb b/spec/models/form/sales/pages/buyer2_live_in_property_spec.rb
new file mode 100644
index 000000000..cfabcf04c
--- /dev/null
+++ b/spec/models/form/sales/pages/buyer2_live_in_property_spec.rb
@@ -0,0 +1,29 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::Buyer2LiveInProperty, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[buy2livein])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_2_live_in_property")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+end
diff --git a/spec/models/form/sales/pages/buyer2_working_situation_spec.rb b/spec/models/form/sales/pages/buyer2_working_situation_spec.rb
new file mode 100644
index 000000000..5077ab6f4
--- /dev/null
+++ b/spec/models/form/sales/pages/buyer2_working_situation_spec.rb
@@ -0,0 +1,29 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::Buyer2WorkingSituation, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[ecstat2])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_2_working_situation")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+end
diff --git a/spec/models/form/sales/pages/buyer_company_spec.rb b/spec/models/form/sales/pages/buyer_company_spec.rb
new file mode 100644
index 000000000..94b42c28b
--- /dev/null
+++ b/spec/models/form/sales/pages/buyer_company_spec.rb
@@ -0,0 +1,29 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::BuyerCompany, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[companybuy])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_company")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+end
diff --git a/spec/models/form/sales/pages/buyer_interview_spec.rb b/spec/models/form/sales/pages/buyer_interview_spec.rb
new file mode 100644
index 000000000..1347fb782
--- /dev/null
+++ b/spec/models/form/sales/pages/buyer_interview_spec.rb
@@ -0,0 +1,29 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::BuyerInterview, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[noint])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_interview")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+end
diff --git a/spec/models/form/sales/pages/gender_identity2_spec.rb b/spec/models/form/sales/pages/gender_identity2_spec.rb
new file mode 100644
index 000000000..0fdd96e27
--- /dev/null
+++ b/spec/models/form/sales/pages/gender_identity2_spec.rb
@@ -0,0 +1,35 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::GenderIdentity2, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[sex2])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_2_gender_identity")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+
+ it "has correct depends_on" do
+ expect(page.depends_on).to eq([{
+ "jointpur" => 1,
+ }])
+ end
+end
diff --git a/spec/models/form/sales/pages/nationality1_spec.rb b/spec/models/form/sales/pages/nationality1_spec.rb
new file mode 100644
index 000000000..5d156e041
--- /dev/null
+++ b/spec/models/form/sales/pages/nationality1_spec.rb
@@ -0,0 +1,33 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::Nationality1, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[national othernational])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("buyer_1_nationality")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+
+ it "has correct depends_on" do
+ expect(page.depends_on).to be_nil
+ end
+end
diff --git a/spec/models/form/sales/pages/privacy_notice_spec.rb b/spec/models/form/sales/pages/privacy_notice_spec.rb
new file mode 100644
index 000000000..9c957b0b5
--- /dev/null
+++ b/spec/models/form/sales/pages/privacy_notice_spec.rb
@@ -0,0 +1,33 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Pages::PrivacyNotice, type: :model do
+ subject(:page) { described_class.new(page_id, page_definition, subsection) }
+
+ let(:page_id) { nil }
+ let(:page_definition) { nil }
+ let(:subsection) { instance_double(Form::Subsection) }
+
+ it "has correct subsection" do
+ expect(page.subsection).to eq(subsection)
+ end
+
+ it "has correct questions" do
+ expect(page.questions.map(&:id)).to eq(%w[privacynotice])
+ end
+
+ it "has the correct id" do
+ expect(page.id).to eq("privacy_notice")
+ end
+
+ it "has the correct header" do
+ expect(page.header).to eq("Department for Levelling Up, Housing and Communities privacy notice")
+ end
+
+ it "has the correct description" do
+ expect(page.description).to eq("")
+ end
+
+ it "has correct depends_on" do
+ expect(page.depends_on).to eq([{ "noint" => 1 }])
+ end
+end
diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb
new file mode 100644
index 000000000..c13eda0c5
--- /dev/null
+++ b/spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb
@@ -0,0 +1,44 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundArab, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("ethnic")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Which of the following best describes the buyer 1’s Arab background?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer 1’s ethnic background")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint_text" do
+ expect(question.hint_text).to eq("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
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "16" => { "value" => "Other ethnic group" },
+ "19" => { "value" => "Arab" },
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb
new file mode 100644
index 000000000..3fe9cee96
--- /dev/null
+++ b/spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb
@@ -0,0 +1,47 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundAsian, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("ethnic")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Which of the following best describes the buyer 1’s Asian or Asian British background?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer 1’s ethnic background")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint_text" do
+ expect(question.hint_text).to eq("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
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "10" => { "value" => "Bangladeshi" },
+ "11" => { "value" => "Any other Asian or Asian British background" },
+ "15" => { "value" => "Chinese" },
+ "8" => { "value" => "Indian" },
+ "9" => { "value" => "Pakistani" },
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb
new file mode 100644
index 000000000..28949b598
--- /dev/null
+++ b/spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb
@@ -0,0 +1,45 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundBlack, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("ethnic")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Which of the following best describes the buyer 1’s Black, African, Caribbean or Black British background?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer 1’s ethnic background")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint_text" do
+ expect(question.hint_text).to eq("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
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "12" => { "value" => "Caribbean" },
+ "13" => { "value" => "African" },
+ "14" => { "value" => "Any other Black, African or Caribbean background" },
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb
new file mode 100644
index 000000000..48ad38fa8
--- /dev/null
+++ b/spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb
@@ -0,0 +1,46 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundMixed, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("ethnic")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Which of the following best describes the buyer 1’s Mixed or Multiple ethnic groups background?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer 1’s ethnic background")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint_text" do
+ expect(question.hint_text).to eq("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
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "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" },
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb
new file mode 100644
index 000000000..4b72afb92
--- /dev/null
+++ b/spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb
@@ -0,0 +1,46 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundWhite, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("ethnic")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Which of the following best describes the buyer 1’s White background?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer 1’s ethnic background")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint_text" do
+ expect(question.hint_text).to eq("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
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" },
+ "18" => { "value" => "Gypsy or Irish Traveller" },
+ "2" => { "value" => "Irish" },
+ "3" => { "value" => "Any other White background" },
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb
new file mode 100644
index 000000000..4823b43c8
--- /dev/null
+++ b/spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb
@@ -0,0 +1,49 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::Buyer1EthnicGroup, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("ethnic_group")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("What is buyer 1’s ethnic group?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer 1’s ethnic group")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint_text" do
+ expect(question.hint_text).to eq("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
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "0" => { "value" => "White" },
+ "1" => { "value" => "Mixed or Multiple ethnic groups" },
+ "17" => { "value" => "Buyer 1 prefers not to say" },
+ "2" => { "value" => "Asian or Asian British" },
+ "3" => { "value" => "Black, African, Caribbean or Black British" },
+ "4" => { "value" => "Arab or other ethnic group" },
+ "divider" => { "value" => true },
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/buyer1_working_situation_spec.rb b/spec/models/form/sales/questions/buyer1_working_situation_spec.rb
new file mode 100644
index 000000000..832c91538
--- /dev/null
+++ b/spec/models/form/sales/questions/buyer1_working_situation_spec.rb
@@ -0,0 +1,49 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::Buyer1WorkingSituation, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("ecstat1")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Which of these best describes buyer 1's working situation?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer 1's working situation")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "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" },
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/buyer2_live_in_property_spec.rb b/spec/models/form/sales/questions/buyer2_live_in_property_spec.rb
new file mode 100644
index 000000000..b0d1af779
--- /dev/null
+++ b/spec/models/form/sales/questions/buyer2_live_in_property_spec.rb
@@ -0,0 +1,44 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::Buyer2LiveInProperty, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("buy2livein")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Will buyer 2 live in the property?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Will buyer 2 live in the property?")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint" do
+ expect(question.hint_text).to eq("")
+ end
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "1" => { "value" => "Yes" },
+ "2" => { "value" => "No" },
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/buyer2_working_situation_spec.rb b/spec/models/form/sales/questions/buyer2_working_situation_spec.rb
new file mode 100644
index 000000000..0573f02ed
--- /dev/null
+++ b/spec/models/form/sales/questions/buyer2_working_situation_spec.rb
@@ -0,0 +1,53 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::Buyer2WorkingSituation, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("ecstat2")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Which of these best describes buyer 2's working situation?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer 2's working situation")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint" do
+ expect(question.hint_text).to eq("")
+ end
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "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" },
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/buyer_company_spec.rb b/spec/models/form/sales/questions/buyer_company_spec.rb
new file mode 100644
index 000000000..1d7d98940
--- /dev/null
+++ b/spec/models/form/sales/questions/buyer_company_spec.rb
@@ -0,0 +1,40 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::BuyerCompany, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("companybuy")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Is the buyer a company?")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint_text" do
+ expect(question.hint_text).to eq("")
+ end
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "1" => { "value" => "Yes" },
+ "2" => { "value" => "No" },
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/buyer_interview_spec.rb b/spec/models/form/sales/questions/buyer_interview_spec.rb
new file mode 100644
index 000000000..69c45ee4e
--- /dev/null
+++ b/spec/models/form/sales/questions/buyer_interview_spec.rb
@@ -0,0 +1,44 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::BuyerInterview, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("noint")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Was the buyer interviewed for any of the answers you will provide on this log?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer interviewed in person?")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint" do
+ expect(question.hint_text).to eq("You should still try to answer all questions even if the buyer wasn't interviewed in person")
+ end
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "1" => { "value" => "No" },
+ "2" => { "value" => "Yes" },
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/gender_identity2_spec.rb b/spec/models/form/sales/questions/gender_identity2_spec.rb
new file mode 100644
index 000000000..e4da94a24
--- /dev/null
+++ b/spec/models/form/sales/questions/gender_identity2_spec.rb
@@ -0,0 +1,42 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::GenderIdentity2, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("sex2")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Which of these best describes buyer 2’s gender identity?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer 2’s gender identity")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "F" => { "value" => "Female" },
+ "M" => { "value" => "Male" },
+ "X" => { "value" => "Non-binary" },
+ "R" => { "value" => "Buyer prefers not to say" },
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/nationality1_spec.rb b/spec/models/form/sales/questions/nationality1_spec.rb
new file mode 100644
index 000000000..819d41ae4
--- /dev/null
+++ b/spec/models/form/sales/questions/nationality1_spec.rb
@@ -0,0 +1,63 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::Nationality1, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("national")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("What is buyer 1’s nationality?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer 1’s nationality")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("radio")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint" do
+ expect(question.hint_text).to eq("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
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "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" },
+ })
+ end
+
+ it "has correct conditional for" do
+ expect(question.conditional_for).to eq({
+ "othernational" => [12],
+ })
+ end
+
+ it "has correct hidden in check answers" do
+ expect(question.hidden_in_check_answers).to eq({
+ "depends_on" => [
+ {
+ "national" => 12,
+ },
+ ],
+ })
+ end
+end
diff --git a/spec/models/form/sales/questions/other_nationality1_spec.rb b/spec/models/form/sales/questions/other_nationality1_spec.rb
new file mode 100644
index 000000000..b01928efc
--- /dev/null
+++ b/spec/models/form/sales/questions/other_nationality1_spec.rb
@@ -0,0 +1,37 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::OtherNationality1, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("othernational")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Nationality")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer 1’s nationality")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("text")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint" do
+ expect(question.hint_text).to be_nil
+ end
+end
diff --git a/spec/models/form/sales/questions/privacy_notice_spec.rb b/spec/models/form/sales/questions/privacy_notice_spec.rb
new file mode 100644
index 000000000..f90daef1b
--- /dev/null
+++ b/spec/models/form/sales/questions/privacy_notice_spec.rb
@@ -0,0 +1,43 @@
+require "rails_helper"
+
+RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do
+ subject(:question) { described_class.new(question_id, question_definition, page) }
+
+ let(:question_id) { nil }
+ let(:question_definition) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("privacynotice")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Declaration")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Buyer has seen the privacy notice?")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("checkbox")
+ end
+
+ it "is not marked as derived" do
+ expect(question.derived?).to be false
+ end
+
+ it "has the correct hint" do
+ expect(question.hint_text).to eq("")
+ end
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "privacynotice" => { "value" => "The buyer has seen the DLUHC privacy notice" },
+ })
+ end
+end
diff --git a/spec/models/form/sales/subsections/household_characteristics_spec.rb b/spec/models/form/sales/subsections/household_characteristics_spec.rb
index 71a8e898d..aa94e05dd 100644
--- a/spec/models/form/sales/subsections/household_characteristics_spec.rb
+++ b/spec/models/form/sales/subsections/household_characteristics_spec.rb
@@ -13,7 +13,26 @@ RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, type: :model
it "has correct pages" do
expect(household_characteristics.pages.map(&:id)).to eq(
- %w[buyer_1_age buyer_1_gender_identity buyer_1_live_in_property buyer_2_relationship_to_buyer_1 buyer_2_age],
+ %w[
+ buyer_interview
+ privacy_notice
+ buyer_1_age
+ buyer_1_gender_identity
+ buyer_1_ethnic_group
+ buyer_1_ethnic_background_black
+ buyer_1_ethnic_background_asian
+ buyer_1_ethnic_background_arab
+ buyer_1_ethnic_background_mixed
+ buyer_1_ethnic_background_white
+ buyer_1_nationality
+ buyer_1_working_situation
+ buyer_1_live_in_property
+ buyer_2_relationship_to_buyer_1
+ buyer_2_age
+ buyer_2_gender_identity
+ buyer_2_working_situation
+ buyer_2_live_in_property
+ ],
)
end
diff --git a/spec/models/form/sales/subsections/setup_spec.rb b/spec/models/form/sales/subsections/setup_spec.rb
index ca63d092d..ec7ff4ada 100644
--- a/spec/models/form/sales/subsections/setup_spec.rb
+++ b/spec/models/form/sales/subsections/setup_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do
it "has correct pages" do
expect(setup.pages.map(&:id)).to eq(
- %w[organisation created_by completion_date purchaser_code ownership_scheme shared_ownership_type discounted_ownership_type outright_ownership_type buyer_live joint_purchase number_joint_buyers builtype],
+ %w[organisation created_by completion_date purchaser_code ownership_scheme shared_ownership_type discounted_ownership_type outright_ownership_type buyer_company buyer_live joint_purchase number_joint_buyers builtype],
)
end
diff --git a/spec/models/form_handler_spec.rb b/spec/models/form_handler_spec.rb
index b991a0278..e2ee27419 100644
--- a/spec/models/form_handler_spec.rb
+++ b/spec/models/form_handler_spec.rb
@@ -61,14 +61,14 @@ RSpec.describe FormHandler do
it "is able to load a current sales form" do
form = form_handler.get_form("current_sales")
expect(form).to be_a(Form)
- expect(form.pages.count).to eq(19)
+ expect(form.pages.count).to eq(33)
expect(form.name).to eq("2022_2023_sales")
end
it "is able to load a previous sales form" do
form = form_handler.get_form("previous_sales")
expect(form).to be_a(Form)
- expect(form.pages.count).to eq(19)
+ expect(form.pages.count).to eq(33)
expect(form.name).to eq("2021_2022_sales")
end
end
diff --git a/spec/models/form_spec.rb b/spec/models/form_spec.rb
index c4da6ecf4..571e7930e 100644
--- a/spec/models/form_spec.rb
+++ b/spec/models/form_spec.rb
@@ -218,9 +218,9 @@ RSpec.describe Form, type: :model do
expect(form.sections[0].class).to eq(Form::Sales::Sections::Setup)
expect(form.subsections.count).to eq(1)
expect(form.subsections.first.id).to eq("setup")
- expect(form.pages.count).to eq(12)
+ expect(form.pages.count).to eq(13)
expect(form.pages.first.id).to eq("organisation")
- expect(form.questions.count).to eq(13)
+ expect(form.questions.count).to eq(14)
expect(form.questions.first.id).to eq("owning_organisation_id")
expect(form.start_date).to eq(Time.zone.parse("2022-04-01"))
expect(form.end_date).to eq(Time.zone.parse("2023-07-01"))
diff --git a/spec/models/lettings_log_spec.rb b/spec/models/lettings_log_spec.rb
index 6251e050f..dc4a646fe 100644
--- a/spec/models/lettings_log_spec.rb
+++ b/spec/models/lettings_log_spec.rb
@@ -1,4 +1,5 @@
require "rails_helper"
+require "shared/shared_examples_for_derived_fields"
RSpec.describe LettingsLog do
let(:owning_organisation) { FactoryBot.create(:organisation) }
@@ -10,6 +11,8 @@ RSpec.describe LettingsLog do
allow(FormHandler.instance).to receive(:current_lettings_form).and_return(fake_2021_2022_form)
end
+ include_examples "shared examples for derived fields", :lettings_log
+
it "inherits from log" do
expect(described_class).to be < Log
expect(described_class).to be < ApplicationRecord
diff --git a/spec/models/sales_log_spec.rb b/spec/models/sales_log_spec.rb
index 31a41d411..3ee033971 100644
--- a/spec/models/sales_log_spec.rb
+++ b/spec/models/sales_log_spec.rb
@@ -1,9 +1,12 @@
require "rails_helper"
+require "shared/shared_examples_for_derived_fields"
RSpec.describe SalesLog, type: :model do
let(:owning_organisation) { FactoryBot.create(:organisation) }
let(:created_by_user) { FactoryBot.create(:user) }
+ include_examples "shared examples for derived fields", :sales_log
+
it "inherits from log" do
expect(described_class).to be < Log
expect(described_class).to be < ApplicationRecord
diff --git a/spec/shared/shared_examples_for_derived_fields.rb b/spec/shared/shared_examples_for_derived_fields.rb
new file mode 100644
index 000000000..6382ef4f4
--- /dev/null
+++ b/spec/shared/shared_examples_for_derived_fields.rb
@@ -0,0 +1,17 @@
+require "rails_helper"
+
+RSpec.shared_examples "shared examples for derived fields" do |log_type|
+ describe "sets ethnic based on the value of ethnic_refused" do
+ it "is set to 17 when ethnic_group is 17" do
+ log = FactoryBot.build(log_type, ethnic_group: 17, ethnic: nil)
+
+ expect { log.set_derived_fields! }.to change(log, :ethnic).from(nil).to(17)
+ end
+
+ it "is is not modified otherwise" do
+ log = FactoryBot.build(log_type, ethnic_group: nil, ethnic: nil)
+
+ expect { log.set_derived_fields! }.not_to change(log, :ethnic)
+ end
+ end
+end