2025-02-21 11:57:59 -05:00
|
|
|
<%# locals: (entry:, balance_trend: nil, view_ctx: "global") %>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2025-02-21 11:57:59 -05:00
|
|
|
<% transaction = entry.entryable %>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2025-02-21 11:57:59 -05:00
|
|
|
<%= turbo_frame_tag dom_id(entry) do %>
|
|
|
|
<%= turbo_frame_tag dom_id(transaction) do %>
|
2025-07-18 05:52:18 -04:00
|
|
|
<div class="grid grid-cols-12 items-center text-primary text-sm font-medium p-4 lg:p-4 <%= entry.excluded ? "opacity-50 text-gray-400" : "" %>">
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2025-06-20 17:10:36 -04:00
|
|
|
<div class="pr-4 lg:pr-10 flex items-center gap-3 lg:gap-4 col-span-8 <%= view_ctx == "global" ? "lg:col-span-8" : "lg:col-span-6" %>">
|
2025-02-21 11:57:59 -05:00
|
|
|
<%= check_box_tag dom_id(entry, "selection"),
|
2025-06-20 13:31:58 -04:00
|
|
|
disabled: transaction.transfer.present?,
|
2025-02-21 11:57:59 -05:00
|
|
|
class: "checkbox checkbox--light",
|
|
|
|
data: {
|
|
|
|
id: entry.id,
|
|
|
|
"bulk-select-target": "row",
|
|
|
|
action: "bulk-select#toggleRowSelection"
|
|
|
|
} %>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2025-02-21 11:57:59 -05:00
|
|
|
<div class="max-w-full">
|
|
|
|
<%= content_tag :div, class: ["flex items-center gap-2"] do %>
|
2025-04-18 11:39:58 -04:00
|
|
|
<% if transaction.merchant&.logo_url.present? %>
|
|
|
|
<%= image_tag transaction.merchant.logo_url,
|
2025-02-21 11:57:59 -05:00
|
|
|
class: "w-6 h-6 rounded-full",
|
|
|
|
loading: "lazy" %>
|
|
|
|
<% else %>
|
2025-04-30 18:14:22 -04:00
|
|
|
<%= render FilledIconComponent.new(
|
|
|
|
variant: :text,
|
|
|
|
text: entry.name,
|
|
|
|
size: "sm",
|
|
|
|
rounded: true
|
|
|
|
) %>
|
2025-02-21 11:57:59 -05:00
|
|
|
<% end %>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2025-02-21 11:57:59 -05:00
|
|
|
<div class="truncate">
|
|
|
|
<div class="space-y-0.5">
|
2025-06-20 14:08:46 -04:00
|
|
|
<div class="flex items-center gap-1 min-w-0">
|
|
|
|
<div class="truncate flex-shrink">
|
|
|
|
<% if transaction.transfer? %>
|
|
|
|
<%= link_to(
|
|
|
|
entry.name,
|
|
|
|
transaction.transfer.present? ? transfer_path(transaction.transfer) : entry_path(entry),
|
|
|
|
data: {
|
|
|
|
turbo_frame: "drawer",
|
|
|
|
turbo_prefetch: false
|
|
|
|
},
|
|
|
|
class: "hover:underline"
|
|
|
|
) %>
|
|
|
|
<% else %>
|
|
|
|
<%= link_to(
|
|
|
|
entry.name,
|
|
|
|
entry_path(entry),
|
|
|
|
data: {
|
|
|
|
turbo_frame: "drawer",
|
|
|
|
turbo_prefetch: false
|
|
|
|
},
|
|
|
|
class: "hover:underline"
|
|
|
|
) %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2025-02-21 11:57:59 -05:00
|
|
|
|
2025-06-20 14:08:46 -04:00
|
|
|
<div class="flex items-center gap-1 flex-shrink-0">
|
2025-06-20 17:10:36 -04:00
|
|
|
<% if transaction.one_time? %>
|
2025-06-20 14:08:46 -04:00
|
|
|
<span class="text-orange-500" title="One-time <%= entry.amount.negative? ? "income" : "expense" %> (excluded from averages)">
|
|
|
|
<%= icon "asterisk", size: "sm", color: "current" %>
|
|
|
|
</span>
|
|
|
|
<% end %>
|
2025-02-21 11:57:59 -05:00
|
|
|
|
2025-06-20 14:08:46 -04:00
|
|
|
<% if transaction.transfer.present? %>
|
|
|
|
<%= render "transactions/transfer_match", transaction: transaction %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2025-02-21 11:57:59 -05:00
|
|
|
</div>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2025-05-08 12:25:53 -04:00
|
|
|
<div class="text-secondary text-xs font-normal hidden lg:block">
|
2025-02-21 11:57:59 -05:00
|
|
|
<% if transaction.transfer? %>
|
2025-06-20 13:31:58 -04:00
|
|
|
<span class="text-secondary">
|
|
|
|
<%= transaction.loan_payment? ? "Loan Payment" : "Transfer" %> • <%= entry.account.name %>
|
|
|
|
</span>
|
2025-02-21 11:57:59 -05:00
|
|
|
<% else %>
|
|
|
|
<%= link_to entry.account.name,
|
2025-07-18 05:52:18 -04:00
|
|
|
account_path(entry.account, tab: "transactions"),
|
2025-02-21 11:57:59 -05:00
|
|
|
data: { turbo_frame: "_top" },
|
|
|
|
class: "hover:underline" %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
2025-01-07 09:41:24 -05:00
|
|
|
</div>
|
2025-02-21 11:57:59 -05:00
|
|
|
<% end %>
|
2025-01-07 09:41:24 -05:00
|
|
|
</div>
|
2025-02-21 11:57:59 -05:00
|
|
|
</div>
|
2024-11-04 20:27:31 -05:00
|
|
|
|
2025-05-08 12:25:53 -04:00
|
|
|
<div class="hidden lg:flex items-center gap-1 col-span-2">
|
2025-04-14 11:40:34 -04:00
|
|
|
<%= render "transactions/transaction_category", transaction: transaction %>
|
2025-02-21 11:57:59 -05:00
|
|
|
</div>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2025-06-20 13:58:24 -04:00
|
|
|
<div class="col-span-4 lg:col-span-2 ml-auto text-right">
|
2025-02-21 11:57:59 -05:00
|
|
|
<%= content_tag :p,
|
|
|
|
transaction.transfer? && view_ctx == "global" ? "+/- #{format_money(entry.amount_money.abs)}" : format_money(-entry.amount_money),
|
|
|
|
class: ["text-green-600": entry.amount.negative?] %>
|
|
|
|
</div>
|
2024-11-04 20:27:31 -05:00
|
|
|
|
2025-06-20 13:58:24 -04:00
|
|
|
<% if view_ctx != "global" %>
|
|
|
|
<div class="col-span-2 justify-self-end hidden lg:block">
|
|
|
|
<% if balance_trend&.trend %>
|
|
|
|
<%= tag.p format_money(balance_trend.trend.current),
|
2025-02-21 11:57:59 -05:00
|
|
|
class: "font-medium text-sm text-primary" %>
|
2025-06-20 13:58:24 -04:00
|
|
|
<% else %>
|
|
|
|
<%= tag.p "--", class: "font-medium text-sm text-gray-400" %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2024-11-04 20:27:31 -05:00
|
|
|
</div>
|
|
|
|
<% end %>
|
2025-02-21 11:57:59 -05:00
|
|
|
<% end %>
|