@model IEnumerable<Activity>

@{
    ViewData["Title"] = "Index";
}
@section scripts {
    <script>
        $(document).ready(function(){
            $("tr[data-hidden=True]").css('background-color','grey')
        })
        </script>
}
<h2>Index</h2>

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

        <th>
            @Html.DisplayNameFor(model => model.Description)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Photo)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Parent)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.SettingsClassName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Children)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Rate)
        </th>
    </tr>
    
@foreach (var item in Model) {
    <tr data-hidden="@item.Hidden">
        <td>
           <a name="@item.Code" class="btn btn-link"></a> @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Code)
        </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>
          <a href="#@item.ParentCode">@Html.DisplayFor(modelItem => item.Parent)</a>
            </text>
            }
        </td>
        <td>
         @if (item.SettingsClassName!=null) {
                <text>
            @SR[item.SettingsClassName]
                </text>
        }
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Children)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Rate)
        </td>
        <td>
            <a asp-action="Edit" asp-route-id="@item.Code" class="btn btn-default">Edit</a> 
            <a asp-action="Details" asp-route-id="@item.Code" class="btn btn-success">Details</a> 
            <a asp-action="Delete" asp-route-id="@item.Code" class="btn btn-danger">Delete</a>
        </td>
    </tr>
}
</table>
