<%= render "accounts/logo", account: account, size: "md" %>
<% if account.pending_deletion? %>
<%= account.name %>
(deletion in progress...)
<% else %>
<%= link_to account.name, account, class: [(account.active? ? "text-primary" : "text-subdued"), "text-sm font-medium hover:underline"], data: { turbo_frame: "_top" } %>
<% if account.institution_name %>
• <%= account.institution_name %>
<% end %>
<% if account.long_subtype_label %>
<%= account.long_subtype_label %>
<% end %>
<% end %>
<% unless account.pending_deletion? %>
<%= link_to edit_account_path(account, return_to: return_to), data: { turbo_frame: :modal }, class: "group-hover/account:flex hidden hover:opacity-80 items-center justify-center" do %>
<%= icon("pencil-line", size: "sm") %>
<% end %>
<% if !account.linked? && ["Depository", "CreditCard", "Investment"].include?(account.accountable_type) %>
<%= link_to select_provider_account_path(account),
data: { turbo_frame: :modal },
class: "group-hover/account:flex hidden hover:opacity-80 items-center justify-center gap-1",
title: t("accounts.account.link_provider") do %>
<%= icon("link", size: "sm") %>
<% end %>
<% elsif account.linked? %>
<%= link_to confirm_unlink_account_path(account),
data: { turbo_frame: :modal },
class: "group-hover/account:flex hidden hover:opacity-80 items-center justify-center gap-1",
title: t("accounts.account.unlink_provider") do %>
<%= icon("unlink", size: "sm") %>
<% end %>
<% end %>
<% end %>
<% if account.draft? %>
<% elsif account.syncing? %>
<% else %>
">
<%= format_money account.balance_money %>
<% end %>
<% if account.draft? %>
<%= render DS::Link.new(
text: "Complete setup",
href: edit_account_path(account, return_to: return_to),
variant: :outline,
frame: :modal
) %>
<% elsif account.active? || account.disabled? %>
<%= form_with model: account, url: toggle_active_account_path(account), method: :patch, data: { turbo_frame: "_top", controller: "auto-submit-form" } do |f| %>
<%= render DS::Toggle.new(
id: "account_#{account.id}_active",
name: "active",
checked: account.active?,
data: { auto_submit_form_target: "auto" }
) %>
<% end %>
<% end %>