2020-11-08 03:29:36 +01:00
@using System.Text.RegularExpressions
2020-04-27 12:55:46 +02:00
@model StoreViewModel
2017-09-13 16:50:36 +02:00
@{
2017-10-27 10:53:04 +02:00
Layout = "../Shared/_NavLayout.cshtml";
2021-04-08 15:32:42 +02:00
ViewData.SetActivePageAndTitle(StoreNavPages.Index, "General Settings", Context.GetStoreData().StoreName);
2020-07-22 15:28:31 +02:00
}
2017-09-13 16:50:36 +02:00
<div class="row">
2020-10-23 17:15:07 +02:00
<div class="col-lg-10 col-xl-9">
2021-04-08 15:32:42 +02:00
@if (!ViewContext.ModelState.IsValid)
{
<div asp-validation-summary="All" class="text-danger"></div>
}
2020-10-23 20:04:13 +02:00
<div class="mb-5">
2020-12-02 07:45:00 +01:00
<h4 class="mb-3">Wallet</h4>
2020-10-23 20:04:13 +02:00
@if (Model.HintWallet)
{
2020-12-02 07:45:00 +01:00
<p>Set up your wallet to receive payments at your store.</p>
2020-10-23 20:04:13 +02:00
}
<ul class="list-group mb-3">
2020-10-23 17:15:07 +02:00
@foreach (var scheme in Model.DerivationSchemes.OrderBy(scheme => scheme.Collapsed))
{
2020-12-08 15:32:04 +01:00
var isSetUp = !string.IsNullOrWhiteSpace(scheme.Value);
2021-07-12 14:16:41 +02:00
<li class="list-group-item bg-tile @(scheme.Collapsed ? "assets-collapsed": "")">
2020-12-08 15:32:04 +01:00
<div class="d-flex align-items-center">
<span class="d-flex flex-wrap flex-fill flex-column flex-sm-row">
2021-05-19 04:39:27 +02:00
<strong class="me-3">@scheme.Crypto</strong>
2020-12-08 15:32:04 +01:00
@if (isSetUp)
2020-10-23 20:04:13 +02:00
{
2021-05-19 04:39:27 +02:00
<span title="@scheme.Value" data-bs-toggle="tooltip" class="d-flex me-3">
2020-12-08 15:32:04 +01:00
<span class="text-truncate text-secondary" style="max-width:8ch">@scheme.Value</span>
@if (scheme.Value.Length > 20)
{
<span class="text-nowrap text-secondary">@Regex.Match(scheme.Value, @"((?:-\[(?:[^\]])+\])+|\S{6})$").Value</span>
}
2020-10-23 20:04:13 +02:00
</span>
@if (scheme.WalletSupported)
2020-10-23 17:15:07 +02:00
{
2021-05-19 04:39:27 +02:00
<a asp-action="WalletTransactions" asp-controller="Wallets" asp-route-walletId="@scheme.WalletId" class="text-secondary me-3">Manage Wallet</a>
2020-10-23 17:15:07 +02:00
}
2020-10-23 20:04:13 +02:00
}
</span>
2020-12-09 09:45:25 +01:00
<span class="d-flex align-items-center fw-semibold">
2020-12-08 15:32:04 +01:00
@if (isSetUp)
2020-12-02 07:45:00 +01:00
{
2021-04-26 22:28:24 +02:00
<form method="post"
asp-action="SetWalletEnabled"
asp-route-cryptoCode="@scheme.Crypto"
asp-route-storeId="@Model.Id"
class="d-flex align-items-center"
style="min-width:7.65rem">
2021-05-19 04:39:27 +02:00
<button type="submit" class="btcpay-toggle me-2 @if (scheme.Enabled) { @("btcpay-toggle--active") }" name="Enabled" value="@(scheme.Enabled ? "false" : "true")" id="@($"{scheme.Crypto}WalletEnabled")">@(scheme.Enabled ? "Disable" : "Enable")</button>
2021-04-26 22:28:24 +02:00
@if (scheme.Enabled)
{
<span class="text-primary">
Enabled
</span>
}
else
{
<span class="text-muted">
Disabled
</span>
}
</form>
2021-05-19 04:39:27 +02:00
<span class="text-light ms-3 me-2">|</span>
2021-04-16 15:31:09 +02:00
<a asp-action="ModifyWallet" asp-route-cryptoCode="@scheme.Crypto" asp-route-storeId="@Model.Id" id="@($"Modify{scheme.Crypto}")" class="btn btn-link px-1 py-1 fw-semibold">
2021-02-11 11:48:54 +01:00
Modify
</a>
}
else
{
2021-05-19 04:39:27 +02:00
<a asp-action="SetupWallet" asp-route-cryptoCode="@scheme.Crypto" asp-route-storeId="@Model.Id" id="@($"Modify{scheme.Crypto}")" class="btn btn-primary btn-sm ms-4 px-3 py-1 fw-semibold">
2021-02-11 11:48:54 +01:00
Setup
</a>
2020-12-02 07:45:00 +01:00
}
2020-10-23 20:04:13 +02:00
</span>
</div>
</li>
2020-10-23 17:15:07 +02:00
}
2020-10-23 20:04:13 +02:00
</ul>
@if (Model.DerivationSchemes.Any(scheme => scheme.Collapsed))
{
<script>
2021-07-12 14:16:41 +02:00
document.addEventListener("DOMContentLoaded", (event) => {
var collapsed = document.getElementsByClassName("assets-collapsed");
for (let collapsedElement of collapsed) {
collapsedElement.style.display = 'none';
}
document
.getElementById("toggle-assets")
.addEventListener("click", function (){
var collapsed = document.getElementsByClassName("assets-collapsed");
for (let collapsedElement of collapsed) {
collapsedElement.style.display = 'block';
}
document.getElementById("toggle-assets").style.display="none";
});
2020-10-23 20:04:13 +02:00
});
</script>
<button class="btn btn-link text-secondary mb-3 p-0 only-for-js" id="toggle-assets" type="button">Show additional assets</button>
}
</div>
2020-10-16 01:20:23 +02:00
2020-10-23 20:04:13 +02:00
<div class="mb-5">
2020-12-02 07:45:00 +01:00
<h4 class="mb-3">Lightning</h4>
2020-10-23 20:04:13 +02:00
@if (Model.HintLightning)
{
2020-12-02 07:45:00 +01:00
<p>A connection to a Lightning node is required to receive Lightning payments.</p>
2020-10-23 20:04:13 +02:00
}
<ul class="list-group mb-3">
2020-10-23 17:15:07 +02:00
@foreach (var scheme in Model.LightningNodes)
{
2020-12-08 15:32:04 +01:00
var isSetUp = !string.IsNullOrWhiteSpace(scheme.Address);
2020-12-02 07:45:00 +01:00
<li class="list-group-item bg-tile">
2020-12-08 15:32:04 +01:00
<div class="d-flex align-items-center">
<span class="d-flex flex-wrap flex-fill flex-column flex-sm-row">
2021-05-19 04:39:27 +02:00
<strong class="me-3">@scheme.CryptoCode</strong>
2020-12-08 15:32:04 +01:00
@if (isSetUp)
2020-10-23 20:04:13 +02:00
{
2021-05-19 04:39:27 +02:00
<span class="smMaxWidth text-truncate text-secondary me-3">@scheme.Address</span>
2021-04-20 12:23:50 +02:00
<a class="text-secondary"
asp-controller="PublicLightningNodeInfo"
asp-action="ShowLightningNodeInfo"
asp-route-cryptoCode="@scheme.CryptoCode"
asp-route-storeId="@Model.Id"
target="_blank">
Public Node Info
</a>
2020-10-23 20:04:13 +02:00
}
</span>
2020-12-09 09:45:25 +01:00
<span class="d-flex align-items-center fw-semibold">
2020-12-08 15:32:04 +01:00
@if (isSetUp)
2020-12-02 07:45:00 +01:00
{
2021-04-26 22:28:24 +02:00
<form method="post"
asp-action="SetLightningNodeEnabled"
asp-route-cryptoCode="@scheme.CryptoCode"
asp-route-storeId="@Model.Id"
class="d-flex align-items-center"
style="min-width:7.65rem">
2021-05-19 04:39:27 +02:00
<button type="submit" class="btcpay-toggle me-2 @if (scheme.Enabled) { @("btcpay-toggle--active") }" name="Enabled" value="@(scheme.Enabled ? "false" : "true")" id="@($"{scheme.CryptoCode}LightningEnabled")">@(scheme.Enabled ? "Disable" : "Enable")e</button>
2021-04-26 22:28:24 +02:00
@if (scheme.Enabled)
{
<span class="text-primary">
Enabled
</span>
}
else
{
<span class="text-muted">
Disabled
</span>
}
</form>
2021-05-19 04:39:27 +02:00
<span class="text-light ms-3 me-2">|</span>
2020-12-02 07:45:00 +01:00
}
2021-05-19 04:39:27 +02:00
<a asp-action="SetupLightningNode" asp-route-cryptoCode="@scheme.CryptoCode" asp-route-storeId="@Model.Id" id="@($"Modify-Lightning{scheme.CryptoCode}")" class="btn btn-@(isSetUp ? "link px-1" : "primary btn-sm ms-4 px-3") py-1 fw-semibold">
2020-12-08 15:32:04 +01:00
@(isSetUp ? "Modify" : "Setup")
2020-10-23 20:04:13 +02:00
</a>
</span>
</div>
</li>
2020-10-23 17:15:07 +02:00
}
2020-10-23 20:04:13 +02:00
</ul>
2020-10-23 17:15:07 +02:00
</div>
2020-10-16 01:20:23 +02:00
2021-04-08 15:32:42 +02:00
<form method="post">
2020-10-23 17:15:07 +02:00
<h4 class="mb-3">General</h4>
<div class="form-group">
2021-06-06 13:44:54 +02:00
<label asp-for="Id" class="form-label"></label>
2020-10-23 17:15:07 +02:00
<input asp-for="Id" readonly class="form-control" />
</div>
<div class="form-group">
2021-06-06 13:44:54 +02:00
<label asp-for="StoreName" class="form-label"></label>
2020-10-23 17:15:07 +02:00
<input asp-for="StoreName" class="form-control" />
<span asp-validation-for="StoreName" class="text-danger"></span>
</div>
<div class="form-group">
2021-06-06 13:44:54 +02:00
<label asp-for="StoreWebsite" class="form-label"></label>
2020-10-23 17:15:07 +02:00
<input asp-for="StoreWebsite" class="form-control" />
<span asp-validation-for="StoreWebsite" class="text-danger"></span>
</div>
2021-10-20 16:17:40 +02:00
<div class="form-group">
<label asp-for="DefaultCurrency" class="form-label"></label>
<input asp-for="DefaultCurrency" class="form-control" />
<span asp-validation-for="DefaultCurrency" class="text-danger"></span>
</div>
2021-09-29 14:33:49 +02:00
@if (Model.IsOnchainSetup || Model.IsLightningSetup)
2021-06-18 03:25:17 +02:00
{
2021-09-29 14:33:49 +02:00
<h4 class="mt-5 mb-3">Payment</h4>
<div class="form-group d-flex align-items-center">
2021-10-20 16:17:40 +02:00
<input asp-for="AnyoneCanCreateInvoice" type="checkbox" class="btcpay-toggle me-2" />
2021-09-29 14:33:49 +02:00
<label asp-for="AnyoneCanCreateInvoice" class="form-label mb-0 me-1"></label>
2021-10-04 13:42:31 +02:00
<a href="https://docs.btcpayserver.org/FAQ/Stores/#allow-anyone-to-create-invoice" target="_blank" rel="noreferrer noopener">
2021-09-29 14:33:49 +02:00
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
</div>
<div class="form-group mt-4">
<label asp-for="NetworkFeeMode" class="form-label"></label>
2021-10-04 13:42:31 +02:00
<a href="https://docs.btcpayserver.org/FAQ/Stores/#add-network-fee-to-invoice-vary-with-mining-fees" target="_blank" rel="noreferrer noopener">
2021-09-29 14:33:49 +02:00
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<select asp-for="NetworkFeeMode" class="form-select">
<option value="MultiplePaymentsOnly">... only if the customer makes more than one payment for the invoice</option>
<option value="Always">... on every payment</option>
<option value="Never">Never add network fee</option>
</select>
</div>
<div class="form-group">
<label asp-for="InvoiceExpiration" class="form-label"></label>
2021-10-04 13:42:31 +02:00
<a href="https://docs.btcpayserver.org/FAQ/Stores/#invoice-expires-if-the-full-amount-has-not-been-paid-after-minutes" target="_blank" rel="noreferrer noopener">
2021-09-29 14:33:49 +02:00
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<div class="input-group">
2021-10-20 16:17:40 +02:00
<input asp-for="InvoiceExpiration" class="form-control" style="max-width:10ch;" />
2021-09-29 14:33:49 +02:00
<span class="input-group-text">minutes</span>
</div>
<span asp-validation-for="InvoiceExpiration" class="text-danger"></span>
</div>
2021-06-18 03:25:17 +02:00
<div class="form-group">
2021-09-29 14:33:49 +02:00
<label asp-for="PaymentTolerance" class="form-label"></label>
2021-10-04 13:42:31 +02:00
<a href="https://docs.btcpayserver.org/FAQ/Stores/#consider-the-invoice-paid-even-if-the-paid-amount-is-less-than-expected" target="_blank" rel="noreferrer noopener">
2021-09-29 14:33:49 +02:00
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<div class="input-group">
2021-10-20 16:17:40 +02:00
<input asp-for="PaymentTolerance" class="form-control" style="max-width:10ch;" />
2021-09-29 14:33:49 +02:00
<span class="input-group-text">percent</span>
</div>
<span asp-validation-for="PaymentTolerance" class="text-danger"></span>
</div>
@if (Model.IsOnchainSetup)
{
2021-09-29 17:23:01 +02:00
<h5 class="mt-5 mb-3">On-Chain</h5>
2021-09-29 14:33:49 +02:00
@if (Model.CanUsePayJoin)
{
<div class="form-group">
<div class="d-flex align-items-center">
2021-10-20 16:17:40 +02:00
<input asp-for="PayJoinEnabled" type="checkbox" class="btcpay-toggle me-2" />
2021-09-29 14:33:49 +02:00
<label asp-for="PayJoinEnabled" class="form-label mb-0 me-1"></label>
<a href="https://docs.btcpayserver.org/Payjoin/" target="_blank" rel="noreferrer noopener">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
</div>
<span asp-validation-for="PayJoinEnabled" class="text-danger"></span>
</div>
}
<div class="form-group">
<label asp-for="MonitoringExpiration" class="form-label"></label>
2021-10-04 13:42:31 +02:00
<a href="https://docs.btcpayserver.org/FAQ/Stores/#payment-invalid-if-transactions-fails-to-confirm-minutes-after-invoice-expiration" target="_blank" rel="noreferrer noopener">
2021-06-18 03:25:17 +02:00
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
2021-09-29 14:33:49 +02:00
<div class="input-group">
2021-10-20 16:17:40 +02:00
<input asp-for="MonitoringExpiration" class="form-control" style="max-width:10ch;" />
2021-09-29 14:33:49 +02:00
<span class="input-group-text">minutes</span>
</div>
<span asp-validation-for="MonitoringExpiration" class="text-danger"></span>
2021-06-18 03:25:17 +02:00
</div>
2021-09-29 14:33:49 +02:00
<div class="form-group">
<label asp-for="SpeedPolicy" class="form-label"></label>
2021-10-04 13:42:31 +02:00
<a href="https://docs.btcpayserver.org/FAQ/Stores/#consider-the-invoice-confirmed-when-the-payment-transaction" target="_blank" rel="noreferrer noopener">
2021-09-29 14:33:49 +02:00
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
2021-10-07 05:27:48 +02:00
<select asp-for="SpeedPolicy" class="form-select w-auto">
2021-09-29 14:33:49 +02:00
<option value="0">Is unconfirmed</option>
<option value="1">Has at least 1 confirmation</option>
<option value="3">Has at least 2 confirmations</option>
<option value="2">Has at least 6 confirmations</option>
</select>
<div class="alert alert-warning my-2" hidden="@(Model.SpeedPolicy != 0)" id="unconfirmed-warning" role="alert">
Choosing to accept an unconfirmed invoice can lead to double-spending and is strongly discouraged.
</div>
<span asp-validation-for="SpeedPolicy" class="text-danger"></span>
</div>
2021-09-29 17:23:01 +02:00
<div class="form-check my-1">
2021-10-20 16:17:40 +02:00
<input asp-for="ShowRecommendedFee" type="checkbox" class="form-check-input" />
2021-09-29 17:23:01 +02:00
<label asp-for="ShowRecommendedFee" class="form-check-label"></label>
<p class="form-text text-muted mb-0">Fee will be shown for BTC and LTC onchain payments only.</p>
</div>
<div class="form-group mt-2 mb-4">
<label asp-for="RecommendedFeeBlockTarget" class="form-label"></label>
<input asp-for="RecommendedFeeBlockTarget" class="form-control" style="width:8ch" min="1" />
<span asp-validation-for="RecommendedFeeBlockTarget" class="text-danger"></span>
</div>
2021-09-29 14:33:49 +02:00
}
2021-10-20 16:17:40 +02:00
2021-09-29 14:33:49 +02:00
@if (Model.IsLightningSetup)
{
2021-09-29 17:23:01 +02:00
<h5 class="mt-5 mb-3">Lightning</h5>
<div class="form-check my-1">
2021-10-20 16:17:40 +02:00
<input asp-for="LightningAmountInSatoshi" type="checkbox" class="form-check-input" />
2021-09-29 17:23:01 +02:00
<label asp-for="LightningAmountInSatoshi" class="form-check-label"></label>
</div>
<div class="form-check my-1">
2021-10-20 16:17:40 +02:00
<input asp-for="LightningPrivateRouteHints" type="checkbox" class="form-check-input" />
2021-09-29 17:23:01 +02:00
<label asp-for="LightningPrivateRouteHints" class="form-check-label"></label>
</div>
<div class="form-check my-1">
2021-10-20 16:17:40 +02:00
<input asp-for="OnChainWithLnInvoiceFallback" type="checkbox" class="form-check-input" />
2021-09-29 17:23:01 +02:00
<label asp-for="OnChainWithLnInvoiceFallback" class="form-check-label"></label>
</div>
<div class="form-group mt-3">
2021-09-29 14:33:49 +02:00
<label asp-for="LightningDescriptionTemplate" class="form-label"></label>
2021-10-20 16:17:40 +02:00
<input asp-for="LightningDescriptionTemplate" class="form-control" />
2021-09-29 14:33:49 +02:00
<span asp-validation-for="LightningDescriptionTemplate" class="text-danger"></span>
<p class="form-text text-muted">
Available placeholders:
<code>{StoreName} {ItemDescription} {OrderId}</code>
</p>
</div>
}
2021-06-18 03:25:17 +02:00
}
2020-10-23 17:15:07 +02:00
<button name="command" type="submit" class="btn btn-primary" value="Save" id="Save">Save Store Settings</button>
</form>
2018-01-08 14:45:09 +01:00
2020-10-23 17:15:07 +02:00
<h4 class="mt-5 mb-3">Services</h4>
<div class="table-responsive-md">
2021-08-20 14:59:31 +02:00
<table class="table table-hover mt-1 mb-5">
2020-04-06 10:11:10 +02:00
<thead>
2020-10-23 17:15:07 +02:00
<tr>
<th>Service</th>
2021-05-19 04:39:27 +02:00
<th class="text-end w-100px">Actions</th>
2020-10-23 17:15:07 +02:00
</tr>
2020-10-16 01:20:23 +02:00
</thead>
<tbody>
2020-10-23 17:15:07 +02:00
<tr>
<td>
Email
</td>
2021-05-19 04:39:27 +02:00
<td class="text-end">
2020-10-23 17:15:07 +02:00
<a asp-action="Emails" asp-route-storeId="@Context.GetRouteValue("storeId")">
Setup
</a>
</td>
</tr>
2020-04-06 10:11:10 +02:00
</tbody>
</table>
2020-10-16 06:04:44 +02:00
</div>
2020-10-23 17:15:07 +02:00
@if (Model.CanDelete)
{
<h4 class="mt-5 mb-3">Other actions</h4>
2021-05-19 04:39:27 +02:00
<button id="danger-zone-expander" class="btn btn-link text-secondary mb-3 p-0" type="button" data-bs-toggle="collapse" data-bs-target="#danger-zone">
2020-10-23 17:15:07 +02:00
See more actions
</button>
<div id="danger-zone" class="collapse">
2021-09-07 04:55:53 +02:00
<a id="delete-store" class="btn btn-outline-danger mb-5" asp-action="DeleteStore" asp-route-storeId="@Model.Id" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-description="The store <strong>@Model.StoreName</strong> will be permanently deleted. This action will also delete all invoices, apps and data associated with the store.">Delete this store</a>
2020-10-23 17:15:07 +02:00
</div>
}
2017-10-27 10:53:04 +02:00
</div>
2017-09-13 16:50:36 +02:00
</div>
2021-09-07 04:55:53 +02:00
<partial name="_Confirm" model="@(new ConfirmModel("Delete store", "The store will be permanently deleted. This action will also delete all invoices, apps and data associated with the store.", "Delete"))" />
2021-05-19 04:39:27 +02:00
@section PageFootContent {
2021-04-08 15:32:42 +02:00
<partial name="_ValidationScriptsPartial" />
2021-10-07 05:27:48 +02:00
<script>
delegate('change', '#SpeedPolicy', e => {
document.getElementById('unconfirmed-warning').hidden = e.target.value !== '0';
});
</script>
2017-09-13 16:50:36 +02:00
}