IW4M-Admin/WebfrontCore/Views/Penalty/List.cshtml

101 lines
4.5 KiB
Plaintext
Raw Normal View History

2022-04-19 19:43:58 -04:00
@using Humanizer
@using Data.Models
@model Data.Models.EFPenalty.PenaltyType
@{
2022-04-19 19:43:58 -04:00
var loc = Utilities.CurrentLocalization.LocalizationIndex;
}
2022-04-19 19:43:58 -04:00
<div class="content mt-20">
<h2 class="content-title mt-15">@ViewBag.Title</h2>
<table class="table with-fixed-layout bg-dark-dm bg-light-lm">
<thead>
<tr class="bg-primary text-light d-none d-lg-table-row">
<th colspan="20%">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</th>
<th colspan="10%">@loc["WEBFRONT_PENALTY_TEMPLATE_TYPE"]</th>
<th colspan="35%">@loc["WEBFRONT_PENALTY_TEMPLATE_OFFENSE"]</th>
<th colspan="20%">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
<th colspan="15%" class="text-right">@loc["WEBFRONT_PENALTY_TEMPLATE_TIME"]</th>
</tr>
<tr class="d-flex d-lg-table-row flex-column">
<td colspan="20%" class="p-10 pb-10">
<div class="d-flex p-5 pr-15 bg-dark-dm bg-light-lm rounded">
<div class="custom-switch">
@if (ViewBag.HideAutomatedPenalties)
{
2022-04-19 19:43:58 -04:00
<input type="checkbox" id="hide_automated_penalties_checkbox" checked="checked"/>
}
else
{
2022-04-19 19:43:58 -04:00
<input type="checkbox" id="hide_automated_penalties_checkbox"/>
}
2022-04-19 19:43:58 -04:00
<label for="hide_automated_penalties_checkbox">@loc["WEBFRONT_PENALTY_HIDE_AUTOMATED"]</label>
</div>
</div>
</td>
<td colspan="46%" class="p-10 pt-5 pb-5">
<div class="input-group mb-10 mb-lg-0">
<div class="input-group-prepend">
<span class="input-group-text">@loc["WEBFRONT_PENALTY_TEMPLATE_SHOWONLY"].Titleize()</span>
</div>
<select class="pl-15 form-control" id="penalty_filter_selection">
@foreach (var penaltyType in Enum.GetValues(typeof(EFPenalty.PenaltyType)).Cast<EFPenalty.PenaltyType>().OrderByDescending(penalty => penalty == EFPenalty.PenaltyType.Any))
{
2022-04-19 19:43:58 -04:00
if (penaltyType == EFPenalty.PenaltyType.Any)
{
if (Model == EFPenalty.PenaltyType.Any)
{
<option value="@Convert.ToInt32(penaltyType)" selected="selected">@penaltyType.ToString()</option>
}
else
{
<option value="@Convert.ToInt32(penaltyType)">@penaltyType.ToString()</option>
}
}
else
{
if (penaltyType == Model)
{
<option value="@Convert.ToInt32(penaltyType)" selected="selected">@penaltyType.ToString()</option>
}
else
{
<option value="@Convert.ToInt32(penaltyType)">@penaltyType.ToString()</option>
}
}
}
2022-04-19 19:43:58 -04:00
</select>
</div>
</td>
</tr>
2018-02-21 20:29:23 -05:00
</thead>
2022-04-19 19:43:58 -04:00
<tbody id="penalty_table">
@await Component.InvokeAsync("PenaltyList", new WebfrontCore.ViewModels.PenaltyFilterInfo
{
Offset = 0,
Count = 30,
ShowOnly = Model,
IgnoreAutomated = ViewBag.HideAutomatedPenalties,
})
2018-02-21 20:29:23 -05:00
</tbody>
</table>
2022-04-19 19:43:58 -04:00
<div class="w-full text-center">
<i id="loaderLoad" class="oi oi-chevron-bottom mt-10 loader-load-more text-primary m-auto" aria-hidden="true"></i>
</div>
2018-02-21 20:29:23 -05:00
</div>
@section scripts {
<environment include="Development">
<script type="text/javascript" src="~/js/penalty.js"></script>
</environment>
2022-04-19 19:43:58 -04:00
<script>
initLoader('/Penalty/ListAsync', '#penalty_table', 30, 30, [{
'name': 'hideAutomatedPenalties',
'value': () => document.getElementById('hide_automated_penalties_checkbox').checked
}, {
'name': 'showOnly',
'value': () => $('#penalty_filter_selection').val()
}]);
</script>
}