2021-04-13 10:36:49 +02:00
|
|
|
@using BTCPayServer.Client.Models
|
|
|
|
@model PayoutsModel
|
|
|
|
|
|
|
|
@inject IEnumerable<IPayoutHandler> PayoutHandlers;
|
2020-06-24 10:34:09 +09:00
|
|
|
@{
|
|
|
|
Layout = "../Shared/_NavLayout.cshtml";
|
2021-04-08 15:32:42 +02:00
|
|
|
ViewData.SetActivePageAndTitle(WalletsNavPages.Payouts, "Manage payouts", Context.GetStoreData().StoreName);
|
2020-06-24 10:34:09 +09:00
|
|
|
}
|
|
|
|
|
2021-05-19 04:39:27 +02:00
|
|
|
@section PageFootContent {
|
|
|
|
<script>
|
|
|
|
function selectAll(e, elementClass)
|
|
|
|
{
|
|
|
|
const items = document.getElementsByClassName("selection-item-"+elementClass);
|
|
|
|
for (let i = 0; i < items.length; i++) {
|
|
|
|
items[i].checked = e.checked;
|
|
|
|
}
|
2020-06-24 10:34:09 +09:00
|
|
|
}
|
2021-05-19 04:39:27 +02:00
|
|
|
</script>
|
|
|
|
}
|
2021-04-13 10:36:49 +02:00
|
|
|
|
2020-06-24 10:34:09 +09:00
|
|
|
<form method="post">
|
2021-04-13 10:36:49 +02:00
|
|
|
<h4 class="mb-3">@ViewData["Title"]</h4>
|
|
|
|
@if (!Model.PayoutStateSets.Any())
|
|
|
|
{
|
|
|
|
<p class="text-secondary mt-3">
|
|
|
|
There are no payouts yet.
|
|
|
|
</p>
|
|
|
|
}
|
2020-06-24 10:34:09 +09:00
|
|
|
<div class="row">
|
2021-05-19 04:39:27 +02:00
|
|
|
<ul class="nav nav-pills">
|
2021-04-13 10:36:49 +02:00
|
|
|
@for (var index = 0; index < Model.PayoutStateSets.Count; index++)
|
2020-08-03 10:12:21 +02:00
|
|
|
{
|
2021-04-13 10:36:49 +02:00
|
|
|
var state = Model.PayoutStateSets[index];
|
|
|
|
<li class="nav-item py-0">
|
2021-05-19 04:39:27 +02:00
|
|
|
<a class="nav-link me-1 @(index == 0 ? "active" : "")" data-bs-toggle="tab" href="#@state.State" role="tab">@state.State.GetStateString() (@state.Payouts.Count)</a>
|
2021-04-13 10:36:49 +02:00
|
|
|
</li>
|
2020-08-03 10:12:21 +02:00
|
|
|
}
|
2021-04-13 10:36:49 +02:00
|
|
|
</ul>
|
2020-06-24 10:34:09 +09:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
2021-04-13 10:36:49 +02:00
|
|
|
<div class="tab-content w-100">
|
|
|
|
@for (var index = 0; index < Model.PayoutStateSets.Count; index++)
|
2020-08-03 10:12:21 +02:00
|
|
|
{
|
2021-04-13 10:36:49 +02:00
|
|
|
var state = Model.PayoutStateSets[index];
|
|
|
|
var stateActions = new List<(string Action, string Text)>();
|
|
|
|
switch (state.State)
|
|
|
|
{
|
|
|
|
case PayoutState.AwaitingApproval:
|
|
|
|
stateActions.Add(("approve", "Approve selected payouts"));
|
|
|
|
stateActions.Add(("approve-pay", "Approve & Send selected payouts"));
|
|
|
|
stateActions.Add(("cancel", "Cancel selected payouts"));
|
|
|
|
break;
|
|
|
|
case PayoutState.AwaitingPayment:
|
|
|
|
stateActions.Add(("pay", "Send selected payouts"));
|
|
|
|
stateActions.Add(("cancel", "Cancel selected payouts"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
<div class="tab-pane @(index == 0 ? "active" : "") " id="@state.State" role="tabpanel">
|
|
|
|
<input type="hidden" asp-for="PayoutStateSets[index].State"/>
|
|
|
|
<input type="hidden" asp-for="PaymentMethodId"/>
|
|
|
|
|
2021-05-19 04:39:27 +02:00
|
|
|
@if (state.Payouts.Any() && stateActions.Any())
|
|
|
|
{
|
|
|
|
<div class="dropdown mt-2">
|
|
|
|
<button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" id="@state.State-actions">
|
2021-04-13 10:36:49 +02:00
|
|
|
Actions
|
|
|
|
</button>
|
2021-05-19 04:39:27 +02:00
|
|
|
<div class="dropdown-menu" aria-labelledby="@state.State-actions">
|
2021-04-13 10:36:49 +02:00
|
|
|
@foreach (var action in stateActions)
|
|
|
|
{
|
|
|
|
<button type="submit" id="@state.State-@action.Action" name="Command" class="dropdown-item" role="button" value="@state.State-@action.Action">@action.Text</button>
|
|
|
|
}
|
|
|
|
</div>
|
2021-05-19 04:39:27 +02:00
|
|
|
</div>
|
|
|
|
}
|
|
|
|
<div>
|
|
|
|
@if (state.Payouts.Any())
|
|
|
|
{
|
|
|
|
<table class="table table-sm table-responsive-lg">
|
|
|
|
<thead class="thead-inverse">
|
|
|
|
<tr>
|
|
|
|
<th>
|
|
|
|
<input id="@state.State-selectAllCheckbox" type="checkbox" onclick="selectAll(this, '@state.State.ToString()'); return true;"/>
|
|
|
|
</th>
|
|
|
|
<th style="min-width: 90px;" class="col-md-auto">
|
|
|
|
Date
|
|
|
|
</th>
|
|
|
|
<th class="text-start">Source</th>
|
|
|
|
<th class="text-start">Destination</th>
|
|
|
|
<th class="text-end">Amount</th>
|
|
|
|
@if (state.State != PayoutState.AwaitingApproval)
|
|
|
|
{
|
|
|
|
<th class="text-end">Transaction</th>
|
|
|
|
}
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
@for (int i = 0; i < state.Payouts.Count; i++)
|
|
|
|
{
|
|
|
|
var pp = state.Payouts[i];
|
|
|
|
<tr class="payout">
|
|
|
|
<td>
|
|
|
|
<span>
|
|
|
|
<input type="checkbox" class="selection-item-@state.State.ToString()" asp-for="PayoutStateSets[index].Payouts[i].Selected"/>
|
|
|
|
<input type="hidden" asp-for="PayoutStateSets[index].Payouts[i].PayoutId"/>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<span>@pp.Date.ToBrowserDate()</span>
|
|
|
|
</td>
|
|
|
|
<td class="mw-100">
|
|
|
|
<span>@pp.PullPaymentName</span>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<span>@pp.Destination</span>
|
|
|
|
</td>
|
|
|
|
<td class="text-end">
|
|
|
|
<span>@pp.Amount</span>
|
|
|
|
</td>
|
2021-04-13 10:36:49 +02:00
|
|
|
@if (state.State != PayoutState.AwaitingApproval)
|
|
|
|
{
|
2021-05-19 04:39:27 +02:00
|
|
|
<td class="text-end">
|
|
|
|
@if (!(pp.TransactionLink is null))
|
|
|
|
{
|
|
|
|
<a class="transaction-link" href="@pp.TransactionLink">Link</a>
|
|
|
|
}
|
|
|
|
</td>
|
2021-04-13 10:36:49 +02:00
|
|
|
}
|
|
|
|
</tr>
|
2021-05-19 04:39:27 +02:00
|
|
|
}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<p class="mb-0 p-4" id="@state.State-no-payouts">No payouts.</p>
|
|
|
|
}
|
2021-04-13 10:36:49 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-03 10:12:21 +02:00
|
|
|
}
|
2020-06-24 10:34:09 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|