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

Allow user to add buy and sell trade transactions for investment accounts (#1066)

* Consolidate modal form structure into partial + helper

* Scaffold out trade transaction form

* Normalize translations

* Add buy and sell trade form with tests

* Move entryable lists to dedicated controllers

* Delegate entry group contents rendering

* More cleanup

* Extract transaction and valuation update logic from entries controller

* Delegate edit and show actions to entryables

* Trade builder

* Update paths for transaction updates
This commit is contained in:
Zach Gollwitzer 2024-08-09 11:22:57 -04:00 committed by GitHub
parent 6bca35fa22
commit e05f03b314
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
75 changed files with 801 additions and 624 deletions

View file

@ -11,7 +11,7 @@
<% if @transaction_entries.present? %>
<div hidden id="entry-selection-bar" data-bulk-select-target="selectionBar">
<%= render "account/entries/entryables/transaction/selection_bar" %>
<%= render "account/transactions/selection_bar" %>
</div>
<div class="grow overflow-y-auto">
<div class="grid grid-cols-12 bg-gray-25 rounded-xl px-5 py-3 text-xs uppercase font-medium text-gray-500 items-center mb-4">
@ -27,8 +27,9 @@
<p class="col-span-2 justify-self-end">amount</p>
</div>
<div class="space-y-6">
<% @transaction_entries.group_by(&:date).each do |date, entries| %>
<%= render "account/entries/entry_group", date:, combine_transfers: true, entries: %>
<%= entries_by_date(@transaction_entries) do |entries| %>
<%= render entries.reject { |e| e.transfer_id.present? }, selectable: true %>
<%= render transfer_entries(entries), selectable: false %>
<% end %>
</div>
</div>

View file

@ -1,10 +1,3 @@
<%= modal do %>
<article class="mx-auto p-4 space-y-4 w-screen max-w-xl">
<header class="flex justify-between">
<h2 class="font-medium text-xl"><%= t(".new_transaction") %></h2>
<%= lucide_icon "x", class: "w-5 h-5 text-gray-500", data: { action: "click->modal#close" } %>
</header>
<%= render "form", transaction: @transaction, entry: @entry %>
</article>
<%= modal_form_wrapper title: t(".new_transaction") do %>
<%= render "form", transaction: @transaction, entry: @entry %>
<% end %>