1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-08 06:55:21 +02:00
Maybe/app/views/valuations/_confirmation_contents.html.erb
Zach Gollwitzer e8eb32d2ae
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions
Start and end balance breakdown in activity view (#2466)
* Initial data objects

* Remove trend calculator

* Fill in balance reconciliation for entry group

* Initial tooltip component

* Balance trends in activity view

* Lint fixes

* trade partial alignment fix

* Tweaks to balance calculation to acknowledge holdings value better

* More lint fixes

* Bump brakeman dep

* Test fixes

* Remove unused class
2025-07-18 17:56:25 -04:00

51 lines
2.1 KiB
Text

<%# locals: (account:, entry:, reconciliation_dry_run:, is_update:, action_verb:) %>
<div class="space-y-4 text-sm text-secondary">
<% if account.investment? %>
<% brokerage_cash = reconciliation_dry_run.new_cash_balance || 0 %>
<% holdings_value = reconciliation_dry_run.new_balance - brokerage_cash %>
<p>This will <%= action_verb %> the account value on <span class="font-medium text-primary"><%= entry.date.strftime("%B %d, %Y") %></span> to:</p>
<div class="bg-container rounded-lg p-4 space-y-2 border border-primary">
<div class="flex justify-between">
<span>Total account value</span>
<span class="font-medium text-primary"><%= Money.new(reconciliation_dry_run.new_balance, account.currency).format %></span>
</div>
<div class="flex justify-between text-xs">
<span>Holdings value</span>
<span><%= Money.new(holdings_value, account.currency).format %></span>
</div>
<div class="flex justify-between text-xs">
<span>Brokerage cash</span>
<span class="<%= brokerage_cash.negative? ? "text-red-500" : "text-green-500" %>"><%= Money.new(brokerage_cash, account.currency).format %></span>
</div>
</div>
<% else %>
<p><%= action_verb.capitalize %>
<% if account.depository? %>
account balance
<% elsif account.credit_card? %>
credit card balance
<% elsif account.loan? %>
loan balance
<% elsif account.property? %>
property value
<% elsif account.vehicle? %>
vehicle value
<% elsif account.crypto? %>
crypto balance
<% elsif account.other_asset? %>
asset value
<% elsif account.other_liability? %>
liability balance
<% else %>
balance
<% end %>
on <span class="font-medium text-primary"><%= entry.date.strftime("%B %d, %Y") %></span> to
<span class="font-medium text-primary"><%= entry.amount_money.format %></span>.
</p>
<% end %>
<p>All future transactions and balances will be recalculated based on this <%= is_update ? "change" : "update" %>.</p>
</div>