<%= title l(:label_group_plural) %>

<% if @groups.any? %>
  <div class="autoscroll">
    <table class="list groups">
    <thead><tr>
        <th><%=l(:label_group)%></th>
        <th><%=l(:field_easy_system_flag)%></th>
        <th><%=l(:label_user_plural)%></th>
        <% @groups.first.custom_field_values.each do |c| %>
          <th><%= c.custom_field.translated_name %></th>
        <% end %>
        <th></th>
      </tr></thead>
    <tbody>
      <% @groups.each do |group| %>
        <tr id="group-<%= group.id %>" class="<%= cycle 'odd', 'even' %> <%= "builtin" if group.builtin? %>">
          <td class="name"><%= link_to group, :action => 'edit', :id => group %></td>
          <td class="tick"><%= checked_image group.easy_system_flag? -%></td>
          <td class="user_count"><%= (@user_count_by_group_id[group.id] || 0) unless group.builtin? %></td>
          <% group.custom_field_values.each do |c| %>
            <td><%= show_value(c) %></td>
          <% end %>
          <td class="buttons"><%= delete_link group unless group.builtin? %></td>
        </tr>
      <% end %>
    </tbody>
  </table>
  </div>
<% else %>
  <p class="nodata"><%= l(:label_no_data) %></p>
<% end %>

<% ### PAGE CUSTOMS ########################################################## -%>

<% content_for :easy_page_layout_service_box_primary_actions do %>
  <%= link_to l(:label_group_new), new_group_path, :class => 'button-positive' %>
<% end %>