Update #9: Hide decommissioned batches by default

This commit is contained in:
Gary Sharp
2014-05-28 15:01:06 +10:00
parent 7cad69598f
commit f6fae26bc7
5 changed files with 335 additions and 188 deletions
@@ -3,66 +3,84 @@
Authorization.Require(Claims.Config.DeviceBatch.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches");
}
@if (Model.DeviceBatches.Count == 0)
{
<div class="form" style="width: 450px; padding: 100px 0;">
<h2>No device batches are configured</h2>
</div>
}
else
{
<table class="tableData">
<tr>
<th>Name
</th>
<th>Default Model
</th>
<th>Purchase Date
</th>
<th>Warranty Expires
</th>
<th>Insurance Expires
</th>
<th>Device Count
</th>
</tr>
@foreach (var item in Model.DeviceBatches)
<div id="Config_DeviceBatches">
@if (Model.DeviceBatches.Count == 0)
{
<div class="form" style="width: 450px; padding: 100px 0;">
<h2>No device batches are configured</h2>
</div>
}
else
{
if (Model.DeviceBatches.Any(db => db.DeviceCount > 0 && db.DeviceDecommissionedCount >= db.DeviceCount))
{
<tr>
<td>
@Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id))
</td>
<td>
@item.DefaultDeviceModel
</td>
<td>
@CommonHelpers.FriendlyDate(item.PurchaseDate)
</td>
<td>
@CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown")
</td>
<td>
@CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown")
@(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier))
</td>
<td>
@if (item.PurchaseUnitQuantity.HasValue)
{
<span>@item.DeviceCount.ToString("n0")/@(item.PurchaseUnitQuantity.Value.ToString("n0"))</span>
}
else
{
@item.DeviceCount.ToString("n0")
}
@if (item.DeviceDecommissionedCount > 0)
{
<span class="smallMessage" title="@(item.DeviceDecommissionedCount.ToString("n0")) Decommissioned">(@(item.DeviceDecommissionedCount.ToString("n0")))</span>
}
</td>
</tr>
<a id="Config_DeviceBatches_ShowDecommissioned" href="#" class="button small">Show Decommissioned (@(Model.DeviceBatches.Count(db => db.DeviceCount > 0 && db.DeviceDecommissionedCount >= db.DeviceCount)))</a>
<script>
$(function () {
//$Config_DeviceBatches_ShowDecommissioned = $('#Config_DeviceBatches_ShowDecommissioned');
$('#Config_DeviceBatches_ShowDecommissioned').click(function () {
$(this).remove();
$('#Config_DeviceBatches_List').find('tr.decommissioned').show();
return false;
}).detach().appendTo('#layout_PageHeading');
})
</script>
}
</table>
}
<table id="Config_DeviceBatches_List" class="tableData">
<tr>
<th>Name
</th>
<th>Default Model
</th>
<th>Purchase Date
</th>
<th>Warranty Expires
</th>
<th>Insurance Expires
</th>
<th>Device Count
</th>
</tr>
@foreach (var item in Model.DeviceBatches)
{
var isDecommissioned = item.DeviceCount > 0 && item.DeviceDecommissionedCount >= item.DeviceCount;
<tr class="@(isDecommissioned ? "decommissioned" : null)">
<td>
@Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)) @if (isDecommissioned) { <em>Decommissioned</em> }
</td>
<td>
@item.DefaultDeviceModel
</td>
<td>
@CommonHelpers.FriendlyDate(item.PurchaseDate)
</td>
<td>
@CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown")
</td>
<td>
@CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown")
@(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier))
</td>
<td>
@if (item.PurchaseUnitQuantity.HasValue)
{
<span>@item.DeviceCount.ToString("n0")/@(item.PurchaseUnitQuantity.Value.ToString("n0"))</span>
}
else
{
@item.DeviceCount.ToString("n0")
}
@if (item.DeviceDecommissionedCount > 0)
{
<span class="smallMessage" title="@(item.DeviceDecommissionedCount.ToString("n0")) Decommissioned">(@(item.DeviceDecommissionedCount.ToString("n0")))</span>
}
</td>
</tr>
}
</table>
}
</div>
@if (Authorization.HasAny(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.ShowTimeline))
{
<div class="actionBar">
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34011
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -53,155 +53,238 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"Config_DeviceBatches\"");
WriteLiteral(">\r\n");
#line 6 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (Model.DeviceBatches.Count == 0)
{
#line 7 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 7 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (Model.DeviceBatches.Count == 0)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px; padding: 100px 0;\"");
WriteLiteral(">\r\n <h2>No device batches are configured</h2>\r\n </div> \r\n");
WriteLiteral(">\r\n <h2>No device batches are configured</h2>\r\n </div> \r\n");
#line 11 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(@">
<tr>
<th>Name
</th>
<th>Default Model
</th>
<th>Purchase Date
</th>
<th>Warranty Expires
</th>
<th>Insurance Expires
</th>
<th>Device Count
</th>
</tr>
");
#line 29 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 29 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
foreach (var item in Model.DeviceBatches)
#line 12 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
else
{
if (Model.DeviceBatches.Any(db => db.DeviceCount > 0 && db.DeviceDecommissionedCount >= db.DeviceCount))
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" <a");
WriteLiteral(" ");
WriteLiteral(" id=\"Config_DeviceBatches_ShowDecommissioned\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"button small\"");
WriteLiteral(">Show Decommissioned (");
#line 33 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)));
#line 17 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Model.DeviceBatches.Count(db => db.DeviceCount > 0 && db.DeviceDecommissionedCount >= db.DeviceCount));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(")</a>\r\n");
WriteLiteral(" ");
WriteLiteral(@" <script>
$(function () {
//$Config_DeviceBatches_ShowDecommissioned = $('#Config_DeviceBatches_ShowDecommissioned');
$('#Config_DeviceBatches_ShowDecommissioned').click(function () {
$(this).remove();
$('#Config_DeviceBatches_List').find('tr.decommissioned').show();
return false;
}).detach().appendTo('#layout_PageHeading');
})
</script>
");
#line 36 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DefaultDeviceModel);
#line 29 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" <table");
WriteLiteral(" ");
WriteLiteral(" id=\"Config_DeviceBatches_List\"");
#line 39 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.PurchaseDate));
WriteLiteral(" class=\"tableData\"");
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 42 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown"));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
WriteLiteral(@">
<tr>
<th>Name
</th>
<th>Default Model
</th>
<th>Purchase Date
</th>
<th>Warranty Expires
</th>
<th>Insurance Expires
</th>
<th>Device Count
</th>
</tr>
");
#line 45 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown"));
#line default
#line hidden
#line 45 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
foreach (var item in Model.DeviceBatches)
{
var isDecommissioned = item.DeviceCount > 0 && item.DeviceDecommissionedCount >= item.DeviceCount;
#line default
#line hidden
WriteLiteral(" <tr");
WriteAttribute("class", Tuple.Create(" class=\"", 2028), Tuple.Create("\"", 2081)
#line 48 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
, Tuple.Create(Tuple.Create("", 2036), Tuple.Create<System.Object, System.Int32>(isDecommissioned ? "decommissioned" : null
#line default
#line hidden
, 2036), false)
);
WriteLiteral(">\r\n <td>\r\n");
WriteLiteral(" ");
#line 50 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)));
#line default
#line hidden
WriteLiteral(" ");
#line 50 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (isDecommissioned) {
#line default
#line hidden
WriteLiteral(" <em>Decommissioned</em> ");
#line 50 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 53 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DefaultDeviceModel);
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 56 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.PurchaseDate));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 59 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown"));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 62 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown"));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
WriteLiteral(" ");
#line 46 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier));
#line 63 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral("\r\n </td>\r\n <td>\r\n");
#line 49 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 49 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.PurchaseUnitQuantity.HasValue)
{
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.PurchaseUnitQuantity.HasValue)
{
#line default
#line hidden
WriteLiteral(" <span>");
WriteLiteral(" <span>");
#line 51 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line 68 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
@@ -209,8 +292,8 @@ WriteLiteral(" <span>");
WriteLiteral("/");
#line 51 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.PurchaseUnitQuantity.Value.ToString("n0"));
#line 68 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.PurchaseUnitQuantity.Value.ToString("n0"));
#line default
@@ -218,59 +301,59 @@ WriteLiteral("/");
WriteLiteral("</span>\r\n");
#line 52 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
else
{
#line 69 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
else
{
#line default
#line hidden
#line 55 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line 72 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
#line 55 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line 72 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral(" ");
#line 57 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.DeviceDecommissionedCount > 0)
{
#line 74 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.DeviceDecommissionedCount > 0)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2117), Tuple.Create("\"", 2188)
WriteAttribute("title", Tuple.Create(" title=\"", 3515), Tuple.Create("\"", 3586)
#line 59 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
, Tuple.Create(Tuple.Create("", 2125), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0")
#line 76 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
, Tuple.Create(Tuple.Create("", 3523), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0")
#line default
#line hidden
, 2125), false)
, Tuple.Create(Tuple.Create(" ", 2173), Tuple.Create("Decommissioned", 2174), true)
, 3523), false)
, Tuple.Create(Tuple.Create(" ", 3571), Tuple.Create("Decommissioned", 3572), true)
);
WriteLiteral(">(");
#line 59 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceDecommissionedCount.ToString("n0"));
#line 76 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceDecommissionedCount.ToString("n0"));
#line default
@@ -278,32 +361,34 @@ WriteLiteral(">(");
WriteLiteral(")</span>\r\n");
#line 60 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line 77 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n");
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 63 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line 80 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </table>\r\n");
WriteLiteral(" </table>\r\n");
#line 65 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line 82 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("</div>\r\n");
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line 84 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (Authorization.HasAny(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.ShowTimeline))
{
@@ -317,13 +402,13 @@ WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
#line 69 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line 87 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 69 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line 87 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (Authorization.Has(Claims.Config.DeviceBatch.ShowTimeline) && Model.DeviceBatches.Count > 0)
{
@@ -331,14 +416,14 @@ WriteLiteral(">\r\n");
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line 89 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline()));
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line 89 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
@@ -348,7 +433,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 73 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line 91 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (Authorization.HasAll(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.Configure))
{
@@ -356,14 +441,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 75 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line 93 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create()));
#line default
#line hidden
#line 75 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line 93 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
@@ -373,7 +458,7 @@ WriteLiteral(" ");
WriteLiteral(" </div>\r\n");
#line 78 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line 96 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
+18
View File
@@ -813,6 +813,24 @@ div.logEventsViewport table.logEventsViewport > tbody > tr > td.eventType {
margin-top: 8px;
text-align: right;
}
#Config_DeviceBatches #Config_DeviceBatches_List tr.decommissioned {
display: none;
}
#Config_DeviceBatches #Config_DeviceBatches_List tr.decommissioned > td {
background-color: #f7f7f7;
color: #888;
}
#Config_DeviceBatches #Config_DeviceBatches_List tr.decommissioned:nth-child(odd) > td {
background-color: #f2f2f2;
}
#Config_DeviceBatches_ShowDecommissioned {
position: absolute;
right: 30px;
bottom: 8px;
font-size: 0.5em;
line-height: 1em;
text-align: right;
}
.deviceBatches #DeviceBatch_PurchaseDetails_Container {
padding: 5px 0 5px 5px;
}
+26
View File
@@ -899,6 +899,32 @@ div.logEventsViewport {
}
}
// Device Batches
#Config_DeviceBatches {
#Config_DeviceBatches_List {
tr.decommissioned {
display: none;
& > td {
background-color: darken(@white, 3%);
color: #888;
}
&:nth-child(odd) > td {
background-color: darken(@TableDataRowBackgroundColor, 4%);
}
}
}
}
#Config_DeviceBatches_ShowDecommissioned {
position: absolute;
right: 30px;
bottom: 8px;
font-size: 0.5em;
line-height: 1em;
text-align: right;
}
.deviceBatches {
#DeviceBatch_PurchaseDetails_Container {
padding: 5px 0 5px 5px;
File diff suppressed because one or more lines are too long