Files
Disco/Disco.Web/Views/Device/_DeviceTable.cshtml
T
2018-04-19 17:06:58 +10:00

106 lines
4.1 KiB
Plaintext

@model IEnumerable<Disco.Models.Services.Searching.DeviceSearchResultItem>
@{
var canShowDevices = Authorization.Has(Claims.Device.Show);
var canShowUsers = Authorization.Has(Claims.User.Show);
Html.BundleDeferred("~/ClientScripts/Modules/Disco-DataTableHelpers");
}
<div class="genericData deviceTable">
@if (Model != null && Model.Count() > 0)
{
<table class="genericData deviceTable">
<thead>
<tr>
<th>Serial</th>
<th>Asset</th>
<th class="date">Decommissioned</th>
<th>Name</th>
<th>Model</th>
<th>Profile</th>
<th>Batch</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
</td>
<td>
@if (item.DecommissionedDate.HasValue)
{ @CommonHelpers.FriendlyDate(item.DecommissionedDate.Value) }
</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.DeviceProfileName
</td>
<td>
@if (item.DeviceBatchName != null)
{
<span>@item.DeviceBatchName</span>
}
else
{
<span class="smallMessage">N/A</span>
}
</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>