@model IEnumerable<ApplicationUser>
@{
    ViewData["Title"] = "Lista de usuarios";
}

<br />
<br />

<div class="border backgroundWhite">
    <div class="row">
        <div class="col-6">
            <h2 class="text-info">Lista de Usuarios</h2>
        </div>
        <div class="col-6">
            <a asp-area="Identity" asp-page="/Account/Register" class="btn btn-info">
                <i class="fas fa-plus"></i>&nbsp; Registra un nuevo usuario
            </a>
        </div>
    </div>

    @if (Model.Count() > 0)
    {
        <table class="table table-striped table-bordered" style="width:100%">
            <thead>
            <tr>
                <th>@Html.DisplayNameFor(m => m.Nombre)</th>
                <th>@Html.DisplayNameFor(m => m.Email)</th>
                <th>@Html.DisplayNameFor(m => m.PhoneNumber)</th>
                <th>Acciones</th>
            </tr>
        </thead>
        <tbody>
                @foreach(var item in Model)
                {
                    <tr>
                        <td>@Html.DisplayFor(m => item.Nombre)</td>
                        <td>@Html.DisplayFor(m => item.Email)</td>
                        <td>@Html.DisplayFor(m => item.PhoneNumber)</td>
                        <td>
                            @if(item.LockoutEnd == null || item.LockoutEnd < DateTime.Now)
                            {
                                <a class="btn btn-warning text-white" asp-action="Bloquear" style="width:50px" asp-route-id="@item.Id">
                                    <i class="fas fa-lock"></i>
                                </a>
                            }
                            else
                            {
                                <a class="btn btn-success text-white" asp-action="Desbloquear" style="width:50px" asp-route-id="@item.Id">
                                    <i class="fas fa-lock-open"></i>
                                </a>
                            }
                        </td>
                    </tr>
                }
            </tbody>


        </table>
    }else
    {
        <p>No existen usuarios...</p>
    }

</div>