<% # Currently there isn't a way to summarize records on associations. # We'd love to support this feature so please send in a PR. should_summarize = @parent_record.blank? %> <% if @resource.record_selector %> <%== item_select_all_input %> <% end %> <% if Avo.configuration.resource_controls_on_the_left? %> <% end %> <% fields.each_with_index do |field, index| %> <% if params[:sort_by] == field.id.to_s if params[:sort_direction] == 'asc' sort_by = nil else sort_by = field.id end if sort_by.present? case params[:sort_direction] when nil sort_direction = 'desc' when 'desc' sort_direction = 'asc' when 'asc' sort_direction = nil end else sort_direction = nil end else sort_by = field.id sort_direction = 'desc' end text_classes = "text-gray-500 tracking-tight leading-tight text-xs font-semibold" %> <%= content_tag :th, class: "relative text-left uppercase px-3 py-3 whitespace-nowrap rounded-l", data: { control: "resource-field-th", controller: "toggle", table_header_field_id: field.id, table_header_field_type: field.type, } do %> <%= content_tag :div, class: "relative flex items-center justify-between w-full" do %> <% if field.sortable %> <%= link_to params.permit!.merge(sort_by: sort_by, sort_direction: sort_direction), class: class_names("flex-1 flex justify-between", text_classes), 'data-turbo-frame': params[:turbo_frame] do %> <%= field.table_header_label %> <%= render partial: 'avo/partials/sortable_component', locals: {field: field} %> <% end %> <% else %> <%= content_tag :div, class: text_classes, data: {sortable: false} do %> <%= field.table_header_label %> <% end %> <% end %> <% if field.summarizable && should_summarize %>
<%= svg 'heroicons/solid/chart-bar', class: 'h-3 ml-1' %>
<% end %> <% end %> <% end %> <% end %> <% if Avo.configuration.resource_controls_on_the_right? %> <% end %>