<div class="container">
  <p id="notice"><%= notice %></p>
  <div class="col-7">
    <div class="welcome">Welcome, <%= current_user.editor.full_name %></div>
    <div class="hero-small dashboard">
      <div class="hero-title">
        <%= image_tag "icon_papers.svg", height: "32px" %><h1>Editor Overview</h1>
      </div>
      <div class="welcome" style="padding-left:20px"><%= "Track: #{@track.name}" if @track.present? %></div>
    </div>
  </div>
</div>

<%= render partial: "aeic_dashboard/menu" %>

<div class="container">
  <table class="dashboard-table sortable eic">
    <thead>
      <tr class="text-nowrap">
        <th scope="col">Name</th>
        <th scope="col">Handle</th>
        <th scope="col" width="30%" >Categories</th>
        <th scope="col" width="8%" class="text-center">Start date</th>
        <th scope="col" width="8%" class="text-center" title="Papers assigned (+ paused)">Editing</th>
        <th scope="col" width="6%" class="text-center">Space</th>
        <th scope="col" width="8%" class="text-center">Invites</th>
        <th scope="col" class="sorttable_nosort"></th>
      </tr>
    </thead>

    <tbody>
      <%- @active_editors.each do |editor| %>
      <tr>
        <td><%= link_to editor.full_name, editor %></td>
        <td sorttable_customkey=<%= editor.login.downcase %>>
          <%= link_to(image_tag(avatar(editor.login), size: "32x32", class: "avatar", title: editor.full_name), github_user_link(editor.login), target: "_blank") %>
          <%= link_to editor.login, editor, title: editor.full_name %>
        </td>
        <td style="max-width:250px"><%= editor.category_list %></td>
        <td class="text-center"><%= editor.created_at.strftime('%Y-%m-%d') %></td>
        <td sorttable_customkey=<%= active_assignments_for_editor(editor) %> class="text-center" title="Limit: <%= editor.max_assignments %>"><%= link_to display_availability(editor), "/dashboard/#{editor.login}" %></td>
        <td sorttable_customkey=<%= availability_remaining(editor) %> class="text-center" title="Limit: <%= editor.max_assignments %>"><%= availability_remaining(editor) %></td>
        <td sorttable_customkey=<%= @pending_invitations_by_editor[editor.id].to_i %> class="text-center" title="Invites"><%= open_invites_for_editor(editor) %></td>
        <td><%= link_to 'Edit', edit_editor_path(editor), title: 'Edit' %></td>
      </tr>
      <%- end %>
    </tbody>
  </table>

  <div class="links">
    <%= link_to 'New Editor', new_editor_path, class: 'btn action-btn float-right' %>
  </div>
</div>

<br />
<br />

</div>
