mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
* adds pay button icon adds more update icons * reduces update app titles * capitalize PP * more icons notification icon update adds more * Truncate long titles in nav * Adjust "off" color state for the wallet/lightning * Theme switch alignment * Update store selector * adds more space in store selector span * Prevent form zoom on mobile Safari * updates lightning + settings view * updates store icon * adjusts notification icon * removes notifications setting button icon * Update status colors * Fix Lightning nav markup * Prevent icons from shrinking * Move main menu styles to css * Remove max-width container for content area * Update headlines * Use fixed header on mobile * Extract custom pills component * Form field update Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
165 lines
7.5 KiB
Text
165 lines
7.5 KiB
Text
@using BTCPayServer.Client.Models
|
|
@using BTCPayServer.Payments
|
|
@using BTCPayServer.Views.Stores
|
|
@using BTCPayServer.Abstractions.Extensions
|
|
@using BTCPayServer.Client
|
|
@model BTCPayServer.Models.WalletViewModels.PayoutsModel
|
|
|
|
@inject IEnumerable<IPayoutHandler> PayoutHandlers;
|
|
@{
|
|
ViewData.SetActivePage(StoreNavPages.Payouts, $"Payouts{(string.IsNullOrEmpty(Model.PullPaymentName) ? string.Empty : " for pull payment " + Model.PullPaymentName)}", Context.GetStoreData().Id);
|
|
Model.PaginationQuery ??= new Dictionary<string, object>();
|
|
Model.PaginationQuery.Add("pullPaymentId", Model.PullPaymentId);
|
|
Model.PaginationQuery.Add("paymentMethodId", Model.PaymentMethodId);
|
|
Model.PaginationQuery.Add("payoutState", Model.PayoutState);
|
|
var stateActions = new List<(string Action, string Text)>();
|
|
if (PaymentMethodId.TryParse(Model.PaymentMethodId, out var paymentMethodId))
|
|
{
|
|
var payoutHandler = PayoutHandlers.FindPayoutHandler(paymentMethodId);
|
|
if (payoutHandler is null)
|
|
return;
|
|
stateActions.AddRange(payoutHandler.GetPayoutSpecificActions().Where(pair => pair.Key == Model.PayoutState).SelectMany(pair => pair.Value));
|
|
|
|
}
|
|
switch (Model.PayoutState)
|
|
{
|
|
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"));
|
|
stateActions.Add(("mark-paid", "Mark selected payouts as already paid"));
|
|
break;
|
|
}
|
|
}
|
|
|
|
@section PageFootContent {
|
|
<script>
|
|
delegate('click', '.selectAll', e => {
|
|
const { payoutState } = e.target.dataset;
|
|
document.querySelectorAll(`.selection-item-${payoutState}`).forEach(checkbox => {
|
|
checkbox.checked = e.target.checked;
|
|
});
|
|
});
|
|
</script>
|
|
}
|
|
|
|
<partial name="_StatusMessage" />
|
|
|
|
<h2 class="mt-1 mb-4">@ViewData["Title"]</h2>
|
|
|
|
<form method="post">
|
|
<input type="hidden" asp-for="PaymentMethodId" />
|
|
<input type="hidden" asp-for="PayoutState" />
|
|
<div class="d-flex justify-content-between mb-4">
|
|
<ul class="nav mb-1">
|
|
@foreach (var state in Model.PaymentMethods)
|
|
{
|
|
<li class="nav-item py-0">
|
|
<a asp-action="Payouts" asp-route-storeId="@Context.GetRouteValue("storeId")"
|
|
asp-route-payoutState="@Model.PayoutState"
|
|
asp-route-paymentMethodId="@state.ToString()"
|
|
asp-route-pullPaymentId="@Model.PullPaymentId"
|
|
class="btcpay-pill @(state.ToString() == Model.PaymentMethodId ? "active" : "")"
|
|
id="@state.ToString()-view"
|
|
role="tab">@state.ToPrettyString()</a>
|
|
</li>
|
|
}
|
|
</ul>
|
|
@if (Model.Payouts.Any() && stateActions.Any())
|
|
{
|
|
<div class="dropdown ms-xl-auto mt-xl-0" permission="@Policies.CanModifyStoreSettings">
|
|
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" id="@Model.PayoutState-actions">Actions</button>
|
|
<div class="dropdown-menu" aria-labelledby="@Model.PayoutState-actions">
|
|
@foreach (var action in stateActions)
|
|
{
|
|
<button type="submit" id="@Model.PayoutState-@action.Action" name="Command" class="dropdown-item" role="button" value="@Model.PayoutState-@action.Action">@action.Text</button>
|
|
}
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
|
|
<nav id="SectionNav" class="mb-3">
|
|
<div class="nav">
|
|
@foreach (var state in Model.PayoutStateCount)
|
|
{
|
|
<a id="@state.Key-view"
|
|
asp-action="Payouts"
|
|
asp-route-storeId="@Context.GetRouteValue("storeId")"
|
|
asp-route-payoutState="@state.Key"
|
|
asp-route-pullPaymentId="@Model.PullPaymentId"
|
|
asp-route-paymentMethodId="@Model.PaymentMethodId"
|
|
class="nav-link @(state.Key == Model.PayoutState ? "active" : "")" role="tab">@state.Key.GetStateString() (@state.Value)</a>
|
|
}
|
|
</div>
|
|
</nav>
|
|
|
|
@if (Model.Payouts.Any())
|
|
{
|
|
<div class="table-responsive">
|
|
<table class="table table-hover">
|
|
<thead class="thead-inverse">
|
|
<tr>
|
|
<th permission="@Policies.CanModifyStoreSettings">
|
|
<input id="@Model.PayoutState-selectAllCheckbox" type="checkbox" class="form-check-input selectAll" data-payout-state="@Model.PayoutState.ToString()" />
|
|
</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 (Model.PayoutState != PayoutState.AwaitingApproval)
|
|
{
|
|
<th class="text-end">Transaction</th>
|
|
}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@for (int i = 0; i < Model.Payouts.Count; i++)
|
|
{
|
|
var pp = Model.Payouts[i];
|
|
<tr class="payout">
|
|
<td permission="@Policies.CanModifyStoreSettings">
|
|
<span>
|
|
<input type="checkbox" class="selection-item-@Model.PayoutState.ToString() form-check-input" asp-for="Payouts[i].Selected" />
|
|
<input type="hidden" asp-for="Payouts[i].PayoutId" />
|
|
</span>
|
|
</td>
|
|
<td>
|
|
<span>@pp.Date.ToBrowserDate()</span>
|
|
</td>
|
|
<td class="mw-100">
|
|
<span>@pp.PullPaymentName</span>
|
|
</td>
|
|
<td title="@pp.Destination">
|
|
<span class="text-break">@pp.Destination</span>
|
|
</td>
|
|
<td class="text-end text-nowrap">
|
|
<span>@pp.Amount</span>
|
|
</td>
|
|
@if (Model.PayoutState != PayoutState.AwaitingApproval)
|
|
{
|
|
<td class="text-end">
|
|
@if (!(pp.ProofLink is null))
|
|
{
|
|
<a class="transaction-link" href="@pp.ProofLink" rel="noreferrer noopener">Link</a>
|
|
}
|
|
</td>
|
|
}
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<vc:pager view-model="Model" />
|
|
}
|
|
else
|
|
{
|
|
<p class="text-muted mb-0" id="@Model.PayoutState-no-payouts">There are no payouts matching this criteria.</p>
|
|
}
|
|
</form>
|