mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-20 13:34:37 +01:00
Applying conventions from ListInvoice on PaymentRequests
This commit is contained in:
parent
9d9d0461ad
commit
e3a8e1a187
3 changed files with 61 additions and 51 deletions
|
@ -76,10 +76,11 @@ namespace BTCPayServer.Controllers
|
|||
});
|
||||
return View(new ListPaymentRequestsViewModel()
|
||||
{
|
||||
IncludeArchived = includeArchived,
|
||||
Skip = skip,
|
||||
Count = count,
|
||||
Total = result.Total,
|
||||
SearchTerm = searchTerm,
|
||||
TimezoneOffset = timezoneOffset,
|
||||
Items = result.Items.Select(data => new ViewPaymentRequestViewModel(data)).ToList()
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@ namespace BTCPayServer.Models.PaymentRequestViewModels
|
|||
{
|
||||
public int Skip { get; set; }
|
||||
public int Count { get; set; }
|
||||
|
||||
public int Total { get; set; }
|
||||
public string SearchTerm { get; set; }
|
||||
public int? TimezoneOffset { get; set; }
|
||||
public List<ViewPaymentRequestViewModel> Items { get; set; }
|
||||
|
||||
public int Total { get; set; }
|
||||
public bool IncludeArchived { get; set; }
|
||||
}
|
||||
|
||||
public class UpdatePaymentRequestViewModel
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
{
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<partial name="_StatusMessage"/>
|
||||
<partial name="_StatusMessage" />
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
@ -18,10 +18,35 @@
|
|||
<div class="col-lg-12 section-heading">
|
||||
<h2>Payment Requests</h2>
|
||||
<hr class="primary">
|
||||
<p>Create, search or pay an payment request.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form asp-action="GetPaymentRequests" method="get" style="float:right;">
|
||||
<input type="hidden" asp-for="Count" />
|
||||
<div class="input-group">
|
||||
<input asp-for="TimezoneOffset" type="hidden" />
|
||||
<input asp-for="SearchTerm" class="form-control" style="width:300px;" />
|
||||
<div class="input-group-append">
|
||||
<button type="submit" class="btn btn-primary" title="Search invoice">
|
||||
<span class="fa fa-search"></span> Search
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="/payment-requests?Count=@Model.Count&SearchTerm=includearchived%3Atrue">Include Archived Payment Reqs</a>
|
||||
<div role="separator" class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="/payment-requests?SearchTerm=">Unfiltered</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span asp-validation-for="SearchTerm" class="text-danger"></span>
|
||||
</form>
|
||||
|
||||
<div class="row button-row">
|
||||
<div class="col-lg-12">
|
||||
<div class="col-lg-24">
|
||||
<a asp-action="EditPaymentRequest" class="btn btn-primary" role="button" id="CreatePaymentRequest"><span class="fa fa-plus"></span> Create a new payment request</a>
|
||||
<a href="https://docs.btcpayserver.org/PaymentRequests/" target="_blank">
|
||||
<span class="fa fa-question-circle-o" title="More information..."></span>
|
||||
|
@ -32,37 +57,37 @@
|
|||
<div class="col-lg-12">
|
||||
<table class="table table-sm table-responsive-md">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Expiry</th>
|
||||
<th class="text-right">Price</th>
|
||||
<th class="text-right">Status</th>
|
||||
<th class="text-right">Actions</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Expiry</th>
|
||||
<th class="text-right">Price</th>
|
||||
<th class="text-right">Status</th>
|
||||
<th class="text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model.Items)
|
||||
{
|
||||
<tr>
|
||||
<td>@item.Title</td>
|
||||
<td>@(item.ExpiryDate?.ToString("g") ?? "No Expiry")</td>
|
||||
<td class="text-right">@item.Amount @item.Currency</td>
|
||||
<td class="text-right">@item.Status</td>
|
||||
<td class="text-right">
|
||||
<a asp-action="EditPaymentRequest" asp-route-id="@item.Id">Edit</a>
|
||||
<span> - </span>
|
||||
<a asp-action="ViewPaymentRequest" asp-route-id="@item.Id">View</a>
|
||||
<span> - </span>
|
||||
<a target="_blank" asp-action="ListInvoices" asp-controller="Invoice" asp-route-searchterm="@($"orderid:{PaymentRequestRepository.GetOrderIdForPaymentRequest(item.Id)}")">Invoices</a>
|
||||
<span> - </span>
|
||||
<a target="_blank" asp-action="PayPaymentRequest" asp-route-id="@item.Id">Pay</a>
|
||||
<span> - </span>
|
||||
<a target="_blank" asp-action="ClonePaymentRequest" asp-route-id="@item.Id">Clone</a>
|
||||
<span> - </span>
|
||||
<a asp-action="TogglePaymentRequestArchival" asp-route-id="@item.Id">@(item.Archived ? "Unarchive" : "Archive")</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@foreach (var item in Model.Items)
|
||||
{
|
||||
<tr>
|
||||
<td>@item.Title</td>
|
||||
<td>@(item.ExpiryDate?.ToString("g") ?? "No Expiry")</td>
|
||||
<td class="text-right">@item.Amount @item.Currency</td>
|
||||
<td class="text-right">@item.Status</td>
|
||||
<td class="text-right">
|
||||
<a asp-action="EditPaymentRequest" asp-route-id="@item.Id">Edit</a>
|
||||
<span> - </span>
|
||||
<a asp-action="ViewPaymentRequest" asp-route-id="@item.Id">View</a>
|
||||
<span> - </span>
|
||||
<a target="_blank" asp-action="ListInvoices" asp-controller="Invoice" asp-route-searchterm="@($"orderid:{PaymentRequestRepository.GetOrderIdForPaymentRequest(item.Id)}")">Invoices</a>
|
||||
<span> - </span>
|
||||
<a target="_blank" asp-action="PayPaymentRequest" asp-route-id="@item.Id">Pay</a>
|
||||
<span> - </span>
|
||||
<a target="_blank" asp-action="ClonePaymentRequest" asp-route-id="@item.Id">Clone</a>
|
||||
<span> - </span>
|
||||
<a asp-action="TogglePaymentRequestArchival" asp-route-id="@item.Id">@(item.Archived ? "Unarchive" : "Archive")</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -95,22 +120,6 @@
|
|||
|
||||
</ul>
|
||||
</nav>
|
||||
<a class="ml-2 mt-1" href="@Url.Action("GetPaymentRequests", new
|
||||
{
|
||||
skip = Model.Skip,
|
||||
count = Model.Count,
|
||||
searchTerm = "includearchived:"+ !Model.IncludeArchived
|
||||
})">
|
||||
@if (Model.IncludeArchived)
|
||||
{
|
||||
<span> Hide archived payment requests. </span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span> Show archived payment requests.</span>
|
||||
}
|
||||
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue