<%# locals: (group:) -%> <% type = Accountable.from_type(group.name) %> <% if group && group.children.any? %>
<%= lucide_icon("chevron-down", class: "hidden group-open:block text-gray-500 w-5 h-5") %> <%= lucide_icon("chevron-right", class: "group-open:hidden text-gray-500 w-5 h-5") %>
<%= type.model_name.human %>

<%= format_money group.sum %>

<%= tag.div( id: "#{group.name}_sparkline", class: "h-3 w-8 ml-auto", data: { controller: "time-series-chart", "time-series-chart-data-value": group.series.to_json, "time-series-chart-stroke-width-value": 1, "time-series-chart-use-labels-value": false, "time-series-chart-use-tooltip-value": false } ) %> <% styles = trend_styles(group.series.trend) %> <%= sprintf("%+.2f", group.series.trend.percent) %>%
<% group.children.sort_by(&:name).each do |account_value_node| %> <% account = account_value_node.original %> <%= link_to account_path(account), class: "flex items-center w-full gap-3 px-3 py-2 mb-1 hover:bg-gray-100 rounded-[10px]" do %> <%= image_tag account_logo_url(account), class: "w-6 h-6" %>

<%= account_value_node.name %>

<% if account.subtype %>

<%= account.subtype&.humanize %>

<% end %>

<%= format_money account.balance_money %>

<% unless account_value_node.series.trend.direction.flat? %>
<%= tag.div( id: dom_id(account, :list_sparkline), class: "h-3 w-8 ml-auto", data: { controller: "time-series-chart", "time-series-chart-data-value": account_value_node.series.to_json, "time-series-chart-stroke-width-value": 1, "time-series-chart-use-labels-value": false, "time-series-chart-use-tooltip-value": false } ) %> <% styles = trend_styles(account_value_node.series.trend) %> <%= sprintf("%+.2f", account_value_node.series.trend.percent) %>%
<% end %>
<% end %> <% end %> <%= link_to new_account_path(step: "method", type: type.name.demodulize), class: "flex items-center min-h-10 gap-4 px-3 py-2 mb-1 text-gray-500 text-sm font-medium rounded-[10px] hover:bg-gray-100", data: { turbo_frame: "modal" } do %> <%= lucide_icon("plus", class: "w-5 h-5") %>

New <%= type.model_name.human.downcase %>

<% end %>
<% end %>