<%= f.fields_for :user do |user_form| %>
<%= user_form.label :username -%>
<%= profile.user.username -%>
<%= user_form.label :email -%>
<%= user_form.text_field :email %>
<%= user_form.label :auto_generated_password -%> <%= user_form.check_box :auto_generated_password -%>
<%= f.label :expired_at -%>
<%- if current_user.has_role?('Librarian') -%> <%= f.text_field :expired_at, value: profile.expired_at.try(:strftime, "%Y-%m-%d"), class: 'date_text_field', placeholder: "#{t('page.example')}: 2011-04-12"-%> <%- else -%> <%= l(profile.expired_at) if profile.expired_at -%> <%- end -%>
<%= user_form.label :locked -%> <%= user_form.check_box :locked -%>
<%= user_form.label t('activerecord.models.role') -%>
<%= user_form.fields_for :user_has_role do |u| %> <%- if current_user.has_role?('Administrator') and current_user != profile.user -%> <%= u.select :role_id, @roles.select{|r| r.name != 'Guest' }.collect{|r| [r.display_name.localize, r.id]} %> <% else %> <%= u.select :role_id, @roles.select{|r| r.name != 'Guest' }.collect{|r| [r.display_name.localize, r.id]}, {}, {disabled: 'disabled'} %> <% end %> <% end %>
<%= f.label :full_name -%>
<%= f.text_field :full_name -%>
<%= f.label :full_name_transcription -%>
<%= f.text_field :full_name_transcription -%>
<%- if current_user.has_role?('Librarian') -%>
<%= f.label t('activerecord.models.user_group') -%>
<%= f.select(:user_group_id, @user_groups.collect{|u| [u.display_name.localize, u.id]}) -%>
<%- end -%>
<%= f.label :user_number -%>
<%- if current_user.has_role?('Librarian') -%> <%= f.text_field :user_number, class: 'resource_user_number' -%> <%- else -%> <%= profile.user_number -%> <%- end -%>
<%- if current_user.has_role?('Librarian') -%>
<%= f.label t('activerecord.models.library') -%>
<%= f.select(:library_id, @libraries.collect{|l| [l.display_name.localize, l.id]}) -%>
<%= f.label t('role.required_role') -%>
<%= f.select(:required_role_id, @roles.collect{|r| [r.display_name.localize, r.id]}) -%>
<%- end -%>
<%= f.label :locale -%>
<%= f.select(:locale, @available_languages.collect{|language| [language.display_name.localize, language.iso_639_1]}) -%>
<% end %>