<%= render Avo::PanelComponent.new(title: title, body_classes: 'py-4', data: { component: 'resources-index' }, display_breadcrumbs: @reflection.blank?) do |c| %> <% c.tools do %> <%= render 'actions' if @actions.present? %> <% if can_create? %> <%= a_link create_path do %> <%= svg 'plus' %> <%= t('avo.create_new_item', item: singular_resource_name.downcase ) %> <% end %> <% end %> <% if can_detach? %> <%= a_link detach_path, color: 'indigo', method: :delete, data: { confirm: "Are you sure you want to detach this #{@resource.singular_name}." } do %> <%= svg 'trash' %> <%= t('avo.detach_item', item: singular_resource_name).capitalize %> <% end %> <% end %> <% if can_attach? %> <%= a_link attach_path, color: 'indigo', 'data-turbo-frame': 'attach_modal' do %> <%= svg 'view-grid-add' %> <%= t('avo.attach_item', item: singular_resource_name).capitalize %> <% end %> <% end %> <% end %> <% c.body do %>
<%= render partial: 'avo/partials/resource_search', locals: {resource: @resource.route_key} if @resource.search_query.present? %>
<%= render partial: 'avo/partials/view_toggle_button', locals: { available_view_types: available_view_types, view_type: view_type, turbo_frame: @turbo_frame } if @models.present? %> <%= render 'filters' if @filters.present? %>
<% if view_type.to_sym == :table %>
<%= render(Avo::Index::ResourceTableComponent.new(resources: @resources, resource: @resource, reflection: @reflection, parent_model: @parent_model)) %>
<% if @models.present? %>
<%= render partial: 'avo/partials/paginator', locals: { pagy: @pagy, turbo_frame: @turbo_frame || 'none' } %>
<% end %>
<% end %> <% end %> <% c.bare_content do %> <% if view_type.to_sym == :grid %> <%= render Avo::Index::ResourceGridComponent.new(resources: @resources, resource: @resource, reflection: @reflection, parent_model: @parent_model) %>
<%= render partial: 'avo/partials/paginator', locals: { pagy: @pagy, turbo_frame: @turbo_frame || 'none' } %>
<% end %> <% end %> <% end %>