<%
query_columns = easy_query.inline_columns.count
first_summable = easy_query.inline_columns.index{|column| column.sumable? } || query_columns
first_summable = 1 if first_summable < 1
group_limit = options[:group_limit] || @limit || controller.per_page_option
modal_selector = (options[:modal_selector].to_s == 'true')
%>
<% groups.each do |group, attributes| %>
  <% uniq_id = "#{modul_uniq_id}_#{options[:block_name]}_#{easy_query.group_by_column.name}_#{group.hash}" %>
  <%
     attributes[:name] = attributes[:name].blank? ? [attributes[:name]] : Array.wrap(attributes[:name]) %>
  <%#= filter_plus_button(group.blank?, easy_query.inline_columns.size + 3, uniq_id, format_html_entity_attribute(easy_query.entity, easy_query.group_by_column, group), easy_query_group_by_title_content(easy_query, attributes[:count], attributes[:percent], attributes[:sums], :top, {:hide_sums => options[:hide_sums_in_group_by]}), user, name: attributes[:name]) %>
  <tr class="group <%= 'preloaded' if options[:preloaded] %>" id="<%= uniq_id %>" data-group-name="<%= easy_query_data_qroup_name(group) %>"
      data-pages="<%= Redmine::Pagination::Paginator.new(attributes[:count] || 0, group_limit.to_i, 1).last_page %>" data-entity-count="<%= attributes[:count].to_i %>">
    <td class="hide-when-print checkbox">
      <div class="row-control">
        <span class="expander icon icon-remove" alt="Expander" title="<%= l(:collapse_expand) %>" ></span>
      </div>
    </td>
    <%= content_tag(:td, nil, :class => 'hide-when-print easy-query-additional-beginning-buttons') -%>
    <%= content_tag(:td, nil, :class => 'hide-when-print') if modal_selector -%>
    <td class='group-name' colspan="<%=(options[:colspan] || 0) + first_summable %>">
      <%= format_groupby_html_entity_attribute(easy_query.entity, easy_query.group_by_column, attributes[:name], period: easy_query.group_by_period, allow_avatar: easy_query.show_avatars?, entity: attributes[:entity], editable: false, group: group) %>
      <%= easy_query_group_by_title_tags(easy_query, attributes[:count], attributes[:percent], attributes[:sums][:bottom], {:hide_sums => options[:hide_sums_in_group_by]}) %>
    </td>

    <% easy_query.inline_columns[first_summable...query_columns].each do |column| %>
      <td class="<%= column.css_classes %>"><%= format_html_entity_attribute(easy_query.entity, column, attributes[:sums][:bottom][column]) if column.sumable? %></td>
    <% end unless query_columns.zero? %>
    <% unless modal_selector %>
      <td class="hide-when-print easy-query-additional-ending-buttons"></td>
    <% end %>
  </tr>

  <% if options[:preloaded] && attributes[:entities] %>
    <%= render 'easy_queries/easy_query_entities', easy_query: easy_query, entities: attributes[:entities], modul_uniq_id: modul_uniq_id, user: user, options: options %>
  <% end %>
<% end %>
