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,6 +3,7 @@
Authorization.Require(Claims.Config.DeviceBatch.Show); Authorization.Require(Claims.Config.DeviceBatch.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches"); ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches");
} }
<div id="Config_DeviceBatches">
@if (Model.DeviceBatches.Count == 0) @if (Model.DeviceBatches.Count == 0)
{ {
<div class="form" style="width: 450px; padding: 100px 0;"> <div class="form" style="width: 450px; padding: 100px 0;">
@@ -11,7 +12,22 @@
} }
else else
{ {
<table class="tableData"> if (Model.DeviceBatches.Any(db => db.DeviceCount > 0 && db.DeviceDecommissionedCount >= db.DeviceCount))
{
<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 id="Config_DeviceBatches_List" class="tableData">
<tr> <tr>
<th>Name <th>Name
</th> </th>
@@ -28,9 +44,10 @@ else
</tr> </tr>
@foreach (var item in Model.DeviceBatches) @foreach (var item in Model.DeviceBatches)
{ {
<tr> var isDecommissioned = item.DeviceCount > 0 && item.DeviceDecommissionedCount >= item.DeviceCount;
<tr class="@(isDecommissioned ? "decommissioned" : null)">
<td> <td>
@Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)) @Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)) @if (isDecommissioned) { <em>Decommissioned</em> }
</td> </td>
<td> <td>
@item.DefaultDeviceModel @item.DefaultDeviceModel
@@ -63,6 +80,7 @@ else
} }
</table> </table>
} }
</div>
@if (Authorization.HasAny(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.ShowTimeline)) @if (Authorization.HasAny(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.ShowTimeline))
{ {
<div class="actionBar"> <div class="actionBar">
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // 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 // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@@ -53,10 +53,20 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
#line default #line default
#line hidden #line hidden
WriteLiteral("\r\n"); WriteLiteral("\r\n<div");
WriteLiteral(" id=\"Config_DeviceBatches\"");
WriteLiteral(">\r\n");
#line 6 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #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) if (Model.DeviceBatches.Count == 0)
{ {
@@ -72,16 +82,59 @@ 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" #line 12 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
} }
else else
{
if (Model.DeviceBatches.Any(db => db.DeviceCount > 0 && db.DeviceDecommissionedCount >= db.DeviceCount))
{ {
#line default
#line hidden
WriteLiteral(" <a");
WriteLiteral(" id=\"Config_DeviceBatches_ShowDecommissioned\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"button small\"");
WriteLiteral(">Show Decommissioned (");
#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(")</a>\r\n");
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 29 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default #line default
#line hidden #line hidden
WriteLiteral(" <table"); WriteLiteral(" <table");
WriteLiteral(" id=\"Config_DeviceBatches_List\"");
WriteLiteral(" class=\"tableData\""); WriteLiteral(" class=\"tableData\"");
WriteLiteral(@"> WriteLiteral(@">
@@ -102,36 +155,66 @@ WriteLiteral(@">
"); ");
#line 29 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 45 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default #line default
#line hidden #line hidden
#line 29 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 45 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
foreach (var item in Model.DeviceBatches) foreach (var item in Model.DeviceBatches)
{ {
var isDecommissioned = item.DeviceCount > 0 && item.DeviceDecommissionedCount >= item.DeviceCount;
#line default #line default
#line hidden #line hidden
WriteLiteral(" <tr>\r\n <td>\r\n"); 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(" "); WriteLiteral(" ");
#line 33 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 50 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id))); Write(Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)));
#line default #line default
#line hidden #line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n"); 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(" "); WriteLiteral(" ");
#line 36 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 53 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DefaultDeviceModel); Write(item.DefaultDeviceModel);
@@ -142,7 +225,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" "); WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 56 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.PurchaseDate)); Write(CommonHelpers.FriendlyDate(item.PurchaseDate));
@@ -153,7 +236,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" "); WriteLiteral(" ");
#line 42 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 59 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown")); Write(CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown"));
@@ -164,7 +247,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" "); WriteLiteral(" ");
#line 45 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 62 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown")); Write(CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown"));
@@ -175,7 +258,7 @@ WriteLiteral("\r\n");
WriteLiteral(" "); WriteLiteral(" ");
#line 46 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 63 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier)); Write(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier));
@@ -184,13 +267,13 @@ WriteLiteral(" ");
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 default
#line hidden #line hidden
#line 49 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.PurchaseUnitQuantity.HasValue) if (item.PurchaseUnitQuantity.HasValue)
{ {
@@ -200,7 +283,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" <span>"); WriteLiteral(" <span>");
#line 51 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 68 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0")); Write(item.DeviceCount.ToString("n0"));
@@ -209,7 +292,7 @@ WriteLiteral(" <span>");
WriteLiteral("/"); WriteLiteral("/");
#line 51 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 68 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.PurchaseUnitQuantity.Value.ToString("n0")); Write(item.PurchaseUnitQuantity.Value.ToString("n0"));
@@ -218,7 +301,7 @@ WriteLiteral("/");
WriteLiteral("</span>\r\n"); WriteLiteral("</span>\r\n");
#line 52 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 69 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
} }
else else
{ {
@@ -227,14 +310,14 @@ WriteLiteral("</span>\r\n");
#line default #line default
#line hidden #line hidden
#line 55 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 72 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0")); Write(item.DeviceCount.ToString("n0"));
#line default #line default
#line hidden #line hidden
#line 55 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 72 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
} }
@@ -244,7 +327,7 @@ WriteLiteral("</span>\r\n");
WriteLiteral(" "); WriteLiteral(" ");
#line 57 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 74 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.DeviceDecommissionedCount > 0) if (item.DeviceDecommissionedCount > 0)
{ {
@@ -255,21 +338,21 @@ WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\""); 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" #line 76 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
, Tuple.Create(Tuple.Create("", 2125), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0") , Tuple.Create(Tuple.Create("", 3523), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0")
#line default #line default
#line hidden #line hidden
, 2125), false) , 3523), false)
, Tuple.Create(Tuple.Create(" ", 2173), Tuple.Create("Decommissioned", 2174), true) , Tuple.Create(Tuple.Create(" ", 3571), Tuple.Create("Decommissioned", 3572), true)
); );
WriteLiteral(">("); WriteLiteral(">(");
#line 59 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 76 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceDecommissionedCount.ToString("n0")); Write(item.DeviceDecommissionedCount.ToString("n0"));
@@ -278,7 +361,7 @@ WriteLiteral(">(");
WriteLiteral(")</span>\r\n"); WriteLiteral(")</span>\r\n");
#line 60 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 77 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
} }
@@ -287,7 +370,7 @@ WriteLiteral(")</span>\r\n");
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"
} }
@@ -296,14 +379,16 @@ WriteLiteral(" </td>\r\n </tr>\r\n");
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 default
#line hidden #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)) if (Authorization.HasAny(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.ShowTimeline))
{ {
@@ -317,13 +402,13 @@ WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 69 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 87 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default #line default
#line hidden #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) if (Authorization.Has(Claims.Config.DeviceBatch.ShowTimeline) && Model.DeviceBatches.Count > 0)
{ {
@@ -331,14 +416,14 @@ WriteLiteral(">\r\n");
#line default #line default
#line hidden #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())); Write(Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline()));
#line default #line default
#line hidden #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(" "); 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)) if (Authorization.HasAll(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.Configure))
{ {
@@ -356,14 +441,14 @@ WriteLiteral(" ");
#line default #line default
#line hidden #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())); Write(Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create()));
#line default #line default
#line hidden #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"); WriteLiteral(" </div>\r\n");
#line 78 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" #line 96 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
} }
#line default #line default
+18
View File
@@ -813,6 +813,24 @@ div.logEventsViewport table.logEventsViewport > tbody > tr > td.eventType {
margin-top: 8px; margin-top: 8px;
text-align: right; 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 { .deviceBatches #DeviceBatch_PurchaseDetails_Container {
padding: 5px 0 5px 5px; padding: 5px 0 5px 5px;
} }
+26
View File
@@ -899,6 +899,32 @@ div.logEventsViewport {
} }
} }
// Device Batches // 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 { .deviceBatches {
#DeviceBatch_PurchaseDetails_Container { #DeviceBatch_PurchaseDetails_Container {
padding: 5px 0 5px 5px; padding: 5px 0 5px 5px;
File diff suppressed because one or more lines are too long