Files
marechai/Marechai/Pages/Companies/Index.razor
2020-12-20 21:34:13 +00:00

105 lines
4.5 KiB
Plaintext

@{
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ 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 "/companies"
@page "/companies/country/{CountryId:int}"
@page "/companies/{StartingCharacter}"
@inherits OwningComponentBase<CompaniesService>
@inject IStringLocalizer<CompaniesService> L
@inject IWebHostEnvironment Host
@if(_companies is null)
{
<p align="center">@L["Loading..."]</p>
return;
}
@if(CountryId.HasValue)
{
<p align="center">
<b>@string.Format(L["Companies founded in {0}."], L[_countryName])</b>
@if(File.Exists(Path.Combine(Host.WebRootPath, "assets/flags/countries", $"{CountryId:D3}.svg")))
{
<picture>
<source srcset="/assets/flags/countries/@($"{CountryId:D3}").svg" type="image/svg+xml">
<source srcset="/assets/flags/countries/webp/1x/@($"{CountryId:D3}").webp,
/assets/flags/countries/webp/1x/@($"{CountryId:D3}").webp 2x,
/assets/flags/countries/webp/1x/@($"{CountryId:D3}").webp 3x" type="image/webp">
<img alt="" height="32" src="/assets/flags/countries/png/1x/@($"{CountryId:D3}").png" srcset="/assets/flags/countries/png/1x/@($"{CountryId:D3}").png,
/assets/flags/countries/png/1x/@($"{CountryId:D3}").png 2x,
/assets/flags/countries/png/1x/@($"{CountryId:D3}").webp 3x" />
</picture>
}
</p>
}
@if(_character.HasValue)
{
<p align="center">
<b>@string.Format(L["Companies which name starts with {0}."], _character)</b>
</p>
}
@if(_companies.Any())
{
<div class="container">
<span class="align-content-center">@string.Format(L["{0} companies found in the database."], _companies.Count())</span>
<hr />
<table>
@foreach(var company in _companies)
{
<tr>
<td class="text-right">
<a href="/company/@company.Id">
@if(company.LastLogo != null &&
File.Exists(Path.Combine(Host.WebRootPath, "assets/logos", company.LastLogo + ".svg")))
{
<picture>
<source srcset="/assets/logos/@(company.LastLogo).svg" type="image/svg+xml">
<source srcset="/assets/logos/thumbs/webp/1x/@(company.LastLogo).webp,
/assets/logos/thumbs/webp/2x/@(company.LastLogo).webp 2x,
/assets/logos/thumbs/webp/3x/@(company.LastLogo).webp 3x" type="image/webp">
<img alt="" height="auto" src="/assets/logos/thumbs/png/1x/@(company.LastLogo).png" srcset="/assets/logos/thumbs/png/1x/@(company.LastLogo).png,
/assets/logos/thumbs/png/2x/@(company.LastLogo).png 2x,
/assets/logos/thumbs/png/3x/@(company.LastLogo).png 3x" style="max-height: 32px; max-width: 128px" width="auto" />
</picture>
}
</a>
</td>
<td>
<a href="/company/@company.Id">@company.Name</a>
</td>
</tr>
}
</table>
</div>
}
else
{
<p align="center">@L["There are no companies in the database."]</p>
}