diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index ce6d2848b..46d5dfe1c 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -2881,7 +2881,7 @@ namespace BTCPayServer.Tests Assert.Single(paymentTypes["On-Chain"]); // 2 on-chain transactions: It received from the cashcow, then paid its own invoice - report = await GetReport(acc, new() { ViewName = "On-Chain Wallets" }); + report = await GetReport(acc, new() { ViewName = "Wallets" }); var txIdIndex = report.GetIndex("TransactionId"); var balanceIndex = report.GetIndex("BalanceChange"); Assert.Equal(2, report.Data.Count); @@ -2889,7 +2889,7 @@ namespace BTCPayServer.Tests Assert.Contains(report.Data, d => d[balanceIndex]["v"].Value() == 1.0m); // Items sold - report = await GetReport(acc, new() { ViewName = "Products sold" }); + report = await GetReport(acc, new() { ViewName = "Sales" }); var itemIndex = report.GetIndex("Product"); var countIndex = report.GetIndex("Quantity"); var itemsCount = report.Data.GroupBy(d => d[itemIndex].Value()) diff --git a/BTCPayServer/Components/TruncateCenter/Default.cshtml b/BTCPayServer/Components/TruncateCenter/Default.cshtml index f7744dc50..79fea8db6 100644 --- a/BTCPayServer/Components/TruncateCenter/Default.cshtml +++ b/BTCPayServer/Components/TruncateCenter/Default.cshtml @@ -9,7 +9,15 @@ @if (Model.IsVue) { - + @if (Model.Elastic) + { + + } + else + { + + + } @@ -33,7 +41,7 @@ } @if (!string.IsNullOrEmpty(Model.Link)) { - + } diff --git a/BTCPayServer/Services/Reporting/OnChainWalletReportProvider.cs b/BTCPayServer/Services/Reporting/OnChainWalletReportProvider.cs index 31cf815d4..cc4b62476 100644 --- a/BTCPayServer/Services/Reporting/OnChainWalletReportProvider.cs +++ b/BTCPayServer/Services/Reporting/OnChainWalletReportProvider.cs @@ -27,7 +27,7 @@ public class OnChainWalletReportProvider : ReportProvider private StoreRepository StoreRepository { get; } private BTCPayNetworkProvider NetworkProvider { get; } private WalletRepository WalletRepository { get; } - public override string Name => "On-Chain Wallets"; + public override string Name => "Wallets"; ViewDefinition CreateViewDefinition() { return new() diff --git a/BTCPayServer/Services/Reporting/PaymentsReportProvider.cs b/BTCPayServer/Services/Reporting/PaymentsReportProvider.cs index 91fc78fa1..134b88f7d 100644 --- a/BTCPayServer/Services/Reporting/PaymentsReportProvider.cs +++ b/BTCPayServer/Services/Reporting/PaymentsReportProvider.cs @@ -58,7 +58,7 @@ public class PaymentsReportProvider : ReportProvider }, new () { - Name = "Aggregated currency amount", + Name = "Aggregated amount", Groups = { "Currency" }, Totals = { "Currency" }, HasGrandTotal = false, @@ -66,7 +66,7 @@ public class PaymentsReportProvider : ReportProvider }, new () { - Name = "Group by Lightning Address (Currency amount)", + Name = "Group by Lightning Address", Filters = { "typeof this.LightningAddress === 'string' && this.Crypto == \"BTC\"" }, Groups = { "LightningAddress", "Currency" }, Aggregates = { "CurrencyAmount" }, @@ -74,7 +74,7 @@ public class PaymentsReportProvider : ReportProvider }, new () { - Name = "Group by Lightning Address (Crypto amount)", + Name = "Group by Lightning Address (Crypto)", Filters = { "typeof this.LightningAddress === 'string' && this.Crypto == \"BTC\"" }, Groups = { "LightningAddress", "Crypto" }, Aggregates = { "CryptoAmount" }, diff --git a/BTCPayServer/Services/Reporting/ProductsReportProvider.cs b/BTCPayServer/Services/Reporting/ProductsReportProvider.cs index 980273fe5..d83f9d0de 100644 --- a/BTCPayServer/Services/Reporting/ProductsReportProvider.cs +++ b/BTCPayServer/Services/Reporting/ProductsReportProvider.cs @@ -22,7 +22,7 @@ public class ProductsReportProvider : ReportProvider private InvoiceRepository InvoiceRepository { get; } private AppService Apps { get; } - public override string Name => "Products sold"; + public override string Name => "Sales"; public override async Task Query(QueryContext queryContext, CancellationToken cancellation) { @@ -114,7 +114,7 @@ public class ProductsReportProvider : ReportProvider { new () { - Name = "Summary by products", + Name = "Summary", Groups = { "AppId", "Currency", "State", "Product" }, Aggregates = { "Quantity", "CurrencyAmount" }, Totals = { "State" } diff --git a/BTCPayServer/Views/UIReports/StoreReports.cshtml b/BTCPayServer/Views/UIReports/StoreReports.cshtml index 1a77cbfc9..cf78301ab 100644 --- a/BTCPayServer/Views/UIReports/StoreReports.cshtml +++ b/BTCPayServer/Views/UIReports/StoreReports.cshtml @@ -16,7 +16,11 @@ { @* Set a height for the responsive table container to make it work with the fixed table headers. Details described here: thttps://uxdesign.cc/position-stuck-96c9f55d9526 *@ - + } @@ -64,35 +66,47 @@
-
-

