<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
<% not_list = defined?(:users_count) %>

<td class="text-left"><%= overflow_hidden_span department.name, width: 150 %></td>
<td class="text-left"><%= overflow_hidden_span department.school.name, width: 150 %></td>

<% if not_list %>
  <td><%= department.user_extensions.count %></td>
  <td><%= department.user_extensions.joins(:user).where(users: { professional_certification: true }).count %></td>
<% else %>
  <td><%= users_count.fetch(department.id, 0) %></td>
  <td><%= professional_auth_count.fetch(department.id, 0) %></td>
<% end %>

<td class="member-container">
  <%= render partial: 'admins/departments/shared/member_users', locals: { department: department } %>
</td>
<td>
  <% if department.identifier.present? %>
    <%= link_to department.identifier.to_s, "/colleges/#{department.identifier}/statistics", target: '_blank' %>
  <% else %>
    --
  <% end %>
</td>
<td><%= department.host_count %></td>
<td><%= department.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
<td class="action-container">
  <%= link_to '编辑', edit_admins_department_path(department), remote: true, class: 'action' %>

  <%= javascript_void_link '添加管理员', class: 'action', data: { department_id: department.id, toggle: 'modal', target: '.admin-add-department-member-modal' } %>

  <%= javascript_void_link '更改', class: 'action', data: { school_id: department.school_id, department_id: department.id,
                                                          toggle: 'modal', target: '.admin-merge-department-modal', url: merge_admins_departments_path } %>

  <%= delete_link '删除', admins_department_path(department, element: ".department-item-#{department.id}"), class: 'delete-department-action' %>
</td>