mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-06 22:15:20 +02:00
Add reconciliation manager (#2459)
* Add reconciliation manager * Fix notes editing
This commit is contained in:
parent
89cc64418e
commit
52333e3fa6
11 changed files with 273 additions and 64 deletions
|
@ -1,14 +1,16 @@
|
|||
<%# locals: (account:, entry:, reconciliation_dry_run:, is_update:, action_verb:) %>
|
||||
|
||||
<div class="space-y-4 text-sm text-secondary">
|
||||
<% if account.investment? %>
|
||||
<% holdings_value = account.investment.holdings_value_for_date(entry.date) %>
|
||||
<% brokerage_cash = entry.amount - holdings_value %>
|
||||
<% holdings_value = reconciliation_dry_run.new_balance - reconciliation_dry_run.new_cash_balance %>
|
||||
<% brokerage_cash = reconciliation_dry_run.new_cash_balance %>
|
||||
|
||||
<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"><%= entry.amount_money.format %></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>
|
||||
|
@ -20,7 +22,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<p><%= action_verb.capitalize %>
|
||||
<p><%= action_verb.capitalize %>
|
||||
<% if account.depository? %>
|
||||
account balance
|
||||
<% elsif account.credit_card? %>
|
||||
|
@ -40,10 +42,10 @@
|
|||
<% else %>
|
||||
balance
|
||||
<% end %>
|
||||
on <span class="font-medium text-primary"><%= entry.date.strftime("%B %d, %Y") %></span> to
|
||||
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>
|
||||
</div>
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
<%= render DialogComponent.new do |dialog| %>
|
||||
<% dialog.with_header(title: "Confirm new balance") %>
|
||||
<% dialog.with_body do %>
|
||||
<%= styled_form_with model: @entry, url: valuations_path, class: "space-y-4", data: { turbo: false } do |form| %>
|
||||
<%= styled_form_with model: @entry, url: valuations_path, class: "space-y-4" do |form| %>
|
||||
<%= form.hidden_field :account_id %>
|
||||
<%= form.hidden_field :date %>
|
||||
<%= form.hidden_field :amount %>
|
||||
<%= form.hidden_field :currency %>
|
||||
<%= form.hidden_field :notes %>
|
||||
|
||||
<%= render "confirmation_contents",
|
||||
account: @account,
|
||||
entry: @entry,
|
||||
action_verb: "set",
|
||||
<%= render "confirmation_contents",
|
||||
reconciliation_dry_run: @reconciliation_dry_run,
|
||||
account: @account,
|
||||
entry: @entry,
|
||||
action_verb: "set",
|
||||
is_update: false %>
|
||||
|
||||
<%= form.submit "Confirm" %>
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
<%= render DialogComponent.new do |dialog| %>
|
||||
<% dialog.with_header(title: "Update balance") %>
|
||||
<% dialog.with_body do %>
|
||||
<%= styled_form_with model: @entry, url: valuation_path(@entry), method: :patch, class: "space-y-4", data: { turbo: false } do |form| %>
|
||||
<%= styled_form_with model: @entry, url: valuation_path(@entry), method: :patch, class: "space-y-4", data: { turbo_frame: :_top } do |form| %>
|
||||
<%= form.hidden_field :date %>
|
||||
<%= form.hidden_field :amount %>
|
||||
<%= form.hidden_field :currency %>
|
||||
<%= form.hidden_field :notes %>
|
||||
|
||||
<%= render "confirmation_contents",
|
||||
account: @account,
|
||||
entry: @entry,
|
||||
action_verb: "update",
|
||||
<%= render "confirmation_contents",
|
||||
reconciliation_dry_run: @reconciliation_dry_run,
|
||||
account: @account,
|
||||
entry: @entry,
|
||||
action_verb: "update",
|
||||
is_update: true %>
|
||||
|
||||
<%= form.submit "Update" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -44,10 +44,7 @@
|
|||
url: valuation_path(entry),
|
||||
method: :patch,
|
||||
class: "space-y-2",
|
||||
data: { controller: "auto-submit-form" } do |f| %>
|
||||
<%= f.hidden_field :date, value: entry.date %>
|
||||
<%= f.hidden_field :amount, value: entry.amount %>
|
||||
<%= f.hidden_field :currency, value: entry.currency %>
|
||||
data: { controller: "auto-submit-form", auto_submit_form_trigger_event_value: "blur" } do |f| %>
|
||||
<%= f.text_area :notes,
|
||||
label: t(".note_label"),
|
||||
placeholder: t(".note_placeholder"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue