mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
@@ -290,6 +290,24 @@ namespace BTCPayServer.Controllers
|
|||||||
return RedirectToAction(nameof(invoice), new { invoiceId });
|
return RedirectToAction(nameof(invoice), new { invoiceId });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> MassAction(string command, string[] selectedItems)
|
||||||
|
{
|
||||||
|
if (selectedItems != null)
|
||||||
|
{
|
||||||
|
switch (command)
|
||||||
|
{
|
||||||
|
case "archive":
|
||||||
|
await _InvoiceRepository.MassArchive(selectedItems);
|
||||||
|
TempData[WellKnownTempData.SuccessMessage] = $"{selectedItems.Length} invoice(s) archived.";
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return RedirectToAction(nameof(ListInvoices));
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("i/{invoiceId}")]
|
[Route("i/{invoiceId}")]
|
||||||
[Route("i/{invoiceId}/{paymentMethodId}")]
|
[Route("i/{invoiceId}/{paymentMethodId}")]
|
||||||
|
|||||||
@@ -403,6 +403,24 @@ retry:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task MassArchive(string[] invoiceIds)
|
||||||
|
{
|
||||||
|
using (var context = _ContextFactory.CreateContext())
|
||||||
|
{
|
||||||
|
var items = context.Invoices.Where(a => invoiceIds.Contains(a.Id));
|
||||||
|
if (items == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (InvoiceData invoice in items)
|
||||||
|
{
|
||||||
|
invoice.Archived = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task ToggleInvoiceArchival(string invoiceId, bool archived)
|
public async Task ToggleInvoiceArchival(string invoiceId, bool archived)
|
||||||
{
|
{
|
||||||
using (var context = _ContextFactory.CreateContext())
|
using (var context = _ContextFactory.CreateContext())
|
||||||
|
|||||||
@@ -45,22 +45,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row button-row">
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<a asp-action="CreateInvoice" class="btn btn-primary" role="button" id="CreateNewInvoice"><span class="fa fa-plus"></span> Create a new invoice</a>
|
|
||||||
<a class="btn btn-primary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
||||||
Export
|
|
||||||
</a>
|
|
||||||
<a href="https://docs.btcpayserver.org/Accounting/" target="_blank">
|
|
||||||
<span class="fa fa-question-circle-o" title="More information..."></span>
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
|
|
||||||
<a asp-action="Export" asp-route-timezoneoffset="0" asp-route-format="csv" asp-route-searchTerm="@Model.SearchTerm" class="dropdown-item export-link" target="_blank">CSV</a>
|
|
||||||
<a asp-action="Export" asp-route-timezoneoffset="0" asp-route-format="json" asp-route-searchTerm="@Model.SearchTerm" class="dropdown-item export-link" target="_blank">JSON</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<form asp-action="ListInvoices" method="get" style="float:right;">
|
<form asp-action="ListInvoices" method="get" style="float:right;">
|
||||||
<input type="hidden" asp-for="Count" />
|
<input type="hidden" asp-for="Count" />
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -101,7 +85,33 @@
|
|||||||
</div>
|
</div>
|
||||||
<span asp-validation-for="SearchTerm" class="text-danger"></span>
|
<span asp-validation-for="SearchTerm" class="text-danger"></span>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<form method="post" id="MassAction" asp-action="MassAction">
|
||||||
|
<div class="row button-row">
|
||||||
|
<div class="col-lg-24">
|
||||||
|
<a asp-action="CreateInvoice" class="btn btn-primary" role="button" id="CreateNewInvoice"><span class="fa fa-plus"></span> Create a new invoice</a>
|
||||||
|
|
||||||
|
<span>
|
||||||
|
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
Actions
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<button type="submit" asp-action="MassAction" class="dropdown-item" name="command" value="archive"><i class="fa fa-archive"></i> Archive</button>
|
||||||
</div>
|
</div>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span>
|
||||||
|
<a class="btn btn-primary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
Export
|
||||||
|
</a>
|
||||||
|
<a href="https://docs.btcpayserver.org/Accounting/" target="_blank">
|
||||||
|
<span class="fa fa-question-circle-o" title="More information..."></span>
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
|
||||||
|
<a asp-action="Export" asp-route-timezoneoffset="0" asp-route-format="csv" asp-route-searchTerm="@Model.SearchTerm" class="dropdown-item export-link" target="_blank">CSV</a>
|
||||||
|
<a asp-action="Export" asp-route-timezoneoffset="0" asp-route-format="json" asp-route-searchTerm="@Model.SearchTerm" class="dropdown-item export-link" target="_blank">JSON</a>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -183,11 +193,26 @@
|
|||||||
</script>
|
</script>
|
||||||
@* Custom Range Modal *@
|
@* Custom Range Modal *@
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function selectAll(e)
|
||||||
|
{
|
||||||
|
var items = document.getElementsByClassName("selector");
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
items[i].checked = e.checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<table class="table table-sm table-responsive-md">
|
<table class="table table-sm table-responsive-md">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th class="only-for-js">
|
||||||
|
@if (Model.Total > 0)
|
||||||
|
{
|
||||||
|
<input id="selectAllCheckbox" type="checkbox" onclick="selectAll(this);" />
|
||||||
|
}
|
||||||
|
</th>
|
||||||
<th style="min-width: 90px;" class="col-md-auto">
|
<th style="min-width: 90px;" class="col-md-auto">
|
||||||
Date
|
Date
|
||||||
<a href="javascript:switchTimeFormat()">
|
<a href="javascript:switchTimeFormat()">
|
||||||
@@ -205,6 +230,9 @@
|
|||||||
@foreach (var invoice in Model.Invoices)
|
@foreach (var invoice in Model.Invoices)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
|
<td class="only-for-js">
|
||||||
|
<input name="selectedItems" type="checkbox" class="selector" value="@invoice.InvoiceId" />
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="switchTimeFormat" data-switch="@invoice.Date.ToTimeAgo()">
|
<span class="switchTimeFormat" data-switch="@invoice.Date.ToTimeAgo()">
|
||||||
@invoice.Date.ToBrowserDate()
|
@invoice.Date.ToBrowserDate()
|
||||||
@@ -269,8 +297,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<a asp-action="Invoice" class="invoice-details-link" asp-route-invoiceId="@invoice.InvoiceId">Details</a>
|
<a asp-action="Invoice" class="invoice-details-link" asp-route-invoiceId="@invoice.InvoiceId">Details</a>
|
||||||
@*<span title="Details" class="fa fa-list"></span>*@
|
|
||||||
|
|
||||||
<a href="javascript:void(0);" onclick="detailsToggle(this, '@invoice.InvoiceId')">
|
<a href="javascript:void(0);" onclick="detailsToggle(this, '@invoice.InvoiceId')">
|
||||||
<span title="Invoice Details Toggle" class="fa fa-1x fa-angle-double-down"></span>
|
<span title="Invoice Details Toggle" class="fa fa-1x fa-angle-double-down"></span>
|
||||||
</a>
|
</a>
|
||||||
@@ -356,7 +382,7 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user