<% provide(:head_title, t("users.registrations.edit.head_title")) %>
<% provide(:container_class, "no-second-nav-container") %>

<%= render partial: "users/settings/sidebar" %>

<div class="content-pane active flexible user-settings">
  <div class="content-header">
    <div class="title-row">
      <h1><%=t "users.registrations.edit.title" %></h1>
    </div>
  </div>
  <div class="row settings-row">
    <div class="col-md-12">
      <% if resource.errors.present? %>
        <div class="alert alert-danger">
          <%= devise_error_messages! %>
        </div>
      <% end %>
      <div class="row">
        <div class="col-md-2">
        <%= render partial: 'users/registrations/edit_partials/avatar' %>
        </div>
        <div class="col-md-10">
          <div class="row">
            <div class="col-md-6">
              <%= render partial: 'users/registrations/edit_partials/full_name' %>
              <%= render partial: 'users/registrations/edit_partials/initials' %>
              <%= render partial: 'users/registrations/edit_partials/external_id' %>
              <%= render partial: 'users/registrations/edit_partials/job_title' %>
            </div>
            <div class="col-md-6">
              <%= render partial: 'users/registrations/edit_partials/email' %>
              <%= render partial: 'users/registrations/edit_partials/password' %>
            </div>
          </div>
        </div>
      </div>
      <%= render partial: 'users/registrations/edit_partials/2fa' %>

      <% if current_user.api_key_enabled? %>
        <%= render partial: 'users/registrations/edit_partials/api_key' %>
      <% end %>
   </div>
  </div>

<% if Rails.application.config.x.connected_devices_enabled %>
  <!-- Manage devices -->
  <div class="manage-devices">
    <%= render partial: 'users/registrations/manage_devices' %>
  <div>
<% end %>

  <!-- User statistics -->
  <div class="row">
    <div class="col-md-12">
      <div class="row user-statistics">
        <div class="col-md-12">
          <h3><%=t "users.statistics.title" %></h3>
          <ul class="list-inline">
            <li class="label label-primary">
              <h2><%= @user_statistics[:number_of_teams]%></h2>
              <%= t("users.statistics.team").pluralize(@user_statistics[:number_of_teams]) %>
            </li>
            <li class="label label-primary">
              <h2><%= @user_statistics[:number_of_projects] %></h2>
              <%= t("users.statistics.project").pluralize(@user_statistics[:number_of_projects]) %>
            </li>
            <li class="label label-primary">
              <h2><%= @user_statistics[:number_of_experiments] %></h2>
              <%= t("users.statistics.experiment").pluralize(@user_statistics[:number_of_experiments]) %>
            </li>
            <li class="label label-primary">
              <h2><%= @user_statistics[:number_of_protocols] %></h2>
              <%= t("users.statistics.protocol").pluralize(@user_statistics[:number_of_protocols]) %>
            </li>
          </ul>
        </div>
      </div>
      <span style="display: none;" data-hook="profile-statistics"></span>
    </div>
  </div>
</div>

<%= render partial: '2fa_modal' %>

<%= render partial: 'users/shared/user_avatars_modal' %>

<%= javascript_include_tag 'croppie' %>
<%= stylesheet_link_tag 'croppie_styles' %>
<%= javascript_include_tag "users/registrations/edit" %>
