Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

78 lines
3.4 KiB

<% content_for :title, "Invite somebody to submit CORE data" %>
<% content_for :before_content do %>
<%= govuk_back_link(href: :back) %>
<% end %>
<%= form_for(@user, as: :user, html: { method: :post }) do |f| %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %>
<h1 class="govuk-heading-l">
<%= content_for(:title) %>
</h1>
<%= f.govuk_text_field :name,
autocomplete: "name",
label: { text: "Name", size: "m" } %>
<%= f.govuk_email_field :email,
label: { text: "Email address", size: "m" },
autocomplete: "email",
spellcheck: "false",
value: @user.email %>
<% if current_user.support? %>
<% null_option = [OpenStruct.new(id: "", name: "Select an option")] %>
<% organisations = Organisation.all.map { |org| OpenStruct.new(id: org.id, name: org.name) } %>
<% answer_options = null_option + organisations %>
<% if @organisation_id %>
<% organisation = Organisation.find(@organisation_id) %>
<% answer_options = [OpenStruct.new(id: organisation.id, name: organisation.name)] %>
<% end %>
<%= f.govuk_collection_select :organisation_id,
answer_options,
:id,
:name,
label: { text: "Organisation", size: "m" },
options: { disabled: [""], selected: @organisation_id ? answer_options.first : "" } %>
<% end %>
<% hints_for_roles = { data_provider: ["Can view and submit logs for this this organisation"], data_coordinator: ["Can view and submit logs for this this organisation"], support: [] } %>
<% roles_with_hints = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: hints_for_roles[key.to_sym]) } %>
<%= f.govuk_collection_radio_buttons :role,
roles_with_hints,
:id,
:name,
->(option) do
content_tag(:ul, class: "govuk-list govuk-list--bullet govuk-hint") do
content_tag(:li, "1")
content_tag(:li, "2")
content_tag(:li, "3")
end
end,
legend: { text: "Role", size: "m" } %>
<%= f.govuk_collection_radio_buttons :is_dpo,
[OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")],
:id,
:name,
legend: { text: "#{perspective(@user, current_user)} the organisation’s data protection officer?", size: "m" } %>
<%= f.govuk_collection_radio_buttons :is_key_contact,
[OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")],
:id,
:name,
legend: { text: "#{perspective(@user, current_user)} a key contact for this service?", size: "m" },
hint: { text: "This is a person responsible for sharing information about social housing lettings and sales data within the organisation." } %>
<%= f.govuk_submit "Continue" %>
</div>
</div>
<% end %>