<%# locals: (wise_item:) %> <%= tag.div id: dom_id(wise_item) do %> <%= render DS::Disclosure.new(variant: :card, open: true) do |disclosure| %> <% disclosure.with_summary_content do %>
<%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>

WI

<%= tag.p wise_item.name, class: "font-medium text-primary" %> <%= t("wise_items.profile_types.#{wise_item.profile_type}") %> <% if wise_item.scheduled_for_deletion? %> <%= tag.p t(".deletion_in_progress"), class: "text-destructive text-sm animate-pulse" %> <% end %>
<% if wise_item.syncing? %>
<%= icon "loader", size: "sm", class: "animate-spin" %> <%= tag.span t(".syncing") %>
<% elsif wise_item.sync_error.present? %>
<%= render DS::Tooltip.new(text: wise_item.sync_error, icon: "alert-circle", size: "sm", color: "destructive", as: :span) %> <%= tag.span t(".error"), class: "text-destructive" %>
<% else %>

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

<% end %>
<% if Current.user&.admin? %>
<%= render DS::Menu.new do |menu| %> <% menu.with_item( variant: "button", text: t(".delete"), icon: "trash-2", href: wise_item_path(wise_item), method: :delete, confirm: CustomConfirm.for_resource_deletion(wise_item.name, high_severity: true) ) %> <% end %>
<% end %>
<% end %> <% unless wise_item.scheduled_for_deletion? %>
<% if wise_item.accounts.any? %> <%= render "accounts/index/account_groups", accounts: wise_item.accounts %> <% end %> <% unlinked = wise_item.unlinked_accounts_count %> <% total = wise_item.total_accounts_count %> <% linked = wise_item.linked_accounts_count %> <% if unlinked > 0 %>

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

<%= t(".setup_description", linked: linked, total: total) %>

<%= render DS::Link.new( text: t(".setup_action"), icon: "settings", variant: "primary", href: setup_accounts_wise_item_path(wise_item), frame: :modal ) %>
<% elsif wise_item.accounts.empty? && total == 0 %>

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

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

<%= render DS::Link.new( text: t(".setup_action"), icon: "settings", variant: "primary", href: setup_accounts_wise_item_path(wise_item), frame: :modal ) %>
<% end %>
<% end %> <% end %> <% end %>