Files
Disco/Disco.Web/Views/Device/_DeviceTable.cshtml
T
Gary Sharp 2ac3a9bdd3 Bug Fix: Minor permission enforcements
Also some UI tweaks.
2014-02-13 15:27:04 +11:00

98 lines
3.7 KiB
Plaintext

@model IEnumerable<Disco.Models.Services.Searching.DeviceSearchResultItem>
@{
var canShowDevices = Authorization.Has(Claims.Device.Show);
var canShowUsers = Authorization.Has(Claims.User.Show);
}
<div class="genericData deviceTable">
@if (Model != null && Model.Count() > 0)
{
<table class="genericData deviceTable">
<thead>
<tr>
<th>Serial#
</th>
<th>Asset#
</th>
<th>Name
</th>
<th>Model
</th>
<th>Profile
</th>
<th>Assigned User
</th>
<th>Jobs
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr class="@(item.DecommissionedDate.HasValue ? "decommissioned" : string.Empty)">
<td>
@if (canShowDevices)
{@Html.ActionLink(item.Id, MVC.Device.Show(item.Id))}
else
{@item.Id}
</td>
<td>
@item.AssetNumber
@if (item.DecommissionedDate.HasValue)
{ <span class="smallMessage">(Decommissioned
@CommonHelpers.FriendlyDate(item.DecommissionedDate.Value))</span> }
</td>
<td>
@if (string.IsNullOrWhiteSpace(item.ComputerName))
{
<span class="smallMessage">Unknown</span>
}
else
{
@item.ComputerName
}
</td>
<td>
@if (item.DeviceModelDescription != null)
{
<span>@item.DeviceModelDescription</span>
}
else
{
<span class="smallMessage">Unknown</span>
}
</td>
<td>
@item.DeviceProfileDescription
</td>
<td>
@if (string.IsNullOrEmpty(item.AssignedUserId))
{
<span class="smallMessage">N/A</span>
}
else
{
<span>@if (canShowUsers)
{
@Html.ActionLink(item.AssignedUserDescription, MVC.User.Show(item.AssignedUserId))
}
else
{
@item.AssignedUserDescription
}
</span>
}
</td>
<td>
@item.JobCount
</td>
</tr>
}
</tbody>
</table>
}
else
{
<span class="smallMessage">No Devices Found</span>
}
</div>