<%= render 'buyers/accounts/menu' %>

<h2>Edit user <%= h @user.display_name %> of buyer account <%= h @user.account.org_name %></h2>

<%= semantic_form_for @user, :url => resource_path(@user), :builder => Fields::FormBuilder do |form| %>

  <%= form.inputs :name => 'User Information' do %>
    <%= form.user_defined_form %>
  <% end %>

  <%= form.inputs :name => "Change Password" do %>
    <%= form.input :password, required: true, input_html: { autocomplete: 'off' } %>
    <%= form.input :password_confirmation, required: true, input_html: { autocomplete: 'off' } %>
  <% end -%>

  <% if can? :update_role, @user %>
    <%= form.inputs :name => 'Administrative' do %>
      <%= form.input :role,
        :label      => 'Role',
        :as         => :radio,
        :collection => roles_collection_for_form_helpers(@user), :input_html => { :class => 'users_ids' } -%>
    <% end %>
  <% end %>

  <%= form.buttons do %>
    <%= form.commit_button %>
  <% end %>

  <%= javascript_include_tag 'custom_profiles_input_texts' %>
  <style type="text/css">
    <%# the 'Role' radio button is unclickable without this style (see #1994)%>
    #user_role_input legend.label { width:auto; }
    form.formtastic fieldset.buttons ol {left: -157px;}
  </style>

<% end %>
