1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-08 23:15:24 +02:00

Transfer and Payment auto-matching, model and UI improvements (#1585)

* Transfer data model migration

* Transfers and payment modeling and UI improvements

* Fix CI

* Transfer matching flow

* Better UI for transfers

* Auto transfer matching, approve, reject flow

* Mark transfers created from form as confirmed

* Account filtering

* Excluded rejected transfers from calculations

* Calculation tweaks with transfer exclusions

* Clean up migration
This commit is contained in:
Zach Gollwitzer 2025-01-07 09:41:24 -05:00 committed by GitHub
parent 46e129308f
commit 307a3687e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
78 changed files with 1161 additions and 682 deletions

View file

@ -0,0 +1,101 @@
<%= drawer do %>
<header class="mb-4 space-y-1">
<div class="flex items-center gap-4">
<h3 class="font-medium">
<span class="text-2xl">
<%= format_money @transfer.amount_abs %>
</span>
<span class="text-lg text-gray-500">
<%= @transfer.amount_abs.currency.iso_code %>
</span>
</h3>
<%= lucide_icon "arrow-left-right", class: "text-gray-500 mt-1 w-5 h-5" %>
</div>
<span class="text-sm text-gray-500">
<%= @transfer.name %>
</span>
</header>
<div class="space-y-2">
<!-- Overview Section -->
<%= disclosure t(".overview") do %>
<div class="pb-4 px-3 pt-2 text-sm space-y-3 text-gray-900">
<div class="space-y-3">
<dl class="flex items-center gap-2 justify-between">
<dt class="text-gray-500">From</dt>
<dd class="flex items-center gap-2 font-medium">
<%= render "accounts/logo", account: @transfer.from_account, size: "sm" %>
<%= link_to @transfer.from_account.name, account_path(@transfer.from_account), data: { turbo_frame: "_top" } %>
</dd>
</dl>
<dl class="flex items-center gap-2 justify-between">
<dt class="text-gray-500">Date</dt>
<dd class="font-medium"><%= l(@transfer.outflow_transaction.entry.date, format: :long) %></dd>
</dl>
<dl class="flex items-center gap-2 justify-between">
<dt class="text-gray-500">Amount</dt>
<dd class="font-medium text-red-500"><%= format_money -@transfer.amount_abs %></dd>
</dl>
</div>
<div class="bg-alpha-black-100 h-px my-2"></div>
<div class="space-y-3">
<dl class="flex items-center gap-2 justify-between">
<dt class="text-gray-500">To</dt>
<dd class="flex items-center gap-2 font-medium">
<%= render "accounts/logo", account: @transfer.to_account, size: "sm" %>
<%= link_to @transfer.to_account.name, account_path(@transfer.to_account), data: { turbo_frame: "_top" } %>
</dd>
</dl>
<dl class="flex items-center gap-2 justify-between">
<dt class="text-gray-500">Date</dt>
<dd class="font-medium"><%= l(@transfer.inflow_transaction.entry.date, format: :long) %></dd>
</dl>
<dl class="flex items-center gap-2 justify-between">
<dt class="text-gray-500">Amount</dt>
<dd class="font-medium text-green-500">+<%= format_money @transfer.amount_abs %></dd>
</dl>
</div>
</div>
<% end %>
<!-- Details Section -->
<%= disclosure t(".details") do %>
<%= styled_form_with model: @transfer,
data: { controller: "auto-submit-form" } do |f| %>
<%= f.text_area :notes,
label: t(".note_label"),
placeholder: t(".note_placeholder"),
rows: 5,
"data-auto-submit-form-target": "auto" %>
<% end %>
<% end %>
<!-- Settings Section -->
<%= disclosure t(".settings") do %>
<div class="pb-4">
<div class="flex items-center justify-between gap-2 p-3">
<div class="text-sm space-y-1">
<h4 class="text-gray-900"><%= t(".delete_title") %></h4>
<p class="text-gray-500"><%= t(".delete_subtitle") %></p>
</div>
<%= button_to t(".delete"),
transfer_path(@transfer),
method: :delete,
class: "rounded-lg px-3 py-2 whitespace-nowrap text-red-500 text-sm
font-medium border border-alpha-black-200",
data: { turbo_confirm: true, turbo_frame: "_top" } %>
</div>
</div>
<% end %>
</div>
<% end %>