%= turbo_frame_tag "modal" do %>
<%= render DS::Dialog.new do |dialog| %>
<% dialog.with_header(title: t(".title", account_name: @account.name)) %>
<% dialog.with_body do %>
<% if @api_error.present? %>
<%= render DS::Alert.new(message: @api_error, variant: :error) %>
<% elsif @up_accounts.empty? %>
<%= t(".no_accounts_found") %>
<% else %>
<%= t(".description") %>
<%= form_with url: link_existing_account_up_items_path,
method: :post,
data: { turbo_frame: "_top" },
class: "space-y-4" do %>
<%= hidden_field_tag :up_item_id, @up_item.id %>
<%= hidden_field_tag :account_id, @account.id %>
<%= hidden_field_tag :return_to, @return_to %>
<% @up_accounts.each do |up_account| %>
<% end %>
<%= render DS::Link.new(
text: t(".cancel"),
href: @return_to || accounts_path,
variant: :secondary,
data: { turbo_frame: "_top", action: "DS--dialog#close" }
) %>
<%= render DS::Button.new(text: t(".link_account"), type: "submit") %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>