<%= render DS::Dialog.new(variant: "drawer") do |dialog| %> <% dialog.with_header do %>
<%= tag.h3 @holding.name, class: "text-2xl font-medium text-primary" %> <%= tag.p @holding.ticker, class: "text-sm text-secondary" %>
<% if @holding.security.brandfetch_icon_url.present? %> <%= image_tag @holding.security.brandfetch_icon_url, loading: "lazy", class: "w-9 h-9 rounded-full" %> <% elsif @holding.security.logo_url.present? %> <%= image_tag @holding.security.logo_url, loading: "lazy", class: "w-9 h-9 rounded-full" %> <% else %> <%= render DS::FilledIcon.new(variant: :text, text: @holding.name, size: "md", rounded: true) %> <% end %>
<% end %> <% dialog.with_body do %> <% dialog.with_section(title: t(".overview"), open: true) do %>
<%= t(".ticker_label") %>
<%= @holding.ticker %>
<%= t(".current_market_price_label") %>
<%= @holding.security.current_price ? format_money(@holding.security.current_price) : t(".unknown") %>
<%= t(".portfolio_weight_label") %>
<%= @holding.weight ? number_to_percentage(@holding.weight, precision: 2) : t(".unknown") %>
<%= t(".avg_cost_label") %>
<%= @holding.avg_cost ? format_money(@holding.avg_cost) : t(".unknown") %>
<%= t(".total_return_label") %>
<%= @holding.trend ? render("shared/trend_change", trend: @holding.trend) : t(".unknown") %>
<% end %> <% dialog.with_section(title: t(".history"), open: true) do %>
<% if @holding.trades.any? %> <% else %>

No trade history available for this holding.

<% end %>
<% end %> <% if @holding.account.can_delete_holdings? %> <% dialog.with_section(title: t(".settings"), open: true) do %>

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

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

<%= button_to t(".delete"), holding_path(@holding), method: :delete, class: "rounded-lg px-3 py-2 text-red-500 text-sm font-medium border border-secondary", data: { turbo_confirm: true } %>
<% end %> <% end %> <% end %> <% end %>