@page "/players"
@using Blazor.ViewClasses;
@using Blazorise.DataGrid
@using Blazored.Modal;
<PageTitle>@Localizer["PageTitle"]</PageTitle>
<h3>@Localizer["Title"]</h3>
<div>
    <NavLink class="btn btn-primary" href="addPlayer" Match="NavLinkMatch.All">
        <i class="fa fa-plus"></i> @Localizer["Add"]
    </NavLink>
</div>

<DataGrid TItem="Player"
          Data="@players"
          ReadData="@OnReadData"
          TotalItems="@totalPlayer"
          PageSize="10"
          ShowPager
          Responsive>
    <DataGridColumn TItem="Player" Field="@nameof(Player.Id)" Caption="#" />
    <DataGridColumn TItem="Player" Field="@nameof(Player.Nickname)" Caption="@Localizer["Nickname"]" />
    <DataGridColumn TItem="Player" Field="@nameof(Player.Id)" Caption="Action">
        <DisplayTemplate>
            <a href="editPlayer/@(context.Id)" class="btn btn-primary"><i class="fa fa-edit"></i> @Localizer["Edit"]</a>
            <button type="button" class="btn btn-danger" @onclick="() => OnDelete(context.Id)"><i class="fa fa-trash"></i> @Localizer["Delete"]</button>
        </DisplayTemplate>
    </DataGridColumn>
</DataGrid>

