71 lines
2.8 KiB
Plaintext
71 lines
2.8 KiB
Plaintext
@model Disco.Web.Areas.Config.Models.DeviceModel.IndexModel
|
|
@{
|
|
Authorization.Require(Claims.Config.DeviceModel.Show);
|
|
|
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models");
|
|
|
|
var hasDecommissionedModels = Model.DeviceModels.Any(db => db.DeviceCount > 0 && db.DeviceDecommissionedCount >= db.DeviceCount);
|
|
}
|
|
@if (hasDecommissionedModels)
|
|
{
|
|
<a id="Config_DeviceModels_ShowDecommissioned" href="#" class="button small">Show Decommissioned (@(Model.DeviceModels.Count(db => db.DeviceCount > 0 && db.DeviceDecommissionedCount >= db.DeviceCount)))</a>
|
|
<script>
|
|
$(function () {
|
|
$('#Config_DeviceModels_ShowDecommissioned').click(function () {
|
|
$(this).remove();
|
|
$('#Config_DeviceModels_List').find('tr.hidden').show();
|
|
return false;
|
|
}).detach().appendTo('#layout_PageHeading');
|
|
})
|
|
</script>
|
|
}
|
|
<table id="Config_DeviceModels_List" class="tableData">
|
|
<tr>
|
|
<th>Name/Description</th>
|
|
<th>Manufacturer</th>
|
|
<th>Model</th>
|
|
<th>Type</th>
|
|
<th>Device Count</th>
|
|
</tr>
|
|
@foreach (var item in Model.DeviceModels)
|
|
{
|
|
var isDecommissioned = item.DeviceCount > 0 && item.DeviceDecommissionedCount >= item.DeviceCount;
|
|
<tr class="@(isDecommissioned ? "hidden" : null)">
|
|
<td>
|
|
@Html.ActionLink(item.ToString(), MVC.Config.DeviceModel.Index(item.Id))
|
|
</td>
|
|
<td>
|
|
@Html.DisplayFor(modelItem => item.Manufacturer)
|
|
</td>
|
|
<td>
|
|
@Html.DisplayFor(modelItem => item.Model)
|
|
</td>
|
|
<td>
|
|
@Html.DisplayFor(modelItem => item.ModelType)
|
|
</td>
|
|
<td>
|
|
@if (item.DeviceCount > 0 && Authorization.Has(Claims.Device.Search))
|
|
{
|
|
<span>@Html.ActionLink(string.Format("View {0}", item.DeviceCount), MVC.Search.Query(item.Id.ToString(), "DeviceModel"))</span>
|
|
}
|
|
else
|
|
{
|
|
<span>@item.DeviceCount.ToString("n0")</span>
|
|
}
|
|
@if (item.DeviceDecommissionedCount > 0)
|
|
{
|
|
<span class="smallMessage" title="@(item.DeviceDecommissionedCount.ToString("n0")) Decommissioned">
|
|
(@(item.DeviceDecommissionedCount.ToString("n0")))
|
|
</span>
|
|
}
|
|
</td>
|
|
</tr>
|
|
}
|
|
</table>
|
|
<div class="actionBar">
|
|
@Html.ActionLinkButton("Generic Components", MVC.Config.DeviceModel.GenericComponents())
|
|
@if (Authorization.HasAll(Claims.Config.DeviceModel.CreateCustom, Claims.Config.DeviceModel.Configure))
|
|
{
|
|
@Html.ActionLinkButton("Create Custom Device Model", MVC.Config.DeviceModel.Create())
|
|
}
|
|
</div> |