mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
* Implement recurring transactions support * Amount fix * Hide section when any filter is applied * Add automatic identify feature Automatic identification runs after: - CSV Import completes (TransactionImport, TradeImport, AccountImport, MintImport) - Plaid sync completes - SimpleFIN sync completes - LunchFlow sync completes - Any new provider that we create. * Fix linter and tests * Fix address review * FIX proper text sizing * Fix further linter Use circular distance to handle month-boundary wrapping * normalize to a circular representation before computing the median * Better tests validation * Added some UI info Fix pattern identification, last recurrent transaction needs to happened within the last 45 days. * Fix styling * Revert text subdued look * Match structure of the other sections * Styling * Restore positive amounts styling * Shorten label for UI styling --------- Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
111 lines
4.8 KiB
Plaintext
111 lines
4.8 KiB
Plaintext
<div class="space-y-4 pb-20 flex flex-col">
|
|
<header class="flex justify-between items-center text-primary font-medium">
|
|
<h1 class="text-xl">Transactions</h1>
|
|
<div class="flex items-center gap-5">
|
|
<div class="flex items-center gap-2">
|
|
<%= render DS::Menu.new do |menu| %>
|
|
<% menu.with_item(variant: "link", text: "New rule", href: new_rule_path(resource_type: "transaction"), icon: "plus", data: { turbo_frame: :modal }) %>
|
|
<% menu.with_item(variant: "link", text: "Edit rules", href: rules_path, icon: "git-branch", data: { turbo_frame: :_top }) %>
|
|
<% menu.with_item(variant: "link", text: "Edit categories", href: categories_path, icon: "shapes", data: { turbo_frame: :_top }) %>
|
|
<% menu.with_item(variant: "link", text: "Edit tags", href: tags_path, icon: "tags", data: { turbo_frame: :_top }) %>
|
|
<% menu.with_item(variant: "link", text: "Edit merchants", href: family_merchants_path, icon: "store", data: { turbo_frame: :_top }) %>
|
|
<% menu.with_item(variant: "link", text: "Edit imports", href: imports_path, icon: "hard-drive-upload", data: { turbo_frame: :_top }) %>
|
|
<% menu.with_item(variant: "link", text: "Import", href: new_import_path, icon: "download", data: { turbo_frame: "modal", class_name: "md:!hidden" }) %>
|
|
<% end %>
|
|
|
|
<div class="hidden md:flex">
|
|
<%= render DS::Link.new(
|
|
text: t(".import"),
|
|
icon: "download",
|
|
variant: "outline",
|
|
href: new_import_path,
|
|
frame: :modal,
|
|
) %>
|
|
</div>
|
|
|
|
<%= render DS::Link.new(
|
|
text: "New transaction",
|
|
icon: "plus",
|
|
variant: "primary",
|
|
href: new_transaction_path,
|
|
frame: :modal,
|
|
class: "hidden md:inline-flex"
|
|
) %>
|
|
|
|
<%= render DS::Link.new(
|
|
icon: "plus",
|
|
variant: "icon-inverse",
|
|
href: new_transaction_path,
|
|
frame: :modal,
|
|
class: "rounded-full md:hidden"
|
|
) %>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<%= render "summary", totals: @search.totals %>
|
|
|
|
<div id="transactions"
|
|
data-controller="bulk-select"
|
|
data-bulk-select-singular-label-value="<%= t(".transaction") %>"
|
|
data-bulk-select-plural-label-value="<%= t(".transactions") %>"
|
|
class="flex flex-col bg-container rounded-xl shadow-border-xs p-4">
|
|
<%= render "transactions/searches/search" %>
|
|
|
|
<div id="entry-selection-bar" data-bulk-select-target="selectionBar" class="flex justify-center hidden">
|
|
<%= render "transactions/selection_bar" %>
|
|
</div>
|
|
|
|
<% if @pagy.count > 0 || (@projected_recurring.any? && @q.blank?) %>
|
|
<div class="grow overflow-y-auto">
|
|
<div class="grid-cols-12 bg-container-inset rounded-xl px-5 py-3 text-xs uppercase font-medium text-secondary items-center mb-4 hidden md:grid">
|
|
<div class="pl-0.5 col-span-8 flex items-center gap-4">
|
|
<%= check_box_tag "selection_entry",
|
|
class: "checkbox checkbox--light",
|
|
data: { action: "bulk-select#togglePageSelection" } %>
|
|
<p>transaction</p>
|
|
</div>
|
|
|
|
<p class="col-span-2">category</p>
|
|
<p class="col-span-2 justify-self-end">amount</p>
|
|
</div>
|
|
|
|
<% if @transactions.any? %>
|
|
<div class="md:hidden text-xs uppercase font-medium text-secondary mb-2 px-2">
|
|
<%= check_box_tag "selection_entry",
|
|
class: "checkbox checkbox--light mr-2 ml-1",
|
|
data: { action: "bulk-select#togglePageSelection" } %>
|
|
<span>TRANSACTION</span>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="space-y-6">
|
|
<% if @projected_recurring.any? && @q.blank? %>
|
|
<div class="space-y-2">
|
|
<h3 class="text-xs uppercase font-medium text-secondary px-2"><%= t("recurring_transactions.upcoming") %></h3>
|
|
<% @projected_recurring.group_by(&:next_expected_date).sort.each do |date, transactions| %>
|
|
<div class="space-y-2">
|
|
<div class="text-xs text-secondary px-2 pt-2"><%= l(date, format: :long) %></div>
|
|
<% transactions.each do |recurring_transaction| %>
|
|
<%= render "recurring_transactions/projected_transaction", recurring_transaction: recurring_transaction %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<%= entries_by_date(@transactions.map(&:entry), totals: true) do |entries| %>
|
|
<%= render entries %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% else %>
|
|
<%= render "entries/empty" %>
|
|
<% end %>
|
|
|
|
<div class="pt-4">
|
|
<%= render "shared/pagination", pagy: @pagy %>
|
|
</div>
|
|
</div>
|
|
</div>
|