Permissions & Authorization for Users #24
Initial Release; Includes Database and MVC refactoring
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
@model Disco.Web.Areas.Config.Models.DeviceModel.ComponentsModel
|
||||
@{
|
||||
Authorization.Require(Claims.Config.DeviceModel.Show);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), "Generic Components");
|
||||
}
|
||||
@Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model)
|
||||
@@ -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.DeviceModel
|
||||
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/DeviceModel/GenericComponents.cshtml")]
|
||||
public partial class GenericComponents : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ComponentsModel>
|
||||
public partial class GenericComponents : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ComponentsModel>
|
||||
{
|
||||
public GenericComponents()
|
||||
{
|
||||
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\DeviceModel\GenericComponents.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Config.DeviceModel.Show);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), "Generic Components");
|
||||
|
||||
|
||||
@@ -51,7 +55,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 5 "..\..\Areas\Config\Views\DeviceModel\GenericComponents.cshtml"
|
||||
#line 7 "..\..\Areas\Config\Views\DeviceModel\GenericComponents.cshtml"
|
||||
Write(Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model));
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@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");
|
||||
}
|
||||
<table class="tableData">
|
||||
|
||||
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
|
||||
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/DeviceModel/Index.cshtml")]
|
||||
public partial class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.IndexModel>
|
||||
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.IndexModel>
|
||||
{
|
||||
public Index()
|
||||
{
|
||||
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Config.DeviceModel.Show);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models");
|
||||
|
||||
|
||||
@@ -73,13 +77,13 @@ WriteLiteral(@">
|
||||
");
|
||||
|
||||
|
||||
#line 23 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 25 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 23 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 25 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
foreach (var item in Model.DeviceModels)
|
||||
{
|
||||
|
||||
@@ -91,7 +95,7 @@ WriteLiteral(" <tr>\r\n <td>\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 27 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 29 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
Write(Html.ActionLink(item.ToString(), MVC.Config.DeviceModel.Index(item.Id)));
|
||||
|
||||
|
||||
@@ -102,7 +106,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 30 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 32 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
Write(Html.DisplayFor(modelItem => item.Manufacturer));
|
||||
|
||||
|
||||
@@ -113,7 +117,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 33 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 35 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
Write(Html.DisplayFor(modelItem => item.Model));
|
||||
|
||||
|
||||
@@ -124,7 +128,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 36 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 38 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
Write(Html.DisplayFor(modelItem => item.ModelType));
|
||||
|
||||
|
||||
@@ -135,7 +139,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 39 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 41 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
Write(item.DeviceCount.ToString("n0"));
|
||||
|
||||
|
||||
@@ -144,13 +148,13 @@ WriteLiteral(" ");
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 40 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 42 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 40 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 42 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
if (item.DeviceDecommissionedCount > 0)
|
||||
{
|
||||
|
||||
@@ -161,21 +165,21 @@ WriteLiteral(" <span");
|
||||
|
||||
WriteLiteral(" class=\"smallMessage\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1167), Tuple.Create("\"", 1223)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1233), Tuple.Create("\"", 1289)
|
||||
|
||||
#line 42 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1175), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount
|
||||
#line 44 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1241), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1175), false)
|
||||
, Tuple.Create(Tuple.Create(" ", 1208), Tuple.Create("Decommissioned", 1209), true)
|
||||
, 1241), false)
|
||||
, Tuple.Create(Tuple.Create(" ", 1274), Tuple.Create("Decommissioned", 1275), true)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n (");
|
||||
|
||||
|
||||
#line 43 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 45 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
Write(item.DeviceDecommissionedCount.ToString("n0"));
|
||||
|
||||
|
||||
@@ -184,7 +188,7 @@ WriteLiteral(">\r\n (");
|
||||
WriteLiteral(")</span>\r\n");
|
||||
|
||||
|
||||
#line 44 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 46 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +197,7 @@ WriteLiteral(")</span>\r\n");
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 47 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 49 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +212,7 @@ WriteLiteral(">\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 50 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
#line 52 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
|
||||
Write(Html.ActionLinkButton("Generic Components", MVC.Config.DeviceModel.GenericComponents()));
|
||||
|
||||
|
||||
|
||||
@@ -1,37 +1,44 @@
|
||||
@model Disco.Web.Areas.Config.Models.DeviceModel.ShowModel
|
||||
@{
|
||||
Authorization.Require(Claims.Config.DeviceModel.Show);
|
||||
|
||||
var canConfig = Authorization.Has(Claims.Config.DeviceModel.Configure);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), Model.DeviceModel.ToString());
|
||||
}
|
||||
<div class="form" style="width: 530px">
|
||||
<table>
|
||||
<tr>
|
||||
<th style="width: 150px">
|
||||
Id:
|
||||
<th style="width: 150px">Id:
|
||||
</th>
|
||||
<td>
|
||||
@Html.DisplayFor(model => model.DeviceModel.Id)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Description:
|
||||
<th>Description:
|
||||
</th>
|
||||
<td>@Html.EditorFor(model => model.DeviceModel.Description)
|
||||
<td>@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceModel.Description)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.DisplayFor(model => model.DeviceModel.Description)
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Manufacturer:
|
||||
<th>Manufacturer:
|
||||
</th>
|
||||
<td>
|
||||
@Html.DisplayFor(model => model.DeviceModel.Manufacturer)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Model:
|
||||
<th>Model:
|
||||
</th>
|
||||
<td>
|
||||
@Html.DisplayFor(model => model.DeviceModel.Model)
|
||||
@@ -48,169 +55,206 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Default Purchase Date:
|
||||
<th>Default Purchase Date:
|
||||
</th>
|
||||
<td>
|
||||
<td>@if (canConfig)
|
||||
{
|
||||
@Html.EditorFor(model => model.DeviceModel.DefaultPurchaseDate)
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
}
|
||||
else
|
||||
{
|
||||
@CommonHelpers.FriendlyDate(Model.DeviceModel.DefaultPurchaseDate, "Unknown")
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Default Warranty Provider:
|
||||
<th>Default Warranty Provider:
|
||||
</th>
|
||||
<td>
|
||||
<td>@if (canConfig)
|
||||
{
|
||||
@Html.DropDownListFor(model => model.DeviceModel.DefaultWarrantyProvider, Model.WarrantyProviders.ToSelectListItems(Model.DeviceModel.DefaultWarrantyProvider, true, "None"))
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Model.DeviceModel.DefaultWarrantyProvider == null)
|
||||
{
|
||||
<span class="smallMessage"><None Specified></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
var provider = Model.WarrantyProviders.FirstOrDefault(wp => wp.Id == Model.DeviceModel.DefaultWarrantyProvider);
|
||||
if (provider == null)
|
||||
{
|
||||
<span class="smallMessage"><None Specified></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
@provider.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Type:
|
||||
<th>Type:
|
||||
</th>
|
||||
<td>
|
||||
@Html.DisplayFor(model => model.DeviceModel.ModelType)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Image:
|
||||
<th>Image:
|
||||
</th>
|
||||
<td>
|
||||
<img alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="DeviceModel_Image">
|
||||
Update Image:
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
@using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||
{
|
||||
<input type="file" name="Image" id="Image" style="width: 250px;" />
|
||||
<input class="button" type="submit" value="Update" />
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
@if (canConfig)
|
||||
{
|
||||
<tr>
|
||||
<th>
|
||||
<label for="DeviceModel_Image">
|
||||
Update Image:
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
@using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||
{
|
||||
<input type="file" name="Image" id="Image" style="width: 250px;" />
|
||||
<input class="button" type="submit" value="Update" />
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $Description = $('#DeviceModel_Description');
|
||||
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
|
||||
$Description
|
||||
.watermark('Model Description')
|
||||
.focus(function () { $Description.select() })
|
||||
.keydown(function (e) {
|
||||
$DescriptionAjaxSave.show();
|
||||
if (e.which == 13) {
|
||||
$(this).blur();
|
||||
}
|
||||
}).blur(function () {
|
||||
$DescriptionAjaxSave.hide();
|
||||
@if (canConfig)
|
||||
{
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $Description = $('#DeviceModel_Description');
|
||||
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
|
||||
$Description
|
||||
.watermark('Model Description')
|
||||
.focus(function () { $Description.select() })
|
||||
.keydown(function (e) {
|
||||
$DescriptionAjaxSave.show();
|
||||
if (e.which == 13) {
|
||||
$(this).blur();
|
||||
}
|
||||
}).blur(function () {
|
||||
$DescriptionAjaxSave.hide();
|
||||
})
|
||||
.change(function () {
|
||||
$DescriptionAjaxSave.hide();
|
||||
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
|
||||
var data = { Description: $Description.val() };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.Id))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to update description: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update description: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $dataField = $('#DeviceModel_DefaultPurchaseDate');
|
||||
var $ajaxLoading = $dataField.next('.ajaxLoading');
|
||||
var dateFieldValue = $dataField.val();
|
||||
var dateFieldChangeToken = null;
|
||||
$dataField
|
||||
.watermark('None')
|
||||
.datepicker({
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
dateFormat: 'yy/mm/dd'
|
||||
})
|
||||
.change(function () {
|
||||
$DescriptionAjaxSave.hide();
|
||||
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
|
||||
var data = { Description: $Description.val() };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.Id))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to update description: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update description: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
var dateText = $dataField.val();
|
||||
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
|
||||
dateFieldValue = dateText;
|
||||
if (dateFieldChangeToken)
|
||||
window.clearTimeout(dateFieldChangeToken);
|
||||
dateFieldChangeToken = window.setTimeout(function () {
|
||||
$ajaxLoading.show();
|
||||
var data = {};
|
||||
data['DefaultPurchaseDate'] = dateFieldValue;
|
||||
$.getJSON('@(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)))', data, function (response, result) {
|
||||
if (result != 'success' || response != 'OK') {
|
||||
alert('Unable to change Date:\n' + response);
|
||||
$ajaxLoading.hide();
|
||||
} else {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
}
|
||||
})
|
||||
dateFieldChangeToken = null;
|
||||
}, 500);
|
||||
}
|
||||
}).focus(function () {
|
||||
$(this).select();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $dataField = $('#DeviceModel_DefaultPurchaseDate');
|
||||
var $ajaxLoading = $dataField.next('.ajaxLoading');
|
||||
var dateFieldValue = $dataField.val();
|
||||
var dateFieldChangeToken = null;
|
||||
$dataField
|
||||
.watermark('None')
|
||||
.datepicker({
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
dateFormat: 'yy/mm/dd'
|
||||
})
|
||||
.change(function () {
|
||||
var dateText = $dataField.val();
|
||||
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
|
||||
dateFieldValue = dateText;
|
||||
if (dateFieldChangeToken)
|
||||
window.clearTimeout(dateFieldChangeToken);
|
||||
dateFieldChangeToken = window.setTimeout(function () {
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $DefaultWarrantyProvider = $('#DeviceModel_DefaultWarrantyProvider');
|
||||
var $ajaxLoading = $DefaultWarrantyProvider.next('.ajaxLoading');
|
||||
$DefaultWarrantyProvider
|
||||
.change(function () {
|
||||
$ajaxLoading.show();
|
||||
var data = {};
|
||||
data['DefaultPurchaseDate'] = dateFieldValue;
|
||||
$.getJSON('@(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)))', data, function (response, result) {
|
||||
if (result != 'success' || response != 'OK') {
|
||||
alert('Unable to change Date:\n' + response);
|
||||
var data = { DefaultWarrantyProvider: $DefaultWarrantyProvider.val() };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.Id))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to default warranty provider: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to default warranty provider: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
} else {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
}
|
||||
})
|
||||
dateFieldChangeToken = null;
|
||||
}, 500);
|
||||
}
|
||||
}).focus(function () {
|
||||
$(this).select();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $DefaultWarrantyProvider = $('#DeviceModel_DefaultWarrantyProvider');
|
||||
var $ajaxLoading = $DefaultWarrantyProvider.next('.ajaxLoading');
|
||||
$DefaultWarrantyProvider
|
||||
.change(function () {
|
||||
$ajaxLoading.show();
|
||||
var data = { DefaultWarrantyProvider: $DefaultWarrantyProvider.val() };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.Id))',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to default warranty provider: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to default warranty provider: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
}
|
||||
</div>
|
||||
<h2>
|
||||
Components</h2>
|
||||
<h2>Components</h2>
|
||||
@Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel)
|
||||
<div class="actionBar">
|
||||
@if (Model.CanDelete)
|
||||
@if (Model.CanDelete)
|
||||
{
|
||||
@Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete")
|
||||
}
|
||||
@Html.ActionLinkButton("Export Devices", MVC.API.DeviceModel.ExportDevices(Model.DeviceModel.Id))
|
||||
@Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel"))
|
||||
@if (Model.DeviceCount > 0)
|
||||
{
|
||||
if (Authorization.Has(Claims.Device.Actions.Export))
|
||||
{
|
||||
@Html.ActionLinkButton("Export Devices", MVC.API.DeviceModel.ExportDevices(Model.DeviceModel.Id))
|
||||
}
|
||||
if (Authorization.Has(Claims.Device.Search))
|
||||
{
|
||||
@Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel"))
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
|
||||
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/DeviceModel/Show.cshtml")]
|
||||
public partial class Show : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ShowModel>
|
||||
public partial class Show : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ShowModel>
|
||||
{
|
||||
public Show()
|
||||
{
|
||||
@@ -43,6 +45,10 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Config.DeviceModel.Show);
|
||||
|
||||
var canConfig = Authorization.Has(Claims.Config.DeviceModel.Configure);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), Model.DeviceModel.ToString());
|
||||
|
||||
|
||||
@@ -58,68 +64,107 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th");
|
||||
|
||||
WriteLiteral(" style=\"width: 150px\"");
|
||||
|
||||
WriteLiteral(">\r\n Id:\r\n </th>\r\n <td>\r\n");
|
||||
WriteLiteral(">Id:\r\n </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 12 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 15 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.DisplayFor(model => model.DeviceModel.Id));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
|
||||
" Description:\r\n </th>\r\n <td>");
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>Description:\r\n " +
|
||||
" </th>\r\n <td>");
|
||||
|
||||
|
||||
#line 19 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 21 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
if (canConfig)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 23 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.EditorFor(model => model.DeviceModel.Description));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 20 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 23 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 24 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(AjaxHelpers.AjaxSave());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 21 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 24 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 25 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(AjaxHelpers.AjaxLoader());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
|
||||
" Manufacturer:\r\n </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 25 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 29 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.DisplayFor(model => model.DeviceModel.Manufacturer));
|
||||
Write(Html.DisplayFor(model => model.DeviceModel.Description));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
|
||||
" Model:\r\n </th>\r\n <td>\r\n");
|
||||
|
||||
#line 29 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>Manufacturer:\r\n " +
|
||||
" </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 37 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.DisplayFor(model => model.DeviceModel.Manufacturer));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>Model:\r\n " +
|
||||
" </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 44 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.DisplayFor(model => model.DeviceModel.Model));
|
||||
|
||||
|
||||
@@ -129,7 +174,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n
|
||||
"\r\n <td>\r\n <div><strong>");
|
||||
|
||||
|
||||
#line 43 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 50 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Model.DeviceCount.ToString("n0"));
|
||||
|
||||
|
||||
@@ -138,7 +183,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n
|
||||
WriteLiteral("</strong> ");
|
||||
|
||||
|
||||
#line 43 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 50 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Model.DeviceCount == 1 ? "devices is" : "devices are");
|
||||
|
||||
|
||||
@@ -147,13 +192,13 @@ WriteLiteral("</strong> ");
|
||||
WriteLiteral(" of this model type.</div>\r\n");
|
||||
|
||||
|
||||
#line 44 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 51 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 44 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 51 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
if (Model.DeviceDecommissionedCount > 0)
|
||||
{
|
||||
|
||||
@@ -167,7 +212,7 @@ WriteLiteral(" class=\"smallMessage\"");
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 46 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 53 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Model.DeviceDecommissionedCount.ToString("n0"));
|
||||
|
||||
|
||||
@@ -176,7 +221,7 @@ WriteLiteral(">");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 46 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 53 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Model.DeviceDecommissionedCount == 1 ? "device is" : "devices are");
|
||||
|
||||
|
||||
@@ -185,108 +230,228 @@ WriteLiteral(" ");
|
||||
WriteLiteral(" decommissioned.</div>\r\n");
|
||||
|
||||
|
||||
#line 47 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 54 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
|
||||
" Default Purchase Date:\r\n </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>Default Purchase " +
|
||||
"Date:\r\n </th>\r\n <td>");
|
||||
|
||||
|
||||
#line 55 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.EditorFor(model => model.DeviceModel.DefaultPurchaseDate));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 56 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(AjaxHelpers.AjaxLoader());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
|
||||
" Default Warranty Provider:\r\n </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 64 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.DropDownListFor(model => model.DeviceModel.DefaultWarrantyProvider, Model.WarrantyProviders.ToSelectListItems(Model.DeviceModel.DefaultWarrantyProvider, true, "None")));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 65 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(AjaxHelpers.AjaxLoader());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
|
||||
" Type:\r\n </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 73 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.DisplayFor(model => model.DeviceModel.ModelType));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
|
||||
" Image:\r\n </th>\r\n <td>\r\n <img");
|
||||
|
||||
WriteLiteral(" alt=\"Model Image\"");
|
||||
|
||||
WriteAttribute("src", Tuple.Create(" src=\"", 2690), Tuple.Create("\"", 2787)
|
||||
|
||||
#line 81 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 2696), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 2696), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
|
||||
" <label");
|
||||
|
||||
WriteLiteral(" for=\"DeviceModel_Image\"");
|
||||
|
||||
WriteLiteral(">\r\n Update Image:\r\n </label>\r\n </th>" +
|
||||
"\r\n <td>\r\n");
|
||||
|
||||
|
||||
#line 91 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 60 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
if (canConfig)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 91 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||
{
|
||||
#line 62 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.EditorFor(model => model.DeviceModel.DefaultPurchaseDate));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <input");
|
||||
|
||||
#line 62 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 63 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(AjaxHelpers.AjaxLoader());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 63 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 67 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(CommonHelpers.FriendlyDate(Model.DeviceModel.DefaultPurchaseDate, "Unknown"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 67 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>Default Warranty " +
|
||||
"Provider:\r\n </th>\r\n <td>");
|
||||
|
||||
|
||||
#line 74 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
if (canConfig)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 76 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.DropDownListFor(model => model.DeviceModel.DefaultWarrantyProvider, Model.WarrantyProviders.ToSelectListItems(Model.DeviceModel.DefaultWarrantyProvider, true, "None")));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 76 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 77 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(AjaxHelpers.AjaxLoader());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 77 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Model.DeviceModel.DefaultWarrantyProvider == null)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <span");
|
||||
|
||||
WriteLiteral(" class=\"smallMessage\"");
|
||||
|
||||
WriteLiteral("><None Specified></span>\r\n");
|
||||
|
||||
|
||||
#line 84 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
var provider = Model.WarrantyProviders.FirstOrDefault(wp => wp.Id == Model.DeviceModel.DefaultWarrantyProvider);
|
||||
if (provider == null)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <span");
|
||||
|
||||
WriteLiteral(" class=\"smallMessage\"");
|
||||
|
||||
WriteLiteral("><None Specified></span>\r\n");
|
||||
|
||||
|
||||
#line 91 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 94 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(provider.Name);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 94 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>Type:\r\n " +
|
||||
" </th>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 104 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.DisplayFor(model => model.DeviceModel.ModelType));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>Image:\r\n " +
|
||||
" </th>\r\n <td>\r\n <img");
|
||||
|
||||
WriteLiteral(" alt=\"Model Image\"");
|
||||
|
||||
WriteAttribute("src", Tuple.Create(" src=\"", 3910), Tuple.Create("\"", 4007)
|
||||
|
||||
#line 111 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 3916), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 3916), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 114 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 114 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
if (canConfig)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <th>\r\n <label");
|
||||
|
||||
WriteLiteral(" for=\"DeviceModel_Image\"");
|
||||
|
||||
WriteLiteral(">\r\n Update Image:\r\n </label>\r\n " +
|
||||
" </th>\r\n <td>\r\n");
|
||||
|
||||
|
||||
#line 123 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 123 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <input");
|
||||
|
||||
WriteLiteral(" type=\"file\"");
|
||||
|
||||
@@ -298,7 +463,7 @@ WriteLiteral(" style=\"width: 250px;\"");
|
||||
|
||||
WriteLiteral(" />\r\n");
|
||||
|
||||
WriteLiteral(" <input");
|
||||
WriteLiteral(" <input");
|
||||
|
||||
WriteLiteral(" class=\"button\"");
|
||||
|
||||
@@ -309,164 +474,199 @@ WriteLiteral(" value=\"Update\"");
|
||||
WriteLiteral(" />\r\n");
|
||||
|
||||
|
||||
#line 95 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
}
|
||||
#line 127 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n <script");
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 130 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </table>\r\n");
|
||||
|
||||
|
||||
#line 132 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 132 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
if (canConfig)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
$(function () {
|
||||
var $Description = $('#DeviceModel_Description');
|
||||
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
|
||||
$Description
|
||||
.watermark('Model Description')
|
||||
.focus(function () { $Description.select() })
|
||||
.keydown(function (e) {
|
||||
$DescriptionAjaxSave.show();
|
||||
if (e.which == 13) {
|
||||
$(this).blur();
|
||||
}
|
||||
}).blur(function () {
|
||||
$DescriptionAjaxSave.hide();
|
||||
})
|
||||
.change(function () {
|
||||
$DescriptionAjaxSave.hide();
|
||||
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
|
||||
var data = { Description: $Description.val() };
|
||||
$.ajax({
|
||||
url: '");
|
||||
$(function () {
|
||||
var $Description = $('#DeviceModel_Description');
|
||||
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
|
||||
$Description
|
||||
.watermark('Model Description')
|
||||
.focus(function () { $Description.select() })
|
||||
.keydown(function (e) {
|
||||
$DescriptionAjaxSave.show();
|
||||
if (e.which == 13) {
|
||||
$(this).blur();
|
||||
}
|
||||
}).blur(function () {
|
||||
$DescriptionAjaxSave.hide();
|
||||
})
|
||||
.change(function () {
|
||||
$DescriptionAjaxSave.hide();
|
||||
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
|
||||
var data = { Description: $Description.val() };
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 119 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.Id)));
|
||||
#line 154 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to update description: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update description: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to update description: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update description: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script");
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
WriteLiteral(" <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
$(function () {
|
||||
var $dataField = $('#DeviceModel_DefaultPurchaseDate');
|
||||
var $ajaxLoading = $dataField.next('.ajaxLoading');
|
||||
var dateFieldValue = $dataField.val();
|
||||
var dateFieldChangeToken = null;
|
||||
$dataField
|
||||
.watermark('None')
|
||||
.datepicker({
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
dateFormat: 'yy/mm/dd'
|
||||
})
|
||||
.change(function () {
|
||||
var dateText = $dataField.val();
|
||||
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
|
||||
dateFieldValue = dateText;
|
||||
if (dateFieldChangeToken)
|
||||
window.clearTimeout(dateFieldChangeToken);
|
||||
dateFieldChangeToken = window.setTimeout(function () {
|
||||
$ajaxLoading.show();
|
||||
var data = {};
|
||||
data['DefaultPurchaseDate'] = dateFieldValue;
|
||||
$.getJSON('");
|
||||
$(function () {
|
||||
var $dataField = $('#DeviceModel_DefaultPurchaseDate');
|
||||
var $ajaxLoading = $dataField.next('.ajaxLoading');
|
||||
var dateFieldValue = $dataField.val();
|
||||
var dateFieldChangeToken = null;
|
||||
$dataField
|
||||
.watermark('None')
|
||||
.datepicker({
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
dateFormat: 'yy/mm/dd'
|
||||
})
|
||||
.change(function () {
|
||||
var dateText = $dataField.val();
|
||||
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
|
||||
dateFieldValue = dateText;
|
||||
if (dateFieldChangeToken)
|
||||
window.clearTimeout(dateFieldChangeToken);
|
||||
dateFieldChangeToken = window.setTimeout(function () {
|
||||
$ajaxLoading.show();
|
||||
var data = {};
|
||||
data['DefaultPurchaseDate'] = dateFieldValue;
|
||||
$.getJSON('");
|
||||
|
||||
|
||||
#line 161 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)));
|
||||
#line 196 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"', data, function (response, result) {
|
||||
if (result != 'success' || response != 'OK') {
|
||||
alert('Unable to change Date:\n' + response);
|
||||
$ajaxLoading.hide();
|
||||
} else {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
}
|
||||
})
|
||||
dateFieldChangeToken = null;
|
||||
}, 500);
|
||||
}
|
||||
}).focus(function () {
|
||||
$(this).select();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script");
|
||||
if (result != 'success' || response != 'OK') {
|
||||
alert('Unable to change Date:\n' + response);
|
||||
$ajaxLoading.hide();
|
||||
} else {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
}
|
||||
})
|
||||
dateFieldChangeToken = null;
|
||||
}, 500);
|
||||
}
|
||||
}).focus(function () {
|
||||
$(this).select();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
WriteLiteral(" <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
$(function () {
|
||||
var $DefaultWarrantyProvider = $('#DeviceModel_DefaultWarrantyProvider');
|
||||
var $ajaxLoading = $DefaultWarrantyProvider.next('.ajaxLoading');
|
||||
$DefaultWarrantyProvider
|
||||
.change(function () {
|
||||
$ajaxLoading.show();
|
||||
var data = { DefaultWarrantyProvider: $DefaultWarrantyProvider.val() };
|
||||
$.ajax({
|
||||
url: '");
|
||||
$(function () {
|
||||
var $DefaultWarrantyProvider = $('#DeviceModel_DefaultWarrantyProvider');
|
||||
var $ajaxLoading = $DefaultWarrantyProvider.next('.ajaxLoading');
|
||||
$DefaultWarrantyProvider
|
||||
.change(function () {
|
||||
$ajaxLoading.show();
|
||||
var data = { DefaultWarrantyProvider: $DefaultWarrantyProvider.val() };
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 186 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.Id)));
|
||||
#line 221 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
} else {
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to default warranty provider: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to default warranty provider: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
alert('Unable to default warranty provider: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to default warranty provider: ' + textStatus);
|
||||
$ajaxLoading.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<h2>
|
||||
Components</h2>
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
|
||||
#line 208 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 240 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</div>\r\n<h2>Components</h2>\r\n");
|
||||
|
||||
|
||||
#line 243 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel));
|
||||
|
||||
|
||||
@@ -479,28 +679,28 @@ WriteLiteral(" class=\"actionBar\"");
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 210 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
#line 245 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 210 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
if (Model.CanDelete)
|
||||
#line 245 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
if (Model.CanDelete)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 212 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 247 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 212 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
#line 247 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
}
|
||||
|
||||
@@ -510,24 +710,49 @@ WriteLiteral(">\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 214 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.ActionLinkButton("Export Devices", MVC.API.DeviceModel.ExportDevices(Model.DeviceModel.Id)));
|
||||
#line 249 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
if (Model.DeviceCount > 0)
|
||||
{
|
||||
if (Authorization.Has(Claims.Device.Actions.Export))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 253 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.ActionLinkButton("Export Devices", MVC.API.DeviceModel.ExportDevices(Model.DeviceModel.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 215 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel")));
|
||||
#line 253 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
}
|
||||
if (Authorization.Has(Claims.Device.Search))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 257 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
Write(Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel")));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n</div>\r\n");
|
||||
|
||||
#line 257 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</div>\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,271 +1,312 @@
|
||||
@model Disco.Web.Areas.Config.Models.DeviceModel.ComponentsModel
|
||||
@{
|
||||
Authorization.Require(Claims.Config.DeviceModel.Show);
|
||||
|
||||
var canConfig = Authorization.Has(Claims.Config.DeviceModel.ConfigureComponents);
|
||||
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Disco-jQueryExtensions");
|
||||
}
|
||||
<table id="deviceComponents" data-devicemodelid="@(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty)">
|
||||
<tr>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
<th>
|
||||
Cost
|
||||
</th>
|
||||
<th>
|
||||
Job Types
|
||||
</th>
|
||||
<th class="actions">
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
@foreach (var item in Model.DeviceComponents)
|
||||
{
|
||||
<tr data-devicecomponentid="@item.Id">
|
||||
<td>
|
||||
<input type="text" class="description" value="@item.Description" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="cost" value="@item.Cost.ToString("C")" />
|
||||
</td>
|
||||
<td>
|
||||
<span class="edit@(item.JobSubTypes.Count > 0 ? " editAlert" : string.Empty)"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="remove"></span>
|
||||
@if (canConfig)
|
||||
{
|
||||
<table id="deviceComponents" data-devicemodelid="@(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty)">
|
||||
<tr>
|
||||
<th>Description
|
||||
</th>
|
||||
<th>Cost
|
||||
</th>
|
||||
<th>Job Types
|
||||
</th>
|
||||
<th class="actions">
|
||||
</th>
|
||||
</tr>
|
||||
@foreach (var item in Model.DeviceComponents)
|
||||
{
|
||||
<tr data-devicecomponentid="@item.Id">
|
||||
<td>
|
||||
<input type="text" class="description" value="@item.Description" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="cost" value="@item.Cost.ToString("C")" />
|
||||
</td>
|
||||
<td>
|
||||
<span class="edit@(item.JobSubTypes.Count > 0 ? " editAlert" : string.Empty)"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="remove"></span>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<a href="#" id="addDeviceComponent">Add Component</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<a href="#" id="addDeviceComponent">Add Component</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $deviceComponents = $('#deviceComponents');
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var $deviceComponents = $('#deviceComponents');
|
||||
|
||||
$('#addDeviceComponent').click(function () {
|
||||
var dc = $('<tr><td><input type="text" class="description" /></td><td><input type="text" class="cost" /></td><td><span class="edit"></span></td><td><span class="remove"></span></td></tr>');
|
||||
dc.find('input').focus(function () { $(this).select() })
|
||||
dc.insertBefore($deviceComponents.find('tr').last());
|
||||
dc.find('input.description').focus();
|
||||
return false;
|
||||
});
|
||||
$('#addDeviceComponent').click(function () {
|
||||
var dc = $('<tr><td><input type="text" class="description" /></td><td><input type="text" class="cost" /></td><td><span class="edit"></span></td><td><span class="remove"></span></td></tr>');
|
||||
dc.find('input').focus(function () { $(this).select() })
|
||||
dc.insertBefore($deviceComponents.find('tr').last());
|
||||
dc.find('input.description').focus();
|
||||
return false;
|
||||
});
|
||||
|
||||
$deviceComponents.on('change', 'input', updateComponent);
|
||||
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
|
||||
$deviceComponents.on('change', 'input', updateComponent);
|
||||
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
|
||||
|
||||
$deviceComponents.on('click', 'span.remove', removeComponent);
|
||||
$deviceComponents.on('click', 'span.edit', editComponentJobTypes);
|
||||
$deviceComponents.on('click', 'span.remove', removeComponent);
|
||||
$deviceComponents.on('click', 'span.edit', editComponentJobTypes);
|
||||
|
||||
function removeComponentConfirmed(id, row) {
|
||||
var data = { id: id };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentRemove())',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
row.remove();
|
||||
} else {
|
||||
alert('Unable to remove component: ' + d);
|
||||
function removeComponentConfirmed(id, row) {
|
||||
var data = { id: id };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentRemove())',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d == 'OK') {
|
||||
row.remove();
|
||||
} else {
|
||||
alert('Unable to remove component: ' + d);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to remove component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
function removeComponent() {
|
||||
var componentRow = $(this).closest('tr');
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
if (id) {
|
||||
var dialog = $("#dialogConfirmRemove");
|
||||
var buttons = dialog.dialog("option", "buttons");
|
||||
buttons['Remove'] = function () { removeComponentConfirmed(id, componentRow); $(this).dialog("close"); };
|
||||
var buttons = dialog.dialog("option", "buttons", buttons);
|
||||
dialog.dialog('open');
|
||||
} else {
|
||||
// New - Remove
|
||||
componentRow.remove();
|
||||
}
|
||||
}
|
||||
function updateComponent() {
|
||||
var componentRow = $(this).closest('tr');
|
||||
componentRow.find('input').attr('disabled', true).addClass('updating');
|
||||
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
if (id) {
|
||||
// Update
|
||||
var data = {
|
||||
id: id,
|
||||
Description: componentRow.find('input.description').val(),
|
||||
Cost: componentRow.find('input.cost').val()
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdate())',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to update component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Add
|
||||
id = componentRow.closest('table').attr('data-devicemodelid');
|
||||
var data = {
|
||||
id: id,
|
||||
Description: componentRow.find('input.description').val(),
|
||||
Cost: componentRow.find('input.cost').val()
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.attr('data-devicecomponentid', d.Component.Id);
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to add component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function editComponentJobTypes() {
|
||||
var edit$this = $(this);
|
||||
var componentRow = edit$this.closest('tr');
|
||||
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
|
||||
if (id) {
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.Component())',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
$dialogUpdateJobTypes = $('#dialogUpdateJobTypes');
|
||||
$dialogUpdateJobTypes.find('input:checked').each(function () { $(this).prop('checked', false) });
|
||||
for (var i = 0; i < d.Component.JobSubTypes.length; i++) {
|
||||
var sjt = d.Component.JobSubTypes[i];
|
||||
$dialogUpdateJobTypes.find('#SubTypes_' + sjt).prop('checked', true);
|
||||
}
|
||||
$('#CheckboxBulkSelect_dialogUpdateJobTypes').checkboxBulkSelect('update');
|
||||
var buttons = $dialogUpdateJobTypes.dialog("option", "buttons");
|
||||
buttons['Save'] = function () {
|
||||
$dialogUpdateJobTypes.dialog("disable");
|
||||
var selectedSJTs = [];
|
||||
$dialogUpdateJobTypes.find('input:checked').each(function () { selectedSJTs.push($(this).val()) });
|
||||
|
||||
var data = {
|
||||
id: id,
|
||||
JobSubTypes: selectedSJTs
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes())',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d.Result == 'OK') {
|
||||
if (d.Component.JobSubTypes.length > 0) {
|
||||
edit$this.addClass('editAlert');
|
||||
} else {
|
||||
edit$this.removeClass('editAlert');
|
||||
}
|
||||
$dialogUpdateJobTypes.dialog("enable");
|
||||
$dialogUpdateJobTypes.dialog("close");
|
||||
} else {
|
||||
alert('Unable to update component sub types: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update component sub types: ' + textStatus);
|
||||
}
|
||||
});
|
||||
};
|
||||
var buttons = $dialogUpdateJobTypes.dialog("option", "buttons", buttons);
|
||||
$dialogUpdateJobTypes.dialog('open');
|
||||
} else {
|
||||
alert('Unable to load component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to load component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$("#dialogConfirmRemove").dialog({
|
||||
resizable: false,
|
||||
height: 140,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Remove": function () {
|
||||
$(this).dialog("close");
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to remove component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
function removeComponent() {
|
||||
var componentRow = $(this).closest('tr');
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
if (id) {
|
||||
var dialog = $("#dialogConfirmRemove");
|
||||
var buttons = dialog.dialog("option", "buttons");
|
||||
buttons['Remove'] = function () { removeComponentConfirmed(id, componentRow); $(this).dialog("close"); };
|
||||
var buttons = dialog.dialog("option", "buttons", buttons);
|
||||
dialog.dialog('open');
|
||||
} else {
|
||||
// New - Remove
|
||||
componentRow.remove();
|
||||
}
|
||||
}
|
||||
function updateComponent() {
|
||||
var componentRow = $(this).closest('tr');
|
||||
componentRow.find('input').attr('disabled', true).addClass('updating');
|
||||
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
if (id) {
|
||||
// Update
|
||||
var data = {
|
||||
id: id,
|
||||
Description: componentRow.find('input.description').val(),
|
||||
Cost: componentRow.find('input.cost').val()
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdate())',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to update component: ' + d.Result);
|
||||
}
|
||||
$('#dialogUpdateJobTypes').dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 550,
|
||||
buttons: {
|
||||
"Save": function () {
|
||||
$(this).dialog("close");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update component: ' + textStatus);
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Add
|
||||
id = componentRow.closest('table').attr('data-devicemodelid');
|
||||
var data = {
|
||||
id: id,
|
||||
Description: componentRow.find('input.description').val(),
|
||||
Cost: componentRow.find('input.cost').val()
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null))',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.attr('data-devicecomponentid', d.Component.Id);
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to add component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function editComponentJobTypes() {
|
||||
var edit$this = $(this);
|
||||
var componentRow = edit$this.closest('tr');
|
||||
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
|
||||
if (id) {
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.Component())',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
$dialogUpdateJobTypes = $('#dialogUpdateJobTypes');
|
||||
$dialogUpdateJobTypes.find('input:checked').each(function () { $(this).prop('checked', false) });
|
||||
for (var i = 0; i < d.Component.JobSubTypes.length; i++) {
|
||||
var sjt = d.Component.JobSubTypes[i];
|
||||
$dialogUpdateJobTypes.find('#SubTypes_' + sjt).prop('checked', true);
|
||||
}
|
||||
$('#CheckboxBulkSelect_dialogUpdateJobTypes').checkboxBulkSelect('update');
|
||||
var buttons = $dialogUpdateJobTypes.dialog("option", "buttons");
|
||||
buttons['Save'] = function () {
|
||||
$dialogUpdateJobTypes.dialog("disable");
|
||||
var selectedSJTs = [];
|
||||
$dialogUpdateJobTypes.find('input:checked').each(function () { selectedSJTs.push($(this).val()) });
|
||||
|
||||
var data = {
|
||||
id: id,
|
||||
JobSubTypes: selectedSJTs
|
||||
};
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes())',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d.Result == 'OK') {
|
||||
if (d.Component.JobSubTypes.length > 0) {
|
||||
edit$this.addClass('editAlert');
|
||||
} else {
|
||||
edit$this.removeClass('editAlert');
|
||||
}
|
||||
$dialogUpdateJobTypes.dialog("enable");
|
||||
$dialogUpdateJobTypes.dialog("close");
|
||||
} else {
|
||||
alert('Unable to update component sub types: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update component sub types: ' + textStatus);
|
||||
}
|
||||
});
|
||||
};
|
||||
var buttons = $dialogUpdateJobTypes.dialog("option", "buttons", buttons);
|
||||
$dialogUpdateJobTypes.dialog('open');
|
||||
} else {
|
||||
alert('Unable to load component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to load component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$("#dialogConfirmRemove").dialog({
|
||||
resizable: false,
|
||||
height: 140,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Remove": function () {
|
||||
$(this).dialog("close");
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#dialogUpdateJobTypes').dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 550,
|
||||
buttons: {
|
||||
"Save": function () {
|
||||
$(this).dialog("close");
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
$('#CheckboxBulkSelect_dialogUpdateJobTypes').checkboxBulkSelect({ parentSelector: 'div' });
|
||||
});
|
||||
|
||||
$('#CheckboxBulkSelect_dialogUpdateJobTypes').checkboxBulkSelect({ parentSelector: 'div' });
|
||||
});
|
||||
</script>
|
||||
<div id="dialogUpdateJobTypes" title="Update Job Types">
|
||||
<div>
|
||||
<h2>
|
||||
Hardware Non-Warranty Job Types</h2>
|
||||
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.ToSelectListItems(), 2)
|
||||
<br />
|
||||
<span id="CheckboxBulkSelect_dialogUpdateJobTypes" class="checkboxBulkSelectContainer">
|
||||
</span>
|
||||
</script>
|
||||
<div id="dialogUpdateJobTypes" title="Update Job Types">
|
||||
<div>
|
||||
<h2>Hardware Non-Warranty Job Types</h2>
|
||||
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.ToSelectListItems(), 2)
|
||||
<br />
|
||||
<span id="CheckboxBulkSelect_dialogUpdateJobTypes" class="checkboxBulkSelectContainer"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="dialogConfirmRemove" title="Delete this Component?">
|
||||
<p>
|
||||
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
|
||||
This item will be permanently deleted and cannot be recovered. Are you sure?</p>
|
||||
</div>
|
||||
<div id="dialogConfirmRemove" title="Delete this Component?">
|
||||
<p>
|
||||
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
|
||||
This item will be permanently deleted and cannot be recovered. Are you sure?
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table id="deviceComponents" data-devicemodelid="@(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty)">
|
||||
<tr>
|
||||
<th>Description
|
||||
</th>
|
||||
<th>Cost
|
||||
</th>
|
||||
<th>Job Types
|
||||
</th>
|
||||
</tr>
|
||||
@foreach (var item in Model.DeviceComponents)
|
||||
{
|
||||
<tr data-devicecomponentid="@item.Id">
|
||||
<td>
|
||||
@item.Description
|
||||
</td>
|
||||
<td>
|
||||
@item.Cost.ToString("C")
|
||||
</td>
|
||||
<td>
|
||||
@if (item.JobSubTypes.Count > 0)
|
||||
{
|
||||
<ul>
|
||||
@foreach (var jst in item.JobSubTypes)
|
||||
{
|
||||
<li>@jst.Description</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="smallMessage"><None Specified></span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
}
|
||||
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
|
||||
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/DeviceModel/_DeviceComponentsTable.cshtml")]
|
||||
public partial class DeviceComponentsTable : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ComponentsModel>
|
||||
public partial class DeviceComponentsTable : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ComponentsModel>
|
||||
{
|
||||
public DeviceComponentsTable()
|
||||
{
|
||||
@@ -43,370 +45,564 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Config.DeviceModel.Show);
|
||||
|
||||
var canConfig = Authorization.Has(Claims.Config.DeviceModel.ConfigureComponents);
|
||||
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Disco-jQueryExtensions");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<table");
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 9 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
if (canConfig)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <table");
|
||||
|
||||
WriteLiteral(" id=\"deviceComponents\"");
|
||||
|
||||
WriteLiteral(" data-devicemodelid=\"");
|
||||
|
||||
|
||||
#line 5 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty);
|
||||
#line 11 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <tr>\r\n <th>\r\n Description\r\n </th>\r\n <th>\r\n" +
|
||||
" Cost\r\n </th>\r\n <th>\r\n Job Types\r\n </" +
|
||||
"th>\r\n <th");
|
||||
WriteLiteral(">\r\n <tr>\r\n <th>Description\r\n </th>\r\n <th>" +
|
||||
"Cost\r\n </th>\r\n <th>Job Types\r\n </th>\r\n " +
|
||||
" <th");
|
||||
|
||||
WriteLiteral(" class=\"actions\"");
|
||||
|
||||
WriteLiteral(">\r\n \r\n </th>\r\n </tr>\r\n");
|
||||
WriteLiteral("> \r\n </th>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 20 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
|
||||
#line 22 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 20 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
foreach (var item in Model.DeviceComponents)
|
||||
{
|
||||
#line 22 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
foreach (var item in Model.DeviceComponents)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr");
|
||||
WriteLiteral(" <tr");
|
||||
|
||||
WriteLiteral(" data-devicecomponentid=\"");
|
||||
|
||||
|
||||
#line 22 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(item.Id);
|
||||
#line 24 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(item.Id);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <td>\r\n <input");
|
||||
WriteLiteral(">\r\n <td>\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteLiteral(" class=\"description\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 704), Tuple.Create("\"", 729)
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 883), Tuple.Create("\"", 908)
|
||||
|
||||
#line 24 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 712), Tuple.Create<System.Object, System.Int32>(item.Description
|
||||
#line 26 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 891), Tuple.Create<System.Object, System.Int32>(item.Description
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 712), false)
|
||||
, 891), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
|
||||
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteLiteral(" class=\"cost\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 819), Tuple.Create("\"", 851)
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 1010), Tuple.Create("\"", 1042)
|
||||
|
||||
#line 27 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 827), Tuple.Create<System.Object, System.Int32>(item.Cost.ToString("C")
|
||||
#line 29 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1018), Tuple.Create<System.Object, System.Int32>(item.Cost.ToString("C")
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 827), false)
|
||||
, 1018), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
|
||||
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 915), Tuple.Create("\"", 986)
|
||||
, Tuple.Create(Tuple.Create("", 923), Tuple.Create("edit", 923), true)
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 1118), Tuple.Create("\"", 1189)
|
||||
, Tuple.Create(Tuple.Create("", 1126), Tuple.Create("edit", 1126), true)
|
||||
|
||||
#line 30 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 927), Tuple.Create<System.Object, System.Int32>(item.JobSubTypes.Count > 0 ? " editAlert" : string.Empty
|
||||
#line 32 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1130), Tuple.Create<System.Object, System.Int32>(item.JobSubTypes.Count > 0 ? " editAlert" : string.Empty
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 927), false)
|
||||
, 1130), false)
|
||||
);
|
||||
|
||||
WriteLiteral("></span>\r\n </td>\r\n <td>\r\n <span");
|
||||
WriteLiteral("></span>\r\n </td>\r\n <td>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"remove\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n");
|
||||
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 36 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
}
|
||||
#line 38 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <td");
|
||||
WriteLiteral(" <tr>\r\n <td");
|
||||
|
||||
WriteLiteral(" colspan=\"4\"");
|
||||
|
||||
WriteLiteral(">\r\n <a");
|
||||
WriteLiteral(">\r\n <a");
|
||||
|
||||
WriteLiteral(" href=\"#\"");
|
||||
|
||||
WriteLiteral(" id=\"addDeviceComponent\"");
|
||||
|
||||
WriteLiteral(">Add Component</a>\r\n </td>\r\n </tr>\r\n</table>\r\n<script");
|
||||
WriteLiteral(">Add Component</a>\r\n </td>\r\n </tr>\r\n </table>\r\n");
|
||||
|
||||
WriteLiteral(" <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
$(function () {
|
||||
var $deviceComponents = $('#deviceComponents');
|
||||
$(function () {
|
||||
var $deviceComponents = $('#deviceComponents');
|
||||
|
||||
$('#addDeviceComponent').click(function () {
|
||||
var dc = $('<tr><td><input type=""text"" class=""description"" /></td><td><input type=""text"" class=""cost"" /></td><td><span class=""edit""></span></td><td><span class=""remove""></span></td></tr>');
|
||||
dc.find('input').focus(function () { $(this).select() })
|
||||
dc.insertBefore($deviceComponents.find('tr').last());
|
||||
dc.find('input.description').focus();
|
||||
return false;
|
||||
});
|
||||
$('#addDeviceComponent').click(function () {
|
||||
var dc = $('<tr><td><input type=""text"" class=""description"" /></td><td><input type=""text"" class=""cost"" /></td><td><span class=""edit""></span></td><td><span class=""remove""></span></td></tr>');
|
||||
dc.find('input').focus(function () { $(this).select() })
|
||||
dc.insertBefore($deviceComponents.find('tr').last());
|
||||
dc.find('input.description').focus();
|
||||
return false;
|
||||
});
|
||||
|
||||
$deviceComponents.on('change', 'input', updateComponent);
|
||||
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
|
||||
$deviceComponents.on('change', 'input', updateComponent);
|
||||
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
|
||||
|
||||
$deviceComponents.on('click', 'span.remove', removeComponent);
|
||||
$deviceComponents.on('click', 'span.edit', editComponentJobTypes);
|
||||
$deviceComponents.on('click', 'span.remove', removeComponent);
|
||||
$deviceComponents.on('click', 'span.edit', editComponentJobTypes);
|
||||
|
||||
function removeComponentConfirmed(id, row) {
|
||||
var data = { id: id };
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 64 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentRemove()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data,\r\n " +
|
||||
" success: function (d) {\r\n if (d == \'OK\') {\r\n " +
|
||||
" row.remove();\r\n } else {\r\n a" +
|
||||
"lert(\'Unable to remove component: \' + d);\r\n }\r\n " +
|
||||
" },\r\n error: function (jqXHR, textStatus, errorThrown) {\r\n " +
|
||||
" alert(\'Unable to remove component: \' + textStatus);\r\n " +
|
||||
" }\r\n });\r\n }\r\n function removeComponent() {\r\n " +
|
||||
" var componentRow = $(this).closest(\'tr\');\r\n var id = componentRow" +
|
||||
".attr(\'data-devicecomponentid\');\r\n if (id) {\r\n var dia" +
|
||||
"log = $(\"#dialogConfirmRemove\");\r\n var buttons = dialog.dialog(\"o" +
|
||||
"ption\", \"buttons\");\r\n buttons[\'Remove\'] = function () { removeCom" +
|
||||
"ponentConfirmed(id, componentRow); $(this).dialog(\"close\"); };\r\n " +
|
||||
"var buttons = dialog.dialog(\"option\", \"buttons\", buttons);\r\n dial" +
|
||||
"og.dialog(\'open\');\r\n } else {\r\n // New - Remove\r\n " +
|
||||
" componentRow.remove();\r\n }\r\n }\r\n function up" +
|
||||
"dateComponent() {\r\n var componentRow = $(this).closest(\'tr\');\r\n " +
|
||||
" componentRow.find(\'input\').attr(\'disabled\', true).addClass(\'updating\');\r\n\r" +
|
||||
"\n var id = componentRow.attr(\'data-devicecomponentid\');\r\n " +
|
||||
"if (id) {\r\n // Update\r\n var data = {\r\n " +
|
||||
" id: id,\r\n Description: componentRow.find(\'input.descr" +
|
||||
"iption\').val(),\r\n Cost: componentRow.find(\'input.cost\').val()" +
|
||||
"\r\n };\r\n $.ajax({\r\n url: \'");
|
||||
|
||||
|
||||
#line 106 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdate()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to update component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Add
|
||||
id = componentRow.closest('table').attr('data-devicemodelid');
|
||||
var data = {
|
||||
id: id,
|
||||
Description: componentRow.find('input.description').val(),
|
||||
Cost: componentRow.find('input.cost').val()
|
||||
};
|
||||
function removeComponentConfirmed(id, row) {
|
||||
var data = { id: id };
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 132 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.attr('data-devicecomponentid', d.Component.Id);
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to add component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function editComponentJobTypes() {
|
||||
var edit$this = $(this);
|
||||
var componentRow = edit$this.closest('tr');
|
||||
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
|
||||
if (id) {
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 163 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.Component()));
|
||||
#line 66 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentRemove()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data,\r\n " +
|
||||
" success: function (d) {\r\n componentRow.fin" +
|
||||
"d(\'input\').attr(\'disabled\', false).removeClass(\'updating\');\r\n " +
|
||||
" if (d.Result == \'OK\') {\r\n $dialogUpdateJobTypes " +
|
||||
"= $(\'#dialogUpdateJobTypes\');\r\n $dialogUpdateJobTypes" +
|
||||
".find(\'input:checked\').each(function () { $(this).prop(\'checked\', false) });\r\n " +
|
||||
" for (var i = 0; i < d.Component.JobSubTypes.length; i+" +
|
||||
"+) {\r\n var sjt = d.Component.JobSubTypes[i];\r\n " +
|
||||
" $dialogUpdateJobTypes.find(\'#SubTypes_\' + sjt).prop" +
|
||||
"(\'checked\', true);\r\n }\r\n $" +
|
||||
"(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect(\'update\');\r\n " +
|
||||
" var buttons = $dialogUpdateJobTypes.dialog(\"option\", \"bu" +
|
||||
"ttons\");\r\n buttons[\'Save\'] = function () {\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\"disable\");\r\n " +
|
||||
" var selectedSJTs = [];\r\n $dialog" +
|
||||
"UpdateJobTypes.find(\'input:checked\').each(function () { selectedSJTs.push($(this" +
|
||||
").val()) });\r\n\r\n var data = {\r\n " +
|
||||
" id: id,\r\n JobSubTypes: sele" +
|
||||
"ctedSJTs\r\n };\r\n $." +
|
||||
"ajax({\r\n url: \'");
|
||||
" success: function (d) {\r\n if (d == \'OK\') {" +
|
||||
"\r\n row.remove();\r\n } else {\r\n " +
|
||||
" alert(\'Unable to remove component: \' + d);\r\n " +
|
||||
" }\r\n },\r\n error: function (j" +
|
||||
"qXHR, textStatus, errorThrown) {\r\n alert(\'Unable to remov" +
|
||||
"e component: \' + textStatus);\r\n }\r\n });\r\n " +
|
||||
" }\r\n function removeComponent() {\r\n var componentRow" +
|
||||
" = $(this).closest(\'tr\');\r\n var id = componentRow.attr(\'data-devi" +
|
||||
"cecomponentid\');\r\n if (id) {\r\n var dialog = $(" +
|
||||
"\"#dialogConfirmRemove\");\r\n var buttons = dialog.dialog(\"optio" +
|
||||
"n\", \"buttons\");\r\n buttons[\'Remove\'] = function () { removeCom" +
|
||||
"ponentConfirmed(id, componentRow); $(this).dialog(\"close\"); };\r\n " +
|
||||
" var buttons = dialog.dialog(\"option\", \"buttons\", buttons);\r\n " +
|
||||
" dialog.dialog(\'open\');\r\n } else {\r\n // New" +
|
||||
" - Remove\r\n componentRow.remove();\r\n }\r\n " +
|
||||
" }\r\n function updateComponent() {\r\n var component" +
|
||||
"Row = $(this).closest(\'tr\');\r\n componentRow.find(\'input\').attr(\'d" +
|
||||
"isabled\', true).addClass(\'updating\');\r\n\r\n var id = componentRow.a" +
|
||||
"ttr(\'data-devicecomponentid\');\r\n if (id) {\r\n /" +
|
||||
"/ Update\r\n var data = {\r\n id: id,\r\n " +
|
||||
" Description: componentRow.find(\'input.description\').val(),\r" +
|
||||
"\n Cost: componentRow.find(\'input.cost\').val()\r\n " +
|
||||
" };\r\n $.ajax({\r\n url: \'");
|
||||
|
||||
|
||||
#line 187 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes()));
|
||||
#line 108 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdate()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
|
||||
" type: \'POST\',\r\n traditional: tr" +
|
||||
"ue,\r\n data: data,\r\n " +
|
||||
" success: function (d) {\r\n if (d" +
|
||||
".Result == \'OK\') {\r\n if (d.Component." +
|
||||
"JobSubTypes.length > 0) {\r\n edit$" +
|
||||
"this.addClass(\'editAlert\');\r\n } else " +
|
||||
"{\r\n edit$this.removeClass(\'editAl" +
|
||||
"ert\');\r\n }\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\"enable\");\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\"close\");\r\n " +
|
||||
" } else {\r\n al" +
|
||||
"ert(\'Unable to update component sub types: \' + d.Result);\r\n " +
|
||||
" }\r\n },\r\n " +
|
||||
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
|
||||
" alert(\'Unable to update component sub types: \' + t" +
|
||||
"extStatus);\r\n }\r\n " +
|
||||
" });\r\n };\r\n var buttons" +
|
||||
" = $dialogUpdateJobTypes.dialog(\"option\", \"buttons\", buttons);\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\'open\');\r\n } els" +
|
||||
"e {\r\n alert(\'Unable to load component: \' + d.Result);" +
|
||||
"\r\n }\r\n },\r\n error: " +
|
||||
"function (jqXHR, textStatus, errorThrown) {\r\n alert(\'Unab" +
|
||||
"le to load component: \' + textStatus);\r\n }\r\n }" +
|
||||
");\r\n }\r\n\r\n }\r\n\r\n $(\"#dialogConfirmRemove\").dialog({\r\n " +
|
||||
" resizable: false,\r\n height: 140,\r\n modal: true,\r" +
|
||||
"\n autoOpen: false,\r\n buttons: {\r\n \"Remove\":" +
|
||||
" function () {\r\n $(this).dialog(\"close\");\r\n }," +
|
||||
"\r\n Cancel: function () {\r\n $(this).dialog(\"clo" +
|
||||
"se\");\r\n }\r\n }\r\n });\r\n\r\n $(\'#dialogUpdate" +
|
||||
"JobTypes\').dialog({\r\n resizable: false,\r\n modal: true,\r\n " +
|
||||
" autoOpen: false,\r\n width: 550,\r\n buttons: {\r\n " +
|
||||
" \"Save\": function () {\r\n $(this).dialog(\"close\");" +
|
||||
"\r\n },\r\n Cancel: function () {\r\n " +
|
||||
" $(this).dialog(\"close\");\r\n }\r\n }\r\n });\r\n\r\n " +
|
||||
" $(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect({ parentSel" +
|
||||
"ector: \'div\' });\r\n });\r\n</script>\r\n<div");
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to update component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to update component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Add
|
||||
id = componentRow.closest('table').attr('data-devicemodelid');
|
||||
var data = {
|
||||
id: id,
|
||||
Description: componentRow.find('input.description').val(),
|
||||
Cost: componentRow.find('input.cost').val()
|
||||
};
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 134 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||
if (d.Result == 'OK') {
|
||||
componentRow.attr('data-devicecomponentid', d.Component.Id);
|
||||
componentRow.find('input.description').val(d.Component.Description);
|
||||
componentRow.find('input.cost').val(d.Component.Cost);
|
||||
} else {
|
||||
alert('Unable to add component: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function editComponentJobTypes() {
|
||||
var edit$this = $(this);
|
||||
var componentRow = edit$this.closest('tr');
|
||||
|
||||
var id = componentRow.attr('data-devicecomponentid');
|
||||
|
||||
if (id) {
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 165 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.Component()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data" +
|
||||
",\r\n success: function (d) {\r\n " +
|
||||
"componentRow.find(\'input\').attr(\'disabled\', false).removeClass(\'updating\');\r\n " +
|
||||
" if (d.Result == \'OK\') {\r\n " +
|
||||
" $dialogUpdateJobTypes = $(\'#dialogUpdateJobTypes\');\r\n " +
|
||||
" $dialogUpdateJobTypes.find(\'input:checked\').each(function () { $(this).pr" +
|
||||
"op(\'checked\', false) });\r\n for (var i = 0; i < d." +
|
||||
"Component.JobSubTypes.length; i++) {\r\n var sj" +
|
||||
"t = d.Component.JobSubTypes[i];\r\n $dialogUpda" +
|
||||
"teJobTypes.find(\'#SubTypes_\' + sjt).prop(\'checked\', true);\r\n " +
|
||||
" }\r\n $(\'#CheckboxBulkSelect_dialogUpda" +
|
||||
"teJobTypes\').checkboxBulkSelect(\'update\');\r\n var " +
|
||||
"buttons = $dialogUpdateJobTypes.dialog(\"option\", \"buttons\");\r\n " +
|
||||
" buttons[\'Save\'] = function () {\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\"disable\");\r\n " +
|
||||
" var selectedSJTs = [];\r\n $dialogUpdateJobTyp" +
|
||||
"es.find(\'input:checked\').each(function () { selectedSJTs.push($(this).val()) });" +
|
||||
"\r\n\r\n var data = {\r\n " +
|
||||
" id: id,\r\n JobSubTypes: sele" +
|
||||
"ctedSJTs\r\n };\r\n " +
|
||||
" $.ajax({\r\n url: \'");
|
||||
|
||||
|
||||
#line 189 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
|
||||
" type: \'POST\',\r\n tra" +
|
||||
"ditional: true,\r\n data: data,\r\n " +
|
||||
" success: function (d) {\r\n " +
|
||||
" if (d.Result == \'OK\') {\r\n " +
|
||||
" if (d.Component.JobSubTypes.length > 0) {\r\n " +
|
||||
" edit$this.addClass(\'editAlert\');\r\n " +
|
||||
" } else {\r\n " +
|
||||
" edit$this.removeClass(\'editAlert\');\r\n " +
|
||||
" }\r\n $dialogUpdate" +
|
||||
"JobTypes.dialog(\"enable\");\r\n $dia" +
|
||||
"logUpdateJobTypes.dialog(\"close\");\r\n " +
|
||||
"} else {\r\n alert(\'Unable to updat" +
|
||||
"e component sub types: \' + d.Result);\r\n " +
|
||||
" }\r\n },\r\n " +
|
||||
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
|
||||
" alert(\'Unable to update component sub types: \' + textS" +
|
||||
"tatus);\r\n }\r\n " +
|
||||
" });\r\n };\r\n " +
|
||||
" var buttons = $dialogUpdateJobTypes.dialog(\"option\", \"buttons\", buttons);\r\n " +
|
||||
" $dialogUpdateJobTypes.dialog(\'open\');\r\n " +
|
||||
" } else {\r\n alert(\'Unable to load c" +
|
||||
"omponent: \' + d.Result);\r\n }\r\n " +
|
||||
" },\r\n error: function (jqXHR, textStatus, errorThrown) {\r" +
|
||||
"\n alert(\'Unable to load component: \' + textStatus);\r\n" +
|
||||
" }\r\n });\r\n }\r\n\r\n " +
|
||||
" }\r\n\r\n $(\"#dialogConfirmRemove\").dialog({\r\n resiza" +
|
||||
"ble: false,\r\n height: 140,\r\n modal: true,\r\n " +
|
||||
" autoOpen: false,\r\n buttons: {\r\n \"Remo" +
|
||||
"ve\": function () {\r\n $(this).dialog(\"close\");\r\n " +
|
||||
" },\r\n Cancel: function () {\r\n " +
|
||||
" $(this).dialog(\"close\");\r\n }\r\n }\r\n " +
|
||||
" });\r\n\r\n $(\'#dialogUpdateJobTypes\').dialog({\r\n resizab" +
|
||||
"le: false,\r\n modal: true,\r\n autoOpen: false,\r\n " +
|
||||
" width: 550,\r\n buttons: {\r\n \"Save\":" +
|
||||
" function () {\r\n $(this).dialog(\"close\");\r\n " +
|
||||
" },\r\n Cancel: function () {\r\n $(t" +
|
||||
"his).dialog(\"close\");\r\n }\r\n }\r\n });" +
|
||||
"\r\n\r\n $(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect" +
|
||||
"({ parentSelector: \'div\' });\r\n });\r\n </script>\r\n");
|
||||
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" id=\"dialogUpdateJobTypes\"");
|
||||
|
||||
WriteLiteral(" title=\"Update Job Types\"");
|
||||
|
||||
WriteLiteral(">\r\n <div>\r\n <h2>\r\n Hardware Non-Warranty Job Types</h2>\r\n");
|
||||
WriteLiteral(">\r\n <div>\r\n <h2>Hardware Non-Warranty Job Types</h2>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 261 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.ToSelectListItems(), 2));
|
||||
#line 262 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.ToSelectListItems(), 2));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <br />\r\n <span");
|
||||
WriteLiteral("\r\n <br />\r\n <span");
|
||||
|
||||
WriteLiteral(" id=\"CheckboxBulkSelect_dialogUpdateJobTypes\"");
|
||||
|
||||
WriteLiteral(" class=\"checkboxBulkSelectContainer\"");
|
||||
|
||||
WriteLiteral(">\r\n </span>\r\n </div>\r\n</div>\r\n<div");
|
||||
WriteLiteral("></span>\r\n </div>\r\n </div>\r\n");
|
||||
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" id=\"dialogConfirmRemove\"");
|
||||
|
||||
WriteLiteral(" title=\"Delete this Component?\"");
|
||||
|
||||
WriteLiteral(">\r\n <p>\r\n <span");
|
||||
WriteLiteral(">\r\n <p>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"ui-icon ui-icon-alert\"");
|
||||
|
||||
WriteLiteral(" style=\"float: left; margin: 0 7px 20px 0;\"");
|
||||
|
||||
WriteLiteral("></span>\r\n This item will be permanently deleted and cannot be recovered. " +
|
||||
"Are you sure?</p>\r\n</div>\r\n");
|
||||
WriteLiteral("></span>\r\n This item will be permanently deleted and cannot be recover" +
|
||||
"ed. Are you sure?\r\n </p>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 273 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <table");
|
||||
|
||||
WriteLiteral(" id=\"deviceComponents\"");
|
||||
|
||||
WriteLiteral(" data-devicemodelid=\"");
|
||||
|
||||
|
||||
#line 276 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <tr>\r\n <th>Description\r\n </th>\r\n <th>" +
|
||||
"Cost\r\n </th>\r\n <th>Job Types\r\n </th>\r\n <" +
|
||||
"/tr>\r\n");
|
||||
|
||||
|
||||
#line 285 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 285 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
foreach (var item in Model.DeviceComponents)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr");
|
||||
|
||||
WriteLiteral(" data-devicecomponentid=\"");
|
||||
|
||||
|
||||
#line 287 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(item.Id);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 289 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(item.Description);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 292 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(item.Cost.ToString("C"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
|
||||
|
||||
#line 295 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 295 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
if (item.JobSubTypes.Count > 0)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <ul>\r\n");
|
||||
|
||||
|
||||
#line 298 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 298 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
foreach (var jst in item.JobSubTypes)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <li>");
|
||||
|
||||
|
||||
#line 300 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
Write(jst.Description);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</li>\r\n");
|
||||
|
||||
|
||||
#line 301 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </ul>\r\n");
|
||||
|
||||
|
||||
#line 303 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <span");
|
||||
|
||||
WriteLiteral(" class=\"smallMessage\"");
|
||||
|
||||
WriteLiteral("><None Specified></span>\r\n");
|
||||
|
||||
|
||||
#line 307 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 310 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </table>\r\n");
|
||||
|
||||
|
||||
#line 312 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user