%= 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 %>
<%= t(".description") %>
<% if @available_accounts.empty? %>
<%= icon "check-circle", size: "lg", class: "text-success" %>
<%= t(".no_accounts_found") %>
<%= render DS::Link.new(
text: t(".cancel"),
variant: :secondary,
href: @return_to || accounts_path,
frame: "_top"
) %>
<% else %>
<%= form_with url: link_existing_account_wise_items_path,
method: :post,
data: { turbo_frame: "_top" },
class: "space-y-4" do %>
<%= hidden_field_tag :wise_item_id, @wise_item&.id %>
<%= hidden_field_tag :account_id, @account.id %>
<%= hidden_field_tag :return_to, @return_to %>
<% @available_accounts.each do |wise_account| %>
<% end %>
<%= render DS::Link.new(
text: t(".cancel"),
variant: :secondary,
href: @return_to || accounts_path,
frame: "_top"
) %>
<%= render DS::Button.new(
text: t(".link_account"),
variant: :primary,
type: :submit
) %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>