<% content_for :title, current_user == @user ? "Change your personal details" : "Change #{@user.name.presence || 'this user'}’s personal details" %> <% content_for :before_content do %> <%= govuk_back_link( text: "Back", href: :back, ) %> <% end %> <%= form_for(@user, as: :user, html: { method: :patch }) do |f| %>
<%= f.govuk_error_summary %>

<%= content_for(:title) %>

<%= f.govuk_text_field :name, label: { text: "Name", size: "m" }, autocomplete: "name" %> <%= f.govuk_email_field :email, label: { text: "Email address", size: "m" }, autocomplete: "email", spellcheck: "false" %> <% if current_user.data_coordinator? || current_user.support? %> <% roles = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> <%= f.govuk_collection_radio_buttons :role, roles, :id, :name, 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." } %> <% end %> <%= f.govuk_submit "Save changes" %>
<% end %>