Adds fiat currency balances to user balances
Extends user balance information to include fiat currency balances, calculated based on entry line metadata and account types. This allows for a more comprehensive view of user balances, including both satoshi and fiat currency holdings. Updates the castle index template and API to display fiat balances.
This commit is contained in:
parent
be386f60ef
commit
b0705fc24a
5 changed files with 116 additions and 4 deletions
|
|
@ -79,6 +79,11 @@
|
|||
<div class="text-h4" :class="balance.balance >= 0 ? 'text-negative' : 'text-positive'">
|
||||
{% raw %}{{ formatSats(Math.abs(balance.balance)) }} sats{% endraw %}
|
||||
</div>
|
||||
<div v-if="balance.fiat_balances && Object.keys(balance.fiat_balances).length > 0" class="text-h6 q-mt-sm">
|
||||
<span v-for="(amount, currency) in balance.fiat_balances" :key="currency" class="q-mr-md">
|
||||
{% raw %}{{ formatFiat(Math.abs(amount), currency) }}{% endraw %}
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-subtitle2" v-if="isSuperUser">
|
||||
{% raw %}{{ balance.balance > 0 ? 'Total you owe' : balance.balance < 0 ? 'Total owed to you' : 'No outstanding balances' }}{% endraw %}
|
||||
</div>
|
||||
|
|
@ -126,6 +131,11 @@
|
|||
<div :class="props.row.balance > 0 ? 'text-negative' : 'text-positive'">
|
||||
{% raw %}{{ formatSats(Math.abs(props.row.balance)) }} sats{% endraw %}
|
||||
</div>
|
||||
<div v-if="props.row.fiat_balances && Object.keys(props.row.fiat_balances).length > 0" class="text-caption">
|
||||
<span v-for="(amount, currency) in props.row.fiat_balances" :key="currency" class="q-mr-sm">
|
||||
{% raw %}{{ formatFiat(Math.abs(amount), currency) }}{% endraw %}
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-caption text-grey">
|
||||
{% raw %}{{ props.row.balance > 0 ? 'You owe' : 'Owes you' }}{% endraw %}
|
||||
</div>
|
||||
|
|
@ -316,7 +326,14 @@
|
|||
<div class="text-h6 q-mb-md">Pay Balance</div>
|
||||
|
||||
<div v-if="balance" class="q-mb-md">
|
||||
Amount owed: <strong>{% raw %}{{ formatSats(Math.abs(balance.balance)) }}{% endraw %} sats</strong>
|
||||
<div>
|
||||
Amount owed: <strong>{% raw %}{{ formatSats(Math.abs(balance.balance)) }}{% endraw %} sats</strong>
|
||||
</div>
|
||||
<div v-if="balance.fiat_balances && Object.keys(balance.fiat_balances).length > 0" class="text-body2 q-mt-xs">
|
||||
<span v-for="(amount, currency) in balance.fiat_balances" :key="currency" class="q-mr-md">
|
||||
<strong>{% raw %}{{ formatFiat(Math.abs(amount), currency) }}{% endraw %}</strong>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="!payDialog.paymentRequest">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue