2024-12-10 17:41:20 -05:00
|
|
|
<%# locals: (entry:, selectable: true, balance_trend: nil) %>
|
2024-07-01 10:49:43 -04:00
|
|
|
<% transaction, account = entry.account_transaction, entry.account %>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2024-11-04 20:27:31 -05:00
|
|
|
<div class="grid grid-cols-12 items-center <%= entry.excluded ? "text-gray-400 bg-gray-25" : "text-gray-900" %> text-sm font-medium p-4">
|
|
|
|
<div class="pr-10 flex items-center gap-4 col-span-6">
|
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"),
|
2024-06-24 11:58:39 -04:00
|
|
|
class: "maybe-checkbox maybe-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 %>
|
2024-12-19 10:16:09 -05:00
|
|
|
<% if transaction.merchant&.icon_url %>
|
|
|
|
<%= image_tag transaction.merchant.icon_url, class: "w-6 h-6 rounded-full" %>
|
2024-12-13 17:22:27 -05:00
|
|
|
<% else %>
|
2024-12-19 10:16:09 -05:00
|
|
|
<%= render "shared/circle_logo", name: entry.display_name, size: "sm" %>
|
2024-12-13 17:22:27 -05:00
|
|
|
<% end %>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2024-11-04 20:27:31 -05:00
|
|
|
<div class="truncate">
|
|
|
|
<% if entry.new_record? %>
|
2024-12-19 10:16:09 -05:00
|
|
|
<%= content_tag :p, entry.display_name %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<% else %>
|
2024-12-19 10:16:09 -05:00
|
|
|
<%= link_to entry.display_name,
|
2024-11-27 16:01:50 -05:00
|
|
|
entry.transfer.present? ? account_transfer_path(entry.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" %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
2024-07-01 10:49:43 -04:00
|
|
|
<% if unconfirmed_transfer?(entry) %>
|
2024-11-04 20:27:31 -05:00
|
|
|
<%= render "account/transfers/transfer_toggle", entry: entry %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
2024-11-04 20:27:31 -05:00
|
|
|
<% if entry.transfer.present? %>
|
2024-12-10 17:41:20 -05:00
|
|
|
<% unless balance_trend %>
|
2024-11-04 20:27:31 -05:00
|
|
|
<div class="col-span-2"></div>
|
2024-06-24 11:58:39 -04:00
|
|
|
<% end %>
|
|
|
|
|
2024-11-04 20:27:31 -05:00
|
|
|
<div class="col-span-2">
|
2024-12-19 10:16:09 -05:00
|
|
|
<%= render "account/transfers/account_logos", transfer: entry.transfer, outflow: entry.amount.positive? %>
|
2024-11-04 20:27:31 -05:00
|
|
|
</div>
|
|
|
|
<% else %>
|
|
|
|
<div class="flex items-center gap-1 col-span-2">
|
2024-11-27 16:01:50 -05:00
|
|
|
<%= render "categories/menu", transaction: transaction %>
|
2024-11-04 20:27:31 -05:00
|
|
|
</div>
|
|
|
|
|
2024-12-10 17:41:20 -05:00
|
|
|
<% unless balance_trend %>
|
2024-11-07 15:42:51 +01:00
|
|
|
<%= tag.div class: "col-span-2 overflow-hidden truncate" do %>
|
2024-07-01 10:49:43 -04:00
|
|
|
<% if entry.new_record? %>
|
|
|
|
<%= tag.p account.name %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<% else %>
|
2024-07-01 10:49:43 -04:00
|
|
|
<%= link_to account.name,
|
|
|
|
account_path(account, tab: "transactions"),
|
2024-06-24 11:58:39 -04:00
|
|
|
data: { turbo_frame: "_top" },
|
|
|
|
class: "hover:underline" %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
|
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 %>
|
|
|
|
<%= tag.p format_money(balance_trend.trend.current), class: "font-medium text-sm text-gray-900" %>
|
2024-11-15 13:49:37 -05:00
|
|
|
<% else %>
|
2024-12-10 17:41:20 -05:00
|
|
|
<%= tag.p "--", class: "font-medium text-sm text-gray-400" %>
|
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>
|