mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Update hard-coded currency UI with currency specific params (#488)
* Update hard-coded currency UI with currency specific params * Rename extension methods to match currency option names; Move cents extension to numeric class extension * Use currency's precision to show the cents part in accounts show page --------- Co-authored-by: Sriram Krishnan <sriram@seafoodsouq.com>
This commit is contained in:
parent
1968fb0145
commit
7e883c4439
6 changed files with 78 additions and 5 deletions
|
@ -11,7 +11,7 @@
|
|||
<div class="flex items-center gap-3">
|
||||
<div class="relative cursor-not-allowed">
|
||||
<div class="flex items-center gap-2 px-3 py-2">
|
||||
<span class="text-gray-900">USD $</span>
|
||||
<span class="text-gray-900"><%= @account.original_currency %> <%= @account.original_currency.unit %></span>
|
||||
<%= lucide_icon("chevron-down", class: "w-5 h-5 text-gray-500") %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -29,9 +29,11 @@
|
|||
<p class="text-sm text-gray-500">Total Value</p>
|
||||
<%# TODO: Will need a better way to split a formatted monetary value into these 3 parts %>
|
||||
<p class="text-gray-900">
|
||||
<span class="text-gray-500"><%= number_to_currency(@account.original_balance)[0] %></span>
|
||||
<span class="text-xl font-medium"><%= number_with_delimiter(@account.original_balance.round) %></span>
|
||||
<span class="text-gray-500">.<%= number_to_currency(@account.original_balance, precision: 2)[-2, 2] %></span>
|
||||
<span class="text-gray-500"><%= @account.original_currency.unit %></span>
|
||||
<span class="text-xl font-medium"><%= format_currency(@account.original_balance, precision: 0, unit: '') %></span>
|
||||
<%- if @account.original_currency.precision.positive? -%>
|
||||
<span class="text-gray-500"><%= @account.original_currency.separator %><%= @account.original_balance.cents(precision: @account.original_currency.precision) %></span>
|
||||
<% end %>
|
||||
</p>
|
||||
<% if @balance_series.nil? %>
|
||||
<p class="text-sm text-gray-500">Data not available for the selected period</p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue