Permissions & Authorization for Users #24
Initial Release; Includes Database and MVC refactoring
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
@model Disco.Web.Areas.Config.Models.DeviceBatch.CreateModel
|
||||
@{
|
||||
Authorization.Require(Claims.Config.DeviceBatch.Create);
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Create");
|
||||
}
|
||||
@using (Html.BeginForm())
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18033
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceBatch/Create.cshtml")]
|
||||
public partial class Create : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceBatch.CreateModel>
|
||||
public partial class Create : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceBatch.CreateModel>
|
||||
{
|
||||
public Create()
|
||||
{
|
||||
@@ -43,6 +45,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Config.DeviceBatch.Create);
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Create");
|
||||
|
||||
|
||||
@@ -51,7 +54,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 5 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
#line 6 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
using (Html.BeginForm())
|
||||
{
|
||||
|
||||
@@ -70,7 +73,7 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 14 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
#line 15 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
Write(Html.EditorFor(model => model.DeviceBatch.Name));
|
||||
|
||||
|
||||
@@ -79,7 +82,7 @@ WriteLiteral(" ");
|
||||
WriteLiteral("<br />");
|
||||
|
||||
|
||||
#line 14 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
#line 15 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.DeviceBatch.Name));
|
||||
|
||||
|
||||
@@ -90,7 +93,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
||||
"d>");
|
||||
|
||||
|
||||
#line 21 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
#line 22 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
Write(Html.EditorFor(model => model.DeviceBatch.PurchaseDate));
|
||||
|
||||
|
||||
@@ -99,7 +102,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
||||
WriteLiteral("<br />");
|
||||
|
||||
|
||||
#line 21 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
#line 22 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.DeviceBatch.PurchaseDate));
|
||||
|
||||
|
||||
@@ -136,7 +139,7 @@ WriteLiteral(@">
|
||||
");
|
||||
|
||||
|
||||
#line 39 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
#line 40 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,69 +1,78 @@
|
||||
@model Disco.Web.Areas.Config.Models.DeviceBatch.IndexModel
|
||||
@{
|
||||
Authorization.Require(Claims.Config.DeviceBatch.Show);
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches");
|
||||
}
|
||||
<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)
|
||||
{
|
||||
@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>
|
||||
<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>
|
||||
<th>Name
|
||||
</th>
|
||||
<th>Default Model
|
||||
</th>
|
||||
<th>Purchase Date
|
||||
</th>
|
||||
<th>Warranty Expires
|
||||
</th>
|
||||
<th>Insurance Expires
|
||||
</th>
|
||||
<th>Device Count
|
||||
</th>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
<div class="actionBar">
|
||||
@if (Model.DeviceBatches.Count > 0)
|
||||
{
|
||||
@Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline())
|
||||
}
|
||||
@Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create())
|
||||
</div>
|
||||
@foreach (var item in Model.DeviceBatches)
|
||||
{
|
||||
<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>
|
||||
}
|
||||
</table>
|
||||
}
|
||||
@if (Authorization.HasAny(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.ShowTimeline))
|
||||
{
|
||||
<div class="actionBar">
|
||||
@if (Authorization.Has(Claims.Config.DeviceBatch.ShowTimeline) && Model.DeviceBatches.Count > 0)
|
||||
{
|
||||
@Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline())
|
||||
}
|
||||
@if (Authorization.HasAll(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.Configure))
|
||||
{
|
||||
@Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create())
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceBatch/Index.cshtml")]
|
||||
public partial class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceBatch.IndexModel>
|
||||
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceBatch.IndexModel>
|
||||
{
|
||||
public Index()
|
||||
{
|
||||
@@ -43,139 +45,161 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Config.DeviceBatch.Show);
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<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 26 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 26 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
foreach (var item in Model.DeviceBatches)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 30 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 33 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(item.DefaultDeviceModel);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 36 "..\..\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 39 "..\..\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 42 "..\..\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(" ");
|
||||
|
||||
|
||||
#line 43 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier));
|
||||
#line 6 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
if (Model.DeviceBatches.Count == 0)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
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");
|
||||
|
||||
|
||||
#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 default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 33 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 36 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(item.DefaultDeviceModel);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 39 "..\..\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 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(" ");
|
||||
|
||||
|
||||
#line 45 "..\..\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(" ");
|
||||
|
||||
|
||||
#line 46 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 46 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
if (item.PurchaseUnitQuantity.HasValue)
|
||||
{
|
||||
Write(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <span>");
|
||||
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
|
||||
|
||||
#line 48 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(item.DeviceCount.ToString("n0"));
|
||||
#line 49 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 49 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
if (item.PurchaseUnitQuantity.HasValue)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <span>");
|
||||
|
||||
|
||||
#line 51 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(item.DeviceCount.ToString("n0"));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -183,8 +207,8 @@ WriteLiteral(" <span>");
|
||||
WriteLiteral("/");
|
||||
|
||||
|
||||
#line 48 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(item.PurchaseUnitQuantity.Value.ToString("n0"));
|
||||
#line 51 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(item.PurchaseUnitQuantity.Value.ToString("n0"));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -192,59 +216,59 @@ WriteLiteral("/");
|
||||
WriteLiteral("</span>\r\n");
|
||||
|
||||
|
||||
#line 49 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 52 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(item.DeviceCount.ToString("n0"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 55 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(item.DeviceCount.ToString("n0"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 52 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
|
||||
}
|
||||
#line 55 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 54 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
if (item.DeviceDecommissionedCount > 0)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <span");
|
||||
|
||||
WriteLiteral(" class=\"smallMessage\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1775), Tuple.Create("\"", 1846)
|
||||
|
||||
#line 56 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1783), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0")
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1783), false)
|
||||
, Tuple.Create(Tuple.Create(" ", 1831), Tuple.Create("Decommissioned", 1832), true)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n (");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 57 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(item.DeviceDecommissionedCount.ToString("n0"));
|
||||
if (item.DeviceDecommissionedCount > 0)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <span");
|
||||
|
||||
WriteLiteral(" class=\"smallMessage\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 2117), Tuple.Create("\"", 2188)
|
||||
|
||||
#line 59 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 2125), 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)
|
||||
);
|
||||
|
||||
WriteLiteral(">(");
|
||||
|
||||
|
||||
#line 59 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(item.DeviceDecommissionedCount.ToString("n0"));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -252,67 +276,106 @@ WriteLiteral(">\r\n (");
|
||||
WriteLiteral(")</span>\r\n");
|
||||
|
||||
|
||||
#line 58 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
}
|
||||
#line 60 "..\..\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 61 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
}
|
||||
#line 63 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</table>\r\n<div");
|
||||
WriteLiteral(" </table>\r\n");
|
||||
|
||||
|
||||
#line 65 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
if (Authorization.HasAny(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.ShowTimeline))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" class=\"actionBar\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 64 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 64 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
if (Model.DeviceBatches.Count > 0)
|
||||
{
|
||||
#line 69 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline()));
|
||||
#line 69 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
if (Authorization.Has(Claims.Config.DeviceBatch.ShowTimeline) && Model.DeviceBatches.Count > 0)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 71 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
|
||||
}
|
||||
#line 71 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" ");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 68 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create()));
|
||||
#line 73 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
if (Authorization.HasAll(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.Configure))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 75 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
Write(Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n</div>\r\n");
|
||||
|
||||
#line 75 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </div>\r\n");
|
||||
|
||||
|
||||
#line 78 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
@model Disco.Web.Areas.Config.Models.DeviceBatch.ShowModel
|
||||
@{
|
||||
Authorization.Require(Claims.Config.DeviceBatch.Show);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), Model.DeviceBatch.ToString());
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/tinymce");
|
||||
|
||||
var canConfig = Authorization.Has(Claims.Config.DeviceBatch.Configure);
|
||||
var canDeviceModelShow = Authorization.Has(Claims.Config.DeviceModel.Show);
|
||||
|
||||
if (canConfig)
|
||||
{
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/tinymce");
|
||||
}
|
||||
}
|
||||
<div class="form deviceBatches" style="width: 730px">
|
||||
<table>
|
||||
@@ -17,26 +26,35 @@
|
||||
<tr>
|
||||
<th>Name:
|
||||
</th>
|
||||
<td>@Html.EditorFor(model => model.DeviceBatch.Name)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
document.DiscoFunctions.PropertyChangeHelper(
|
||||
$('#DeviceBatch_Name'),
|
||||
'Invalid Name',
|
||||
'@(Url.Action(MVC.API.DeviceBatch.UpdateName(Model.DeviceBatch.Id)))',
|
||||
<td>
|
||||
@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.Name)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
document.DiscoFunctions.PropertyChangeHelper(
|
||||
$('#DeviceBatch_Name'),
|
||||
'Invalid Name',
|
||||
'@(Url.Action(MVC.API.DeviceBatch.UpdateName(Model.DeviceBatch.Id)))',
|
||||
'BatchName'
|
||||
);
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
@Model.DeviceBatch.Name
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Default Device Model:
|
||||
</th>
|
||||
<td>
|
||||
@Html.DropDownListFor(model => model.DeviceBatch.DefaultDeviceModelId, Model.DeviceModels.ToSelectListItems())
|
||||
<td>@if (canConfig)
|
||||
{
|
||||
@Html.DropDownListFor(model => model.DeviceBatch.DefaultDeviceModelId, Model.DeviceModels.ToSelectListItems(null, true))
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
@@ -49,6 +67,15 @@
|
||||
);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Model.DefaultDeviceModel == null)
|
||||
{<span class="smallMessage"><None Specified></span>}
|
||||
else
|
||||
{@Model.DefaultDeviceModel.ToString();
|
||||
}
|
||||
}
|
||||
<br />
|
||||
<span class="smallMessage">Devices added offline will default to this Device Model.
|
||||
Once a device enrols the Device Model will be accurately represented.</span>
|
||||
@@ -72,7 +99,14 @@
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.ActionLink(membership.DeviceModel.ToString(), MVC.Config.DeviceModel.Index(membership.DeviceModel.Id))
|
||||
@if (canDeviceModelShow)
|
||||
{
|
||||
@Html.ActionLink(membership.DeviceModel.ToString(), MVC.Config.DeviceModel.Index(membership.DeviceModel.Id))
|
||||
}
|
||||
else
|
||||
{
|
||||
@membership.DeviceModel.ToString()
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@membership.DeviceCount.ToString("n0")
|
||||
@@ -115,27 +149,35 @@
|
||||
<th class="name" style="width: 100px">Purchase Date:
|
||||
</th>
|
||||
<td>
|
||||
@Html.EditorFor(model => model.DeviceBatch.PurchaseDate)
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script>
|
||||
$(function () {
|
||||
var dateField = $('#DeviceBatch_PurchaseDate');
|
||||
document.DiscoFunctions.DateChangeHelper(
|
||||
dateField,
|
||||
'Invalid Date',
|
||||
'@(Url.Action(MVC.API.DeviceBatch.UpdatePurchaseDate(Model.DeviceBatch.Id)))',
|
||||
@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.PurchaseDate)
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script>
|
||||
$(function () {
|
||||
var dateField = $('#DeviceBatch_PurchaseDate');
|
||||
document.DiscoFunctions.DateChangeHelper(
|
||||
dateField,
|
||||
'Invalid Date',
|
||||
'@(Url.Action(MVC.API.DeviceBatch.UpdatePurchaseDate(Model.DeviceBatch.Id)))',
|
||||
'PurchaseDate',
|
||||
null,
|
||||
true
|
||||
);
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
@CommonHelpers.FriendlyDate(Model.DeviceBatch.PurchaseDate)
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Supplier:
|
||||
</th>
|
||||
<td>
|
||||
<td>@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.Supplier)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
@@ -149,12 +191,21 @@
|
||||
);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(Model.DeviceBatch.Supplier))
|
||||
{<span class="smallMessage"><None Specified></span>}
|
||||
else
|
||||
{@Model.DeviceBatch.Supplier}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Unit Cost:
|
||||
</th>
|
||||
<td>
|
||||
<td>@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.UnitCost)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
@@ -168,12 +219,21 @@
|
||||
);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Model.DeviceBatch.UnitCost.HasValue)
|
||||
{<span class="smallMessage"><None Specified></span>}
|
||||
else
|
||||
{@Model.DeviceBatch.UnitCost.Value.ToString("C")}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Quantity:
|
||||
</th>
|
||||
<td>
|
||||
<td>@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.UnitQuantity)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
@@ -187,6 +247,14 @@
|
||||
);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Model.DeviceBatch.UnitQuantity.HasValue)
|
||||
{<span class="smallMessage"><None Specified></span>}
|
||||
else
|
||||
{@Model.DeviceBatch.UnitQuantity.Value.ToString("n0")}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -194,55 +262,65 @@
|
||||
<div>
|
||||
Details @AjaxHelpers.AjaxLoader("ajaxPurchaseDetails")
|
||||
</div>
|
||||
@Html.EditorFor(model => model.DeviceBatch.PurchaseDetails)
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var model = {
|
||||
$field: $('#DeviceBatch_PurchaseDetails'),
|
||||
fieldName: 'PurchaseDetails',
|
||||
$ajax_loading: null,
|
||||
$ajax_ok: null,
|
||||
updated: function () {
|
||||
if (!model.$ajax_loading)
|
||||
model.$ajax_loading = $('#ajax' + model.fieldName + '_loading');
|
||||
if (!model.$ajax_ok)
|
||||
model.$ajax_ok = $('#ajax' + model.fieldName + '_ok');
|
||||
model.$ajax_loading.show();
|
||||
var data = {};
|
||||
data[model.fieldName] = model.$field.tinymce().getContent();
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.DeviceBatch.UpdatePurchaseDetails(Model.DeviceBatch.Id)))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
traditional: true,
|
||||
type: 'POST',
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.PurchaseDetails)
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var model = {
|
||||
$field: $('#DeviceBatch_PurchaseDetails'),
|
||||
fieldName: 'PurchaseDetails',
|
||||
$ajax_loading: null,
|
||||
$ajax_ok: null,
|
||||
updated: function () {
|
||||
if (!model.$ajax_loading)
|
||||
model.$ajax_loading = $('#ajax' + model.fieldName + '_loading');
|
||||
if (!model.$ajax_ok)
|
||||
model.$ajax_ok = $('#ajax' + model.fieldName + '_ok');
|
||||
model.$ajax_loading.show();
|
||||
var data = {};
|
||||
data[model.fieldName] = model.$field.tinymce().getContent();
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.DeviceBatch.UpdatePurchaseDetails(Model.DeviceBatch.Id)))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
traditional: true,
|
||||
type: 'POST',
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
model.$ajax_loading.hide();
|
||||
model.$ajax_ok.show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
model.$ajax_loading.hide();
|
||||
alert('Unable to update purchase details: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update purchase details: ' + errorThrown);
|
||||
model.$ajax_loading.hide();
|
||||
model.$ajax_ok.show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
model.$ajax_loading.hide();
|
||||
alert('Unable to update purchase details: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update purchase details: ' + errorThrown);
|
||||
model.$ajax_loading.hide();
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
model.$field.tinymce({
|
||||
theme: 'simple',
|
||||
setup: function (ed) {
|
||||
ed.onInit.add(function (ed) {
|
||||
$(ed.getWin()).blur(model.updated);
|
||||
});
|
||||
}
|
||||
model.$field.tinymce({
|
||||
theme: 'simple',
|
||||
setup: function (ed) {
|
||||
ed.onInit.add(function (ed) {
|
||||
$(ed.getWin()).blur(model.updated);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(Model.DeviceBatch.PurchaseDetails))
|
||||
{<span class="smallMessage"><None Specified></span>}
|
||||
else
|
||||
{@(new HtmlString(Model.DeviceBatch.PurchaseDetails))}
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -255,21 +333,28 @@
|
||||
<th class="name" style="width: 100px">Valid Until:
|
||||
</th>
|
||||
<td>
|
||||
@Html.EditorFor(model => model.DeviceBatch.WarrantyValidUntil)
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script>
|
||||
$(function () {
|
||||
var dateField = $('#DeviceBatch_WarrantyValidUntil');
|
||||
document.DiscoFunctions.DateChangeHelper(
|
||||
dateField,
|
||||
'Warranty Valid Until',
|
||||
'@(Url.Action(MVC.API.DeviceBatch.UpdateWarrantyValidUntil(Model.DeviceBatch.Id)))',
|
||||
@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.WarrantyValidUntil)
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script>
|
||||
$(function () {
|
||||
var dateField = $('#DeviceBatch_WarrantyValidUntil');
|
||||
document.DiscoFunctions.DateChangeHelper(
|
||||
dateField,
|
||||
'Warranty Valid Until',
|
||||
'@(Url.Action(MVC.API.DeviceBatch.UpdateWarrantyValidUntil(Model.DeviceBatch.Id)))',
|
||||
'WarrantyValidUntil',
|
||||
null,
|
||||
true
|
||||
);
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
@CommonHelpers.FriendlyDate(Model.DeviceBatch.WarrantyValidUntil, "Unknown")
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -277,55 +362,65 @@
|
||||
<div>
|
||||
Details @AjaxHelpers.AjaxLoader("ajaxWarrantyDetails")
|
||||
</div>
|
||||
@Html.EditorFor(model => model.DeviceBatch.WarrantyDetails)
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var model = {
|
||||
$field: $('#DeviceBatch_WarrantyDetails'),
|
||||
fieldName: 'WarrantyDetails',
|
||||
$ajax_loading: null,
|
||||
$ajax_ok: null,
|
||||
updated: function () {
|
||||
if (!model.$ajax_loading)
|
||||
model.$ajax_loading = $('#ajax' + model.fieldName + '_loading');
|
||||
if (!model.$ajax_ok)
|
||||
model.$ajax_ok = $('#ajax' + model.fieldName + '_ok');
|
||||
model.$ajax_loading.show();
|
||||
var data = {};
|
||||
data[model.fieldName] = model.$field.tinymce().getContent();
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.DeviceBatch.UpdateWarrantyDetails(Model.DeviceBatch.Id)))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
traditional: true,
|
||||
type: 'POST',
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.WarrantyDetails)
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var model = {
|
||||
$field: $('#DeviceBatch_WarrantyDetails'),
|
||||
fieldName: 'WarrantyDetails',
|
||||
$ajax_loading: null,
|
||||
$ajax_ok: null,
|
||||
updated: function () {
|
||||
if (!model.$ajax_loading)
|
||||
model.$ajax_loading = $('#ajax' + model.fieldName + '_loading');
|
||||
if (!model.$ajax_ok)
|
||||
model.$ajax_ok = $('#ajax' + model.fieldName + '_ok');
|
||||
model.$ajax_loading.show();
|
||||
var data = {};
|
||||
data[model.fieldName] = model.$field.tinymce().getContent();
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.DeviceBatch.UpdateWarrantyDetails(Model.DeviceBatch.Id)))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
traditional: true,
|
||||
type: 'POST',
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
model.$ajax_loading.hide();
|
||||
model.$ajax_ok.show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
model.$ajax_loading.hide();
|
||||
alert('Unable to update warranty details: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update warranty details: ' + errorThrown);
|
||||
model.$ajax_loading.hide();
|
||||
model.$ajax_ok.show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
model.$ajax_loading.hide();
|
||||
alert('Unable to update warranty details: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update warranty details: ' + errorThrown);
|
||||
model.$ajax_loading.hide();
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
model.$field.tinymce({
|
||||
theme: 'simple',
|
||||
setup: function (ed) {
|
||||
ed.onInit.add(function (ed) {
|
||||
$(ed.getWin()).blur(model.updated);
|
||||
});
|
||||
}
|
||||
model.$field.tinymce({
|
||||
theme: 'simple',
|
||||
setup: function (ed) {
|
||||
ed.onInit.add(function (ed) {
|
||||
$(ed.getWin()).blur(model.updated);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(Model.DeviceBatch.WarrantyDetails))
|
||||
{<span class="smallMessage"><None Specified></span>}
|
||||
else
|
||||
{@(new HtmlString(Model.DeviceBatch.WarrantyDetails))}
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -337,7 +432,8 @@
|
||||
<tr>
|
||||
<th class="name" style="width: 100px">Supplier:
|
||||
</th>
|
||||
<td>
|
||||
<td>@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.InsuranceSupplier)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
@@ -351,12 +447,22 @@
|
||||
);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(Model.DeviceBatch.InsuranceSupplier))
|
||||
{<span class="smallMessage"><None Specified></span>}
|
||||
else
|
||||
{@Model.DeviceBatch.InsuranceSupplier;
|
||||
}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="name">Insured Date:
|
||||
</th>
|
||||
<td>
|
||||
<td>@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.InsuredDate)
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script>
|
||||
@@ -372,12 +478,18 @@
|
||||
);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
@CommonHelpers.FriendlyDate(Model.DeviceBatch.InsuredDate, "Unknown")
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="name">Insured Until:
|
||||
</th>
|
||||
<td>
|
||||
<td>@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.InsuredUntil)
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script>
|
||||
@@ -393,6 +505,11 @@
|
||||
);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
@CommonHelpers.FriendlyDate(Model.DeviceBatch.InsuredUntil, "Unknown")
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -400,54 +517,64 @@
|
||||
<div>
|
||||
Details @AjaxHelpers.AjaxLoader("ajaxInsuranceDetails")
|
||||
</div>
|
||||
@Html.EditorFor(model => model.DeviceBatch.InsuranceDetails)
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var model = {
|
||||
$DeviceBatch_Comments: $('#DeviceBatch_InsuranceDetails'),
|
||||
$ajax_loading: null,
|
||||
$ajax_ok: null,
|
||||
updated: function () {
|
||||
if (!model.$ajax_loading)
|
||||
model.$ajax_loading = $('#ajaxInsuranceDetails_loading');
|
||||
if (!model.$ajax_ok)
|
||||
model.$ajax_ok = $('#ajaxInsuranceDetails_ok');
|
||||
model.$ajax_loading.show();
|
||||
var data = { InsuranceDetails: model.$DeviceBatch_Comments.tinymce().getContent() };
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.DeviceBatch.UpdateInsuranceDetails(Model.DeviceBatch.Id)))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
traditional: true,
|
||||
type: 'POST',
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.InsuranceDetails)
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var model = {
|
||||
$DeviceBatch_Comments: $('#DeviceBatch_InsuranceDetails'),
|
||||
$ajax_loading: null,
|
||||
$ajax_ok: null,
|
||||
updated: function () {
|
||||
if (!model.$ajax_loading)
|
||||
model.$ajax_loading = $('#ajaxInsuranceDetails_loading');
|
||||
if (!model.$ajax_ok)
|
||||
model.$ajax_ok = $('#ajaxInsuranceDetails_ok');
|
||||
model.$ajax_loading.show();
|
||||
var data = { InsuranceDetails: model.$DeviceBatch_Comments.tinymce().getContent() };
|
||||
$.ajax({
|
||||
url: '@(Url.Action(MVC.API.DeviceBatch.UpdateInsuranceDetails(Model.DeviceBatch.Id)))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
traditional: true,
|
||||
type: 'POST',
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
model.$ajax_loading.hide();
|
||||
model.$ajax_ok.show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
model.$ajax_loading.hide();
|
||||
alert('Unable to update insurance details: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update insurance details: ' + errorThrown);
|
||||
model.$ajax_loading.hide();
|
||||
model.$ajax_ok.show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
model.$ajax_loading.hide();
|
||||
alert('Unable to update insurance details: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update insurance details: ' + errorThrown);
|
||||
model.$ajax_loading.hide();
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
model.$DeviceBatch_Comments.tinymce({
|
||||
theme: 'simple',
|
||||
setup: function (ed) {
|
||||
//ed.onChange.add(model.updatedThrottle);
|
||||
ed.onInit.add(function (ed) {
|
||||
$(ed.getWin()).blur(model.updated);
|
||||
});
|
||||
}
|
||||
model.$DeviceBatch_Comments.tinymce({
|
||||
theme: 'simple',
|
||||
setup: function (ed) {
|
||||
//ed.onChange.add(model.updatedThrottle);
|
||||
ed.onInit.add(function (ed) {
|
||||
$(ed.getWin()).blur(model.updated);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(Model.DeviceBatch.InsuranceDetails))
|
||||
{<span class="smallMessage"><None Specified></span>}
|
||||
else
|
||||
{@(new HtmlString(Model.DeviceBatch.InsuranceDetails))}
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -455,7 +582,8 @@
|
||||
<th>Comments:<br />
|
||||
@AjaxHelpers.AjaxLoader("ajaxComments")
|
||||
</th>
|
||||
<td>
|
||||
<td>@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceBatch.Comments)
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
@@ -504,6 +632,14 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(Model.DeviceBatch.Comments))
|
||||
{<span class="smallMessage"><None Specified></span>}
|
||||
else
|
||||
{@(new HtmlString(Model.DeviceBatch.Comments))}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -514,8 +650,14 @@
|
||||
@Html.ActionLinkButton("Delete", MVC.API.DeviceBatch.Delete(Model.DeviceBatch.Id, true), "buttonDelete")
|
||||
}
|
||||
@if (Model.DeviceCount > 0)
|
||||
{
|
||||
{
|
||||
if (Authorization.Has(Claims.Device.Actions.Export))
|
||||
{
|
||||
@Html.ActionLinkButton("Export Devices", MVC.API.DeviceBatch.ExportDevices(Model.DeviceBatch.Id))
|
||||
}
|
||||
if (Authorization.Has(Claims.Device.Search))
|
||||
{
|
||||
@Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceBatch.Id.ToString(), "DeviceBatch"))
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,6 @@
|
||||
@{
|
||||
Authorization.Require(Claims.Config.DeviceBatch.ShowTimeline);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline");
|
||||
Html.BundleDeferred("~/Style/Timeline");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Timeline");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18033
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceBatch/Timeline.cshtml")]
|
||||
public partial class Timeline : System.Web.Mvc.WebViewPage<dynamic>
|
||||
public partial class Timeline : Disco.Services.Web.WebViewPage<dynamic>
|
||||
{
|
||||
public Timeline()
|
||||
{
|
||||
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
|
||||
|
||||
#line 1 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Config.DeviceBatch.ShowTimeline);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline");
|
||||
Html.BundleDeferred("~/Style/Timeline");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Timeline");
|
||||
@@ -63,7 +67,7 @@ WriteLiteral(" type=\"text/javascript\"");
|
||||
WriteLiteral(">\r\n (function () {\r\n var dataUrl = \'");
|
||||
|
||||
|
||||
#line 10 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
|
||||
#line 12 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceBatch.Timeline()));
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user