2024-12-10 17:41:20 -05:00
|
|
|
<%# locals: (entry:, selectable: true, balance_trend: nil) %>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2025-02-13 11:31:07 -05:00
|
|
|
<div class="grid grid-cols-12 items-center text-primary text-sm font-medium p-4 <%= @focused_record == entry ? "border border-gray-900 rounded-lg" : "" %>">
|
2025-01-07 09:41:24 -05:00
|
|
|
<div class="pr-10 flex items-center gap-4 <%= balance_trend ? "col-span-6" : "col-span-8" %>">
|
2024-06-24 11:58:39 -04:00
|
|
|
<% if selectable %>
|
2024-07-01 10:49:43 -04:00
|
|
|
<%= check_box_tag dom_id(entry, "selection"),
|
2025-01-31 19:08:21 -05:00
|
|
|
disabled: entry.entryable.transfer?,
|
2025-02-13 11:31:07 -05:00
|
|
|
class: "checkbox checkbox--light",
|
2024-07-01 10:49:43 -04:00
|
|
|
data: { id: entry.id, "bulk-select-target": "row", action: "bulk-select#toggleRowSelection" } %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<div class="max-w-full">
|
|
|
|
<%= content_tag :div, class: ["flex items-center gap-2"] do %>
|
2025-01-31 19:08:21 -05:00
|
|
|
<% if entry.entryable.merchant&.icon_url %>
|
|
|
|
<%= image_tag entry.entryable.merchant.icon_url, class: "w-6 h-6 rounded-full", loading: "lazy" %>
|
2025-01-30 15:31:16 -05:00
|
|
|
<% else %>
|
|
|
|
<%= render "shared/circle_logo", name: entry.display_name, size: "sm" %>
|
|
|
|
<% end %>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2024-11-04 20:27:31 -05:00
|
|
|
<div class="truncate">
|
2025-01-07 09:41:24 -05:00
|
|
|
<div class="space-y-0.5">
|
|
|
|
<div class="flex items-center gap-1">
|
|
|
|
<% if entry.new_record? %>
|
|
|
|
<%= content_tag :p, entry.display_name %>
|
|
|
|
<% else %>
|
2025-01-31 19:08:21 -05:00
|
|
|
<%= link_to entry.entryable.transfer? ? entry.entryable.transfer.name : entry.display_name,
|
|
|
|
entry.entryable.transfer? ? transfer_path(entry.entryable.transfer) : account_entry_path(entry),
|
2024-06-24 11:58:39 -04:00
|
|
|
data: { turbo_frame: "drawer", turbo_prefetch: false },
|
|
|
|
class: "hover:underline hover:text-gray-800" %>
|
2025-01-07 09:41:24 -05:00
|
|
|
<% end %>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2025-01-07 09:41:24 -05:00
|
|
|
<% if entry.excluded %>
|
|
|
|
<span title="One-time <%= entry.amount.negative? ? "income" : "expense" %> (excluded from averages)">
|
|
|
|
<%= lucide_icon "asterisk", class: "w-4 h-4 shrink-0 text-orange-500" %>
|
|
|
|
</span>
|
|
|
|
<% end %>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2025-01-31 19:08:21 -05:00
|
|
|
<% if entry.entryable.transfer? %>
|
2025-01-07 09:41:24 -05:00
|
|
|
<%= render "account/transactions/transfer_match", entry: entry %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2025-02-13 11:31:07 -05:00
|
|
|
<div class="text-secondary text-xs font-normal">
|
2025-01-31 19:08:21 -05:00
|
|
|
<% if entry.entryable.transfer? %>
|
|
|
|
<%= render "transfers/account_links", transfer: entry.entryable.transfer, is_inflow: entry.entryable.transfer_as_inflow.present? %>
|
2025-01-07 09:41:24 -05:00
|
|
|
<% else %>
|
2025-01-30 14:12:01 -05:00
|
|
|
<%= link_to entry.account.name, account_path(entry.account, tab: "transactions", focused_record_id: entry.id), data: { turbo_frame: "_top" }, class: "hover:underline" %>
|
2025-01-07 09:41:24 -05:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2024-11-04 20:27:31 -05:00
|
|
|
</div>
|
2025-01-07 09:41:24 -05:00
|
|
|
</div>
|
2024-11-04 20:27:31 -05:00
|
|
|
|
2025-01-07 09:41:24 -05:00
|
|
|
<div class="flex items-center gap-1 col-span-2">
|
|
|
|
<%= render "account/transactions/transaction_category", entry: entry %>
|
|
|
|
</div>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2024-08-09 11:22:57 -04:00
|
|
|
<div class="col-span-2 ml-auto">
|
2024-06-24 11:58:39 -04:00
|
|
|
<%= content_tag :p,
|
2024-07-01 10:49:43 -04:00
|
|
|
format_money(-entry.amount_money),
|
2024-12-19 10:16:09 -05:00
|
|
|
class: ["text-green-600": entry.amount.negative?] %>
|
2024-06-24 11:58:39 -04:00
|
|
|
</div>
|
2024-11-04 20:27:31 -05:00
|
|
|
|
2024-12-10 17:41:20 -05:00
|
|
|
<% if balance_trend %>
|
2024-11-04 20:27:31 -05:00
|
|
|
<div class="col-span-2 justify-self-end">
|
2024-12-10 17:41:20 -05:00
|
|
|
<% if balance_trend.trend %>
|
2025-02-13 11:31:07 -05:00
|
|
|
<%= tag.p format_money(balance_trend.trend.current), class: "font-medium text-sm text-primary" %>
|
2024-11-15 13:49:37 -05:00
|
|
|
<% else %>
|
2025-02-13 11:31:07 -05:00
|
|
|
<%= tag.p "--", class: "font-medium text-sm text-subdued" %>
|
2024-11-15 13:49:37 -05:00
|
|
|
<% end %>
|
2024-11-04 20:27:31 -05:00
|
|
|
</div>
|
|
|
|
<% end %>
|
2024-07-01 10:49:43 -04:00
|
|
|
</div>
|