mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-26 17:34:27 +01:00
Update price display (#4736)
* Update price display As proposed by @dstrukt in #4364. * Update format * Unify price display across the app * Add DisplayFormatter * Replace DisplayFormatCurrency method * Use symbol currency format for invoice * Unify currency formats on backend pages * Revert recent changes * Do not show exchange rate and fiat order amount for crypto denominations * Fix test and add test cases
This commit is contained in:
@@ -183,37 +183,37 @@
|
||||
</noscript>
|
||||
<script type="text/x-template" id="payment-details">
|
||||
<dl>
|
||||
<div v-if="orderAmount > 0">
|
||||
<div v-if="orderAmount > 0" id="PaymentDetails-TotalPrice">
|
||||
<dt v-t="'total_price'"></dt>
|
||||
<dd :data-clipboard="srvModel.orderAmount" :data-clipboard-confirm="$t('copy_confirm')">{{srvModel.orderAmount}} {{ srvModel.cryptoCode }}</dd>
|
||||
</div>
|
||||
<div v-if="orderAmount > 0 && srvModel.orderAmountFiat">
|
||||
<div v-if="orderAmount > 0 && srvModel.orderAmountFiat" id="PaymentDetails-TotalFiat">
|
||||
<dt v-t="'total_fiat'"></dt>
|
||||
<dd :data-clipboard="srvModel.orderAmountFiat" :data-clipboard-confirm="$t('copy_confirm')">{{srvModel.orderAmountFiat}}</dd>
|
||||
</div>
|
||||
<div v-if="srvModel.rate && srvModel.cryptoCode">
|
||||
<div v-if="srvModel.rate && srvModel.cryptoCode" id="PaymentDetails-ExchangeRate">
|
||||
<dt v-t="'exchange_rate'"></dt>
|
||||
<dd :data-clipboard="srvModel.rate" :data-clipboard-confirm="$t('copy_confirm')">
|
||||
<template v-if="srvModel.cryptoCode === 'sats'">1 sat = {{ srvModel.rate }}</template>
|
||||
<template v-else>1 {{ srvModel.cryptoCode }} = {{ srvModel.rate }}</template>
|
||||
</dd>
|
||||
</div>
|
||||
<div v-if="srvModel.networkFee">
|
||||
<div v-if="srvModel.networkFee" id="PaymentDetails-NetworkCost">
|
||||
<dt v-t="'network_cost'"></dt>
|
||||
<dd :data-clipboard="srvModel.networkFee" :data-clipboard-confirm="$t('copy_confirm')">
|
||||
<div v-if="srvModel.txCountForFee > 0" v-t="{ path: 'tx_count', args: { count: srvModel.txCount } }"></div>
|
||||
<div v-text="`${srvModel.networkFee} ${srvModel.cryptoCode}`"></div>
|
||||
</dd>
|
||||
</div>
|
||||
<div v-if="btcPaid > 0">
|
||||
<div v-if="btcPaid > 0" id="PaymentDetails-AmountPaid">
|
||||
<dt v-t="'amount_paid'"></dt>
|
||||
<dd :data-clipboard="srvModel.btcPaid" :data-clipboard-confirm="$t('copy_confirm')" v-text="`${srvModel.btcPaid} ${srvModel.cryptoCode}`"></dd>
|
||||
</div>
|
||||
<div v-if="btcDue > 0">
|
||||
<div v-if="btcDue > 0" id="PaymentDetails-AmountDue">
|
||||
<dt v-t="'amount_due'"></dt>
|
||||
<dd :data-clipboard="srvModel.btcDue" :data-clipboard-confirm="$t('copy_confirm')" v-text="`${srvModel.btcDue} ${srvModel.cryptoCode}`"></dd>
|
||||
</div>
|
||||
<div v-if="showRecommendedFee">
|
||||
<div v-if="showRecommendedFee" id="PaymentDetails-RecommendedFee">
|
||||
<dt v-t="'recommended_fee'"></dt>
|
||||
<dd :data-clipboard="srvModel.feeRate" :data-clipboard-confirm="$t('copy_confirm')" v-t="{ path: 'fee_rate', args: { feeRate: srvModel.feeRate } }"></dd>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
@model BTCPayServer.Models.InvoicingModels.InvoiceReceiptViewModel
|
||||
@using BTCPayServer.Client
|
||||
@using BTCPayServer.Client.Models
|
||||
@using BTCPayServer.Services.Rates
|
||||
@inject BTCPayServer.Services.BTCPayServerEnvironment Env
|
||||
@inject BTCPayServer.Services.ThemeSettings Theme
|
||||
@inject CurrencyNameTable CurrencyNameTable
|
||||
@using BTCPayServer.Components.QRCode
|
||||
@using BTCPayServer.Services
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@using BTCPayServer.Abstractions.TagHelpers
|
||||
@inject BTCPayServerEnvironment Env
|
||||
@inject DisplayFormatter DisplayFormatter
|
||||
@{
|
||||
Layout = null;
|
||||
ViewData["Title"] = $"Receipt from {Model.StoreName}";
|
||||
@@ -66,7 +68,7 @@
|
||||
</button>
|
||||
<dd class="text-muted mb-0 fw-semibold">Amount Paid</dd>
|
||||
</div>
|
||||
<dt class="fs-2 mb-0 text-nowrap fw-semibold">@CurrencyNameTable.DisplayFormatCurrency(Model.Amount, Model.Currency)</dt>
|
||||
<dt class="fs-2 mb-0 text-nowrap fw-semibold">@DisplayFormatter.Currency(Model.Amount, Model.Currency, DisplayFormatter.CurrencyFormat.Symbol)</dt>
|
||||
</div>
|
||||
<div class="d-flex flex-column">
|
||||
<dd class="text-muted mb-0 fw-semibold">Date</dd>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@using BTCPayServer.Client
|
||||
@using BTCPayServer.Client.Models
|
||||
@using BTCPayServer.Services
|
||||
@inject DisplayFormatter DisplayFormatter
|
||||
@model InvoicesModel
|
||||
@{
|
||||
ViewData.SetActivePage(InvoiceNavPages.Index, "Invoices");
|
||||
@@ -371,7 +373,7 @@
|
||||
<span class="badge bg-warning">Refund</span>
|
||||
}
|
||||
</td>
|
||||
<td class="text-end text-nowrap">@invoice.AmountCurrency</td>
|
||||
<td class="text-end text-nowrap">@DisplayFormatter.Currency(invoice.Amount, invoice.Currency)</td>
|
||||
<td class="text-end text-nowrap">
|
||||
@if (invoice.ShowCheckout)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user