2025-02-21 11:57:59 -05:00
|
|
|
<%# locals: (account_group:) %>
|
|
|
|
|
2025-05-07 09:26:06 -04:00
|
|
|
<%= render DisclosureComponent.new(title: account_group.name, align: :left, open: account_group.accounts.any? { |account| page_active?(account_path(account)) }) do |disclosure| %>
|
2025-04-30 18:14:22 -04:00
|
|
|
<% disclosure.with_summary_content do %>
|
2025-02-21 11:57:59 -05:00
|
|
|
<div class="ml-auto text-right grow">
|
|
|
|
<%= tag.p format_money(account_group.total_money), class: "text-sm font-medium text-primary" %>
|
|
|
|
|
|
|
|
<%= turbo_frame_tag "#{account_group.key}_sparkline", src: accountable_sparkline_path(account_group.key), loading: "lazy" do %>
|
|
|
|
<div class="flex items-center w-8 h-4 ml-auto">
|
2025-04-11 09:28:00 -05:00
|
|
|
<div class="w-6 h-px bg-surface-inset"></div>
|
2025-02-21 11:57:59 -05:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2025-04-30 18:14:22 -04:00
|
|
|
<% end %>
|
2025-02-21 11:57:59 -05:00
|
|
|
|
|
|
|
<div class="space-y-1">
|
|
|
|
<% account_group.accounts.each do |account| %>
|
2025-05-07 09:26:06 -04:00
|
|
|
<%= link_to account_path(account),
|
|
|
|
class: class_names(
|
|
|
|
"block flex items-center gap-2 px-3 py-2 rounded-lg",
|
|
|
|
page_active?(account_path(account)) ? "bg-container" : "hover:bg-surface-hover"
|
|
|
|
),
|
|
|
|
data: { sidebar_tabs_target: "account", action: "click->sidebar-tabs#select" },
|
|
|
|
title: account.name do %>
|
2025-02-21 11:57:59 -05:00
|
|
|
<%= render "accounts/logo", account: account, size: "sm", color: account_group.color %>
|
|
|
|
|
2025-02-25 17:28:40 -05:00
|
|
|
<div class="min-w-0 grow">
|
2025-04-11 09:28:00 -05:00
|
|
|
<%= tag.p account.name, class: "text-sm text-primary font-medium mb-0.5 truncate" %>
|
2025-04-22 13:10:50 -05:00
|
|
|
<%= tag.p account.short_subtype_label, class: "text-sm text-secondary truncate" %>
|
2025-02-21 11:57:59 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="ml-auto text-right grow h-10">
|
2025-02-28 08:35:14 -05:00
|
|
|
<%= tag.p format_money(account.balance_money), class: "text-sm font-medium text-primary whitespace-nowrap" %>
|
2025-02-21 11:57:59 -05:00
|
|
|
|
|
|
|
<%= turbo_frame_tag dom_id(account, :sparkline), src: sparkline_account_path(account), loading: "lazy" do %>
|
|
|
|
<div class="flex items-center w-8 h-5 ml-auto">
|
2025-04-11 09:28:00 -05:00
|
|
|
<div class="w-6 h-px bg-surface-inset"></div>
|
2025-02-21 11:57:59 -05:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
2025-05-07 09:26:06 -04:00
|
|
|
<div class="my-2">
|
|
|
|
<%= render LinkComponent.new(
|
|
|
|
href: new_polymorphic_path(account_group.key, step: "method_select"),
|
|
|
|
text: "New #{account_group.name.downcase.singularize}",
|
|
|
|
icon: "plus",
|
|
|
|
full_width: true,
|
|
|
|
variant: "ghost",
|
|
|
|
frame: :modal,
|
|
|
|
class: "justify-start"
|
|
|
|
) %>
|
|
|
|
</div>
|
2025-04-30 18:14:22 -04:00
|
|
|
<% end %>
|