From f6fae26bc7cc6a406aedc76fc059801ecce8a81a Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Wed, 28 May 2014 15:01:06 +1000 Subject: [PATCH] Update #9: Hide decommissioned batches by default --- .../Config/Views/DeviceBatch/Index.cshtml | 134 ++++--- .../Views/DeviceBatch/Index.generated.cs | 343 +++++++++++------- Disco.Web/ClientSource/Style/Config.css | 18 + Disco.Web/ClientSource/Style/Config.less | 26 ++ Disco.Web/ClientSource/Style/Config.min.css | 2 +- 5 files changed, 335 insertions(+), 188 deletions(-) diff --git a/Disco.Web/Areas/Config/Views/DeviceBatch/Index.cshtml b/Disco.Web/Areas/Config/Views/DeviceBatch/Index.cshtml index aeeff154..093a6ab2 100644 --- a/Disco.Web/Areas/Config/Views/DeviceBatch/Index.cshtml +++ b/Disco.Web/Areas/Config/Views/DeviceBatch/Index.cshtml @@ -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) -{ -
-

No device batches are configured

-
-} -else -{ - - - - - - - - - - @foreach (var item in Model.DeviceBatches) +
+ @if (Model.DeviceBatches.Count == 0) + { +
+

No device batches are configured

+
+ } + else + { + if (Model.DeviceBatches.Any(db => db.DeviceCount > 0 && db.DeviceDecommissionedCount >= db.DeviceCount)) { -
- - - - - - - + Show Decommissioned (@(Model.DeviceBatches.Count(db => db.DeviceCount > 0 && db.DeviceDecommissionedCount >= db.DeviceCount))) + } -
Name - Default Model - Purchase Date - Warranty Expires - Insurance Expires - Device Count -
- @Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)) - - @item.DefaultDeviceModel - - @CommonHelpers.FriendlyDate(item.PurchaseDate) - - @CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown") - - @CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown") - @(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier)) - - @if (item.PurchaseUnitQuantity.HasValue) - { - @item.DeviceCount.ToString("n0")/@(item.PurchaseUnitQuantity.Value.ToString("n0")) - } - else - { - @item.DeviceCount.ToString("n0") - } - @if (item.DeviceDecommissionedCount > 0) - { - (@(item.DeviceDecommissionedCount.ToString("n0"))) - } -
-} + + + + + + + + + + @foreach (var item in Model.DeviceBatches) + { + var isDecommissioned = item.DeviceCount > 0 && item.DeviceDecommissionedCount >= item.DeviceCount; + + + + + + + + + } +
Name + Default Model + Purchase Date + Warranty Expires + Insurance Expires + Device Count +
+ @Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)) @if (isDecommissioned) { Decommissioned } + + @item.DefaultDeviceModel + + @CommonHelpers.FriendlyDate(item.PurchaseDate) + + @CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown") + + @CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown") + @(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier)) + + @if (item.PurchaseUnitQuantity.HasValue) + { + @item.DeviceCount.ToString("n0")/@(item.PurchaseUnitQuantity.Value.ToString("n0")) + } + else + { + @item.DeviceCount.ToString("n0") + } + @if (item.DeviceDecommissionedCount > 0) + { + (@(item.DeviceDecommissionedCount.ToString("n0"))) + } +
+ } + @if (Authorization.HasAny(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.ShowTimeline)) {
diff --git a/Disco.Web/Areas/Config/Views/DeviceBatch/Index.generated.cs b/Disco.Web/Areas/Config/Views/DeviceBatch/Index.generated.cs index 7b92db4b..1cb32da2 100644 --- a/Disco.Web/Areas/Config/Views/DeviceBatch/Index.generated.cs +++ b/Disco.Web/Areas/Config/Views/DeviceBatch/Index.generated.cs @@ -2,7 +2,7 @@ //------------------------------------------------------------------------------ // // 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\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(" \r\n

No device batches are configured

\r\n
\r\n"); +WriteLiteral(">\r\n

No device batches are configured

\r\n \r\n"); - #line 11 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml" -} -else -{ - - - #line default - #line hidden -WriteLiteral(" - - Name - - Default Model - - Purchase Date - - Warranty Expires - - Insurance Expires - - Device Count - - -"); - - - #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(" \r\n \r\n"); +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 \r\n \r\n"); +WriteLiteral(")\r\n"); -WriteLiteral(" "); +WriteLiteral(@" +"); - #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 \r\n \r\n"); +WriteLiteral("