<table class="table table-hover users-list-table">
  <thead class="thead-light">
    <tr>
      <th width="5%">序号</th>
      <th width="8%" class="text-left">login</th>
      <th width="10%" class="text-left">昵称</th>
      <th width="15%"><%= sort_tag('创建于', name: 'created_on', path: admins_organizations_path) %></th>
      <th width="8%" >团队</th>
      <th width="8%" >成员</th>
      <th width="8%">项目数</th>
      <th width="10%">操作</th>
    </tr>
  </thead>
  <tbody>
    <% if organizations.present? %>
      <% organizations.each_with_index do |org, index| %>
        <tr class="org-item-<%= org.id %>">
          <td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
          <td class="text-left">
            <%= link_to "/#{org.login}", target: '_blank' do %>
              <%= overflow_hidden_span org.login, width: 100 %>
            <% end %>
          </td>
          <td><%= org.nickname %> </td>
          <td><%= display_text(org.created_on&.strftime('%Y-%m-%d %H:%M')) %></td>
          <td><%= link_to org.teams_count, "/#{org.login}", target: "_blank" %></td>
          <td><%= link_to org.organization_users_count, "/#{org.login}", target: "_blank" %></td>
          <td><%= link_to org.projects_count, "/#{org.login}", target: "_blank" %></td>
          <td class="action-container">
            <% if current_user.admin? %>
            <%= javascript_void_link '开通CLA', class: 'action open-cla-action', data: { id: org.id }, style: org.open_cla? ? 'display: none;' : '' %>
            <%= javascript_void_link '关闭CLA', class: 'action close-cla-action', data: { id: org.id }, style: org.open_cla? ? '' : 'display: none;' %>  
            <%= link_to '查看', admins_organization_path(org), class: 'action' %>
            <div class="d-inline">
              <%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
              <div class="dropdown-menu more-action-dropdown">
                <%= delete_link '删除', admins_organization_path(org, element: ".user-item-#{org.id}"), class: 'dropdown-item delete-user-action' %>
              </div>
            </div>
            <% end %>
          </td>
        </tr>
      <% end %>
    <% else %>
      <%= render 'admins/shared/no_data_for_table' %>
    <% end %>
  </tbody>
</table>

<%= render partial: 'admins/shared/paginate', locals: { objects: organizations } %>
