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
@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>
2022-11-14 14:29:23 +01:00
<h3 class="mt-5 mb-3">Branding</h3>
2022-10-17 12:16:29 +02:00
<div class="form-group">
<label asp-for="LogoFile" class="form-label"></label>
@if (canUpload)
{
<div class="d-flex align-items-center">
<input asp-for="LogoFile" type="file" class="form-control flex-grow">
@if (!string.IsNullOrEmpty(Model.LogoFileId))
{
<img src="@(await FileService.GetFileUrl(Context.Request.GetAbsoluteRootUri(), Model.LogoFileId))" alt="@Model.StoreName" class="rounded-circle ms-3" style="width:2.1rem;height:2.1rem;"/>
}
</div>
<p class="form-text text-muted">Please upload an image with square dimension, as it will be displayed in 1:1 format and circular.</p>
}
else
{
<input asp-for="LogoFile" type="file" class="form-control" disabled>
<p class="form-text text-muted">In order to upload a logo, a <a asp-controller="UIServer" asp-action="Files">file storage</a> must be configured.</p>
}
</div>
<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" />
<input asp-for="BrandColor" class="form-control form-control-color flex-grow-0 font-monospace" pattern="@ColorPalette.Pattern" style="width:5.5rem" />
</div>
<span asp-validation-for="BrandColor" class="text-danger"></span>
</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>
<a href="https://docs.btcpayserver.org/FAQ/Stores/#allow-anyone-to-create-invoice" target="_blank" rel="noreferrer noopener">
<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>
<a href="https://docs.btcpayserver.org/FAQ/Stores/#add-network-fee-to-invoice-vary-with-mining-fees" target="_blank" rel="noreferrer noopener">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</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>
<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">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<div class="input-group">
2022-03-30 00:58:50 -07:00
<input inputmode="numeric" asp-for="InvoiceExpiration" class="form-control" style="max-width:10ch;"/>
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>
<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">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<div class="input-group">
2022-03-30 00:58:50 -07:00
<input inputmode="decimal" asp-for="PaymentTolerance" class="form-control" style="max-width:10ch;"/>
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">
2022-03-30 00:58:50 -07:00
<input inputmode="numeric" asp-for="BOLT11Expiration" class="form-control" style="max-width:10ch;"/>
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-01-17 17:19:27 -08:00
<button name="command" type="submit" class="btn btn-primary mt-2" value="Save" id="Save">Save</button>
2021-10-29 08:25:43 +02:00
</form>
@if (Model.CanDelete)
{
2022-01-17 17:19:27 -08:00
<h3 class="mt-5 mb-3">Additional Actions</h3>
2021-10-29 08:25:43 +02:00
<div id="danger-zone">
2022-01-17 17:19:27 -08:00
<a id="DeleteStore" class="btn btn-outline-danger mb-5 mt-2" 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." data-confirm-input="DELETE">Delete this store</a>
2021-10-29 08:25:43 +02:00
</div>
}
</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
}