2022-01-18 02:20:59 +01:00
|
|
|
@inject BTCPayServer.Services.BTCPayServerEnvironment _env
|
|
|
|
@inject SignInManager<ApplicationUser> _signInManager
|
2021-12-11 04:32:23 +01:00
|
|
|
@model BTCPayServer.Components.StoreSelector.StoreSelectorViewModel
|
|
|
|
@addTagHelper *, BundlerMinifier.TagHelpers
|
|
|
|
|
2022-01-18 02:20:59 +01:00
|
|
|
@functions {
|
|
|
|
@* ReSharper disable once CSharpWarnings::CS1998 *@
|
|
|
|
private async Task LogoContent()
|
|
|
|
{
|
|
|
|
var logoSrc = $"{ViewContext.HttpContext.Request.PathBase}/img/logo.svg";
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" role="img" alt="BTCPay Server" class="logo"><use href="@logoSrc#small" class="logo-small" /><use href="@logoSrc#large" class="logo-large" /></svg>
|
|
|
|
@if (_env.NetworkType != NBitcoin.ChainName.Mainnet)
|
|
|
|
{
|
|
|
|
<span class="badge bg-warning ms-1 ms-sm-0" style="font-size:10px;">@_env.NetworkType.ToString()</span>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private string StoreName(string title)
|
|
|
|
{
|
|
|
|
return string.IsNullOrEmpty(title) ? "Unnamed Store" : title;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@if (Model.CurrentStoreId == null)
|
|
|
|
{
|
|
|
|
<a href="~/" class="navbar-brand py-2 js-scroll-trigger">@{await LogoContent();}</a>
|
|
|
|
}
|
|
|
|
else if (Model.CurrentStoreIsOwner)
|
|
|
|
{
|
|
|
|
<a asp-controller="UIStores" asp-action="Dashboard" asp-route-storeId="@Model.CurrentStoreId" class="navbar-brand py-2 js-scroll-trigger">@{await LogoContent();}</a>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<a asp-controller="UIInvoice" asp-action="ListInvoices" asp-route-storeId="@Model.CurrentStoreId" class="navbar-brand py-2 js-scroll-trigger">@{await LogoContent();}</a>
|
|
|
|
}
|
|
|
|
|
2021-12-11 04:32:23 +01:00
|
|
|
<div id="StoreSelector">
|
2022-01-13 09:08:15 +01:00
|
|
|
@if (Model.Options.Count > 0)
|
|
|
|
{
|
|
|
|
<div id="StoreSelectorDropdown" class="dropdown only-for-js">
|
|
|
|
<button id="StoreSelectorToggle" class="btn btn-secondary dropdown-toggle rounded-pill @(Model.CurrentStoreId == null ? "text-secondary" : "")" type="button" data-bs-toggle="dropdown" aria-expanded="false">@(Model.CurrentStoreId == null ? "Select Store" : Model.CurrentDisplayName)</button>
|
|
|
|
<ul id="StoreSelectorMenu" class="dropdown-menu" aria-labelledby="StoreSelectorToggle">
|
|
|
|
@foreach (var option in Model.Options)
|
|
|
|
{
|
|
|
|
<li>
|
2022-01-18 02:20:59 +01:00
|
|
|
@if (option.IsOwner && option.WalletId != null)
|
|
|
|
{
|
|
|
|
<a asp-controller="UIWallets" asp-action="WalletTransactions" asp-route-walletId="@option.WalletId" class="dropdown-item@(option.Selected ? " active" : "")" id="StoreSelectorMenuItem-@option.Value">@StoreName(option.Text)</a>
|
|
|
|
}
|
|
|
|
else if (option.IsOwner)
|
2022-01-13 09:08:15 +01:00
|
|
|
{
|
2022-01-18 02:20:59 +01:00
|
|
|
<a asp-controller="UIStores" asp-action="Dashboard" asp-route-storeId="@option.Value" class="dropdown-item@(option.Selected ? " active" : "")" id="StoreSelectorMenuItem-@option.Value">@StoreName(option.Text)</a>
|
2022-01-13 09:08:15 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-18 02:20:59 +01:00
|
|
|
<a asp-controller="UIInvoice" asp-action="ListInvoices" asp-route-storeId="@option.Value" class="dropdown-item@(option.Selected ? " active" : "")" id="StoreSelectorMenuItem-@option.Value">@StoreName(option.Text)</a>
|
2022-01-13 09:08:15 +01:00
|
|
|
}
|
|
|
|
</li>
|
|
|
|
}
|
|
|
|
<li><hr class="dropdown-divider"></li>
|
2022-01-07 12:32:00 +09:00
|
|
|
<li><a asp-controller="UIUserStores" asp-action="CreateStore" class="dropdown-item" id="StoreSelectorCreate">Create Store</a></li>
|
2022-01-13 09:08:15 +01:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
}
|
2022-01-18 02:20:59 +01:00
|
|
|
else if (_signInManager.IsSignedIn(User))
|
2022-01-13 09:08:15 +01:00
|
|
|
{
|
2022-01-07 12:32:00 +09:00
|
|
|
<a asp-controller="UIUserStores" asp-action="CreateStore" class="btn btn-primary w-100 rounded-pill" id="StoreSelectorCreate">Create Store</a>
|
2022-01-13 09:08:15 +01:00
|
|
|
}
|
2021-12-11 04:32:23 +01:00
|
|
|
</div>
|