btcpayserver/BTCPayServer/Views/Invoice/PosData.cshtml
nicolas.dorier 649f650da6
Fix build
2021-09-10 00:16:28 +09:00

53 lines
1.7 KiB
Plaintext

@model (Dictionary<string, object> Items, int Level)
<table class="table table-hover table-responsive-md removetopborder">
@foreach (var (key, value) in Model.Items)
{
<tr>
@if (value is string str)
{
if (!string.IsNullOrEmpty(key))
{
<th class="w-150px">@key</th>
}
<td>
@if (str.StartsWith("http"))
{
<a href="@str" target="_blank" rel="noreferrer noopener">@str</a>
}
else
{
@value
}
</td>
}
else if (value is Dictionary<string, object>subItems)
{
@* This is the array case *@
if (subItems.Count == 1 && subItems.First().Value is string str2)
{
<th class="w-150px">@key</th>
<td>
@if (str2.StartsWith("http"))
{
<a href="@str2" target="_blank" rel="noreferrer noopener">@str2</a>
}
else
{
@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>