2022-07-15 05:38:33 +02:00
@using BTCPayServer.Abstractions.Models
2022-10-17 12:16:29 +02:00
@using BTCPayServer.TagHelpers
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using BTCPayServer.Abstractions.Contracts
2023-09-11 02:59:17 +02:00
@using BTCPayServer.Client
2022-10-17 12:16:29 +02:00
@inject IFileService FileService;
2021-10-29 08:25:43 +02:00
@model GeneralSettingsViewModel
@{
2022-10-17 12:16:29 +02:00
Layout = "../Shared/_NavLayout.cshtml";
ViewData.SetActivePage(StoreNavPages.General, "General", Context.GetStoreData().Id);
var canUpload = await FileService.IsAvailable();
2021-10-29 08:25:43 +02:00
}
<div class="row">
2022-01-27 03:56:46 +01:00
<div class="col-xxl-constrain col-xl-8">
2021-10-29 08:25:43 +02:00
@if (!ViewContext.ModelState.IsValid)
{
<div asp-validation-summary="All" class="text-danger"></div>
}
2022-10-17 12:16:29 +02:00
<form method="post" enctype="multipart/form-data">
2022-01-17 17:19:27 -08:00
<h3 class="mb-3">General</h3>
2021-10-29 08:25:43 +02:00
<div class="form-group">
<label asp-for="Id" class="form-label"></label>
<input asp-for="Id" readonly class="form-control" />
</div>
<div class="form-group">
<label asp-for="StoreName" class="form-label"></label>
<input asp-for="StoreName" class="form-control" />
<span asp-validation-for="StoreName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="StoreWebsite" class="form-label"></label>
<input asp-for="StoreWebsite" class="form-control" />
<span asp-validation-for="StoreWebsite" class="text-danger"></span>
</div>
2023-05-11 10:38:40 +02:00
<div class="form-group">
<label asp-for="StoreSupportUrl" class="form-label"></label>
<input asp-for="StoreSupportUrl" class="form-control" />
<span asp-validation-for="StoreSupportUrl" class="text-danger"></span>
<div class="form-text">
For support requests, can contain the placeholders <code>{OrderId}</code> and <code>{InvoiceId}</code>. Can be any valid URI, such as a website, email, and nostr.",
</div>
</div>
2021-10-29 08:25:43 +02:00
2022-11-14 14:29:23 +01:00
<h3 class="mt-5 mb-3">Branding</h3>
2022-12-19 15:51:05 +01:00
<div class="form-group">
<label asp-for="BrandColor" class="form-label"></label>
<div class="input-group">
<input id="BrandColorInput" class="form-control form-control-color flex-grow-0" type="color" style="width:3rem" aria-describedby="BrandColorValue" value="@Model.BrandColor" />
2023-03-09 21:34:15 +01:00
<input asp-for="BrandColor" class="form-control form-control-color flex-grow-0 font-monospace" pattern="@ColorPalette.Pattern" style="width:5.5rem;font-size:0.9rem" />
2022-12-19 15:51:05 +01:00
</div>
<span asp-validation-for="BrandColor" class="text-danger"></span>
</div>
2022-10-17 12:16:29 +02:00
<div class="form-group">
2022-11-24 00:53:32 +01:00
<div class="d-flex align-items-center justify-content-between gap-2">
<label asp-for="LogoFile" class="form-label"></label>
@if (!string.IsNullOrEmpty(Model.LogoFileId))
{
<button type="submit" class="btn btn-link p-0 text-danger" name="RemoveLogoFile" value="true">
<span class="fa fa-times"></span> Remove
</button>
}
</div>
2022-10-17 12:16:29 +02:00
@if (canUpload)
{
2022-11-24 00:53:32 +01:00
<div class="d-flex align-items-center gap-3">
2022-10-17 12:16:29 +02:00
<input asp-for="LogoFile" type="file" class="form-control flex-grow">
@if (!string.IsNullOrEmpty(Model.LogoFileId))
{
2022-11-24 00:53:32 +01:00
<img src="@(await FileService.GetFileUrl(Context.Request.GetAbsoluteRootUri(), Model.LogoFileId))" alt="@Model.StoreName" class="rounded-circle" style="width:2.1rem;height:2.1rem;"/>
2022-10-17 12:16:29 +02:00
}
</div>
2022-11-24 00:53:32 +01:00
<span asp-validation-for="LogoFile" class="text-danger"></span>
2022-12-04 10:01:38 +01:00
<div class="form-text">
2022-11-24 00:53:32 +01:00
Please upload an image with square dimension, as it will be displayed in 1:1 format and circular.
Size should be around 100✕100px.
2022-12-04 10:01:38 +01:00
</div>
2022-10-17 12:16:29 +02:00
}
else
{
<input asp-for="LogoFile" type="file" class="form-control" disabled>
2022-12-04 10:01:38 +01:00
<div class="form-text">In order to upload a logo, a <a asp-controller="UIServer" asp-action="Files">file storage</a> must be configured.</div>
2022-10-17 12:16:29 +02:00
}
</div>
<div class="form-group">
2022-12-19 15:51:05 +01:00
<div class="d-flex align-items-center justify-content-between gap-2">
<label asp-for="CssFile" class="form-label"></label>
@if (!string.IsNullOrEmpty(Model.CssFileId))
{
<button type="submit" class="btn btn-link p-0 text-danger" name="RemoveCssFile" value="true">
<span class="fa fa-times"></span> Remove
</button>
}
2022-10-17 12:16:29 +02:00
</div>
2022-12-19 15:51:05 +01:00
@if (canUpload)
{
<div class="d-flex align-items-center gap-3">
<input asp-for="CssFile" type="file" class="form-control flex-grow">
@if (!string.IsNullOrEmpty(Model.CssFileId))
{
<a href="@(await FileService.GetFileUrl(Context.Request.GetAbsoluteRootUri(), Model.CssFileId))" target="_blank" rel="noreferrer noopener" class="text-nowrap">Custom CSS</a>
}
</div>
<span asp-validation-for="LogoFile" class="text-danger"></span>
<div class="form-text">
Use this CSS to customize the public/customer-facing pages of this store. (Invoice, Payment Request, Pull Payment, etc.)
</div>
}
else
{
<input asp-for="CssFile" type="file" class="form-control" disabled>
<div class="form-text">In order to upload a CSS file, a <a asp-controller="UIServer" asp-action="Files">file storage</a> must be configured.</div>
}
2022-10-17 12:16:29 +02:00
</div>
2022-01-20 12:52:31 +01:00
<h3 class="mt-5 mb-3">Payment</h3>
<div class="form-group">
<label asp-for="DefaultCurrency" class="form-label"></label>
2022-09-26 03:26:13 +02:00
<input asp-for="DefaultCurrency" class="form-control w-auto" currency-selection />
2022-01-20 12:52:31 +01:00
<span asp-validation-for="DefaultCurrency" class="text-danger"></span>
</div>
<div class="form-group d-flex align-items-center">
2022-04-13 21:09:37 -07:00
<input asp-for="AnyoneCanCreateInvoice" type="checkbox" class="btcpay-toggle me-3"/>
2022-01-20 12:52:31 +01:00
<label asp-for="AnyoneCanCreateInvoice" class="form-label mb-0 me-1"></label>
2023-02-13 00:25:24 -08:00
<a href="https://docs.btcpayserver.org/FAQ/Stores/#allow-anyone-to-create-invoice" target="_blank" rel="noreferrer noopener" title="More information...">
<vc:icon symbol="info"/>
2022-01-20 12:52:31 +01:00
</a>
</div>
<div class="form-group mt-4">
<label asp-for="NetworkFeeMode" class="form-label"></label>
2023-02-13 00:25:24 -08:00
<a href="https://docs.btcpayserver.org/FAQ/Stores/#add-network-fee-to-invoice-vary-with-mining-fees" target="_blank" rel="noreferrer noopener" title="More information...">
<vc:icon symbol="info"/>
2022-01-20 12:52:31 +01:00
</a>
2022-05-19 17:36:36 -07:00
@* For whatever reason wrapping the select with this div fixes this Safari bug: https://github.com/btcpayserver/btcpayserver/issues/3699 *@
<div class="overflow-hidden">
<select asp-for="NetworkFeeMode" class="form-select w-auto">
<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>
2022-01-20 12:52:31 +01:00
</div>
<div class="form-group">
<label asp-for="InvoiceExpiration" class="form-label"></label>
2023-02-13 00:25:24 -08: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" title="More information...">
<vc:icon symbol="info"/>
2022-01-20 12:52:31 +01:00
</a>
<div class="input-group">
2023-07-22 14:15:41 +02:00
<input inputmode="numeric" asp-for="InvoiceExpiration" class="form-control" style="max-width:12ch;"/>
2022-01-20 12:52:31 +01:00
<span class="input-group-text">minutes</span>
</div>
<span asp-validation-for="InvoiceExpiration" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="PaymentTolerance" class="form-label"></label>
2023-02-13 00:25:24 -08: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" title="More information...">
<vc:icon symbol="info"/>
2022-01-20 12:52:31 +01:00
</a>
<div class="input-group">
2023-07-22 14:15:41 +02:00
<input inputmode="decimal" asp-for="PaymentTolerance" class="form-control" style="max-width:12ch;"/>
2022-01-20 12:52:31 +01:00
<span class="input-group-text">percent</span>
</div>
<span asp-validation-for="PaymentTolerance" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="BOLT11Expiration" class="form-label"></label>
<div class="input-group">
2023-07-22 14:15:41 +02:00
<input inputmode="numeric" asp-for="BOLT11Expiration" class="form-control" style="max-width:12ch;"/>
2022-01-20 12:52:31 +01:00
<span class="input-group-text">days</span>
</div>
<span asp-validation-for="BOLT11Expiration" class="text-danger"></span>
</div>
2022-11-24 00:53:32 +01:00
<button type="submit" class="btn btn-primary mt-2" id="Save">Save</button>
2021-10-29 08:25:43 +02:00
</form>
2023-09-11 02:59:17 +02:00
<h3 class="mt-5 mb-3">Additional Actions</h3>
<div id="danger-zone" class="d-flex flex-wrap align-items-center gap-3 mb-5 mt-2">
<form asp-action="ToggleArchive" asp-route-storeId="@Model.Id" method="post" permission="@Policies.CanModifyStoreSettings">
<button type="submit" class="btn btn-outline-secondary" id="btn-archive-toggle">
@if (Model.Archived)
{
<span class="text-nowrap" data-bs-toggle="tooltip" title="Unarchive this store">Unarchive this store</span>
}
else
{
<span class="text-nowrap" data-bs-toggle="tooltip" title="Archive this store so that it does not appear in the stores list by default">Archive this store</span>
}
</button>
</form>
@if (Model.CanDelete)
{
<a id="DeleteStore" class="btn btn-outline-danger" asp-action="DeleteStore" asp-route-storeId="@Model.Id" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-description="The store <strong>@Html.Encode(Model.StoreName)</strong> will be permanently deleted. This action will also delete all invoices, apps and data associated with the store." data-confirm-input="DELETE">Delete this store</a>
}
</div>
2021-10-29 08:25:43 +02:00
</div>
</div>
<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"))" />
@section PageFootContent {
2022-10-17 12:16:29 +02:00
<partial name="_ValidationScriptsPartial"/>
<script>
(() => {
const $colorValue = document.getElementById('BrandColor');
const $colorInput = document.getElementById('BrandColorInput');
delegate('change', '#BrandColor', e => {
const value = e.target.value;
if (value.match(@Safe.Json(@ColorPalette.Pattern)))
$colorInput.value = value;
});
delegate('change', '#BrandColorInput', e => {
$colorValue.value = e.target.value;
});
})();
</script>
2021-10-29 08:25:43 +02:00
}