2024-11-04 20:27:31 -05:00
|
|
|
<%# locals: (entry:, selectable: true, show_balance: false, origin: 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 %>
|
|
|
|
<div class="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gray-600/5 text-gray-600">
|
2024-11-04 20:27:31 -05:00
|
|
|
<%= transaction.name.first.upcase %>
|
2024-06-24 11:58:39 -04:00
|
|
|
</div>
|
|
|
|
|
2024-11-04 20:27:31 -05:00
|
|
|
<div class="truncate">
|
|
|
|
<% if entry.new_record? %>
|
|
|
|
<%= content_tag :p, transaction.name %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<% else %>
|
2024-11-04 20:27:31 -05:00
|
|
|
<%= link_to transaction.name,
|
|
|
|
entry.transfer.present? ? account_transfer_path(entry.transfer, origin:) : account_entry_path(account, entry, origin:),
|
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? %>
|
|
|
|
<% unless show_balance %>
|
|
|
|
<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">
|
|
|
|
<%= render "account/transfers/account_logos", transfer: entry.transfer, outflow: entry.outflow? %>
|
|
|
|
</div>
|
|
|
|
<% else %>
|
|
|
|
<div class="flex items-center gap-1 col-span-2">
|
|
|
|
<%= render "categories/menu", transaction: transaction, origin: origin %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% unless show_balance %>
|
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),
|
|
|
|
class: ["text-green-600": entry.inflow?] %>
|
2024-06-24 11:58:39 -04:00
|
|
|
</div>
|
2024-11-04 20:27:31 -05:00
|
|
|
|
|
|
|
<% if show_balance %>
|
|
|
|
<div class="col-span-2 justify-self-end">
|
|
|
|
<%= tag.p format_money(entry.trend.current), class: "font-medium text-sm text-gray-900" %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2024-07-01 10:49:43 -04:00
|
|
|
</div>
|