diff --git a/BTCPayServer/Controllers/InvoiceController.UI.cs b/BTCPayServer/Controllers/InvoiceController.UI.cs index cd2ed90cd..7fa628956 100644 --- a/BTCPayServer/Controllers/InvoiceController.UI.cs +++ b/BTCPayServer/Controllers/InvoiceController.UI.cs @@ -13,16 +13,12 @@ using BTCPayServer.Abstractions.Models; using BTCPayServer.Client; using BTCPayServer.Client.Models; using BTCPayServer.Data; -using BTCPayServer.Events; using BTCPayServer.Filters; -using BTCPayServer.Logging; using BTCPayServer.HostedServices; -using BTCPayServer.Models; using BTCPayServer.Models.InvoicingModels; using BTCPayServer.Payments; using BTCPayServer.Payments.Lightning; using BTCPayServer.Rating; -using BTCPayServer.Security; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Invoices.Export; using BTCPayServer.Services.Rates; @@ -104,6 +100,7 @@ namespace BTCPayServer.Controllers return NotFound(); var store = await _StoreRepository.FindStore(invoice.StoreId); + var invoiceState = invoice.GetInvoiceState(); var model = new InvoiceDetailsModel() { StoreId = store.Id, @@ -111,7 +108,7 @@ namespace BTCPayServer.Controllers StoreLink = Url.Action(nameof(StoresController.UpdateStore), "Stores", new { storeId = store.Id }), PaymentRequestLink = Url.Action(nameof(PaymentRequestController.ViewPaymentRequest), "PaymentRequest", new { id = invoice.Metadata.PaymentRequestId }), Id = invoice.Id, - State = invoice.GetInvoiceState().ToString(), + State = invoiceState.ToString(), TransactionSpeed = invoice.SpeedPolicy == SpeedPolicy.HighSpeed ? "high" : invoice.SpeedPolicy == SpeedPolicy.MediumSpeed ? "medium" : invoice.SpeedPolicy == SpeedPolicy.LowMediumSpeed ? "low-medium" : @@ -129,11 +126,13 @@ namespace BTCPayServer.Controllers Events = invoice.Events, PosData = PosDataParser.ParsePosData(invoice.Metadata.PosData), Archived = invoice.Archived, - CanRefund = CanRefund(invoice.GetInvoiceState()), + CanRefund = CanRefund(invoiceState), ShowCheckout = invoice.Status == InvoiceStatusLegacy.New, Deliveries = (await _InvoiceRepository.GetWebhookDeliveries(invoiceId)) .Select(c => new Models.StoreViewModels.DeliveryViewModel(c)) - .ToList() + .ToList(), + CanMarkInvalid = invoiceState.CanMarkInvalid(), + CanMarkComplete = invoiceState.CanMarkComplete(), }; model.Addresses = invoice.HistoricalAddresses.Select(h => new InvoiceDetailsModel.AddressModel diff --git a/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs b/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs index b5428cb78..8ee52cb36 100644 --- a/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs +++ b/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs @@ -126,5 +126,8 @@ namespace BTCPayServer.Models.InvoicingModels public bool Archived { get; set; } public bool CanRefund { get; set; } public bool ShowCheckout { get; set; } + public bool CanMarkComplete { get; set; } + public bool CanMarkInvalid { get; set; } + public bool CanMarkStatus => CanMarkComplete || CanMarkInvalid; } } diff --git a/BTCPayServer/Views/Invoice/Invoice.cshtml b/BTCPayServer/Views/Invoice/Invoice.cshtml index 66bb63e38..532f654e9 100644 --- a/BTCPayServer/Views/Invoice/Invoice.cshtml +++ b/BTCPayServer/Views/Invoice/Invoice.cshtml @@ -11,6 +11,38 @@ } +@section PageFootContent { + +} +
@@ -19,7 +51,6 @@

@ViewData["Title"]

- @if (Model.ShowCheckout) { @@ -92,7 +123,33 @@ State - @Model.State + + @if (Model.CanMarkStatus) + { + + } + else { + @Model.State + } + Created date diff --git a/BTCPayServer/wwwroot/main/site.css b/BTCPayServer/wwwroot/main/site.css index ec02b56f8..f1d7ab742 100644 --- a/BTCPayServer/wwwroot/main/site.css +++ b/BTCPayServer/wwwroot/main/site.css @@ -337,6 +337,17 @@ h2 small .fa-question-circle-o { .toasted-container { display: none !important; } + #markStatusDropdownMenuButton { + border: 0; + background: transparent; + padding: 0 !important; + color: inherit; + font-weight: var(--btcpay-font-weight-normal); + font-size: var(--btcpay-body-font-size); + } + #markStatusDropdownMenuButton::after { + content: none; + } } /* Richtext editor */