1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 07:39:39 +02:00
Maybe/app/views/loans/_overview.html.erb
Zach Gollwitzer 65db49273c
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions
Account Activity View + Account Forms (#1406)
* Remove balance mode, sketch out refactor

* Activity view checkpoint

* Entry partials, checkpoint

* Finish txn partial

* Give entries context when editing for different turbo responses

* Calculate change of balance for each entry

* Account tabs consolidation

* Translations, linting, brakeman updates

* Account actions concern

* Finalize forms, get account system tests passing

* Get tests passing

* Lint, rubocop, schema updates

* Improve routing and stream responses

* Fix broken routes

* Add import option for adding accounts

* Fix system test

* Fix test specificity

* Fix sparklines

* Improve account redirects
2024-11-04 20:27:31 -05:00

49 lines
1.5 KiB
Text

<%# locals: (account:) %>
<div class="grid grid-cols-3 gap-2">
<%= summary_card title: t(".original_principal") do %>
<%= format_money account.original_balance %>
<% end %>
<%= summary_card title: t(".remaining_principal") do %>
<%= format_money account.balance_money %>
<% end %>
<%= summary_card title: t(".interest_rate") do %>
<% if account.loan.interest_rate.present? %>
<%= number_to_percentage(account.loan.interest_rate, precision: 2) %>
<% else %>
<%= t(".unknown") %>
<% end %>
<% end %>
<%= summary_card title: t(".monthly_payment") do %>
<% if account.loan.rate_type.present? && account.loan.rate_type != 'fixed' %>
<%= t(".not_applicable") %>
<% elsif account.loan.rate_type == 'fixed' && account.loan.monthly_payment.present? %>
<%= format_money(account.loan.monthly_payment) %>
<% else %>
<%= t(".unknown") %>
<% end %>
<% end %>
<%= summary_card title: t(".term") do %>
<% if account.loan.term_months.present? %>
<% if account.loan.term_months < 12 %>
<%= pluralize(account.loan.term_months, "month") %>
<% else %>
<%= pluralize(account.loan.term_months / 12, "year") %>
<% end %>
<% else %>
<%= t(".unknown") %>
<% end %>
<% end %>
<%= summary_card title: t(".type") do %>
<%= account.loan.rate_type&.titleize || t(".unknown") %>
<% end %>
</div>
<div class="flex justify-center py-8">
<%= link_to "Edit loan details", edit_loan_path(account), class: "btn btn--ghost", data: { turbo_frame: :modal } %>
</div>