{{ chart.name }}

-
- - - - - - - - - - - - - +
+
+

{{ chart.name }}

+
+
{{ titleCase(group) }}{{ titleCase(agg) }}
{{ group.name }}Total{{ displayValue(value) }}
+ + + + + + + + + + + + - -
{{ titleCase(group, true) }}{{ titleCase(agg, true) }}
+ + + + + Total + + + +
Grand Total {{ displayValue(value) }}
-
-

No data

-
+ + +
+ +

Raw data

- +
- diff --git a/BTCPayServer/wwwroot/img/icon-sprite.svg b/BTCPayServer/wwwroot/img/icon-sprite.svg index 1d8da0c59..d438dafec 100644 --- a/BTCPayServer/wwwroot/img/icon-sprite.svg +++ b/BTCPayServer/wwwroot/img/icon-sprite.svg @@ -9,6 +9,7 @@ + diff --git a/BTCPayServer/wwwroot/js/store-reports.js b/BTCPayServer/wwwroot/js/store-reports.js index 883a42a75..12a958dff 100644 --- a/BTCPayServer/wwwroot/js/store-reports.js +++ b/BTCPayServer/wwwroot/js/store-reports.js @@ -131,16 +131,28 @@ document.addEventListener("DOMContentLoaded", () => { el: '#app', data() { return { srv } }, methods: { - titleCase(str) { - const result = str.replace(/([A-Z])/g, " $1"); - return result.charAt(0).toUpperCase() + result.slice(1); + hasChartData(chart) { + return chart.rows.length || chart.hasGrandTotal; }, - displayValue + titleCase(str, shorten) { + const result = str.replace(/([A-Z])/g, " $1"); + const title = result.charAt(0).toUpperCase() + result.slice(1) + return shorten && title.endsWith(' Amount') ? 'Amount' : title; + }, + displayValue, + displayDate } }); fetchStoreReports(); }); +const dtFormatter = new Intl.DateTimeFormat('default', { dateStyle: 'short', timeStyle: 'short' }); + +function displayDate(val) { + const date = new Date(val); + return dtFormatter.format(date); +} + function displayValue(val) { return val && typeof val === "object" && typeof val.d === "number" ? new Decimal(val.v).toFixed(val.d) : val; } diff --git a/BTCPayServer/wwwroot/main/bootstrap/bootstrap.css b/BTCPayServer/wwwroot/main/bootstrap/bootstrap.css index 287d389d5..7a5a0af32 100644 --- a/BTCPayServer/wwwroot/main/bootstrap/bootstrap.css +++ b/BTCPayServer/wwwroot/main/bootstrap/bootstrap.css @@ -12161,6 +12161,7 @@ fieldset:disabled .btn { *::-webkit-scrollbar { width: var(--btcpay-scrollbar-width); + height: var(--btcpay-scrollbar-width); } *::-webkit-scrollbar-track { diff --git a/BTCPayServer/wwwroot/main/layout.css b/BTCPayServer/wwwroot/main/layout.css index 0eb764d76..06fd7f778 100644 --- a/BTCPayServer/wwwroot/main/layout.css +++ b/BTCPayServer/wwwroot/main/layout.css @@ -687,7 +687,7 @@ #mainContent > section .w-100-fixed { /* constrains the content to respect the maximum width and enable responsive tables */ - width: calc(100vw - var(--sidebar-width) - var(--content-padding-horizontal) * 2); + width: calc(100vw - var(--sidebar-width) - var(--btcpay-scrollbar-width) - var(--content-padding-horizontal) * 2); } #SectionNav .nav {
@@ -109,14 +123,25 @@
+ {{ displayValue(value) }} - {{ displayValue(value) }} + + + + + + {{ displayValue(value) }} + {{ displayValue(value) }} + {{ displayValue(value) }}