@model IEnumerable<EventDto>
@{
    ViewData["Title"] = "Events";
}

<div class="d-flex justify-content-between align-items-center mb-3">
    <h2>Events</h2>
    <a asp-action="Create" class="btn btn-primary">Add Event</a>
</div>

<partial name="_Notification" />

<div class="row">
    @foreach (var category in new[] { "Track", "Field", "HighJump" })
    {
        var catEvents = Model.Where(e => e.Category.ToString() == category);
        if (!catEvents.Any()) continue;
        <div class="col-md-4">
            <div class="card shadow-sm mb-3">
                <div class="card-header bg-dark text-white"><h6 class="mb-0">@category Events</h6></div>
                <ul class="list-group list-group-flush">
                    @foreach (var e in catEvents)
                    {
                        <li class="list-group-item d-flex justify-content-between align-items-center">
                            @e.Name
                            <span>
                                @if (e.IsRelay) { <span class="badge bg-info">Relay</span> }
                                @if (e.PrimarySchool) { <span class="badge bg-success">P</span> }
                                @if (e.SecondarySchool) { <span class="badge bg-primary">S</span> }
                            </span>
                        </li>
                    }
                </ul>
            </div>
        </div>
    }
</div>

<partial name="_Pagination" />
