<%# locals: (holding:) %> <%= turbo_frame_tag dom_id(holding) do %>
<% if holding.security.brandfetch_icon_url.present? %> <%= image_tag holding.security.brandfetch_icon_url, class: "w-9 h-9 rounded-full", loading: "lazy" %> <% elsif holding.security.logo_url.present? %> <%= image_tag holding.security.logo_url, class: "w-9 h-9 rounded-full", loading: "lazy" %> <% else %> <%= render DS::FilledIcon.new(variant: :text, text: holding.name, size: "md", rounded: true) %> <% end %>
<%= link_to holding.name, holding_path(holding), data: { turbo_frame: :drawer }, class: "hover:underline" %> <% if holding.amount %> <%= tag.p holding.ticker, class: "text-secondary text-xs uppercase" %> <% else %> <%= render "missing_price_tooltip" %> <% end %>
<% if holding.weight %> <%= render "shared/progress_circle", progress: holding.weight %> <%= tag.p number_to_percentage(holding.weight, precision: 1) %> <% else %> <%= tag.p "--", class: "text-secondary mb-5" %> <% end %>
<%= tag.p format_money holding.avg_cost %> <%= tag.p t(".per_share"), class: "font-normal text-secondary" %>
<% if holding.amount_money %> <%= tag.p format_money holding.amount_money %> <% else %> <%= tag.p "--", class: "text-secondary" %> <% end %> <%= tag.p t(".shares", qty: number_with_precision(holding.qty, precision: 1)), class: "font-normal text-secondary" %>
<%# Show Total Return (unrealized G/L) when cost basis exists %> <% if holding.trades.any? && holding.trend %> <%= tag.p format_money(holding.trend.value), style: "color: #{holding.trend.color};" %> <%= tag.p "(#{number_to_percentage(holding.trend.percent, precision: 1)})", style: "color: #{holding.trend.color};" %> <% else %> <%= tag.p "--", class: "text-secondary" %> <%= tag.p "No cost basis", class: "text-xs text-secondary" %> <% end %>
<% end %>