<% title _('Editing profile for %{username}') % { username: @user.name(false) } %>
<div class="row">
  <div class="col-md-12">
    <h1>
      <%= _('Editing profile for %{username}') % { username: @user.name(false) } %>
      <%= link_to(_('View all users'), admin_index_users_path, class: 'btn btn-default pull-right', role: 'button') %>
    </h1>
  </div>
</div>

<div class="row">
  <div class="col-md-12">
    <%= form_for(@user, namespace: :superadmin, as: :user, url: super_admin_user_path(@user), html: {method: :put, id: 'super_admin_user_edit' }) do |f| %>
      <div class="form-group col-xs-8">
        <%= f.label(:email, _('Email'), class: 'control-label') %>
        <%= f.email_field(:email, class: "form-control", "aria-required": true) %>
      </div>

      <div class="form-group col-xs-8">
        <%= f.label(:firstname, _('First name'), class: 'control-label') %>
        <%= f.text_field(:firstname, class: "form-control", "aria-required": true) %>
      </div>

      <div class="form-group col-xs-8">
        <%= f.label(:surname, _('Last name'), class: 'control-label') %>
        <%= f.text_field(:surname, class: "form-control", "aria-required": true) %>
      </div>

      <div class="form-group col-xs-8" id="org-controls">
        <%= render partial: "shared/my_org", locals: {
            f: f,
            default_org: @user.org,
            orgs: Org.where(is_other: false).order("name"),
            allow_other_orgs: true,
            required: true } %>
      </div>

      <% if Language.many? %>
        <div class="form-group col-xs-8">
          <% lang_id = @user.language.nil? ? Language.id_for(FastGettext.default_locale) : @user.language.id %>
          <%= f.label(:language_id, _('Language'), class: 'control-label') %>
          <%= select_tag(:super_admin_user_language_id,
              options_from_collection_for_select(Language.sorted_by_abbreviation, "id", "name", lang_id),
              class: "form-control", name: 'super_admin_user[language_id]') %>
        </div>
      <% end %>

      <div class="form-group col-xs-8">
        <%= f.button(_('Save'), class: 'btn btn-default', type: "submit", id: "personal_details_registration_form_submit") %>
      </div>
    <% end %>
  </div>
</div>
