<h1><%= t("helpers.edit_profile") %></h1>
<!-- information about content in the page-->
<%= raw t("helpers.user_details_text_html")%>
<div class="white_background">
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
<%= hidden_field_tag :unlink_flag, "false" ,:id => "unlink_flag" %>
<!-- body -->
<div class="dmp_details">
<p><%= raw t("helpers.user_details_paragraph_html")%></p>
<table class="dmp_details_table">
<tr>
<td class="first"><%= (t("helpers.email") + " *") %></td>
<td><%= f.email_field :email, :as => :email %></td>
</tr>
<tr>
<td class="first"><%= t("helpers.first_name") %></td>
<td><%= f.text_field :firstname, :as => :string,
:id => "first_time_login_firstname",
:autofocus => true,
:class => "text_field has-tooltip",
"data-toggle" => "tooltip",
"data-trigger" => "focus" ,
"title" => t("helpers.first_name_help_text") %></td>
</tr>
<tr>
<td class="first"><%= t("helpers.last_name") %></td>
<td><%= f.text_field :surname,
:as => :string, :id => "first_time_login_surname",
:class => "text_field has-tooltip",
"data-toggle" => "tooltip",
"data-trigger" => "focus" ,
"title" => t("helpers.surname_help_text") %></td>
</tr>
<tr>
<td class="first"><%= t("helpers.org_type.organisation") %></td>
<td><%= collection_select(:user,
:organisation_id, Organisation.where("parent_id IS NULL").order("name"),
:id, :name, {include_blank: t("helpers.org_type.organisation")},
{ :class => "typeahead org_sign_up" }) %></td>
</tr>
<% other_organisations = Array.new %>
<% Organisation.where("parent_id IS ? AND is_other = ?", nil, 1).each do |org| %>
<% other_organisations << org.id %>
<% end %>
<tr id="other-organisation-name" style="display:none" data-orgs="<%= other_organisations.join(",") %>">
<td class="first"><%= t("helpers.org_type.org_name")%></td>
<td><%= f.text_field :other_organisation,
:as => :string,
:class => "text_field has-tooltip reg-input", "data-toggle" => "tooltip", "data-container" => "body", "title" => t("helpers.org_type.other_org_help_text") %></td>
</tr>
<tr>
<td class="first"><%= t("helpers.orcid_id") %></td>
<td><%= f.text_field :orcid_id ,
:as => :string,
:autocomplete => "off" ,
:class => "text_field has-tooltip", "data-toggle" => "tooltip", "data-html" => "true", "title" => t("helpers.orcid_html") %></td>
</tr>
<% unless @user.api_token.nil? %>
<tr>
<td class="first"><%= t("helpers.api_token") %></td>
<td><%= @user.api_token %></td>
</tr>
<tr>
<td class="first"><%= t("helpers.api_info") %></td>
<td><%= link_to( t("helpers.api_use"), controller: "token_permission_types", action: "index")%></td>
</tr>
<% end %>
</table>
<br />
<p>
<% if Rails.application.config.shibboleth_enabled %>
<% if resource.shibboleth_id.nil? || resource.shibboleth_id.length == 0 then %>
<%= link_to t("helpers.shibboleth_to_link_text"), user_omniauth_shibboleth_path, :class => "a-orange" %>
<% else %>
<%= t("helpers.shibboleth_linked_text") %>
<a id="unlink-shibboleth-button" data-toggle="modal" href="#unlink-institutional-credentials-dialog">
<%= t("helpers.shibboleth_unlink_label")%>
</a>
<% end %>
<% end %>
</p>
<br />
<div class="div_clear">
</div>
<p>
<%= raw t("helpers.edit_password_info")%>
</p>
<table class="dmp_details_table">
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div><%= t('custom_devise.waiting_for_confirmation') %><%= resource.unconfirmed_email %></div>
<% end %>
<tr>
<td class="first"><%= t("helpers.current_password") %></td>
<td>
<%= f.password_field :current_password, :as => :password %>
</td>
</tr>
<tr>
<td class="first"><%= t("helpers.new_password") %></td>
<td><%= f.password_field :password, :as => :password, :autocomplete => "off" %>
</td>
</tr>
<tr>
<td class="first"><%= t("helpers.password_conf") %></td>
<td><%= f.password_field :password_confirmation, :as => :password, :autocomplete => "off" %></td>
</tr>
</table>
<div class="move_2_right">
<%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %>
<%= link_to t("helpers.submit.cancel"), :back, :class => "btn btn-primary" %>
</div>
<% end %>
<!--br/>
<h3>Cancel my account</h3>
<p>Unhappy?
<%# = button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>
</p-->
</div>
</div>
<!-- alert for the default template-->
<div id="unlink-institutional-credentials-dialog" data-container="body" data-backdrop="static" class="modal hide fade">
<div class="modal-header">
<h3><%= t("helpers.shibboleth_unlink_alert") %></h3>
</div>
<div class="modal-body">
<%= raw t("helpers.shibboleth_unlink_dialog_text")%>
</div>
<div class="modal-footer">
<a href="#" id="unlink-shibboleth-cancelled" class="btn"><%= t("helpers.submit.cancel")%></a>
<a href="#" id="unlink-shibboleth-confirmed" class="btn btn-primary"><%= t("helpers.unlink_account")%></a>
</div>
</div>