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

105 lines
4.5 KiB
Plaintext
Raw Normal View History

2020-05-21 20:25:47 +01:00
@{
2020-12-20 21:34:13 +00: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
// ----------------------------------------------------------------------------
//
// 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/>.
//
// ----------------------------------------------------------------------------
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"
2020-05-21 23:32:21 +01:00
@page "/companies/country/{CountryId:int}"
2020-05-22 00:12:13 +01:00
@page "/companies/{StartingCharacter}"
2020-05-21 20:25:47 +01:00
@inherits OwningComponentBase<CompaniesService>
@inject IStringLocalizer<CompaniesService> L
@inject IWebHostEnvironment Host
2018-04-20 19:21:29 +01:00
2020-12-20 21:34:13 +00:00
@if(_companies is null)
2020-05-21 20:25:47 +01:00
{
<p align="center">@L["Loading..."]</p>
return;
2018-04-20 19:21:29 +01:00
}
2020-05-21 20:25:47 +01:00
2020-12-20 21:34:13 +00:00
@if(CountryId.HasValue)
2020-06-01 02:44:34 +01:00
{
<p align="center">
2020-05-21 23:32:21 +01:00
<b>@string.Format(L["Companies founded in {0}."], L[_countryName])</b>
2020-12-20 21:34:13 +00:00
@if(File.Exists(Path.Combine(Host.WebRootPath, "assets/flags/countries", $"{CountryId:D3}.svg")))
2020-05-21 23:32:21 +01:00
{
2020-12-20 21:34:13 +00:00
<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,
2020-12-20 21:34:13 +00:00
/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,
2020-12-20 21:34:13 +00:00
/assets/flags/countries/png/1x/@($"{CountryId:D3}").webp 3x" />
</picture>
2020-05-21 23:32:21 +01:00
}
2020-06-01 02:44:34 +01:00
</p>
}
2020-05-21 23:32:21 +01:00
2020-12-20 21:34:13 +00:00
@if(_character.HasValue)
2020-06-01 02:44:34 +01:00
{
<p align="center">
2020-05-22 00:12:13 +01:00
<b>@string.Format(L["Companies which name starts with {0}."], _character)</b>
2020-06-01 02:44:34 +01:00
</p>
}
2020-05-22 00:12:13 +01:00
2020-12-20 21:34:13 +00:00
@if(_companies.Any())
2020-06-01 02:44:34 +01:00
{
<div class="container">
<span class="align-content-center">@string.Format(L["{0} companies found in the database."], _companies.Count())</span>
2020-12-20 21:34:13 +00:00
<hr />
2020-06-01 02:44:34 +01:00
<table>
2020-12-20 21:34:13 +00:00
@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,
2019-05-20 01:56:45 +01:00
/assets/logos/thumbs/webp/2x/@(company.LastLogo).webp 2x,
2020-12-20 21:34:13 +00:00
/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,
2020-06-01 02:44:34 +01:00
/assets/logos/thumbs/png/2x/@(company.LastLogo).png 2x,
2020-12-20 21:34:13 +00:00
/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>
}
2020-06-01 02:44:34 +01:00
</table>
</div>
}
else
{
<p align="center">@L["There are no companies in the database."]</p>
2020-12-20 21:34:13 +00:00
}