Browse Source

only display relevant property information questions

pull/713/head
Kat 3 years ago
parent
commit
92277b8571
  1. 14
      app/models/derived_variables/case_log_variables.rb
  2. 16
      app/views/case_logs/_tasklist.html.erb
  3. 35
      config/forms/2021_2022.json

14
app/models/derived_variables/case_log_variables.rb

@ -71,12 +71,14 @@ module DerivedVariables::CaseLogVariables
if scheme.locations.size == 1
self.location = scheme.locations.first
end
self.la = location.county
self.postcode_full = location.postcode
self.unittype_gn = form.questions.find { |x| x.id == "unittype_gn" }.answer_options.select { |_key, value| value["value"] == location.type_of_unit }.keys.first
self.builtype = form.questions.find { |x| x.id == "builtype" }.answer_options.select { |_key, value| value["value"] == location.type_of_building }.keys.first
wheelchair_adaptation_map = { 1 => 1, 0 => 2 }
self.wchair = wheelchair_adaptation_map[location.wheelchair_adaptation.to_i]
if location
self.la = location.county
self.postcode_full = location.postcode
self.unittype_gn = form.questions.find { |x| x.id == "unittype_gn" }.answer_options.select { |_key, value| value["value"] == location.type_of_unit }.keys.first
self.builtype = form.questions.find { |x| x.id == "builtype" }.answer_options.select { |_key, value| value["value"] == location.type_of_building }.keys.first
wheelchair_adaptation_map = { 1 => 1, 0 => 2 }
self.wchair = wheelchair_adaptation_map[location.wheelchair_adaptation.to_i]
end
if is_renewal?
self.voiddate = startdate
end

16
app/views/case_logs/_tasklist.html.erb

@ -9,13 +9,15 @@
<% end %>
<ul class="app-task-list__items">
<% section.subsections.map do |subsection| %>
<% subsection_status = subsection.status(@case_log) %>
<li class="app-task-list__item">
<span class="app-task-list__task-name" id="<%= subsection.id.dasherize %>">
<%= subsection_link(subsection, @case_log, current_user) %>
</span>
<%= status_tag(subsection_status, "app-task-list__tag") %>
</li>
<% if subsection.applicable_questions(@case_log).count > 0 || !subsection.enabled?(@case_log) %>
<% subsection_status = subsection.status(@case_log) %>
<li class="app-task-list__item">
<span class="app-task-list__task-name" id="<%= subsection.id.dasherize %>">
<%= subsection_link(subsection, @case_log, current_user) %>
</span>
<%= status_tag(subsection_status, "app-task-list__tag") %>
</li>
<% end %>
<% end %>
</ul>
</li>

35
config/forms/2021_2022.json

@ -54,7 +54,12 @@
"value": "Not known"
}
}
}
},
"depends_on": [
{
"needstype": 1
}
]
},
"property_local_authority": {
"header": "",
@ -388,7 +393,8 @@
},
"depends_on": [
{
"is_la_inferred": false
"is_la_inferred": false,
"needstype": 1
}
]
},
@ -617,7 +623,12 @@
}
}
}
}
},
"depends_on": [
{
"needstype": 1
}
]
},
"property_building_type": {
"header": "",
@ -637,7 +648,12 @@
}
}
}
}
},
"depends_on": [
{
"needstype": 1
}
]
},
"property_wheelchair_accessible": {
"header": "",
@ -657,7 +673,12 @@
}
}
}
}
},
"depends_on": [
{
"needstype": 1
}
]
},
"property_number_of_bedrooms": {
"header": "",
@ -6840,7 +6861,9 @@
},
"net_income_value_check": {
"depends_on": [{ "net_income_soft_validation_triggered?": true }],
"title_text": { "translation": "soft_validations.net_income.title_text" },
"title_text": {
"translation": "soft_validations.net_income.title_text"
},
"informative_text": {
"translation": "soft_validations.net_income.hint_text",
"arguments": [

Loading…
Cancel
Save