2020-10-16 00:35:53 -05:00
@model StoresViewModel
2017-09-13 23:50:36 +09:00
@{
2021-04-08 15:32:42 +02:00
ViewData.SetActivePageAndTitle(StoreNavPages.Index, "Stores");
2020-08-27 01:31:33 -07:00
var storeNameSortOrder = (string)ViewData["StoreNameSortOrder"];
var storeWebsiteSortOrder = (string)ViewData["StoreWebsiteSortOrder"];
var sortByDesc = "Sort by descending...";
var sortByAsc = "Sort by ascending...";
2017-09-13 23:50:36 +09:00
}
<section>
2017-10-27 17:53:04 +09:00
<div class="container">
2021-04-08 15:32:42 +02:00
<partial name="_StatusMessage" />
2017-09-13 23:50:36 +09:00
2021-04-08 15:32:42 +02:00
<div class="d-sm-flex align-items-center justify-content-between mb-2">
<h2 class="mb-0">@ViewData["PageTitle"]</h2>
<a asp-action="CreateStore" class="btn btn-primary mt-3 mt-sm-0" role="button" id="CreateStore"><span class="fa fa-plus"></span> Create a new store</a>
2019-11-01 22:15:02 +01:00
</div>
2017-10-27 17:53:04 +09:00
<div class="row">
2019-11-01 22:15:02 +01:00
<div class="col-lg-12">
2020-12-21 12:26:43 +01:00
@if (Model.Stores.Any())
{
2021-08-20 14:59:31 +02:00
<table class="table table-hover">
2020-12-21 12:26:43 +01:00
<thead>
<tr>
<th>
<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)">
Website
<span class="fa @(storeWebsiteSortOrder == "asc" ? "fa-sort-alpha-desc" : storeWebsiteSortOrder == "desc" ? "fa-sort-alpha-asc" : "fa-sort")" />
</a>
</th>
<th style="text-align:right">Actions</th>
2019-11-01 22:15:02 +01:00
</tr>
2020-12-21 12:26:43 +01:00
</thead>
<tbody>
@foreach (var store in Model.Stores)
{
<tr id="store-@store.Id">
<td>
@if (store.IsOwner)
{
2021-10-29 08:25:43 +02:00
<a asp-action="PaymentMethods" asp-controller="Stores" asp-route-storeId="@store.Id">@store.Name</a>
2020-12-21 12:26:43 +01:00
}
else
{
@store.Name
}
@if (store.HintWalletWarning)
{
<span class="fa fa-warning text-warning" title="Wallet not setup for this store" id="warninghint_@store.Id"></span>
}
</td>
<td>
@if (!string.IsNullOrEmpty(store.WebSite))
{
2021-07-06 10:35:42 +02:00
<a href="@store.WebSite" rel="noreferrer noopener">@store.WebSite</a>
2020-12-21 12:26:43 +01:00
}
</td>
<td style="text-align:right">
<a asp-action="ListInvoices" asp-controller="Invoice" asp-route-searchTerm="storeid:@store.Id">Invoices</a><span> - </span>
@if (store.IsOwner)
{
2021-10-29 08:25:43 +02:00
<a asp-action="PaymentMethods" asp-controller="Stores" asp-route-storeId="@store.Id" id="update-store-@store.Id">Settings</a><span> - </span>
2020-12-21 12:26:43 +01:00
}
2021-09-07 04:55:53 +02:00
<a asp-action="DeleteStore" asp-controller="Stores" asp-route-storeId="@store.Id" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-description="The store <strong>@store.Name</strong> will be permanently deleted. This action will also delete all invoices, apps and data associated with the store." data-confirm-input="DELETE">Delete</a>
2020-12-21 12:26:43 +01:00
</td>
</tr>
}
</tbody>
</table>
}
else
{
<p class="text-secondary mt-3">
There are no stores yet.
</p>
}
2019-11-01 22:15:02 +01:00
</div>
2017-10-27 17:53:04 +09:00
</div>
</div>
</section>
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"))" />