1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00

Only show account grouping if sum > 0

This commit is contained in:
Josh Pigford 2024-02-08 15:52:33 -06:00
parent 9284352f06
commit 69c5df73d9

View file

@ -2,7 +2,8 @@
<% accounts = Current.family.accounts.where(accountable_type: type.name) %>
<details class="text-sm mb-1 group">
<% if accounts.sum(&:balance) > 0 %>
<details class="mb-1 text-sm group">
<summary class="flex gap-4 px-2 py-3 items-center w-full rounded-[10px] font-medium hover:bg-[#f2f2f2]">
<%= lucide_icon("chevron-down", class: "hidden group-open:block text-[#737373] w-5 h-5") %>
<%= lucide_icon("chevron-right", class: "group-open:hidden text-[#737373] w-5 h-5") %>
@ -11,7 +12,7 @@
</summary>
<% accounts.each do |account| %>
<div class="flex gap-3 px-2 py-3 items-center w-full mb-1">
<div class="flex items-center w-full gap-3 px-2 py-3 mb-1">
<div>
<p class="font-medium"><%= account.name %></p>
<% if account.subtype %>
@ -27,4 +28,4 @@
<p>New <%= type.model_name.human.downcase %></p>
<% end %>
</details>
<% end %>