mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Move admin companis index to Blazor.
This commit is contained in:
114
Marechai/Pages/Admin/Companies.razor
Normal file
114
Marechai/Pages/Admin/Companies.razor
Normal file
@@ -0,0 +1,114 @@
|
||||
@{
|
||||
/******************************************************************************
|
||||
// MARECHAI: Master repository of computing history artifacts information
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : Companies.razor
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// List of companies
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright © 2003-2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
}
|
||||
|
||||
@page "/admin/companies"
|
||||
@inherits OwningComponentBase<CompaniesService>
|
||||
@inject IStringLocalizer<CompaniesService> L
|
||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||
<h3>@L["Companies"]</h3>
|
||||
@if (_companies is null)
|
||||
{
|
||||
<p>@L["Loading..."]</p>
|
||||
|
||||
return;
|
||||
}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@L["Name"]
|
||||
</th>
|
||||
<th>
|
||||
@L["Founded"]
|
||||
</th>
|
||||
<th>
|
||||
@L["Status"]
|
||||
</th>
|
||||
<th>
|
||||
@L["Country"]
|
||||
</th>
|
||||
<th>
|
||||
@L["Sold"]
|
||||
</th>
|
||||
<th>
|
||||
@L["Sold to"]
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in _companies)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@item.Name
|
||||
</td>
|
||||
<td>
|
||||
@($"{item.Founded:d}")
|
||||
</td>
|
||||
<td>
|
||||
@item.Status
|
||||
</td>
|
||||
<td>
|
||||
@item.Country
|
||||
</td>
|
||||
<td>
|
||||
@item.SoldView
|
||||
</td>
|
||||
<td>
|
||||
@item.SoldTo
|
||||
</td>
|
||||
<td>
|
||||
<span class="btn btn-primary">
|
||||
@L["Details"]
|
||||
</span>
|
||||
<span class="btn btn-secondary">
|
||||
@L["Edit"]
|
||||
</span>
|
||||
<span class="btn btn-danger">
|
||||
@L["Delete"]
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@code
|
||||
{
|
||||
List<CompanyViewModel> _companies;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_companies = await Service.GetCompaniesAsync();
|
||||
}
|
||||
}
|
||||
@@ -37,9 +37,12 @@
|
||||
<h3>@L["Administration area"]</h3>
|
||||
<p>@L["Welcome to the administration area. Act with care!"]</p>
|
||||
<ul>
|
||||
<authorizeview Roles="UberAdmin">
|
||||
<AuthorizeView Roles="UberAdmin">
|
||||
<li>
|
||||
<a href="/admin/browser_tests">@L["Browser tests"]</a>
|
||||
</li>
|
||||
</authorizeview>
|
||||
</AuthorizeView>
|
||||
<li>
|
||||
<a href="/admin/companies">@L["Companies"]</a>
|
||||
</li>
|
||||
</ul>
|
||||
Reference in New Issue
Block a user