<%= turbo_stream_from @account %> <%= tag.div id: dom_id(@account), class: "space-y-4" do %>
<%= image_tag account_logo_url(@account), class: "w-8 h-8" %>

<%= @account.name %>

<% if @account.property? && @account.property.address %>

<%= @account.property.address %>

<% end %>
<%= button_to sync_account_path(@account), method: :post, class: "flex items-center gap-2", title: "Sync Account" do %> <%= lucide_icon "refresh-cw", class: "w-4 h-4 text-gray-900 hover:text-gray-500" %> <% end %> <%= contextual_menu do %>
<%= link_to edit_account_path(@account), data: { turbo_frame: :modal }, class: "block w-full py-2 px-3 space-x-2 text-gray-900 hover:bg-gray-50 flex items-center rounded-lg" do %> <%= lucide_icon "pencil-line", class: "w-5 h-5 text-gray-500" %> <%= t(".edit") %> <% end %> <%= link_to new_import_path(account_id: @account.id), class: "block w-full py-2 px-3 space-x-2 text-gray-900 hover:bg-gray-50 flex items-center rounded-lg" do %> <%= lucide_icon "download", class: "w-5 h-5 text-gray-500" %> <%= t(".import") %> <% end %> <%= button_to account_path(@account), method: :delete, class: "block w-full py-2 px-3 space-x-2 text-red-600 hover:bg-red-50 flex items-center rounded-lg", data: { turbo_confirm: { title: t(".confirm_title"), body: t(".confirm_body_html"), accept: t(".confirm_accept", name: @account.name) } } do %> <%= lucide_icon("trash-2", class: "w-5 h-5 mr-2") %> Delete account <% end %>
<% end %>
<% if @account.highest_priority_issue %> <%= render partial: "issues/issue", locals: { issue: @account.highest_priority_issue } %> <% end %>
<%= tag.p t(".total_value"), class: "text-sm font-medium text-gray-500" %>
<%= render "tooltip", account: @account if @account.investment? %>
<%= tag.p format_money(@account.value, precision: 0), class: "text-gray-900 text-3xl font-medium" %>
<% if @series.trend.direction.flat? %> <%= tag.span t(".no_change"), class: "text-gray-500" %> <% else %> <%= tag.span format_money(@series.trend.value), style: "color: #{@trend.color}" %> <%= tag.span "(#{@trend.percent}%)", style: "color: #{@trend.color}" %> <% end %> <%= tag.span period_label(@period), class: "text-gray-500" %>
<%= form_with url: account_path(@account), method: :get, data: { controller: "auto-submit-form" } do |form| %> <%= period_select form: form, selected: @period.name %> <% end %>
<%= render partial: "shared/line_chart", locals: { series: @series } %>
<% selected_tab = selected_account_tab(@account) %> <% selected_tab_key = selected_tab[:key] %> <% selected_tab_partial_path = selected_tab[:partial_path] %> <% selected_tab_route = selected_tab[:route] %>
<% account_tabs(@account).each do |tab| %> <%= link_to tab[:label], tab[:path], class: ["px-2 py-1.5 rounded-md border border-transparent", "bg-white shadow-xs border-alpha-black-50": selected_tab_key == tab[:key]] %> <% end %>
<% if selected_tab_route.present? %> <%= turbo_frame_tag dom_id(@account, selected_tab_key), src: selected_tab_route do %> <%= render "account/entries/loading" %> <% end %> <% else %> <%= render selected_tab_partial_path, account: @account %> <% end %>
<% end %>