@model SharedLibraryCore.Database.Models.EFPenalty.PenaltyType
@{
    var loc = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex;
}
<h4 class="pb-3 text-center">@ViewBag.Title</h4>
<div class="row">
    <div class="d-block d-md-flex w-100 pb-2">
        <select class="form-control bg-dark text-muted" id="penalty_filter_selection">
            @{
                foreach (var penaltyType in Enum.GetValues(typeof(SharedLibraryCore.Database.Models.EFPenalty.PenaltyType)))
                {
                    if ((SharedLibraryCore.Database.Models.EFPenalty.PenaltyType)penaltyType == SharedLibraryCore.Database.Models.EFPenalty.PenaltyType.Any)
                    {
                        if (Model == SharedLibraryCore.Database.Models.EFPenalty.PenaltyType.Any)
                        {
                            <option value="@Convert.ToInt32(penaltyType)" selected="selected" )>@loc["WEBFRONT_PENALTY_TEMPLATE_SHOW"] @penaltyType.ToString()</option>
                        }
                        else
                        {
                            <option value="@Convert.ToInt32(penaltyType)" )>@loc["WEBFRONT_PENALTY_TEMPLATE_SHOW"]  @penaltyType.ToString()</option>
                        }
                    }
                    else
                    {
                        if ((SharedLibraryCore.Database.Models.EFPenalty.PenaltyType)penaltyType == Model)
                        {
                            <option value="@Convert.ToInt32(penaltyType)" selected="selected">@loc["WEBFRONT_PENALTY_TEMPLATE_SHOWONLY"]  @penaltyType.ToString()s</option>
                        }
                        else
                        {
                            <option value="@Convert.ToInt32(penaltyType)" )>@loc["WEBFRONT_PENALTY_TEMPLATE_SHOWONLY"]  @penaltyType.ToString()s</option>
                        }
                    }
                }
            }
        </select>
        <div class="pl-md-2 pr-md-2 pt-2 pt-md-0">
            <label class="toggle-switch">
                @if (ViewBag.HideAutomatedPenalties)
                {
                    <input type="checkbox" id="hide_automated_penalties_checkbox" checked="checked" />
                }

                else
                {
                    <input type="checkbox" id="hide_automated_penalties_checkbox" />
                }
                <span class="toggle-switch-slider"></span>
            </label>
        </div>
        <div class="align-self-center">
            <span class="text-light text-nowrap">@loc["WEBFRONT_PENALTY_HIDE_AUTOMATED"]</span>
        </div>
    </div>
</div>
<div class="row">
    <table class="table table-striped">
        <thead class="d-none d-lg-table-header-group">
            <tr class="bg-primary pt-2 pb-2">
                <th scope="col">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</th>
                <th scope="col">@loc["WEBFRONT_PENALTY_TEMPLATE_TYPE"]</th>
                <th scope="col">@loc["WEBFRONT_PENALTY_TEMPLATE_OFFENSE"]</th>
                <th scope="col">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
                <th scope="col" class="text-right">@loc["WEBFRONT_PENALTY_TEMPLATE_TIME"]</th>
            </tr>
        </thead>
        <tbody id="penalty_table" class="border-bottom bg-dark">
            @await Component.InvokeAsync("PenaltyList", new WebfrontCore.ViewModels.PenaltyFilterInfo()
            {
                Offset = 0,
                ShowOnly = Model,
                IgnoreAutomated = ViewBag.HideAutomatedPenalties
            })
        </tbody>
    </table>
    <table class="table d-table d-lg-none">
        <tbody></tbody>
    </table>
    <span id="load_penalties_button" class="oi oi-chevron-bottom text-center text-primary w-100 h3 pb-0 mb-0 d-none d-lg-block"></span>
</div>

@section scripts {
    <environment include="Development">
        <script type="text/javascript" src="~/js/penalty.js"></script>
    </environment>
}
