|
|
|
|
@ -44,21 +44,15 @@
|
|
|
|
|
:description, |
|
|
|
|
legend: { text: "Is this scheme registered under the Care Standards Act 2000?", size: "m" } %> |
|
|
|
|
|
|
|
|
|
<% null_option = [OpenStruct.new(id: "", name: "Select an option")] %> |
|
|
|
|
<% all_orgs = Organisation.all.map { |org| OpenStruct.new(id: org.id, name: org.name) } %> |
|
|
|
|
<% user_org = [OpenStruct.new(id: current_user.organisation_id, name: current_user.organisation.name)] %> |
|
|
|
|
<% stock_owners = current_user.organisation.stock_owners.map { |org| OpenStruct.new(id: org.id, name: org.name) } %> |
|
|
|
|
<% answer_options = current_user.support? ? null_option + all_orgs : null_option + user_org + stock_owners %> |
|
|
|
|
|
|
|
|
|
<% if current_user.data_coordinator? && current_user.organisation.stock_owners.count.zero? %> |
|
|
|
|
<%= f.hidden_field :owning_organisation_id, value: current_user.organisation.id %> |
|
|
|
|
<% else %> |
|
|
|
|
<%= f.govuk_collection_select :owning_organisation_id, |
|
|
|
|
answer_options, |
|
|
|
|
:id, |
|
|
|
|
:name, |
|
|
|
|
label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" }, |
|
|
|
|
"data-controller": %w[accessible-autocomplete conditional-filter] %> |
|
|
|
|
null_option + owning_organisation_options(current_user), |
|
|
|
|
:id, |
|
|
|
|
:name, |
|
|
|
|
label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" }, |
|
|
|
|
"data-controller": %w[accessible-autocomplete conditional-filter] %> |
|
|
|
|
<% end %> |
|
|
|
|
|
|
|
|
|
<% mantype_selection = Scheme.arrangement_types.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> |
|
|
|
|
|