EnVisageOnline/Beta/Source/EnVisage/Views/View/_resourcesList.cshtml

94 lines
2.7 KiB
Plaintext

@using EnVisage.Code.HtmlHelpers
@using EnVisage.Code
@using Microsoft.AspNet.Identity
@model IList<EnVisage.Team>
<script type="text/javascript">
init.push(function () {
var tbl = $('.resourceTable').dataTable({
"bPaginate": true,
"bSort": true,
"bFilter": true,
"bInfo": true,
"sScrollY": "",
"sScrollX": "",
"bScrollCollapse": true
});
});
</script>
<div class="panel">
<div class="panel-heading">
<span class="panel-title ui-expander">
<a data-toggle="collapse" data-target="#panelTeams">
<i class="panel-title-icon fa fa-users"></i>Teams
</a>
</span>
</div>
<div id="panelTeams" class="panel-collapse collapse in">
<div class="panel-body padding-sm">
<div class="messages-list">
@if (Model.Any())
{
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered resourceTable"
id="resourceTbl_">
<thead>
<tr>
<th>Name</th>
<th>Active Employee</th>
<th>Start Date</th>
<th>End Date</th>
<th>Expenditure</th>
@*<th></th>*@
</tr>
</thead>
<tbody>
@foreach (var team in Model)
{
<tr><td colspan="5"><strong>@team.Name</strong></td></tr>
if(team.PeopleResources.Any())
{
foreach (var resource in team.PeopleResources)
{
<tr>
<td><a href="@Url.Action("Details", "PeopleResource", new { resourceId = resource.Id })">@(resource.FirstName + " " + resource.LastName)</a></td>
<td>@(resource.IsActiveEmployee ? "Active" : "Inactive")</td>
<td>@resource.StartDate.ToShortDateString()</td>
<td>@resource.EndDate.ToShortDateString()</td>
@if (resource.ExpenditureCategory == null || resource.ExpenditureCategory.Expenditure == null)
{
<td>No expenditure</td>
}
else
{
<td>@resource.ExpenditureCategory.Expenditure.Name</td>
}
@*<td>
@if (Html.CheckSecurityObjectPermission(Areas.Resources, AccessLevel.Write))
{
<a href="@Url.Action("Edit", "PeopleResource", new { resourceId = resource.Id })" class="btn btn-primary"><i class="fa fa-pencil"></i> Edit</a>
<a href="@Url.Action("Delete", "PeopleResource", new { resourceId = resource.Id })" class="btn btn-danger"><i class="fa fa-trash-o"></i> Delete</a>
}
</td>*@
</tr>
}
}else{
<tr><td colspan="5">No resources in the team.</td></tr>
}
}
</tbody>
<tfoot>
</tfoot>
</table>
}
else
{
<span>No teams in the view.</span>
}
</div>
</div>
</div>
</div>