mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-09 16:24:23 +01:00
Showing warning hint on stores listing page
This commit is contained in:
@@ -5,6 +5,7 @@ using BTCPayServer.Models;
|
||||
using BTCPayServer.Models.StoreViewModels;
|
||||
using BTCPayServer.Security;
|
||||
using BTCPayServer.Services.Stores;
|
||||
using ExchangeSharp;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -125,12 +126,15 @@ namespace BTCPayServer.Controllers
|
||||
for (int i = 0; i < stores.Length; i++)
|
||||
{
|
||||
var store = stores[i];
|
||||
var blob = store.GetStoreBlob();
|
||||
result.Stores.Add(new StoresViewModel.StoreViewModel()
|
||||
{
|
||||
Id = store.Id,
|
||||
|
||||
Name = store.StoreName,
|
||||
WebSite = store.StoreWebsite,
|
||||
IsOwner = store.Role == StoreRoles.Owner
|
||||
IsOwner = store.Role == StoreRoles.Owner,
|
||||
HintWalletWarning = blob.Hints.Wallet
|
||||
});
|
||||
}
|
||||
return View(result);
|
||||
|
||||
@@ -4,32 +4,15 @@ namespace BTCPayServer.Models.StoreViewModels
|
||||
{
|
||||
public class StoresViewModel
|
||||
{
|
||||
public List<StoreViewModel> Stores
|
||||
{
|
||||
get; set;
|
||||
} = new List<StoreViewModel>();
|
||||
public List<StoreViewModel> Stores { get; set; } = new List<StoreViewModel>();
|
||||
|
||||
public class StoreViewModel
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string WebSite
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string Id
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public bool IsOwner
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string WebSite { get; set; }
|
||||
public bool IsOwner { get; set; }
|
||||
public bool HintWalletWarning { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace BTCPayServer.Services.Stores
|
||||
blob.Hints = new Data.StoreBlob.StoreHints
|
||||
{
|
||||
Wallet = true,
|
||||
Lighting = true,
|
||||
Lightning = true,
|
||||
Rates = true
|
||||
};
|
||||
store.SetStoreBlob(blob);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@model StoresViewModel
|
||||
@model StoresViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Stores";
|
||||
var storeNameSortOrder = (string)ViewData["StoreNameSortOrder"];
|
||||
@@ -11,11 +11,11 @@
|
||||
<div class="container">
|
||||
@if (TempData.HasStatusMessage())
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<partial name="_StatusMessage" />
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<partial name="_StatusMessage" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="row">
|
||||
<div class="col-lg-12 section-heading">
|
||||
@@ -37,25 +37,21 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<a
|
||||
asp-action="ListStores"
|
||||
asp-route-sortOrder="@(storeNameSortOrder ?? "asc")"
|
||||
asp-route-sortOrderColumn="StoreName"
|
||||
class="text-nowrap"
|
||||
title="@(storeNameSortOrder == "desc" ? sortByDesc : sortByAsc)"
|
||||
>
|
||||
<a asp-action="ListStores"
|
||||
asp-route-sortOrder="@(storeNameSortOrder ?? "asc")"
|
||||
asp-route-sortOrderColumn="StoreName"
|
||||
class="text-nowrap"
|
||||
title="@(storeNameSortOrder == "desc" ? sortByDesc : sortByAsc)">
|
||||
Name
|
||||
<span class="fa @(storeNameSortOrder == "asc" ? "fa-sort-alpha-desc" : storeNameSortOrder == "desc" ? "fa-sort-alpha-asc" : "fa-sort")" />
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a
|
||||
asp-action="ListStores"
|
||||
asp-route-sortOrder="@(storeWebsiteSortOrder ?? "asc")"
|
||||
asp-route-sortOrderColumn="StoreWebsite"
|
||||
class="text-nowrap"
|
||||
title="@(storeWebsiteSortOrder == "desc" ? sortByDesc : sortByAsc)"
|
||||
>
|
||||
<a asp-action="ListStores"
|
||||
asp-route-sortOrder="@(storeWebsiteSortOrder ?? "asc")"
|
||||
asp-route-sortOrderColumn="StoreWebsite"
|
||||
class="text-nowrap"
|
||||
title="@(storeWebsiteSortOrder == "desc" ? sortByDesc : sortByAsc)">
|
||||
Website
|
||||
<span class="fa @(storeWebsiteSortOrder == "asc" ? "fa-sort-alpha-desc" : storeWebsiteSortOrder == "desc" ? "fa-sort-alpha-asc" : "fa-sort")" />
|
||||
</a>
|
||||
@@ -67,7 +63,21 @@
|
||||
@foreach (var store in Model.Stores)
|
||||
{
|
||||
<tr id="store-@store.Id">
|
||||
<td>@store.Name</td>
|
||||
<td>
|
||||
@if (store.IsOwner)
|
||||
{
|
||||
<a asp-action="UpdateStore" asp-controller="Stores" asp-route-storeId="@store.Id" id="update-store-@store.Id">@store.Name</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
@store.Name
|
||||
}
|
||||
|
||||
@if (store.HintWalletWarning)
|
||||
{
|
||||
<span class="fa fa-warning text-warning" title="Wallet not setup for this store"></span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (!string.IsNullOrEmpty(store.WebSite))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user