Browse Source

added stock owning org to details

pull/671/head
JG 3 years ago
parent
commit
c8babd1ec9
  1. 2
      app/controllers/schemes_controller.rb
  2. 18
      app/views/schemes/details.html.erb

2
app/controllers/schemes_controller.rb

@ -103,7 +103,7 @@ private
end end
def scheme_params def scheme_params
required_params = params.require(:scheme).permit(:service_name, :sensitive, :organisation_id, :scheme_type, :registered_under_care_act, :total_units, :id, :has_other_client_group, :primary_client_group, :secondary_client_group, :support_type, :intended_stay) required_params = params.require(:scheme).permit(:service_name, :sensitive, :organisation_id, :stock_owning_organisation_id, :scheme_type, :registered_under_care_act, :total_units, :id, :has_other_client_group, :primary_client_group, :secondary_client_group, :support_type, :intended_stay)
required_params[:sensitive] = required_params[:sensitive].to_i if required_params[:sensitive] required_params[:sensitive] = required_params[:sensitive].to_i if required_params[:sensitive]
if current_user.data_coordinator? if current_user.data_coordinator?
required_params[:organisation_id] = current_user.organisation_id required_params[:organisation_id] = current_user.organisation_id

18
app/views/schemes/details.html.erb

@ -25,15 +25,23 @@
multiple: false, multiple: false,
label: { text: "This scheme contains confidential information" } %> label: { text: "This scheme contains confidential information" } %>
<% if current_user.support? %> <% null_option = [OpenStruct.new(id: "", name: "Select an option")] %>
<% answer_options = Organisation.all.map { |org| OpenStruct.new(id: org.id, name: org.name) } %> <% organisations = Organisation.all.map { |org| OpenStruct.new(id: org.id, name: org.name) } %>
<% stock_org_answer_options = null_option + organisations %>
<%= f.govuk_collection_select :stock_owning_organisation_id,
stock_org_answer_options,
:id,
:name,
label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" },
"data-controller": %w[accessible-autocomplete conditional-filter] %>
<% if current_user.support? %>
<%= f.govuk_collection_select :organisation_id, <%= f.govuk_collection_select :organisation_id,
answer_options, organisations,
:id, :id,
:name, :name,
label: { text: "Which organisation manages this scheme", size: "m" }, label: { text: "Which organisation manages this scheme?", size: "m" },
hint: { text: "Enter organisation name" },
options: { required: true }, options: { required: true },
"data-controller": %w[accessible-autocomplete conditional-filter] %> "data-controller": %w[accessible-autocomplete conditional-filter] %>
<% end %> <% end %>

Loading…
Cancel
Save