%= turbo_frame_tag Avo::ACTIONS_BACKGROUND_FRAME, src: @background_url, loading: :lazy, target: :_top, class: "block" do %>
<%= render Avo::LoadingComponent.new(title: "...") %>
<% end %>
<%= turbo_frame_tag Avo::ACTIONS_TURBO_FRAME_ID do %>
"
data-action-no-confirmation-value="<%= @action.no_confirmation %>"
data-action-resource-name-value="<%= @resource.model_key %>"
data-resource-id="<%= params[:id] %>"
class="hidden text-slate-800"
>
<%= form_with scope: 'fields',
url: @action.link_arguments(resource: @resource).first,
local: true,
html: {
novalidate: true,
},
data: {
action_target: :form,
**@action.class.form_data_attributes,
} do |form|
%>
<%= render Avo::ModalComponent.new do |c| %>
<% c.with_heading do %>
<%= @action.action_name %>
<% end %>
<%= @action.get_message %>
<%= form.hidden_field :avo_resource_ids, value: params[:id] || params[:resource_ids], 'data-action-target': 'resourceIds' %>
<%= form.hidden_field :avo_selected_query, 'data-action-target': 'selectedAllQuery' %>
<%= form.hidden_field :arguments, value: params[:arguments] %>
<% if @fields.present? %>
<% @fields.each_with_index do |field, index| %>
<%= render field
.hydrate(resource: @resource, record: @resource.record, user: @resource.user, view: @view, action: @action)
.component_for_view(@view)
.new(field: field, resource: @resource, index: index, form: form, compact: true, autofocus: index == 0)
%>
<% end %>
<% end %>
<% c.with_controls do %>
<%= a_button type: :button,
data: { action: 'click->modal#close' },
size: :sm,
color: :gray do %>
<%= @action.cancel_button_label %>
<% end %>
<%= a_button type: :submit,
color: :green,
style: :primary,
size: :sm,
data: {
target: :submit_action,
},
autofocus: @fields.reject { |field| field.is_a?(Avo::Fields::HiddenField) }.empty? do %>
<%= @action.confirm_button_label %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>