@model IEnumerable<Yavsc.Models.Activity>

@{
    ViewData["Title"] = "Index";
}

<h2>Index</h2>

<p>
    <a asp-action="Create">Create New</a>
</p>
<table class="table">
    <tr>
        <th>
          @Html.DisplayNameFor(model => model.Code)
        </th>
        <th>
           @SR["Name"]
        </th>

        <th>
            @Html.DisplayNameFor(model => model.Description)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Photo)
        </th>
        <th>
             @Html.DisplayNameFor(model => model.Parent)
        </th>
        <th>
            @SR["SettingsClass"]
        </th>
    </tr>
    
@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Code)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>@if (item.Photo!=null) {
            <img src="@item.Photo" style="max-height: 4em;" />
        }
        </td>
        <td>
            @if (item.Parent!=null) {
                <text>
            @Html.DisplayFor(modelItem => item.Parent)
            </text>
            }
        </td>
        <td>
         @if (item.SettingsClassName!=null) {
                <text>
            @SR[item.SettingsClassName]
                </text>
        }
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Children)
        </td>
        <td>
            <a asp-action="Edit" asp-route-id="@item.Code">Edit</a> |
            <a asp-action="Details" asp-route-id="@item.Code">Details</a> |
            <a asp-action="Delete" asp-route-id="@item.Code">Delete</a>
        </td>
    </tr>
}
</table>
