Files
marechai/Marechai/Pages/Companies/Index.razor

86 lines
3.2 KiB
Plaintext
Raw Normal View History

2020-05-21 20:25:47 +01:00
@{
/******************************************************************************
2020-02-10 01:52:56 +00:00
// MARECHAI: Master repository of computing history artifacts information
2018-04-20 19:21:29 +01:00
// ----------------------------------------------------------------------------
//
2020-05-21 20:25:47 +01:00
// Filename : Index.razor
2018-04-20 19:21:29 +01:00
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Lists all 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/>.
//
// ----------------------------------------------------------------------------
2020-02-10 03:05:39 +00:00
// Copyright © 2003-2020 Natalia Portillo
2018-04-20 19:21:29 +01:00
*******************************************************************************/
2020-05-21 20:25:47 +01:00
}
@page "/companies"
@inherits OwningComponentBase<CompaniesService>
@inject IStringLocalizer<CompaniesService> L
@inject IWebHostEnvironment Host
2018-04-20 19:21:29 +01:00
2020-05-21 20:25:47 +01:00
@if (_companies is null)
{
<p align="center">@L["Loading..."]</p>
return;
2018-04-20 19:21:29 +01:00
}
2020-05-21 20:25:47 +01:00
2018-08-06 21:07:23 +01:00
<p align="center">
2020-05-21 20:25:47 +01:00
@if (_companies.Any())
2018-04-20 19:21:29 +01:00
{
<p>
2020-05-21 20:25:47 +01:00
@string.Format(L["{0} companies found in the database."], _companies.Count())
2020-02-10 22:44:18 +00:00
<br />
2020-05-21 20:25:47 +01:00
@foreach (var company in _companies)
2018-04-20 19:21:29 +01:00
{
2020-05-21 20:25:47 +01:00
<a href="/companies/@company.Id">
2020-02-10 22:44:18 +00:00
@if (company.LastLogo != null &&
2020-05-21 20:25:47 +01:00
File.Exists(Path.Combine(Host.WebRootPath, "assets/logos", company.LastLogo + ".svg")))
2018-04-20 19:21:29 +01:00
{
<picture>
2020-02-10 22:44:18 +00:00
<source type="image/svg+xml" srcset="/assets/logos/@(company.LastLogo).svg">
<source type="image/webp" srcset="/assets/logos/thumbs/webp/1x/@(company.LastLogo).webp,
2019-05-20 01:56:45 +01:00
/assets/logos/thumbs/webp/2x/@(company.LastLogo).webp 2x,
/assets/logos/thumbs/webp/3x/@(company.LastLogo).webp 3x">
2019-05-20 01:44:22 +01:00
<img srcset="/assets/logos/thumbs/png/1x/@(company.LastLogo).png,
2019-05-20 01:56:45 +01:00
/assets/logos/thumbs/png/2x/@(company.LastLogo).png 2x,
2020-05-21 20:25:47 +01:00
/assets/logos/thumbs/png/3x/@(company.LastLogo).png 3x" src="/assets/logos/thumbs/png/1x@(company.LastLogo).png" alt="" height="auto" width="auto" style="max-height: 32px; max-width: 128px" />
2018-04-20 19:21:29 +01:00
</picture>
}
@company.Name
</a>
<br />
}
</p>
}
else
{
<p>There are no companies in the database.</p>
}
2020-05-21 20:25:47 +01:00
</p>
@code
{
List<CompanyViewModel> _companies;
protected override async Task OnInitializedAsync()
{
_companies = await Service.GetCompaniesAsync();
}
}