<%# locals: (coinstats_item:) %> <%= tag.div id: dom_id(coinstats_item) do %>
<%= icon "chevron-right", class: "group-open:transform group-open:rotate-90" %>
<%= tag.p coinstats_item.institution_display_name.first.upcase, class: "text-success text-xs font-medium" %>
<%= tag.p coinstats_item.institution_display_name, class: "font-medium text-primary" %> <% if coinstats_item.scheduled_for_deletion? %>

<%= t(".deletion_in_progress") %>

<% end %>

<%= t(".provider_name") %>

<% if coinstats_item.syncing? %>
<%= icon "loader", size: "sm", class: "animate-spin" %> <%= tag.span t(".syncing") %>
<% elsif coinstats_item.requires_update? %>
<%= icon "alert-triangle", size: "sm", color: "warning" %> <%= tag.span t(".reconnect") %>
<% else %>

<% if coinstats_item.last_synced_at %> <% if coinstats_item.sync_status_summary %> <%= t(".status_with_summary", timestamp: time_ago_in_words(coinstats_item.last_synced_at), summary: coinstats_item.sync_status_summary) %> <% else %> <%= t(".status", timestamp: time_ago_in_words(coinstats_item.last_synced_at)) %> <% end %> <% else %> <%= t(".status_never") %> <% end %>

<% end %>
<% if coinstats_item.requires_update? %> <%= render DS::Link.new( text: t(".update_api_key"), icon: "refresh-cw", variant: "secondary", href: settings_providers_path, frame: "_top" ) %> <% elsif Rails.env.development? %> <%= icon( "refresh-cw", as_button: true, href: sync_coinstats_item_path(coinstats_item) ) %> <% end %> <%= render DS::Menu.new do |menu| %> <% menu.with_item( variant: "button", text: t(".delete"), icon: "trash-2", href: coinstats_item_path(coinstats_item), method: :delete, confirm: CustomConfirm.for_resource_deletion(coinstats_item.institution_display_name, high_severity: true) ) %> <% end %>
<% unless coinstats_item.scheduled_for_deletion? %>
<% if coinstats_item.accounts.any? %> <%= render "accounts/index/account_groups", accounts: coinstats_item.accounts %> <% end %> <%# Sync summary (collapsible) - using shared ProviderSyncSummary component %> <% stats = if defined?(@coinstats_sync_stats_map) && @coinstats_sync_stats_map @coinstats_sync_stats_map[coinstats_item.id] || {} else coinstats_item.syncs.ordered.first&.sync_stats || {} end %> <%= render ProviderSyncSummary.new( stats: stats, provider_item: coinstats_item ) %> <% if coinstats_item.accounts.empty? %>

<%= t(".no_wallets_title") %>

<%= t(".no_wallets_message") %>

<% end %>
<% end %>
<% end %>