201 lines
6.7 KiB
Plaintext
201 lines
6.7 KiB
Plaintext
@using Microsoft.AspNetCore.Mvc.Localization
|
|
@using gehGassi.Domain.Coins
|
|
@using gehGassi.Core.Interfaces
|
|
@using gehGassi.Domain.Dogs
|
|
@using gehGassi.Web.Helper
|
|
@model List<CoinsPerYearWithNames>
|
|
@inject IViewLocalizer Localizer
|
|
|
|
@{
|
|
ViewData["Title"] = Localizer["Common_Competition"];
|
|
Layout = "_LayoutApp";
|
|
|
|
string selectedLanguage = "de";
|
|
if (ViewBag.SelectedLanguage != null)
|
|
{
|
|
selectedLanguage = ViewBag.SelectedLanguage;
|
|
}
|
|
|
|
string gassiUrl = string.Empty;
|
|
if (selectedLanguage.ToLower() == "de")
|
|
{
|
|
gassiUrl = "https://gehgassi.com/de/wettbewerb?role=owner";
|
|
}
|
|
else
|
|
{
|
|
gassiUrl = "https://gehgassi.com/en/competition?role=owner";
|
|
}
|
|
|
|
bool dark = ViewBag.DarkMode;
|
|
int year = ViewBag.Year;
|
|
var isCurrent = year == DateTimeOffset.UtcNow.Year;
|
|
|
|
var hasNext = !isCurrent;
|
|
var hasPrevious = false;
|
|
var nextYear = new DateTimeOffset(year, 1, 1, 0, 0, 0, TimeSpan.Zero).AddYears(1);
|
|
var previousYear = new DateTimeOffset(year, 1, 1, 0, 0, 0, TimeSpan.Zero).AddYears(-1);
|
|
if (previousYear >= new DateTimeOffset(2023, 1, 1, 0, 0, 0, TimeSpan.Zero))
|
|
{
|
|
hasPrevious = true;
|
|
}
|
|
|
|
var appUserId = string.Empty;
|
|
AppUser appUser = null;
|
|
if (ViewBag.AppUser != null)
|
|
{
|
|
appUser = ViewBag.AppUser;
|
|
appUserId = appUser.Id;
|
|
}
|
|
var appUserIsInList = false;
|
|
|
|
long selectedId = -1;
|
|
CoinsPerYear myCoins = null;
|
|
if (ViewBag.MyCoins != null)
|
|
{
|
|
myCoins = ViewBag.MyCoins;
|
|
selectedId = myCoins.Id;
|
|
}
|
|
var minCoins = 0m;
|
|
if (ViewBag.MinCoins != null)
|
|
{
|
|
minCoins = ViewBag.MinCoins;
|
|
}
|
|
CoinsOptions coinsOptions = ViewBag.CoinsOptions;
|
|
}
|
|
|
|
<div class="mt-4 ">
|
|
<div class="row">
|
|
<div class="col-2">
|
|
@if (hasPrevious)
|
|
{
|
|
<a href="@Url.Action("ShowCompetitionYearOwner", new{year=previousYear.Year, a=appUserId, dark=dark})" class="btn btn-primary"><</a>
|
|
}
|
|
else
|
|
{
|
|
<button class="btn btn-primary" disabled><</button>
|
|
}
|
|
</div>
|
|
<div class="col-8 text-center"><h2 class="mb-1">@year</h2></div>
|
|
<div class="col-2 text-end">
|
|
@if (hasNext)
|
|
{
|
|
<a href="@Url.Action("ShowCompetitionYearOwner", new{year=nextYear.Year, a=appUserId, dark=dark})" class="btn btn-primary">></a>
|
|
}
|
|
else
|
|
{
|
|
<button class="btn btn-primary" disabled>></button>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
@if (isCurrent)
|
|
{
|
|
<h5 class="mb-4 text-center mt-2">Min. @minCoins gassiCoins</h5>
|
|
}
|
|
|
|
@if (Model.Count == 0)
|
|
{
|
|
if (isCurrent)
|
|
{
|
|
<div class="alert alert-info mt-5 mb-5">
|
|
<div>@Localizer["Competition_Criteria_None"]</div>
|
|
<div>@Localizer["Competition_Criteria"] <strong>@minCoins gassiCoins</strong>.</div>
|
|
</div>
|
|
@if(appUser != null)
|
|
{
|
|
<h3 class="text-center mb-5">@Localizer["Competition_Coins_Current"]: @myCoins.Balance</h3>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
<div class="alert alert-info mt-5">
|
|
<div>@Localizer["Competition_NoWinner"]</div>
|
|
</div>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var counter = 1;
|
|
<div class="mt-2 mb-5">
|
|
@if (Model.Count >= 10)
|
|
{
|
|
<div class="text-center"><h5>TOP 10</h5></div>
|
|
}
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">@Localizer["Competition_Place"]</th>
|
|
<th scope="col">@Localizer["Competition_Owner"]</th>
|
|
<th scope="col" class="text-end">gassiCoins</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var item in Model)
|
|
{
|
|
string selected;
|
|
if (item.Id == selectedId)
|
|
{
|
|
selected = "competition-selected";
|
|
appUserIsInList = true;
|
|
}
|
|
else
|
|
{
|
|
selected = string.Empty;
|
|
}
|
|
<tr class="@selected">
|
|
<th scope="row">@counter</th>
|
|
<td>@item.AppUserName.AnonymizeFullName()</td>
|
|
<td class="text-end">@item.Balance</td>
|
|
</tr>
|
|
counter++;
|
|
}
|
|
@if (!appUserIsInList && appUser != null)
|
|
{
|
|
<tr>
|
|
<th scope="row">...</th>
|
|
<td>...</td>
|
|
<td class="text-end">...</td>
|
|
</tr>
|
|
<tr class="competition-selected">
|
|
<th scope="row">
|
|
@if (Model.Count >= 10)
|
|
{
|
|
<span>11+</span>
|
|
}
|
|
else
|
|
{
|
|
<span>?</span>
|
|
}
|
|
</th>
|
|
<td>@((appUser.FirstName + " " + appUser.LastName).AnonymizeFullName())</td>
|
|
<td class="text-end">@myCoins.Balance</td>
|
|
</tr>
|
|
<tr>
|
|
<th scope="row">...</th>
|
|
<td>...</td>
|
|
<td class="text-end">...</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
|
|
</div>
|
|
}
|
|
|
|
@if (isCurrent)
|
|
{
|
|
<div class="text-center mb-3">
|
|
<a href="@gassiUrl">@Localizer["Competition_Price_About_Year"]</a>
|
|
</div>
|
|
<div class="alert alert-info">
|
|
<h4>@Localizer["Competition_Coins_HowToEarn"]</h4>
|
|
<div>@Localizer["Competition_Coins_Walk"]: <strong>@coinsOptions.WalkForOwner</strong></div>
|
|
<div>@Localizer["Competition_Coins_Sitting"]: <strong>@coinsOptions.SittingForOwner</strong></div>
|
|
<div>@Localizer["Competition_Coins_Daycare"]: <strong>@coinsOptions.DayCareForOwner</strong></div>
|
|
</div>
|
|
}
|
|
<div class="mt-4 mb-4 text-center">
|
|
<a class="btn btn-secondary" href="@Url.Action("Show", new{code="CYRULESDO", language=selectedLanguage})">@Localizer["Competition_Rules"]</a>
|
|
</div>
|
|
</div> |