btcpayserver/BTCPayServer/Views/Shared/Lightning/ViewLightningLikePaymentData.cshtml
Dennis Reimann 0cc24c8076
UI: Improve invoice view (#2144)
* 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>
2020-12-16 09:15:33 +01:00

46 lines
1.5 KiB
Text

@using BTCPayServer.Payments
@using BTCPayServer.Payments.Lightning
@model IEnumerable<BTCPayServer.Services.Invoices.PaymentEntity>
@{
var offchainPayments = Model.Where(entity => entity.GetPaymentMethodId()?.PaymentType == LightningPaymentType.Instance).Select(payment =>
{
var offChainPaymentData = payment.GetCryptoPaymentData() as LightningLikePaymentData;
if (offChainPaymentData is null)
{
return null;
}
return new OffChainPaymentViewModel()
{
Crypto = payment.Network.CryptoCode,
BOLT11 = offChainPaymentData.BOLT11
};
}).Where(model => model != null);
}
@if (offchainPayments.Any())
{
<div class="row">
<div class="col-md-12 invoice-payments">
<h3>Off-Chain payments</h3>
<table class="table table-sm table-responsive-md">
<thead class="thead-inverse">
<tr>
<th class="w-150px">Crypto</th>
<th>BOLT11</th>
</tr>
</thead>
<tbody>
@foreach (var payment in offchainPayments)
{
<tr>
<td>@payment.Crypto</td>
<td><div class="wraptextAuto">@payment.BOLT11</div></td>
</tr>
}
</tbody>
</table>
</div>
</div>
}