mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-20 10:40:29 +01:00
0cc24c8076
* UI: Improve invoice view - General improvements for the spacings on the page - Hides rows of data in case they aren't present - Improved the PoS data view so that it renders complex objects nicely and adds links for URLs TDB: For the last row "Links" there's now a special `_urls` property, which renders a list of urls with the key being the title and the value being the URL. * Update BTCPayServer/Views/Invoice/Invoice.cshtml Co-authored-by: Andrew Camilleri <evilkukka@gmail.com> * UI: Handle arrays in PosData view Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>
53 lines
1.4 KiB
Plaintext
53 lines
1.4 KiB
Plaintext
@model (Dictionary<string, object> Items, int Level)
|
|
|
|
@functions{
|
|
void DisplayValue(object value)
|
|
{
|
|
if (value is string str && str.StartsWith("http"))
|
|
{
|
|
<a href="@str" target="_blank">@str</a>
|
|
}
|
|
else
|
|
{
|
|
@value
|
|
}
|
|
}
|
|
}
|
|
|
|
<table class="table table-sm table-responsive-md removetopborder">
|
|
@foreach (var (key, value) in Model.Items)
|
|
{
|
|
<tr>
|
|
@if (value is string)
|
|
{
|
|
if (!string.IsNullOrEmpty(key))
|
|
{
|
|
<th class="w-150px">@key</th>
|
|
}
|
|
<td>
|
|
@{ DisplayValue(value); }
|
|
</td>
|
|
}
|
|
else if (value is Dictionary<string, object>subItems)
|
|
{
|
|
@* This is the array case *@
|
|
if (subItems.Count == 1 && subItems.First().Value is string)
|
|
{
|
|
<th class="w-150px">@key</th>
|
|
<td>
|
|
@{ DisplayValue(subItems.First().Value); }
|
|
</td>
|
|
}
|
|
else
|
|
{
|
|
<td colspan="2">
|
|
@Html.Raw($"<h{Model.Level + 3} class='mt-3'>{key}</h{Model.Level + 3}>")
|
|
<partial name="PosData" model="(subItems, Model.Level + 1)"/>
|
|
</td>
|
|
}
|
|
}
|
|
</tr>
|
|
}
|
|
</table>
|
|
|