<%# locals: (group:) -%> <% type = Accountable.from_type(group.name) %> <% if group && group.children.any? %> <% group_trend = group.series.trend %>
<%= 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 %>

<%= render "shared/sparkline", series: group.series, id: "#{group.name}_sparkline" %>
<%= group_trend.value.positive? ? "+" : "" %><%= group_trend.percent.infinite? ? "∞" : number_to_percentage(group_trend.percent, precision: 0) %>
<% group.children.sort_by(&:name).each do |account_value_node| %> <% account = account_value_node.original %> <% account_trend = account_value_node.series.trend %> <%= link_to account, class: "flex items-center w-full gap-3 px-3 py-2 mb-1 hover:bg-gray-100 rounded-[10px]" do %> <%= render "accounts/logo", account: account, size: "sm" %>

<%= account_value_node.name %>

<% if account.subtype %>

<%= account.subtype&.humanize %>

<% end %>

<%= format_money account.balance_money %>

<%= render "shared/sparkline", series: account_value_node.series, id: dom_id(account, :list_sparkline) %>
<%= account_trend.value.positive? ? "+" : "" %><%= account_trend.percent.infinite? ? "∞" : number_to_percentage(account_trend.percent, precision: 0) %>
<% end %> <% end %> <%= link_to new_polymorphic_path(type, step: "method_select"), 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") %> <%= t(".new_account", type: type.model_name.human.downcase) %> <% end %>
<% end %>