mirror of
https://github.com/we-promise/sure.git
synced 2026-04-21 21:14:17 +00:00
* Remove balance mode, sketch out refactor * Activity view checkpoint * Entry partials, checkpoint * Finish txn partial * Give entries context when editing for different turbo responses * Calculate change of balance for each entry * Account tabs consolidation * Translations, linting, brakeman updates * Account actions concern * Finalize forms, get account system tests passing * Get tests passing * Lint, rubocop, schema updates * Improve routing and stream responses * Fix broken routes * Add import option for adding accounts * Fix system test * Fix test specificity * Fix sparklines * Improve account redirects
75 lines
2.7 KiB
Plaintext
75 lines
2.7 KiB
Plaintext
<%# locals: (entry:, selectable: true, show_balance: false, origin: nil) %>
|
|
<% transaction, account = entry.account_transaction, entry.account %>
|
|
|
|
<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">
|
|
<% if selectable %>
|
|
<%= check_box_tag dom_id(entry, "selection"),
|
|
class: "maybe-checkbox maybe-checkbox--light",
|
|
data: { id: entry.id, "bulk-select-target": "row", action: "bulk-select#toggleRowSelection" } %>
|
|
<% 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">
|
|
<%= transaction.name.first.upcase %>
|
|
</div>
|
|
|
|
<div class="truncate">
|
|
<% if entry.new_record? %>
|
|
<%= content_tag :p, transaction.name %>
|
|
<% else %>
|
|
<%= link_to transaction.name,
|
|
entry.transfer.present? ? account_transfer_path(entry.transfer, origin:) : account_entry_path(account, entry, origin:),
|
|
data: { turbo_frame: "drawer", turbo_prefetch: false },
|
|
class: "hover:underline hover:text-gray-800" %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% if unconfirmed_transfer?(entry) %>
|
|
<%= render "account/transfers/transfer_toggle", entry: entry %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% if entry.transfer.present? %>
|
|
<% unless show_balance %>
|
|
<div class="col-span-2"></div>
|
|
<% end %>
|
|
|
|
<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 %>
|
|
<%= tag.div class: "col-span-2" do %>
|
|
<% if entry.new_record? %>
|
|
<%= tag.p account.name %>
|
|
<% else %>
|
|
<%= link_to account.name,
|
|
account_path(account, tab: "transactions"),
|
|
data: { turbo_frame: "_top" },
|
|
class: "hover:underline" %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<div class="col-span-2 ml-auto">
|
|
<%= content_tag :p,
|
|
format_money(-entry.amount_money),
|
|
class: ["text-green-600": entry.inflow?] %>
|
|
</div>
|
|
|
|
<% 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 %>
|
|
</div>
|