@model ProjectActivityViewModel
@{
    ViewData["Title"] = "Activity";
}

<nav class="breadcrumb-trail" aria-label="Breadcrumb">
    <a asp-controller="Projects" asp-action="Index">Projects</a>
    <a asp-controller="Projects" asp-action="Details" asp-route-id="@Model.Project.ProjectID">@Model.Project.ProjectName</a>
    <span>Activity</span>
</nav>

<div class="page-heading">
    <div>
        <p class="eyebrow">Project activity</p>
        <h1>Activity</h1>
    </div>
    <div class="button-row">
        <a class="btn btn-outline-secondary" asp-action="Details" asp-route-id="@Model.Project.ProjectID">Back to project</a>
    </div>
</div>

<section class="list-section">
    @if (!Model.Activities.Any())
    {
        <p class="muted">No project activity has been recorded yet.</p>
    }
    else
    {
        <div class="table-responsive">
            <table class="table align-middle">
                <thead>
                    <tr>
                        <th>Date</th>
                        <th>User</th>
                        <th>Action</th>
                        <th>Item</th>
                        <th>Description</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model.Activities)
                    {
                        <tr>
                            <td>@item.CreatedDateUTC.ToString("dd MMM yyyy HH:mm") UTC</td>
                            <td>@item.UserLabel</td>
                            <td>@item.ActivityType</td>
                            <td>@item.EntityType@(string.IsNullOrWhiteSpace(item.EntityName) ? string.Empty : $" \"{item.EntityName}\"")</td>
                            <td>@item.Description</td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    }
</section>
