Fix: Javascript Bugs

jQuery v1.9 migrations; Isotope Update
This commit is contained in:
Gary Sharp
2013-02-19 19:17:06 +11:00
parent a76cd8c829
commit 20a12c1c99
60 changed files with 15323 additions and 15642 deletions
+114 -114
View File
@@ -1,114 +1,114 @@
@model Disco.Web.Models.Device.AddOfflineModel
@{
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Add Offline");
}
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
<div class="form" style="width: 450px">
<table>
<tr>
<th>
Serial Number:
</th>
<td>
@Html.TextBoxFor(model => model.Device.SerialNumber)<br />
@Html.ValidationMessageFor(model => model.Device.SerialNumber)
</td>
</tr>
<tr>
<th>
Asset Number:
</th>
<td>@Html.TextBoxFor(model => model.Device.AssetNumber)<br />
@Html.ValidationMessageFor(model => model.Device.AssetNumber)
</td>
</tr>
<tr>
<th>
Location:
</th>
<td>@Html.TextBoxFor(model => model.Device.Location)<br />
@Html.ValidationMessageFor(model => model.Device.Location)
</td>
</tr>
<tr>
<th>
Device Batch:
</th>
<td>
@Html.DropDownListFor(model => model.Device.DeviceBatchId, Model.DeviceBatches) <br />
@Html.ValidationMessageFor(model => model.Device.DeviceBatchId)
</td>
</tr>
<tr>
<th>
Device Profile:
</th>
<td>
@Html.DropDownListFor(model => model.Device.DeviceProfileId, Model.DeviceProfiles.ToSelectListItems(Model.DefaultDeviceProfileId))<br />
@Html.ValidationMessageFor(model => model.Device.DeviceProfileId)
</td>
</tr>
<tr>
<th>
Assigned User:
</th>
<td>
@Html.TextBoxFor(model => model.Device.AssignedUserId)<br />
@Html.ValidationMessageFor(model => model.Device.AssignedUserId)
</td>
</tr>
</table>
<p class="actions">
<input type="submit" class="button" value="Add" />
</p>
<script type="text/javascript">
$(function () {
$SerialNumber = $('#Device_SerialNumber');
$AssetNumber = $('#Device_AssetNumber');
$Location = $('#Device_Location');
$AssignedUserId = $('#Device_AssignedUserId');
$SerialNumber.focus().keydown(function (e) {
if (e.which == 13) {
$AssignedUserId.focus();
return false;
}
});
$AssetNumber.keydown(function (e) {
if (e.which == 13) {
$Location.focus();
return false;
}
});
$Location.keydown(function (e) {
if (e.which == 13) {
$AssignedUserId.focus();
return false;
}
});
$AssignedUserId
.watermark('Search Users')
.focus(function () { $AssignedUserId.select() })
.autocomplete({
source: '@(Url.Action(MVC.API.User.UpstreamUsers()))',
minLength: 2,
focus: function (e, ui) {
$AssignedUserId.val(ui.item.DisplayName + ' (' + ui.item.Id + ')');
return false;
},
select: function (e, ui) {
$AssignedUserId.val(ui.item.Id).blur();
return false;
}
}).data('autocomplete')._renderItem = function (ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a><strong>" + item.DisplayName + "</strong><br>" + item.Id + " (" + item.Type + ")</a>")
.appendTo(ul);
};
});
</script>
</div>
}
@model Disco.Web.Models.Device.AddOfflineModel
@{
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Add Offline");
}
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
<div class="form" style="width: 450px">
<table>
<tr>
<th>
Serial Number:
</th>
<td>
@Html.TextBoxFor(model => model.Device.SerialNumber)<br />
@Html.ValidationMessageFor(model => model.Device.SerialNumber)
</td>
</tr>
<tr>
<th>
Asset Number:
</th>
<td>@Html.TextBoxFor(model => model.Device.AssetNumber)<br />
@Html.ValidationMessageFor(model => model.Device.AssetNumber)
</td>
</tr>
<tr>
<th>
Location:
</th>
<td>@Html.TextBoxFor(model => model.Device.Location)<br />
@Html.ValidationMessageFor(model => model.Device.Location)
</td>
</tr>
<tr>
<th>
Device Batch:
</th>
<td>
@Html.DropDownListFor(model => model.Device.DeviceBatchId, Model.DeviceBatches) <br />
@Html.ValidationMessageFor(model => model.Device.DeviceBatchId)
</td>
</tr>
<tr>
<th>
Device Profile:
</th>
<td>
@Html.DropDownListFor(model => model.Device.DeviceProfileId, Model.DeviceProfiles.ToSelectListItems(Model.DefaultDeviceProfileId))<br />
@Html.ValidationMessageFor(model => model.Device.DeviceProfileId)
</td>
</tr>
<tr>
<th>
Assigned User:
</th>
<td>
@Html.TextBoxFor(model => model.Device.AssignedUserId)<br />
@Html.ValidationMessageFor(model => model.Device.AssignedUserId)
</td>
</tr>
</table>
<p class="actions">
<input type="submit" class="button" value="Add" />
</p>
<script type="text/javascript">
$(function () {
$SerialNumber = $('#Device_SerialNumber');
$AssetNumber = $('#Device_AssetNumber');
$Location = $('#Device_Location');
$AssignedUserId = $('#Device_AssignedUserId');
$SerialNumber.focus().keydown(function (e) {
if (e.which == 13) {
$AssignedUserId.focus();
return false;
}
});
$AssetNumber.keydown(function (e) {
if (e.which == 13) {
$Location.focus();
return false;
}
});
$Location.keydown(function (e) {
if (e.which == 13) {
$AssignedUserId.focus();
return false;
}
});
$AssignedUserId
.watermark('Search Users')
.focus(function () { $AssignedUserId.select() })
.autocomplete({
source: '@(Url.Action(MVC.API.User.UpstreamUsers()))',
minLength: 2,
focus: function (e, ui) {
$AssignedUserId.val(ui.item.DisplayName + ' (' + ui.item.Id + ')');
return false;
},
select: function (e, ui) {
$AssignedUserId.val(ui.item.Id).blur();
return false;
}
}).data('ui-autocomplete')._renderItem = function (ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a><strong>" + item.DisplayName + "</strong><br>" + item.Id + " (" + item.Type + ")</a>")
.appendTo(ul);
};
});
</script>
</div>
}
+304 -304
View File
@@ -1,304 +1,304 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Device
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/AddOffline.cshtml")]
public class AddOffline : System.Web.Mvc.WebViewPage<Disco.Web.Models.Device.AddOfflineModel>
{
public AddOffline()
{
}
public override void Execute()
{
#line 2 "..\..\Views\Device\AddOffline.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Add Offline");
#line default
#line hidden
WriteLiteral("\r\n");
#line 5 "..\..\Views\Device\AddOffline.cshtml"
using (Html.BeginForm())
{
#line default
#line hidden
#line 7 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationSummary(true));
#line default
#line hidden
#line 7 "..\..\Views\Device\AddOffline.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n S" +
"erial Number:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 15 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.TextBoxFor(model => model.Device.SerialNumber));
#line default
#line hidden
WriteLiteral("<br />\r\n");
WriteLiteral(" ");
#line 16 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationMessageFor(model => model.Device.SerialNumber));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Asset Number:\r\n </th>\r\n <td" +
">");
#line 23 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.TextBoxFor(model => model.Device.AssetNumber));
#line default
#line hidden
WriteLiteral("<br />\r\n");
WriteLiteral(" ");
#line 24 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationMessageFor(model => model.Device.AssetNumber));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Location:\r\n </th>\r\n <td>");
#line 31 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.TextBoxFor(model => model.Device.Location));
#line default
#line hidden
WriteLiteral("<br />\r\n");
WriteLiteral(" ");
#line 32 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationMessageFor(model => model.Device.Location));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Device Batch:\r\n </th>\r\n <td" +
">\r\n");
WriteLiteral(" ");
#line 40 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.DropDownListFor(model => model.Device.DeviceBatchId, Model.DeviceBatches));
#line default
#line hidden
WriteLiteral(" <br />\r\n");
WriteLiteral(" ");
#line 41 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationMessageFor(model => model.Device.DeviceBatchId));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Device Profile:\r\n </th>\r\n <" +
"td>\r\n");
WriteLiteral(" ");
#line 49 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.DropDownListFor(model => model.Device.DeviceProfileId, Model.DeviceProfiles.ToSelectListItems(Model.DefaultDeviceProfileId)));
#line default
#line hidden
WriteLiteral("<br />\r\n");
WriteLiteral(" ");
#line 50 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationMessageFor(model => model.Device.DeviceProfileId));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Assigned User:\r\n </th>\r\n <t" +
"d>\r\n");
WriteLiteral(" ");
#line 58 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.TextBoxFor(model => model.Device.AssignedUserId));
#line default
#line hidden
WriteLiteral("<br />\r\n");
WriteLiteral(" ");
#line 59 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationMessageFor(model => model.Device.AssignedUserId));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n <p");
WriteLiteral(" class=\"actions\"");
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"submit\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(" value=\"Add\"");
WriteLiteral(" />\r\n </p>\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
$SerialNumber = $('#Device_SerialNumber');
$AssetNumber = $('#Device_AssetNumber');
$Location = $('#Device_Location');
$AssignedUserId = $('#Device_AssignedUserId');
$SerialNumber.focus().keydown(function (e) {
if (e.which == 13) {
$AssignedUserId.focus();
return false;
}
});
$AssetNumber.keydown(function (e) {
if (e.which == 13) {
$Location.focus();
return false;
}
});
$Location.keydown(function (e) {
if (e.which == 13) {
$AssignedUserId.focus();
return false;
}
});
$AssignedUserId
.watermark('Search Users')
.focus(function () { $AssignedUserId.select() })
.autocomplete({
source: '");
#line 95 "..\..\Views\Device\AddOffline.cshtml"
Write(Url.Action(MVC.API.User.UpstreamUsers()));
#line default
#line hidden
WriteLiteral(@"',
minLength: 2,
focus: function (e, ui) {
$AssignedUserId.val(ui.item.DisplayName + ' (' + ui.item.Id + ')');
return false;
},
select: function (e, ui) {
$AssignedUserId.val(ui.item.Id).blur();
return false;
}
}).data('autocomplete')._renderItem = function (ul, item) {
return $(""<li></li>"")
.data(""item.autocomplete"", item)
.append(""<a><strong>"" + item.DisplayName + ""</strong><br>"" + item.Id + "" ("" + item.Type + "")</a>"")
.appendTo(ul);
};
});
</script>
</div>
");
#line 114 "..\..\Views\Device\AddOffline.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Device
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/AddOffline.cshtml")]
public class AddOffline : System.Web.Mvc.WebViewPage<Disco.Web.Models.Device.AddOfflineModel>
{
public AddOffline()
{
}
public override void Execute()
{
#line 2 "..\..\Views\Device\AddOffline.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Add Offline");
#line default
#line hidden
WriteLiteral("\r\n");
#line 5 "..\..\Views\Device\AddOffline.cshtml"
using (Html.BeginForm())
{
#line default
#line hidden
#line 7 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationSummary(true));
#line default
#line hidden
#line 7 "..\..\Views\Device\AddOffline.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n S" +
"erial Number:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 15 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.TextBoxFor(model => model.Device.SerialNumber));
#line default
#line hidden
WriteLiteral("<br />\r\n");
WriteLiteral(" ");
#line 16 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationMessageFor(model => model.Device.SerialNumber));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Asset Number:\r\n </th>\r\n <td" +
">");
#line 23 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.TextBoxFor(model => model.Device.AssetNumber));
#line default
#line hidden
WriteLiteral("<br />\r\n");
WriteLiteral(" ");
#line 24 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationMessageFor(model => model.Device.AssetNumber));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Location:\r\n </th>\r\n <td>");
#line 31 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.TextBoxFor(model => model.Device.Location));
#line default
#line hidden
WriteLiteral("<br />\r\n");
WriteLiteral(" ");
#line 32 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationMessageFor(model => model.Device.Location));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Device Batch:\r\n </th>\r\n <td" +
">\r\n");
WriteLiteral(" ");
#line 40 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.DropDownListFor(model => model.Device.DeviceBatchId, Model.DeviceBatches));
#line default
#line hidden
WriteLiteral(" <br />\r\n");
WriteLiteral(" ");
#line 41 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationMessageFor(model => model.Device.DeviceBatchId));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Device Profile:\r\n </th>\r\n <" +
"td>\r\n");
WriteLiteral(" ");
#line 49 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.DropDownListFor(model => model.Device.DeviceProfileId, Model.DeviceProfiles.ToSelectListItems(Model.DefaultDeviceProfileId)));
#line default
#line hidden
WriteLiteral("<br />\r\n");
WriteLiteral(" ");
#line 50 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationMessageFor(model => model.Device.DeviceProfileId));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Assigned User:\r\n </th>\r\n <t" +
"d>\r\n");
WriteLiteral(" ");
#line 58 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.TextBoxFor(model => model.Device.AssignedUserId));
#line default
#line hidden
WriteLiteral("<br />\r\n");
WriteLiteral(" ");
#line 59 "..\..\Views\Device\AddOffline.cshtml"
Write(Html.ValidationMessageFor(model => model.Device.AssignedUserId));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n <p");
WriteLiteral(" class=\"actions\"");
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"submit\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(" value=\"Add\"");
WriteLiteral(" />\r\n </p>\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
$SerialNumber = $('#Device_SerialNumber');
$AssetNumber = $('#Device_AssetNumber');
$Location = $('#Device_Location');
$AssignedUserId = $('#Device_AssignedUserId');
$SerialNumber.focus().keydown(function (e) {
if (e.which == 13) {
$AssignedUserId.focus();
return false;
}
});
$AssetNumber.keydown(function (e) {
if (e.which == 13) {
$Location.focus();
return false;
}
});
$Location.keydown(function (e) {
if (e.which == 13) {
$AssignedUserId.focus();
return false;
}
});
$AssignedUserId
.watermark('Search Users')
.focus(function () { $AssignedUserId.select() })
.autocomplete({
source: '");
#line 95 "..\..\Views\Device\AddOffline.cshtml"
Write(Url.Action(MVC.API.User.UpstreamUsers()));
#line default
#line hidden
WriteLiteral(@"',
minLength: 2,
focus: function (e, ui) {
$AssignedUserId.val(ui.item.DisplayName + ' (' + ui.item.Id + ')');
return false;
},
select: function (e, ui) {
$AssignedUserId.val(ui.item.Id).blur();
return false;
}
}).data('ui-autocomplete')._renderItem = function (ul, item) {
return $(""<li></li>"")
.data(""item.autocomplete"", item)
.append(""<a><strong>"" + item.DisplayName + ""</strong><br>"" + item.Id + "" ("" + item.Type + "")</a>"")
.appendTo(ul);
};
});
</script>
</div>
");
#line 114 "..\..\Views\Device\AddOffline.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
+478 -467
View File
@@ -1,467 +1,478 @@
@model Disco.Web.Models.Device.ShowModel
@{
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), string.Format("{0} ({1})", Model.Device.ComputerName, Model.Device.SerialNumber));
Html.BundleDeferred("~/ClientScripts/Modules/Silverlight");
}
<table class="deviceShow">
<tr>
<td class="details">
<table>
<tr>
<th class="name">
Computer Name:
</th>
<td class="value">
@if (string.IsNullOrWhiteSpace(Model.Device.ComputerName))
{
<span class="smallMessage">&lt;Unknown/Not Allocated&gt;</span>
}
else
{
@Model.Device.ComputerName
}
</td>
</tr>
<tr>
<th class="name">
Asset Number:
</th>
<td class="value">
@Html.TextBoxFor(m => m.Device.AssetNumber)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
var $ajaxSave = $('#Device_AssetNumber').next('.ajaxSave');
$('#Device_AssetNumber').watermark('Asset Number').keydown(function (e) {
$ajaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).change(function () {
var $this = $(this);
$ajaxSave.hide();
var $ajaxLoading = $ajaxSave.next('.ajaxLoading').show();
var data = { AssetNumber: $this.val() };
$.getJSON('@(Url.Action(@MVC.API.Device.UpdateAssetNumber(Model.Device.SerialNumber)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Asset Number:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
}).blur(function () {
$ajaxSave.hide();
}).focus(function () {
$(this).select();
});
});
</script>
</td>
</tr>
<tr>
<th class="name">
Location:
</th>
<td class="value">
@Html.TextBoxFor(m => m.Device.Location)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
var $ajaxSave = $('#Device_Location').next('.ajaxSave');
$('#Device_Location').watermark('Location').keydown(function (e) {
$ajaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).change(function () {
var $this = $(this);
$ajaxSave.hide();
var $ajaxLoading = $ajaxSave.next('.ajaxLoading').show();
var data = { Location: $this.val() };
$.getJSON('@(Url.Action(@MVC.API.Device.UpdateLocation(Model.Device.SerialNumber)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Location:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
}).blur(function () {
$ajaxSave.hide();
}).focus(function () {
$(this).select();
});
});
</script>
</td>
</tr>
<tr>
<th class="name">
Batch:
</th>
<td class="value">
@Html.DropDownListFor(m => m.Device.DeviceBatchId, Model.DeviceBatches)
@AjaxHelpers.AjaxLoader() <span id="deviceBatchEdit" class="icon16" title="Edit">
</span>
<script type="text/javascript">
$(function () {
var $DeviceBatchId = $('#Device_DeviceBatchId');
var $DeviceBatchDetails = $('#deviceBatchDetails');
var $DeviceBatchEdit = $('#deviceBatchEdit');
var jsonDate = function (json, unknownValue) {
if (json && json.indexOf('') == 0) {
return $.datepicker.formatDate('yy-mm-dd', new Date(parseInt(json.substr(6, json.length - 8))));
} else
return unknownValue;
}
var updateDetails = function (deviceBatchId) {
$.getJSON('@(Url.Action(MVC.API.DeviceBatch.Index()))/' + deviceBatchId, function (response, result) {
if (result == 'success') {
if (response.Supplier)
$DeviceBatchDetails.find('.supplier').text(response.Supplier);
else
$DeviceBatchDetails.find('.supplier').text('Unknown');
$DeviceBatchDetails.find('.purchaseDate').text(jsonDate(response.PurchaseDate, 'Unknown'));
$DeviceBatchDetails.find('.warrantyValidUntil').text(jsonDate(response.WarrantyValidUntil, 'Unknown'));
if (response.InsuranceSupplier)
$DeviceBatchDetails.find('.insuranceSupplier').text(response.InsuranceSupplier);
else
$DeviceBatchDetails.find('.insuranceSupplier').text('Unknown');
$DeviceBatchDetails.find('.insuredUntil').text(jsonDate(response.InsuredUntil, 'Unknown'));
$DeviceBatchDetails.slideDown('fast');
$DeviceBatchEdit.fadeIn();
} else {
alert('Unable to load Device Batch details:\n' + response);
}
});
};
$DeviceBatchEdit.click(function () {
window.location.href = '@(Url.Action(MVC.Config.DeviceBatch.Index(null)))/' + $DeviceBatchId.val();
});
$DeviceBatchId.change(function () {
var $this = $(this);
var $ajaxLoading = $this.next('.ajaxLoading').show();
$DeviceBatchDetails.hide();
$DeviceBatchEdit.hide();
var data = { DeviceBatchId: $this.val() };
$.getJSON('@(Url.Action(MVC.API.Device.UpdateDeviceBatchId(Model.Device.SerialNumber)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Device Batch:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
if ($DeviceBatchId.val())
updateDetails($DeviceBatchId.val());
}
});
});
$DeviceBatchEdit.hide();
if ($DeviceBatchId.val())
updateDetails($DeviceBatchId.val());
});
</script>
<div id="deviceBatchDetails">
<table class="sub">
<tr>
<th style="width: 50px">
<strong>Purchased:</strong>
</th>
<td>
Supplier: <span class="supplier"></span>
<br />
On: <span class="purchaseDate"></span>
</td>
<th style="width: 50px">
<strong>Warranty:</strong>
</th>
<td>
Valid Until: <span class="warrantyValidUntil"></span>
</td>
<th style="width: 50px">
<strong>Insurance:</strong>
</th>
<td>
Supplier: <span class="insuranceSupplier"></span>
<br />
Until: <span class="insuredUntil"></span>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<th class="name">
Profile:
</th>
<td class="value">
@if (Model.Device.DecommissionedDate.HasValue)
{
@Model.Device.DeviceProfile.ToString()
}
else
{
@Html.DropDownListFor(m => m.Device.DeviceProfileId, Model.DeviceProfiles.ToSelectListItems(Model.Device.DeviceProfile))
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
$('#Device_DeviceProfileId').change(function () {
var $this = $(this);
var $ajaxLoading = $this.next('.ajaxLoading').show();
var data = { DeviceProfileId: $this.val() };
$.getJSON('@(Url.Action(MVC.API.Device.UpdateDeviceProfileId(Model.Device.SerialNumber)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Device Profile:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
});
});
</script>
}
</td>
</tr>
<tr>
<th class="name">
Created:
</th>
<td class="value">
@CommonHelpers.FriendlyDate(Model.Device.CreatedDate)
</td>
</tr>
<tr>
<th class="name">
Enrolment:
</th>
<td class="value">
First:
@CommonHelpers.FriendlyDate(Model.Device.EnrolledDate)
@if (Model.Device.AllowUnauthenticatedEnrol)
{
<a class="unlocked16" href="@Url.Action(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, "false", true))" title="Unauthenticated Enrolment is Allowed">
&nbsp;</a>
}
else
{
<a class="locked16" href="@Url.Action(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, "true", true))" title="Unauthenticated Enrolment is Blocked">
&nbsp;</a>
}
<br />
Last:
@CommonHelpers.FriendlyDate(Model.Device.LastEnrolDate)
</td>
</tr>
<tr>
<th class="name">
Decommissioned:
</th>
<td class="value">
@CommonHelpers.FriendlyDate(Model.Device.DecommissionedDate)
</td>
</tr>
<tr>
<th class="name">
Last Network Logon:
</th>
<td class="value">
<span id="lastNetworkLogonDate" class="nowrap">@CommonHelpers.FriendlyDate(Model.Device.LastNetworkLogonDate)</span>
@if (!string.IsNullOrEmpty(Model.Device.ComputerName))
{
<script type="text/javascript">
$(function () {
var span = $('#lastNetworkLogonDate');
$('<span>').addClass('ajaxHelperIcon ajaxLoading ajaxShowInitially').attr('title', 'Loading...').appendTo(span);
$.getJSON('@(Url.Action(MVC.API.Device.LastNetworkLogonDate(Model.Device.SerialNumber)))', function (response, result) {
if (result != 'success') {
alert('Unable to retrieve latest network logon date:\n' + response);
$('<span>').addClass('smallMessage').text('[may not be current]').appendTo(span);
} else {
span.find('.ajaxLoading').hide();
span.attr('title', response.Formatted).text(response.Friendly);
}
});
});
</script>
}
</td>
</tr>
@if (!Model.Device.DecommissionedDate.HasValue)
{
<tr>
<th class="name">
Assigned User:
</th>
<td class="value">
@Html.TextBoxFor(m => m.Device.AssignedUser, new { userId = Model.Device.AssignedUserId })
@AjaxHelpers.AjaxRemove()
@AjaxHelpers.AjaxLoader()
<br />
<a href="#" id="Device_AssignedUser_History_Trigger" class="smallLink">Show Assignment
History (<span id="Device_AssignedUser_History_RecordCount"></span>)</a> <span id="Device_AssignedUser_History_None"
class="smallMessage" style="display: none">No Assignment History Available</span>
<div id="dialogRemoveAssignedUser" title="Remove this Device Assignment?">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
Are you sure?</p>
</div>
<script type="text/javascript">
$(function () {
// Common Objects
var $assignedUser = $('#Device_AssignedUser');
var $ajaxLoading = $assignedUser.nextAll('.ajaxLoading').first();
var $ajaxRemove = $assignedUser.nextAll('.ajaxRemove').first();
// Assign User
$assignedUser
.watermark('No Assigned User')
.focus(function () { $assignedUser.select() })
.autocomplete({
source: '@(Url.Action(MVC.API.User.UpstreamUsers()))',
minLength: 2,
focus: function (e, ui) {
$assignedUser.val(ui.item.DisplayName + ' (' + ui.item.Id + ')');
return false;
},
select: function (e, ui) {
updateAssignedUser(ui.item.Id);
$assignedUser.val(ui.item.DisplayName + ' (' + ui.item.Id + ')');
return false;
}
})
.data('autocomplete')._renderItem = function (ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a><strong>" + item.DisplayName + "</strong><br>" + item.Id + " (" + item.Type + ")</a>")
.appendTo(ul);
};
var $dialogRemoveAssignedUser = $('#dialogRemoveAssignedUser');
$dialogRemoveAssignedUser.dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false,
buttons: {
"Remove": function () {
updateAssignedUser('');
$assignedUser.val('');
$dialogRemoveAssignedUser.dialog("close");
},
"Cancel": function () {
$dialogRemoveAssignedUser.dialog("close");
}
}
});
// Un-Assign User
if ($assignedUser.val() != '')
$ajaxRemove.show();
$ajaxRemove.click(function () {
$dialogRemoveAssignedUser.dialog('open');
return false;
});
// History
var deviceUserAssignmentCount = @(Model.Device.DeviceUserAssignments.Count);
if (deviceUserAssignmentCount > 0) {
$('#Device_AssignedUser_History_Trigger').click(function () {
$(this).hide();
$('#Device_AssignedUser_History_Host').show();
$('#Device_AssignedUser_History').slideDown('slow');
return false;
});
var recordCountText = deviceUserAssignmentCount + ' record';
if (deviceUserAssignmentCount != 1)
recordCountText += 's';
$('#Device_AssignedUser_History_RecordCount').text(recordCountText)
}
else {
$('#Device_AssignedUser_History_Trigger').hide();
$('#Device_AssignedUser_History_None').show();
};
function updateAssignedUser(userId) {
$ajaxLoading.show();
$ajaxRemove.hide();
var data = { AssignedUserId: userId };
$.getJSON('@(Url.Action(MVC.API.Device.UpdateAssignedUserId(Model.Device.SerialNumber)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Assigned User:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
if (userId != '')
$ajaxRemove.fadeIn('fast');
}
});
}
});
</script>
</td>
</tr>
}
<tr id="Device_AssignedUser_History_Host" style="@(Model.Device.DecommissionedDate.HasValue ? "" : "display: none")">
<td colspan="2">
<div id="Device_AssignedUser_History" style="@(Model.Device.DecommissionedDate.HasValue ? "" : "display: none")">
<h2>
Assigned User History</h2>
@Html.Partial(MVC.Device.Views._DeviceUserAssignmentHistoryTable, Model.Device)
</div>
</td>
</tr>
<tr>
<th class="name">
Generate Documents:
</th>
<td class="value" colspan="3">
@Html.DropDownList("DocumentTemplates", Model.DocumentTemplatesSelectListItems)
<script type="text/javascript">
$(function () {
var generatePdfUrl = '@Url.Action(MVC.API.Device.GeneratePdf(Model.Device.SerialNumber, null))?DocumentTemplateId=';
var $documentTemplates = $('#DocumentTemplates');
$documentTemplates.change(function () {
var v = $documentTemplates.val();
if (v) {
window.location.href = generatePdfUrl + v;
$documentTemplates.val('');
}
});
});
</script>
</td>
</tr>
</table>
</td>
<td class="model">
<table>
<tr>
<td class="subtleHighlight">
<img alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(Model.Device.DeviceModelId, Model.Device.DeviceModel.ImageHash()))" />
<h2>
<a href="@(Url.Action(MVC.Config.DeviceModel.Index(Model.Device.DeviceModelId)))">@Model.Device.DeviceModel.ToString()</a></h2>
</td>
</tr>
</table>
</td>
</tr>
</table>
<h2>
Certificates</h2>
@Html.Partial(MVC.Device.Views._CertificateTable, Model.Certificates)
<h2>
Attachments</h2>
@Html.Partial(MVC.Device.Views.DeviceParts.Resources, Model)
<h2>
Jobs</h2>
@Html.Partial(MVC.Shared.Views._JobTable, Model.Jobs)
@Html.Partial(MVC.Device.Views._DeviceActions, Model.Device)
@model Disco.Web.Models.Device.ShowModel
@{
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), string.Format("{0} ({1})", Model.Device.ComputerName, Model.Device.SerialNumber));
Html.BundleDeferred("~/ClientScripts/Modules/Silverlight");
}
<table class="deviceShow">
<tr>
<td class="details">
<table>
<tr>
<th class="name">
Computer Name:
</th>
<td class="value">
@if (string.IsNullOrWhiteSpace(Model.Device.ComputerName))
{
<span class="smallMessage">&lt;Unknown/Not Allocated&gt;</span>
}
else
{
@Model.Device.ComputerName
}
</td>
</tr>
<tr>
<th class="name">
Asset Number:
</th>
<td class="value">
@Html.TextBoxFor(m => m.Device.AssetNumber)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
var $ajaxSave = $('#Device_AssetNumber').next('.ajaxSave');
$('#Device_AssetNumber').watermark('Asset Number').keydown(function (e) {
$ajaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).change(function () {
var $this = $(this);
$ajaxSave.hide();
var $ajaxLoading = $ajaxSave.next('.ajaxLoading').show();
var data = { AssetNumber: $this.val() };
$.getJSON('@(Url.Action(@MVC.API.Device.UpdateAssetNumber(Model.Device.SerialNumber)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Asset Number:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
}).blur(function () {
$ajaxSave.hide();
}).focus(function () {
$(this).select();
});
});
</script>
</td>
</tr>
<tr>
<th class="name">
Location:
</th>
<td class="value">
@Html.TextBoxFor(m => m.Device.Location)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
var $ajaxSave = $('#Device_Location').next('.ajaxSave');
$('#Device_Location').watermark('Location').keydown(function (e) {
$ajaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).change(function () {
var $this = $(this);
$ajaxSave.hide();
var $ajaxLoading = $ajaxSave.next('.ajaxLoading').show();
var data = { Location: $this.val() };
$.getJSON('@(Url.Action(@MVC.API.Device.UpdateLocation(Model.Device.SerialNumber)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Location:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
}).blur(function () {
$ajaxSave.hide();
}).focus(function () {
$(this).select();
});
});
</script>
</td>
</tr>
<tr>
<th class="name">
Batch:
</th>
<td class="value">
@Html.DropDownListFor(m => m.Device.DeviceBatchId, Model.DeviceBatches)
@AjaxHelpers.AjaxLoader() <span id="deviceBatchDetails" class="icon16" title="Batch Details"></span>
<script type="text/javascript">
$(function () {
var $DeviceBatchId = $('#Device_DeviceBatchId');
var $DeviceBatchDetails = $('#deviceBatchDetails');
var $DeviceBatchSummary = $('#deviceBatchSummary');
var initUpdate = false;
var jsonDate = function (json, unknownValue) {
if (json && json.indexOf('') == 0) {
return $.datepicker.formatDate('yy-mm-dd', new Date(parseInt(json.substr(6, json.length - 8))));
} else
return unknownValue;
}
var updateDetails = function (deviceBatchId) {
$.getJSON('@(Url.Action(MVC.API.DeviceBatch.Index()))/' + deviceBatchId, function (response, result) {
if (result == 'success') {
if (response.Supplier)
$DeviceBatchSummary.find('.supplier').text(response.Supplier);
else
$DeviceBatchSummary.find('.supplier').text('Unknown');
$DeviceBatchSummary.find('.purchaseDate').text(jsonDate(response.PurchaseDate, 'Unknown'));
$DeviceBatchSummary.find('.warrantyValidUntil').text(jsonDate(response.WarrantyValidUntil, 'Unknown'));
if (response.InsuranceSupplier)
$DeviceBatchSummary.find('.insuranceSupplier').text(response.InsuranceSupplier);
else
$DeviceBatchSummary.find('.insuranceSupplier').text('Unknown');
$DeviceBatchSummary.find('.insuredUntil').text(jsonDate(response.InsuredUntil, 'Unknown'));
if (initUpdate){
$DeviceBatchSummary.show();
$DeviceBatchDetails.show();
initUpdate = false;
}else{
$DeviceBatchSummary.slideDown('fast');
$DeviceBatchDetails.fadeIn();
}
} else {
alert('Unable to load Device Batch details:\n' + response);
}
});
};
$DeviceBatchDetails.click(function () {
window.location.href = '@(Url.Action(MVC.Config.DeviceBatch.Index(null)))/' + $DeviceBatchId.val();
});
$DeviceBatchId.change(function () {
var $this = $(this);
var $ajaxLoading = $this.next('.ajaxLoading').show();
$DeviceBatchSummary.hide();
$DeviceBatchDetails.hide();
var data = { DeviceBatchId: $this.val() };
$.getJSON('@(Url.Action(MVC.API.Device.UpdateDeviceBatchId(Model.Device.SerialNumber)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Device Batch:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
if ($DeviceBatchId.val())
updateDetails($DeviceBatchId.val());
}
});
});
$DeviceBatchSummary.hide();
if ($DeviceBatchId.val()){
initUpdate = true;
updateDetails($DeviceBatchId.val());
}
});
</script>
<div id="deviceBatchSummary">
<table class="sub">
<tr>
<th style="width: 50px">
<strong>Purchased:</strong>
</th>
<td>
Supplier: <span class="supplier"></span>
<br />
On: <span class="purchaseDate"></span>
</td>
<th style="width: 50px">
<strong>Warranty:</strong>
</th>
<td>
Valid Until: <span class="warrantyValidUntil"></span>
</td>
<th style="width: 50px">
<strong>Insurance:</strong>
</th>
<td>
Supplier: <span class="insuranceSupplier"></span>
<br />
Until: <span class="insuredUntil"></span>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<th class="name">
Profile:
</th>
<td class="value">
@if (Model.Device.DecommissionedDate.HasValue)
{
@Model.Device.DeviceProfile.ToString()
}
else
{
@Html.DropDownListFor(m => m.Device.DeviceProfileId, Model.DeviceProfiles.ToSelectListItems(Model.Device.DeviceProfile))
@AjaxHelpers.AjaxLoader()<span id="deviceProfileDetails" class="icon16" title="Profile Details"></span>
<script type="text/javascript">
$(function () {
$('#Device_DeviceProfileId').change(function () {
var $this = $(this);
var $ajaxLoading = $this.next('.ajaxLoading').show();
var data = { DeviceProfileId: $this.val() };
$.getJSON('@(Url.Action(MVC.API.Device.UpdateDeviceProfileId(Model.Device.SerialNumber)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Device Profile:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
});
$('#deviceProfileDetails').click(function(){
window.location.href = '@(Url.Action(MVC.Config.DeviceProfile.Index(null)))/' + $('#Device_DeviceProfileId').val();
});
});
</script>
}
</td>
</tr>
<tr>
<th class="name">
Created:
</th>
<td class="value">
@CommonHelpers.FriendlyDate(Model.Device.CreatedDate)
</td>
</tr>
<tr>
<th class="name">
Enrolment:
</th>
<td class="value">
First:
@CommonHelpers.FriendlyDate(Model.Device.EnrolledDate)
@if (Model.Device.AllowUnauthenticatedEnrol)
{
<a class="unlocked16" href="@Url.Action(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, "false", true))" title="Unauthenticated Enrolment is Allowed">
&nbsp;</a>
}
else
{
<a class="locked16" href="@Url.Action(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, "true", true))" title="Unauthenticated Enrolment is Blocked">
&nbsp;</a>
}
<br />
Last:
@CommonHelpers.FriendlyDate(Model.Device.LastEnrolDate)
</td>
</tr>
<tr>
<th class="name">
Decommissioned:
</th>
<td class="value">
@CommonHelpers.FriendlyDate(Model.Device.DecommissionedDate)
</td>
</tr>
<tr>
<th class="name">
Last Network Logon:
</th>
<td class="value">
<span id="lastNetworkLogonDate" class="nowrap">@CommonHelpers.FriendlyDate(Model.Device.LastNetworkLogonDate)</span>
@if (!string.IsNullOrEmpty(Model.Device.ComputerName))
{
<script type="text/javascript">
$(function () {
var span = $('#lastNetworkLogonDate');
$('<span>').addClass('ajaxHelperIcon ajaxLoading ajaxShowInitially').attr('title', 'Loading...').appendTo(span);
$.getJSON('@(Url.Action(MVC.API.Device.LastNetworkLogonDate(Model.Device.SerialNumber)))', function (response, result) {
if (result != 'success') {
alert('Unable to retrieve latest network logon date:\n' + response);
$('<span>').addClass('smallMessage').text('[may not be current]').appendTo(span);
} else {
span.find('.ajaxLoading').hide();
span.attr('title', response.Formatted).text(response.Friendly);
}
});
});
</script>
}
</td>
</tr>
@if (!Model.Device.DecommissionedDate.HasValue)
{
<tr>
<th class="name">
Assigned User:
</th>
<td class="value">
@Html.TextBoxFor(m => m.Device.AssignedUser, new { userId = Model.Device.AssignedUserId })
@AjaxHelpers.AjaxRemove()
@AjaxHelpers.AjaxLoader()
<br />
<a href="#" id="Device_AssignedUser_History_Trigger" class="smallLink">Show Assignment
History (<span id="Device_AssignedUser_History_RecordCount"></span>)</a> <span id="Device_AssignedUser_History_None"
class="smallMessage" style="display: none">No Assignment History Available</span>
<div id="dialogRemoveAssignedUser" title="Remove this Device Assignment?">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
Are you sure?</p>
</div>
<script type="text/javascript">
$(function () {
// Common Objects
var $assignedUser = $('#Device_AssignedUser');
var $ajaxLoading = $assignedUser.nextAll('.ajaxLoading').first();
var $ajaxRemove = $assignedUser.nextAll('.ajaxRemove').first();
// Assign User
$assignedUser
.watermark('No Assigned User')
.focus(function () { $assignedUser.select() })
.autocomplete({
source: '@(Url.Action(MVC.API.User.UpstreamUsers()))',
minLength: 2,
focus: function (e, ui) {
$assignedUser.val(ui.item.DisplayName + ' (' + ui.item.Id + ')');
return false;
},
select: function (e, ui) {
updateAssignedUser(ui.item.Id);
$assignedUser.val(ui.item.DisplayName + ' (' + ui.item.Id + ')');
return false;
}
})
.data('ui-autocomplete')._renderItem = function (ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a><strong>" + item.DisplayName + "</strong><br>" + item.Id + " (" + item.Type + ")</a>")
.appendTo(ul);
};
var $dialogRemoveAssignedUser = $('#dialogRemoveAssignedUser');
$dialogRemoveAssignedUser.dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false,
buttons: {
"Remove": function () {
updateAssignedUser('');
$assignedUser.val('');
$dialogRemoveAssignedUser.dialog("close");
},
"Cancel": function () {
$dialogRemoveAssignedUser.dialog("close");
}
}
});
// Un-Assign User
if ($assignedUser.val() != '')
$ajaxRemove.show();
$ajaxRemove.click(function () {
$dialogRemoveAssignedUser.dialog('open');
return false;
});
// History
var deviceUserAssignmentCount = @(Model.Device.DeviceUserAssignments.Count);
if (deviceUserAssignmentCount > 0) {
$('#Device_AssignedUser_History_Trigger').click(function () {
$(this).hide();
$('#Device_AssignedUser_History_Host').show();
$('#Device_AssignedUser_History').slideDown('slow');
return false;
});
var recordCountText = deviceUserAssignmentCount + ' record';
if (deviceUserAssignmentCount != 1)
recordCountText += 's';
$('#Device_AssignedUser_History_RecordCount').text(recordCountText)
}
else {
$('#Device_AssignedUser_History_Trigger').hide();
$('#Device_AssignedUser_History_None').show();
};
function updateAssignedUser(userId) {
$ajaxLoading.show();
$ajaxRemove.hide();
var data = { AssignedUserId: userId };
$.getJSON('@(Url.Action(MVC.API.Device.UpdateAssignedUserId(Model.Device.SerialNumber)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Assigned User:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
if (userId != '')
$ajaxRemove.fadeIn('fast');
}
});
}
});
</script>
</td>
</tr>
}
<tr id="Device_AssignedUser_History_Host" style="@(Model.Device.DecommissionedDate.HasValue ? "" : "display: none")">
<td colspan="2">
<div id="Device_AssignedUser_History" style="@(Model.Device.DecommissionedDate.HasValue ? "" : "display: none")">
<h2>
Assigned User History</h2>
@Html.Partial(MVC.Device.Views._DeviceUserAssignmentHistoryTable, Model.Device)
</div>
</td>
</tr>
<tr>
<th class="name">
Generate Documents:
</th>
<td class="value" colspan="3">
@Html.DropDownList("DocumentTemplates", Model.DocumentTemplatesSelectListItems)
<script type="text/javascript">
$(function () {
var generatePdfUrl = '@Url.Action(MVC.API.Device.GeneratePdf(Model.Device.SerialNumber, null))?DocumentTemplateId=';
var $documentTemplates = $('#DocumentTemplates');
$documentTemplates.change(function () {
var v = $documentTemplates.val();
if (v) {
window.location.href = generatePdfUrl + v;
$documentTemplates.val('');
}
});
});
</script>
</td>
</tr>
</table>
</td>
<td class="model">
<table>
<tr>
<td class="subtleHighlight">
<img alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(Model.Device.DeviceModelId, Model.Device.DeviceModel.ImageHash()))" />
<h2>
<a href="@(Url.Action(MVC.Config.DeviceModel.Index(Model.Device.DeviceModelId)))">@Model.Device.DeviceModel.ToString()</a></h2>
</td>
</tr>
</table>
</td>
</tr>
</table>
<h2>
Certificates</h2>
@Html.Partial(MVC.Device.Views._CertificateTable, Model.Certificates)
<h2>
Attachments</h2>
@Html.Partial(MVC.Device.Views.DeviceParts.Resources, Model)
<h2>
Jobs</h2>
@Html.Partial(MVC.Shared.Views._JobTable, Model.Jobs)
@Html.Partial(MVC.Device.Views._DeviceActions, Model.Device)
File diff suppressed because it is too large Load Diff
-58
View File
@@ -1,58 +0,0 @@
@model Disco.Web.Models.Job.CreateModel
@{
ViewBag.Title = Html.ToBreadcrumb("Jobs", MVC.Job.Index(), "Create");
}
@using (Html.BeginForm(MVC.Job.Create(), FormMethod.Post))
{
@Html.ValidationSummary(false)
@Html.HiddenFor(m => m.DeviceSerialNumber)
@Html.HiddenFor(m => m.UserId)
<div id="createDialog" class="form" style="width: 650px">
<table>
<tr>
<td colspan="2">
@Html.Partial(MVC.Job.Views._CreateSubject, Model)
</td>
</tr>
<tr id="trJobType">
<th class="name">
Type:
</th>
<td class="value">
@CommonHelpers.RadioButtonList("Type", Model.JobTypes.ToSelectListItems(Model.Type), 2)
</td>
</tr>
@foreach (var jt in Model.JobTypes)
{
<tr id="trJobSubType@(jt.Id)" class="jobSubTypes">
<th class="name">
@jt.Description<br />
Sub Types
</th>
<td class="value">
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.Where(jst => jst.JobTypeId == jt.Id).ToList().ToSelectListItems(Model.SubTypes), 2)
</td>
</tr>
}
</table>
<p class="actions">
<input type="submit" class="button" value="Create" />
</p>
<script type="text/javascript">
$(function () {
$trJobType = $('#trJobType');
$jobTypes = $trJobType.find('input[type="radio"]');
$jobTypes.change(jobTypeChange);
jobTypeChange();
function jobTypeChange() {
$('.jobSubTypes').hide();
var jobType = $jobTypes.filter(':checked').val();
$('#trJobSubType' + jobType).show();
}
});
</script>
</div>
}
+301 -301
View File
@@ -1,301 +1,301 @@
@model Disco.Web.Models.Job.CreateModel
@{
Layout = "~/Views/Shared/_DialogLayout.cshtml";
ViewBag.Title = Html.ToBreadcrumb("Jobs", MVC.Job.Index(), "Create");
}
<div id="createJob_Container">
@using (Html.BeginForm(MVC.Job.Create(), FormMethod.Post))
{
@Html.HiddenFor(m => m.DeviceSerialNumber)
@Html.HiddenFor(m => m.UserId)
@Html.HiddenFor(m => m.QuickLogDestinationUrl)
@Html.Partial(MVC.Job.Views._CreateSubject, Model)
@Html.ValidationSummary(true)
<div class="createJob_Component">
<div id="createJob_Type">
<h3>Type</h3>
@Html.ValidationMessageFor(m => m.Type)
@CommonHelpers.RadioButtonList("Type", Model.JobTypes.ToSelectListItems(Model.Type), 3)
@Html.ValidationMessageFor(m => m.SubTypes)
</div>
<div id="createJob_SubTypes">
@foreach (var jt in Model.JobTypes)
{
<div id="createJob_SubType_@(jt.Id)" class="createJob_SubType">
<div class="createJob_SubTypes">
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.Where(jst => jst.JobTypeId == jt.Id).ToList().ToSelectListItems(Model.SubTypes), 3)
</div>
</div>
}
</div>
</div>
<div id="createJob_DeviceHeldContainer" class="createJob_Component">
@Html.ValidationMessageFor(m => m.DeviceHeld)
@Html.HiddenFor(m => m.DeviceHeld)
<table>
<tr>
<td>
<h3>Device Held</h3>
</td>
<td>
<input id="createJob_DeviceHeld" name="_DeviceHeld" type="radio" value="true" /><label for="createJob_DeviceHeld">Held</label>
</td>
<td>
<input id="createJob_DeviceNotHeld" name="_DeviceHeld" type="radio" value="false" /><label for="createJob_DeviceNotHeld">Not Held</label>
</td>
</tr>
</table>
</div>
<div id="createJob_CommentsContainer" class="createJob_Component">
<table>
<tr>
<td>
<h3>Comments</h3>
</td>
<td>
@Html.EditorFor(m => m.Comments)
</td>
</tr>
</table>
</div>
<div id="createJob_QuickLogContainer" class="createJob_Component">
<div id="createJob_QuickLogAutoCloseContainer">
<h3>Quick Log</h3>
<input id="createJob_QuickLog" name="QuickLog" type="checkbox" value="true" /><label for="createJob_QuickLog">Automatically close this job</label>
</div>
<div id="createJob_QuickLogTaskTimeContainer">
<h3>Task Time</h3>
@Html.ValidationMessageFor(m => m.QuickLogTaskTimeMinutes)
<input type="radio" id="createJob_TaskTime10" name="QuickLogTaskTimeMinutes" value="10" /><label for="createJob_TaskTime10"> 10 Minutes</label>
<input type="radio" id="createJob_TaskTime30" name="QuickLogTaskTimeMinutes" value="30" /><label for="createJob_TaskTime30"> 30 Minutes</label>
<input type="radio" id="createJob_TaskTime60" name="QuickLogTaskTimeMinutes" value="60" /><label for="createJob_TaskTime60"> 1 Hour</label>
<input type="radio" id="createJob_TaskTime120" name="QuickLogTaskTimeMinutes" value="120" /><label for="createJob_TaskTime120"> 2 Hours</label>
<input type="radio" id="createJob_TaskTimeOther" name="QuickLogTaskTimeMinutes" value="" /><label for="createJob_TaskTimeOther"> Other</label>
<span id="createJob_TaskTimeOtherMinutesContainer">
<input type="number" id="createJob_TaskTimeOtherMinutes" name="QuickLogTaskTimeMinutesOther" value="" disabled="disabled" />
Minutes
</span>
</div>
</div>
}
<script type="text/javascript">
$(function () {
var discoDialogMethods;
var init = true;
//#region Parent Dialog
if (window.parent && window.parent.document) {
$('#QuickLogDestinationUrl').val(window.parent.window.location.href);
var parentDialog = $('#createJobDialog', window.parent.document);
if (parentDialog.length > 0) {
discoDialogMethods = parentDialog[0].discoDialogMethods;
var buttons = {
"Create Job": function () {
createJobForm.submit()
},
Cancel: function () {
discoDialogMethods.close();
}
}
discoDialogMethods.setButtons(buttons);
}
}
//#endregion
var createJobForm = $('form');
var validator = createJobForm.data('validator');
var unobtrusiveValidation = createJobForm.data('unobtrusiveValidation');
// Validate all Fields
validator.settings.ignore = '';
//#region Job Type/SubTypes
var $jobTypeContainer = $('#createJob_Type');
var $typeValidationMessage = $('[data-valmsg-for="Type"]', $jobTypeContainer)
var $subTypesValidationMessage = $('[data-valmsg-for="SubTypes"]', $jobTypeContainer)
var $jobTypes = $jobTypeContainer.find('input[type="radio"]').change(jobTypeChange);
$('#createJob_SubTypes').find('input[type="checkbox"]').change(jobSubTypeHighlight).each(jobSubTypeHighlight);
jobTypeChange();
function jobSubTypeHighlight() {
var $this = $(this);
if ($this.is(':checked'))
$this.closest('li').addClass('highlight');
else
$this.closest('li').removeClass('highlight');
}
function jobTypeChange() {
var $checkedItem = $jobTypes.filter(':checked');
$jobTypes.closest('li').removeClass('highlight');
$checkedItem.closest('li').addClass('highlight');
if (init) {
var jobType = $checkedItem.val();
$('#createJob_SubType_' + jobType).show();
} else {
$('#createJob_SubTypes').find('.createJob_SubType:visible').slideUp();
var jobType = $checkedItem.val();
$('#createJob_SubType_' + jobType).slideDown();
}
}
var additionalValidation = function (form) {
var isValid = true;
// Validate Type
var typeValue = $jobTypes.filter(':checked').val();
if (typeValue) {
$typeValidationMessage.removeClass('field-validation-error').addClass('field-validation-valid');
// Validate SubTypes
if ($('#createJob_SubType_' + typeValue).find('input:checked').length > 0) {
$subTypesValidationMessage.removeClass('field-validation-error').addClass('field-validation-valid');
} else {
$subTypesValidationMessage.text('At least one Job Sub Type is required').removeClass('field-validation-valid').addClass('field-validation-error');
isValid = false;
}
} else {
$typeValidationMessage.text('A Job Type is required').removeClass('field-validation-valid').addClass('field-validation-error');
isValid = false;
}
// Validate QuickLog Task Time
if ($quickLog.is(':checked')) {
var selectedTime = $quickLogTaskTimes.filter(':checked');
if (selectedTime.length > 0) {
if (selectedTime.val() === '') {
// Handle 'Other'
var otherTime = parseInt($quickLogTaskTimeOtherMinutes.val());
if (!otherTime || otherTime <= 0) {
$quickLogTaskTimeValidationMessage.text('A Task Time is required').removeClass('field-validation-valid').addClass('field-validation-error');
isValid = false;
}
} else {
$quickLogTaskTimeValidationMessage.removeClass('field-validation-valid').addClass('field-validation-error');
}
} else {
$quickLogTaskTimeValidationMessage.text('A Task Time is required').removeClass('field-validation-valid').addClass('field-validation-error');
isValid = false;
}
} else {
$quickLogTaskTimeValidationMessage.removeClass('field-validation-valid').addClass('field-validation-error');
}
return isValid;
}
validator.settings.submitHandler = function (form) {
if (additionalValidation()) {
discoDialogMethods.setButtons({});
form.submit();
}
}
//#endregion
//#region DeviceHeld
var $deviceHeld = $('#DeviceHeld');
if ($('#DeviceSerialNumber').val()) {
switch ($deviceHeld.val()) {
case 'True':
$('#createJob_DeviceHeld').attr('checked', 'checked');
$('#createJob_DeviceNotHeld').attr('checked', null);
break;
case 'False':
$('#createJob_DeviceHeld').attr('checked', null);
$('#createJob_DeviceNotHeld').attr('checked', 'checked');
break;
default:
$('#createJob_DeviceHeld').attr('checked', null);
$('#createJob_DeviceNotHeld').attr('checked', null);
break;
}
$('#createJob_DeviceHeldContainer').find('input[type="radio"]').change(function () {
// Update Hidden Field with Boolean Value
// Set DeviceHeld
var deviceHeldValue = '';
if ($('#createJob_DeviceHeld').is(':checked'))
deviceHeldValue = 'True';
if ($('#createJob_DeviceNotHeld').is(':checked'))
deviceHeldValue = 'False';
$deviceHeld.val(deviceHeldValue).change();
});
} else {
// No Device Associated
$deviceHeld.val('False');
$('#createJob_DeviceHeldContainer').hide();
}
//#endregion
//#region QuickLog
var $quickLog = $('#createJob_QuickLog');
var $quickLogContainer = $('#createJob_QuickLogContainer');
var $quickLogTaskTimeContainer = $('#createJob_QuickLogTaskTimeContainer');
var $quickLogTaskTimes = $quickLogTaskTimeContainer.find('input[type="radio"]');
var $quickLogTaskTimeOtherMinutes = $('#createJob_TaskTimeOtherMinutes');
var $quickLogTaskTimeValidationMessage = $quickLogTaskTimeContainer.find('[data-valmsg-for="QuickLogTaskTimeMinutes"]');
$deviceHeld.change(validateQuickLog);
$jobTypes.change(validateQuickLog);
validateQuickLog();
function validateQuickLog() {
var quickLogAllowed = false;
if ($deviceHeld.val() === 'True') {
quickLogAllowed = false;
} else {
var selectedType = $jobTypes.filter(':checked').val();
switch (selectedType) {
case 'HMisc':
case 'SApp':
case 'SImg':
case 'SOS':
case 'UMgmt':
quickLogAllowed = true;
break;
default:
quickLogAllowed = false;
break;
}
}
if (quickLogAllowed) {
$quickLogContainer.slideDown();
} else {
if (init)
$quickLogContainer.hide();
else
$quickLogContainer.slideUp();
$quickLog.attr('checked', null).change();
}
}
$quickLog.change(function () {
if ($(this).is(':checked')) {
$quickLogTaskTimeContainer.slideDown();
} else {
$quickLogTaskTimeContainer.slideUp();
}
});
$quickLogTaskTimes.change(function () {
if ($quickLogTaskTimes.filter(':checked').val() === "") {
$('#createJob_TaskTimeOtherMinutesContainer').show();
$quickLogTaskTimeOtherMinutes.attr('disabled', null).focus().select();
} else {
$('#createJob_TaskTimeOtherMinutesContainer').hide();
$quickLogTaskTimeOtherMinutes.attr('disabled', 'disabled');
}
});
//#endregion
init = false;
});
</script>
</div>
@model Disco.Web.Models.Job.CreateModel
@{
Layout = "~/Views/Shared/_DialogLayout.cshtml";
ViewBag.Title = Html.ToBreadcrumb("Jobs", MVC.Job.Index(), "Create");
}
<div id="createJob_Container">
@using (Html.BeginForm(MVC.Job.Create(), FormMethod.Post))
{
@Html.HiddenFor(m => m.DeviceSerialNumber)
@Html.HiddenFor(m => m.UserId)
@Html.HiddenFor(m => m.QuickLogDestinationUrl)
@Html.Partial(MVC.Job.Views._CreateSubject, Model)
@Html.ValidationSummary(true)
<div class="createJob_Component">
<div id="createJob_Type">
<h3>Type</h3>
@Html.ValidationMessageFor(m => m.Type)
@CommonHelpers.RadioButtonList("Type", Model.JobTypes.ToSelectListItems(Model.Type), 3)
@Html.ValidationMessageFor(m => m.SubTypes)
</div>
<div id="createJob_SubTypes">
@foreach (var jt in Model.JobTypes)
{
<div id="createJob_SubType_@(jt.Id)" class="createJob_SubType">
<div class="createJob_SubTypes">
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.Where(jst => jst.JobTypeId == jt.Id).ToList().ToSelectListItems(Model.SubTypes), 3)
</div>
</div>
}
</div>
</div>
<div id="createJob_DeviceHeldContainer" class="createJob_Component">
@Html.ValidationMessageFor(m => m.DeviceHeld)
@Html.HiddenFor(m => m.DeviceHeld)
<table>
<tr>
<td>
<h3>Device Held</h3>
</td>
<td>
<input id="createJob_DeviceHeld" name="_DeviceHeld" type="radio" value="true" /><label for="createJob_DeviceHeld">Held</label>
</td>
<td>
<input id="createJob_DeviceNotHeld" name="_DeviceHeld" type="radio" value="false" /><label for="createJob_DeviceNotHeld">Not Held</label>
</td>
</tr>
</table>
</div>
<div id="createJob_CommentsContainer" class="createJob_Component">
<table>
<tr>
<td>
<h3>Comments</h3>
</td>
<td>
@Html.EditorFor(m => m.Comments)
</td>
</tr>
</table>
</div>
<div id="createJob_QuickLogContainer" class="createJob_Component">
<div id="createJob_QuickLogAutoCloseContainer">
<h3>Quick Log</h3>
<input id="createJob_QuickLog" name="QuickLog" type="checkbox" value="true" /><label for="createJob_QuickLog">Automatically close this job</label>
</div>
<div id="createJob_QuickLogTaskTimeContainer">
<h3>Task Time</h3>
@Html.ValidationMessageFor(m => m.QuickLogTaskTimeMinutes)
<input type="radio" id="createJob_TaskTime10" name="QuickLogTaskTimeMinutes" value="10" /><label for="createJob_TaskTime10"> 10 Minutes</label>
<input type="radio" id="createJob_TaskTime30" name="QuickLogTaskTimeMinutes" value="30" /><label for="createJob_TaskTime30"> 30 Minutes</label>
<input type="radio" id="createJob_TaskTime60" name="QuickLogTaskTimeMinutes" value="60" /><label for="createJob_TaskTime60"> 1 Hour</label>
<input type="radio" id="createJob_TaskTime120" name="QuickLogTaskTimeMinutes" value="120" /><label for="createJob_TaskTime120"> 2 Hours</label>
<input type="radio" id="createJob_TaskTimeOther" name="QuickLogTaskTimeMinutes" value="" /><label for="createJob_TaskTimeOther"> Other</label>
<span id="createJob_TaskTimeOtherMinutesContainer">
<input type="number" id="createJob_TaskTimeOtherMinutes" name="QuickLogTaskTimeMinutesOther" value="" disabled="disabled" />
Minutes
</span>
</div>
</div>
}
<script type="text/javascript">
$(function () {
var discoDialogMethods;
var init = true;
//#region Parent Dialog
if (window.parent && window.parent.document) {
$('#QuickLogDestinationUrl').val(window.parent.window.location.href);
var parentDialog = $('#createJobDialog', window.parent.document);
if (parentDialog.length > 0) {
discoDialogMethods = parentDialog[0].discoDialogMethods;
var buttons = {
"Create Job": function () {
createJobForm.submit()
},
Cancel: function () {
discoDialogMethods.close();
}
}
discoDialogMethods.setButtons(buttons);
}
}
//#endregion
var createJobForm = $('form');
var validator = createJobForm.data('validator');
var unobtrusiveValidation = createJobForm.data('unobtrusiveValidation');
// Validate all Fields
validator.settings.ignore = '';
//#region Job Type/SubTypes
var $jobTypeContainer = $('#createJob_Type');
var $typeValidationMessage = $('[data-valmsg-for="Type"]', $jobTypeContainer)
var $subTypesValidationMessage = $('[data-valmsg-for="SubTypes"]', $jobTypeContainer)
var $jobTypes = $jobTypeContainer.find('input[type="radio"]').change(jobTypeChange);
$('#createJob_SubTypes').find('input[type="checkbox"]').change(jobSubTypeHighlight).each(jobSubTypeHighlight);
jobTypeChange();
function jobSubTypeHighlight() {
var $this = $(this);
if ($this.is(':checked'))
$this.closest('li').addClass('highlight');
else
$this.closest('li').removeClass('highlight');
}
function jobTypeChange() {
var $checkedItem = $jobTypes.filter(':checked');
$jobTypes.closest('li').removeClass('highlight');
$checkedItem.closest('li').addClass('highlight');
if (init) {
var jobType = $checkedItem.val();
$('#createJob_SubType_' + jobType).show();
} else {
$('#createJob_SubTypes').find('.createJob_SubType:visible').slideUp();
var jobType = $checkedItem.val();
$('#createJob_SubType_' + jobType).slideDown();
}
}
var additionalValidation = function (form) {
var isValid = true;
// Validate Type
var typeValue = $jobTypes.filter(':checked').val();
if (typeValue) {
$typeValidationMessage.removeClass('field-validation-error').addClass('field-validation-valid');
// Validate SubTypes
if ($('#createJob_SubType_' + typeValue).find('input:checked').length > 0) {
$subTypesValidationMessage.removeClass('field-validation-error').addClass('field-validation-valid');
} else {
$subTypesValidationMessage.text('At least one Job Sub Type is required').removeClass('field-validation-valid').addClass('field-validation-error');
isValid = false;
}
} else {
$typeValidationMessage.text('A Job Type is required').removeClass('field-validation-valid').addClass('field-validation-error');
isValid = false;
}
// Validate QuickLog Task Time
if ($quickLog.is(':checked')) {
var selectedTime = $quickLogTaskTimes.filter(':checked');
if (selectedTime.length > 0) {
if (selectedTime.val() === '') {
// Handle 'Other'
var otherTime = parseInt($quickLogTaskTimeOtherMinutes.val());
if (!otherTime || otherTime <= 0) {
$quickLogTaskTimeValidationMessage.text('A Task Time is required').removeClass('field-validation-valid').addClass('field-validation-error');
isValid = false;
}
} else {
$quickLogTaskTimeValidationMessage.removeClass('field-validation-valid').addClass('field-validation-error');
}
} else {
$quickLogTaskTimeValidationMessage.text('A Task Time is required').removeClass('field-validation-valid').addClass('field-validation-error');
isValid = false;
}
} else {
$quickLogTaskTimeValidationMessage.removeClass('field-validation-valid').addClass('field-validation-error');
}
return isValid;
}
validator.settings.submitHandler = function (form) {
if (additionalValidation()) {
discoDialogMethods.setButtons({});
form.submit();
}
}
//#endregion
//#region DeviceHeld
var $deviceHeld = $('#DeviceHeld');
if ($('#DeviceSerialNumber').val()) {
switch ($deviceHeld.val()) {
case 'True':
$('#createJob_DeviceHeld').prop('checked', true);
$('#createJob_DeviceNotHeld').prop('checked', false);
break;
case 'False':
$('#createJob_DeviceHeld').prop('checked', false);
$('#createJob_DeviceNotHeld').prop('checked', true);
break;
default:
$('#createJob_DeviceHeld').prop('checked', false);
$('#createJob_DeviceNotHeld').prop('checked', false);
break;
}
$('#createJob_DeviceHeldContainer').find('input[type="radio"]').change(function () {
// Update Hidden Field with Boolean Value
// Set DeviceHeld
var deviceHeldValue = '';
if ($('#createJob_DeviceHeld').is(':checked'))
deviceHeldValue = 'True';
if ($('#createJob_DeviceNotHeld').is(':checked'))
deviceHeldValue = 'False';
$deviceHeld.val(deviceHeldValue).change();
});
} else {
// No Device Associated
$deviceHeld.val('False');
$('#createJob_DeviceHeldContainer').hide();
}
//#endregion
//#region QuickLog
var $quickLog = $('#createJob_QuickLog');
var $quickLogContainer = $('#createJob_QuickLogContainer');
var $quickLogTaskTimeContainer = $('#createJob_QuickLogTaskTimeContainer');
var $quickLogTaskTimes = $quickLogTaskTimeContainer.find('input[type="radio"]');
var $quickLogTaskTimeOtherMinutes = $('#createJob_TaskTimeOtherMinutes');
var $quickLogTaskTimeValidationMessage = $quickLogTaskTimeContainer.find('[data-valmsg-for="QuickLogTaskTimeMinutes"]');
$deviceHeld.change(validateQuickLog);
$jobTypes.change(validateQuickLog);
validateQuickLog();
function validateQuickLog() {
var quickLogAllowed = false;
if ($deviceHeld.val() === 'True') {
quickLogAllowed = false;
} else {
var selectedType = $jobTypes.filter(':checked').val();
switch (selectedType) {
case 'HMisc':
case 'SApp':
case 'SImg':
case 'SOS':
case 'UMgmt':
quickLogAllowed = true;
break;
default:
quickLogAllowed = false;
break;
}
}
if (quickLogAllowed) {
$quickLogContainer.slideDown();
} else {
if (init)
$quickLogContainer.hide();
else
$quickLogContainer.slideUp();
$quickLog.prop('checked', false).change();
}
}
$quickLog.change(function () {
if ($(this).is(':checked')) {
$quickLogTaskTimeContainer.slideDown();
} else {
$quickLogTaskTimeContainer.slideUp();
}
});
$quickLogTaskTimes.change(function () {
if ($quickLogTaskTimes.filter(':checked').val() === "") {
$('#createJob_TaskTimeOtherMinutesContainer').show();
$quickLogTaskTimeOtherMinutes.attr('disabled', null).focus().select();
} else {
$('#createJob_TaskTimeOtherMinutesContainer').hide();
$quickLogTaskTimeOtherMinutes.attr('disabled', 'disabled');
}
});
//#endregion
init = false;
});
</script>
</div>
File diff suppressed because it is too large Load Diff
+187 -184
View File
@@ -1,184 +1,187 @@
@model Disco.Web.Models.Job.ShowModel
@{
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-NumberFormatter");
}
<table id="jobComponents">
<tr>
<th>
Description
</th>
<th>
Cost
</th>
<th class="actions">
&nbsp;
</th>
</tr>
@foreach (var jc in Model.Job.JobComponents)
{
<tr data-jobcomponentid="@jc.Id">
<td>
<input type="text" class="description" value="@jc.Description" />
</td>
<td>
<input type="text" class="cost" value="@jc.Cost.ToString("C")" />
</td>
<td>
<span class="remove"></span>
</td>
</tr>
}
<tr>
<td>
<a href="#" id="jobComponentsAdd">Add Component</a>
</td>
<td colspan="2" class="totalCost">
Total: <span id="jobComponentsTotalCost"></span>
</td>
</tr>
</table>
<div id="dialogRemoveComponent" title="Remove this Component?">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
Are you sure?</p>
</div>
<script type="text/javascript">
$(function () {
var $jobComponents = $('#jobComponents');
$jobComponents.find('input').live('change', updateComponent).focus(function () { $(this).select() }).filter('.cost');
$jobComponents.find('span.remove').live('click', removeComponent);
$('#jobComponentsAdd').click(function () {
var jc = $('<tr><td><input type="text" class="description" /></td><td><input type="text" class="cost" /></td><td><span class="remove"></span></td></tr>');
jc.find('input').focus(function () { $(this).select() })
jc.insertBefore($jobComponents.find('tr').last());
jc.find('input.description').focus();
return false;
});
$('#dialogRemoveComponent').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
function removeComponent() {
var componentRow = $(this).closest('tr');
var id = componentRow.attr('data-jobcomponentid');
if (id) {
var data = { id: id };
var $dialogRemoveComponent = $('#dialogRemoveComponent');
$dialogRemoveComponent.dialog("enable");
$dialogRemoveComponent.dialog('option', 'buttons', {
"Remove": function () {
$dialogRemoveComponent.dialog("disable");
$dialogRemoveComponent.dialog("option", "buttons", null);
$.ajax({
url: '@Url.Action(MVC.API.Job.ComponentRemove())',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
componentRow.remove();
updateTotalCost();
} else {
alert('Unable to remove component: ' + d);
}
$dialogRemoveComponent.dialog("close");
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to remove component: ' + textStatus);
$dialogRemoveComponent.dialog("close");
}
});
},
Cancel: function () {
$dialogRemoveComponent.dialog("close");
}
});
$dialogRemoveComponent.dialog('open');
} else {
// New - Remove
componentRow.remove();
updateTotalCost();
}
}
function updateTotalCost() {
var totalCost = 0;
$jobComponents.find('input.cost').each(function () {
var v = $(this).val();
v = $.parseNumber(v, { format: '#,##0.00', locale: 'au' });
if (!isNaN(v))
totalCost += v;
});
var totalCostFormatted = $.formatNumber(totalCost, { format: '#,##0.00', locale: 'au' });
$('#jobComponentsTotalCost').text('$' + totalCostFormatted);
}
function updateComponent() {
var componentRow = $(this).closest('tr');
componentRow.find('input').attr('disabled', true).addClass('updating');
var id = componentRow.attr('data-jobcomponentid');
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.Job.ComponentUpdate())',
dataType: 'json',
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
var data = {
id: id,
Description: componentRow.find('input.description').val(),
Cost: componentRow.find('input.cost').val()
};
$.ajax({
url: '@Url.Action(MVC.API.Job.ComponentAdd(Model.Job.Id, null, null))',
dataType: 'json',
data: data,
success: function (d) {
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (d.Result == 'OK') {
componentRow.attr('data-jobcomponentid', 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);
}
});
}
updateTotalCost();
}
updateTotalCost();
});
</script>
@model Disco.Web.Models.Job.ShowModel
@{
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-NumberFormatter");
}
<table id="jobComponents">
<tr>
<th>
Description
</th>
<th>
Cost
</th>
<th class="actions">
&nbsp;
</th>
</tr>
@foreach (var jc in Model.Job.JobComponents)
{
<tr data-jobcomponentid="@jc.Id">
<td>
<input type="text" class="description" value="@jc.Description" />
</td>
<td>
<input type="text" class="cost" value="@jc.Cost.ToString("C")" />
</td>
<td>
<span class="remove"></span>
</td>
</tr>
}
<tr>
<td>
<a href="#" id="jobComponentsAdd">Add Component</a>
</td>
<td colspan="2" class="totalCost">
Total: <span id="jobComponentsTotalCost"></span>
</td>
</tr>
</table>
<div id="dialogRemoveComponent" title="Remove this Component?">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
Are you sure?</p>
</div>
<script type="text/javascript">
$(function () {
var $jobComponents = $('#jobComponents');
$jobComponents.on('change', 'input', updateComponent);
$jobComponents.on('focus', 'input', function () { $(this).select() });
$jobComponents.on('click', 'span.remove', removeComponent);
$('#jobComponentsAdd').click(function () {
var jc = $('<tr><td><input type="text" class="description" /></td><td><input type="text" class="cost" /></td><td><span class="remove"></span></td></tr>');
jc.find('input').focus(function () { $(this).select() })
jc.insertBefore($jobComponents.find('tr').last());
jc.find('input.description').focus();
return false;
});
$('#dialogRemoveComponent').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
function removeComponent() {
var componentRow = $(this).closest('tr');
var id = componentRow.attr('data-jobcomponentid');
if (id) {
var data = { id: id };
var $dialogRemoveComponent = $('#dialogRemoveComponent');
$dialogRemoveComponent.dialog("enable");
$dialogRemoveComponent.dialog('option', 'buttons', {
"Remove": function () {
$dialogRemoveComponent.dialog("disable");
$dialogRemoveComponent.dialog("option", "buttons", null);
$.ajax({
url: '@Url.Action(MVC.API.Job.ComponentRemove())',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
componentRow.remove();
updateTotalCost();
} else {
alert('Unable to remove component: ' + d);
}
$dialogRemoveComponent.dialog("close");
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to remove component: ' + textStatus);
$dialogRemoveComponent.dialog("close");
}
});
},
Cancel: function () {
$dialogRemoveComponent.dialog("close");
}
});
$dialogRemoveComponent.dialog('open');
} else {
// New - Remove
componentRow.remove();
updateTotalCost();
}
}
function updateTotalCost() {
var totalCost = 0;
$jobComponents.find('input.cost').each(function () {
var v = $(this).val();
v = $.parseNumber(v, { format: '#,##0.00', locale: 'au' });
if (!isNaN(v))
totalCost += v;
});
var totalCostFormatted = $.formatNumber(totalCost, { format: '#,##0.00', locale: 'au' });
$('#jobComponentsTotalCost').text('$' + totalCostFormatted);
}
function updateComponent() {
var componentRow = $(this).closest('tr');
componentRow.find('input').attr('disabled', true).addClass('updating');
var id = componentRow.attr('data-jobcomponentid');
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.Job.ComponentUpdate())',
dataType: 'json',
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
var data = {
id: id,
Description: componentRow.find('input.description').val(),
Cost: componentRow.find('input.cost').val()
};
$.ajax({
url: '@Url.Action(MVC.API.Job.ComponentAdd(Model.Job.Id, null, null))',
dataType: 'json',
data: data,
success: function (d) {
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (d.Result == 'OK') {
componentRow.attr('data-jobcomponentid', 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);
}
});
}
updateTotalCost();
}
updateTotalCost();
});
</script>
@@ -1,294 +1,295 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Job.JobParts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Job/JobParts/Components.cshtml")]
public class Components : System.Web.Mvc.WebViewPage<Disco.Web.Models.Job.ShowModel>
{
public Components()
{
}
public override void Execute()
{
#line 2 "..\..\Views\Job\JobParts\Components.cshtml"
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-NumberFormatter");
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral(" id=\"jobComponents\"");
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");
WriteLiteral(" class=\"actions\"");
WriteLiteral(">\r\n &nbsp;\r\n </th>\r\n </tr>\r\n");
#line 17 "..\..\Views\Job\JobParts\Components.cshtml"
#line default
#line hidden
#line 17 "..\..\Views\Job\JobParts\Components.cshtml"
foreach (var jc in Model.Job.JobComponents)
{
#line default
#line hidden
WriteLiteral(" <tr");
WriteLiteral(" data-jobcomponentid=\"");
#line 19 "..\..\Views\Job\JobParts\Components.cshtml"
Write(jc.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <td>\r\n <input");
WriteLiteral(" type=\"text\"");
WriteLiteral(" class=\"description\"");
WriteAttribute("value", Tuple.Create(" value=\"", 513), Tuple.Create("\"", 536)
#line 21 "..\..\Views\Job\JobParts\Components.cshtml"
, Tuple.Create(Tuple.Create("", 521), Tuple.Create<System.Object, System.Int32>(jc.Description
#line default
#line hidden
, 521), false)
);
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
WriteLiteral(" type=\"text\"");
WriteLiteral(" class=\"cost\"");
WriteAttribute("value", Tuple.Create(" value=\"", 626), Tuple.Create("\"", 656)
#line 24 "..\..\Views\Job\JobParts\Components.cshtml"
, Tuple.Create(Tuple.Create("", 634), Tuple.Create<System.Object, System.Int32>(jc.Cost.ToString("C")
#line default
#line hidden
, 634), false)
);
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
WriteLiteral(" class=\"remove\"");
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n");
#line 30 "..\..\Views\Job\JobParts\Components.cshtml"
}
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n <a");
WriteLiteral(" href=\"#\"");
WriteLiteral(" id=\"jobComponentsAdd\"");
WriteLiteral(">Add Component</a>\r\n </td>\r\n <td");
WriteLiteral(" colspan=\"2\"");
WriteLiteral(" class=\"totalCost\"");
WriteLiteral(">\r\n Total: <span");
WriteLiteral(" id=\"jobComponentsTotalCost\"");
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n</table>\r\n<div");
WriteLiteral(" id=\"dialogRemoveComponent\"");
WriteLiteral(" title=\"Remove this Component?\"");
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 Are you sure?</p>\r\n</div>\r\n<script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n var $jobComponents = $(\'#jobComponents\');\r\n\r\n " +
" $jobComponents.find(\'input\').live(\'change\', updateComponent).focus(function " +
"() { $(this).select() }).filter(\'.cost\');\r\n $jobComponents.find(\'span.rem" +
"ove\').live(\'click\', removeComponent);\r\n\r\n $(\'#jobComponentsAdd\').click(fu" +
"nction () {\r\n var jc = $(\'<tr><td><input type=\"text\" class=\"descripti" +
"on\" /></td><td><input type=\"text\" class=\"cost\" /></td><td><span class=\"remove\"><" +
"/span></td></tr>\');\r\n jc.find(\'input\').focus(function () { $(this).se" +
"lect() })\r\n jc.insertBefore($jobComponents.find(\'tr\').last());\r\n " +
" jc.find(\'input.description\').focus();\r\n return false;\r\n " +
" });\r\n\r\n $(\'#dialogRemoveComponent\').dialog({\r\n resizable: fal" +
"se,\r\n height: 140,\r\n modal: true,\r\n autoOpen: f" +
"alse\r\n });\r\n\r\n function removeComponent() {\r\n var compo" +
"nentRow = $(this).closest(\'tr\');\r\n var id = componentRow.attr(\'data-j" +
"obcomponentid\');\r\n if (id) {\r\n var data = { id: id };\r" +
"\n\r\n var $dialogRemoveComponent = $(\'#dialogRemoveComponent\');\r\n " +
" $dialogRemoveComponent.dialog(\"enable\");\r\n $dialogR" +
"emoveComponent.dialog(\'option\', \'buttons\', {\r\n \"Remove\": func" +
"tion () {\r\n $dialogRemoveComponent.dialog(\"disable\");\r\n " +
" $dialogRemoveComponent.dialog(\"option\", \"buttons\", null);\r" +
"\n $.ajax({\r\n url: \'");
#line 80 "..\..\Views\Job\JobParts\Components.cshtml"
Write(Url.Action(MVC.API.Job.ComponentRemove()));
#line default
#line hidden
WriteLiteral("\',\r\n dataType: \'json\',\r\n da" +
"ta: data,\r\n success: function (d) {\r\n " +
" if (d == \'OK\') {\r\n componentR" +
"ow.remove();\r\n updateTotalCost();\r\n " +
" } else {\r\n alert(\'Unabl" +
"e to remove component: \' + d);\r\n }\r\n " +
" $dialogRemoveComponent.dialog(\"close\");\r\n " +
" },\r\n error: function (jqXHR, textStatus, erro" +
"rThrown) {\r\n alert(\'Unable to remove component: \'" +
" + textStatus);\r\n $dialogRemoveComponent.dialog(\"" +
"close\");\r\n }\r\n });\r\n " +
" },\r\n Cancel: function () {\r\n " +
" $dialogRemoveComponent.dialog(\"close\");\r\n }\r\n " +
" });\r\n\r\n $dialogRemoveComponent.dialog(\'open\');\r\n\r\n } " +
"else {\r\n // New - Remove\r\n componentRow.remove();\r" +
"\n updateTotalCost();\r\n }\r\n }\r\n function " +
"updateTotalCost() {\r\n var totalCost = 0;\r\n\r\n $jobComponent" +
"s.find(\'input.cost\').each(function () {\r\n var v = $(this).val();\r" +
"\n v = $.parseNumber(v, { format: \'#,##0.00\', locale: \'au\' });\r\n " +
" if (!isNaN(v))\r\n totalCost += v;\r\n }" +
");\r\n var totalCostFormatted = $.formatNumber(totalCost, { format: \'#," +
"##0.00\', locale: \'au\' });\r\n $(\'#jobComponentsTotalCost\').text(\'$\' + t" +
"otalCostFormatted);\r\n }\r\n function updateComponent() {\r\n " +
" var componentRow = $(this).closest(\'tr\');\r\n\r\n componentRow.find(\'in" +
"put\').attr(\'disabled\', true).addClass(\'updating\');\r\n\r\n var id = compo" +
"nentRow.attr(\'data-jobcomponentid\');\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 137 "..\..\Views\Job\JobParts\Components.cshtml"
Write(Url.Action(MVC.API.Job.ComponentUpdate()));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
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
var data = {
id: id,
Description: componentRow.find('input.description').val(),
Cost: componentRow.find('input.cost').val()
};
$.ajax({
url: '");
#line 161 "..\..\Views\Job\JobParts\Components.cshtml"
Write(Url.Action(MVC.API.Job.ComponentAdd(Model.Job.Id, null, null)));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (d.Result == 'OK') {
componentRow.attr('data-jobcomponentid', 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);
}
});
}
updateTotalCost();
}
updateTotalCost();
});
</script>
");
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Job.JobParts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Job/JobParts/Components.cshtml")]
public class Components : System.Web.Mvc.WebViewPage<Disco.Web.Models.Job.ShowModel>
{
public Components()
{
}
public override void Execute()
{
#line 2 "..\..\Views\Job\JobParts\Components.cshtml"
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-NumberFormatter");
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral(" id=\"jobComponents\"");
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");
WriteLiteral(" class=\"actions\"");
WriteLiteral(">\r\n &nbsp;\r\n </th>\r\n </tr>\r\n");
#line 17 "..\..\Views\Job\JobParts\Components.cshtml"
#line default
#line hidden
#line 17 "..\..\Views\Job\JobParts\Components.cshtml"
foreach (var jc in Model.Job.JobComponents)
{
#line default
#line hidden
WriteLiteral(" <tr");
WriteLiteral(" data-jobcomponentid=\"");
#line 19 "..\..\Views\Job\JobParts\Components.cshtml"
Write(jc.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <td>\r\n <input");
WriteLiteral(" type=\"text\"");
WriteLiteral(" class=\"description\"");
WriteAttribute("value", Tuple.Create(" value=\"", 513), Tuple.Create("\"", 536)
#line 21 "..\..\Views\Job\JobParts\Components.cshtml"
, Tuple.Create(Tuple.Create("", 521), Tuple.Create<System.Object, System.Int32>(jc.Description
#line default
#line hidden
, 521), false)
);
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
WriteLiteral(" type=\"text\"");
WriteLiteral(" class=\"cost\"");
WriteAttribute("value", Tuple.Create(" value=\"", 626), Tuple.Create("\"", 656)
#line 24 "..\..\Views\Job\JobParts\Components.cshtml"
, Tuple.Create(Tuple.Create("", 634), Tuple.Create<System.Object, System.Int32>(jc.Cost.ToString("C")
#line default
#line hidden
, 634), false)
);
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
WriteLiteral(" class=\"remove\"");
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n");
#line 30 "..\..\Views\Job\JobParts\Components.cshtml"
}
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n <a");
WriteLiteral(" href=\"#\"");
WriteLiteral(" id=\"jobComponentsAdd\"");
WriteLiteral(">Add Component</a>\r\n </td>\r\n <td");
WriteLiteral(" colspan=\"2\"");
WriteLiteral(" class=\"totalCost\"");
WriteLiteral(">\r\n Total: <span");
WriteLiteral(" id=\"jobComponentsTotalCost\"");
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n</table>\r\n<div");
WriteLiteral(" id=\"dialogRemoveComponent\"");
WriteLiteral(" title=\"Remove this Component?\"");
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 Are you sure?</p>\r\n</div>\r\n<script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n var $jobComponents = $(\'#jobComponents\');\r\n\r\n " +
" $jobComponents.on(\'change\', \'input\', updateComponent);\r\n $jobComponen" +
"ts.on(\'focus\', \'input\', function () { $(this).select() });\r\n\r\n\r\n $jobComp" +
"onents.on(\'click\', \'span.remove\', removeComponent);\r\n\r\n $(\'#jobComponents" +
"Add\').click(function () {\r\n var jc = $(\'<tr><td><input type=\"text\" cl" +
"ass=\"description\" /></td><td><input type=\"text\" class=\"cost\" /></td><td><span cl" +
"ass=\"remove\"></span></td></tr>\');\r\n jc.find(\'input\').focus(function (" +
") { $(this).select() })\r\n jc.insertBefore($jobComponents.find(\'tr\').l" +
"ast());\r\n jc.find(\'input.description\').focus();\r\n return f" +
"alse;\r\n });\r\n\r\n $(\'#dialogRemoveComponent\').dialog({\r\n " +
"resizable: false,\r\n height: 140,\r\n modal: true,\r\n " +
" autoOpen: false\r\n });\r\n\r\n function removeComponent() {\r\n " +
" var componentRow = $(this).closest(\'tr\');\r\n var id = componentRo" +
"w.attr(\'data-jobcomponentid\');\r\n if (id) {\r\n var data " +
"= { id: id };\r\n\r\n var $dialogRemoveComponent = $(\'#dialogRemoveCo" +
"mponent\');\r\n $dialogRemoveComponent.dialog(\"enable\");\r\n " +
" $dialogRemoveComponent.dialog(\'option\', \'buttons\', {\r\n " +
"\"Remove\": function () {\r\n $dialogRemoveComponent.dialog(\"" +
"disable\");\r\n $dialogRemoveComponent.dialog(\"option\", \"but" +
"tons\", null);\r\n $.ajax({\r\n url" +
": \'");
#line 83 "..\..\Views\Job\JobParts\Components.cshtml"
Write(Url.Action(MVC.API.Job.ComponentRemove()));
#line default
#line hidden
WriteLiteral("\',\r\n dataType: \'json\',\r\n da" +
"ta: data,\r\n success: function (d) {\r\n " +
" if (d == \'OK\') {\r\n componentR" +
"ow.remove();\r\n updateTotalCost();\r\n " +
" } else {\r\n alert(\'Unabl" +
"e to remove component: \' + d);\r\n }\r\n " +
" $dialogRemoveComponent.dialog(\"close\");\r\n " +
" },\r\n error: function (jqXHR, textStatus, erro" +
"rThrown) {\r\n alert(\'Unable to remove component: \'" +
" + textStatus);\r\n $dialogRemoveComponent.dialog(\"" +
"close\");\r\n }\r\n });\r\n " +
" },\r\n Cancel: function () {\r\n " +
" $dialogRemoveComponent.dialog(\"close\");\r\n }\r\n " +
" });\r\n\r\n $dialogRemoveComponent.dialog(\'open\');\r\n\r\n } " +
"else {\r\n // New - Remove\r\n componentRow.remove();\r" +
"\n updateTotalCost();\r\n }\r\n }\r\n function " +
"updateTotalCost() {\r\n var totalCost = 0;\r\n\r\n $jobComponent" +
"s.find(\'input.cost\').each(function () {\r\n var v = $(this).val();\r" +
"\n v = $.parseNumber(v, { format: \'#,##0.00\', locale: \'au\' });\r\n " +
" if (!isNaN(v))\r\n totalCost += v;\r\n }" +
");\r\n var totalCostFormatted = $.formatNumber(totalCost, { format: \'#," +
"##0.00\', locale: \'au\' });\r\n $(\'#jobComponentsTotalCost\').text(\'$\' + t" +
"otalCostFormatted);\r\n }\r\n function updateComponent() {\r\n " +
" var componentRow = $(this).closest(\'tr\');\r\n\r\n componentRow.find(\'in" +
"put\').attr(\'disabled\', true).addClass(\'updating\');\r\n\r\n var id = compo" +
"nentRow.attr(\'data-jobcomponentid\');\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 140 "..\..\Views\Job\JobParts\Components.cshtml"
Write(Url.Action(MVC.API.Job.ComponentUpdate()));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
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
var data = {
id: id,
Description: componentRow.find('input.description').val(),
Cost: componentRow.find('input.cost').val()
};
$.ajax({
url: '");
#line 164 "..\..\Views\Job\JobParts\Components.cshtml"
Write(Url.Action(MVC.API.Job.ComponentAdd(Model.Job.Id, null, null)));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (d.Result == 'OK') {
componentRow.attr('data-jobcomponentid', 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);
}
});
}
updateTotalCost();
}
updateTotalCost();
});
</script>
");
}
}
}
#pragma warning restore 1591
+90 -90
View File
@@ -1,90 +1,90 @@
@model Disco.Web.Models.Job.ShowModel
@{
var validFlags = Model.Job.ValidFlagsGrouped();
}
<div id="jobDetailTab-Flags" class="jobPart">
<table id="jobFlags">
@foreach (var flagGroup in validFlags)
{
<tr>
<th>
<span class="flagGroupName">@flagGroup.Key</span><br />
@AjaxHelpers.AjaxLoader()
</th>
<td>
@foreach (var flagItem in flagGroup.Value)
{
<div>
<input type="checkbox" value="@flagItem.Item1" id="jobFlag_@(flagItem.Item1)" @(flagItem.Item3 ? new HtmlString("checked=\"checked\"") : new HtmlString(string.Empty)) /><label id="jobFlagLabel_@(flagItem.Item1)" for="jobFlag_@(flagItem.Item1)">@flagItem.Item2</label></div>
}
</td>
</tr>
}
</table>
<div id="dialogFlagsAction" title="Add Flag">
@using (Html.BeginForm(MVC.API.Job.UpdateFlag(Model.Job.Id, null, null, true)))
{
<input id="dialogFlagsActionFlag" type="hidden" name="Flag" value="0" />
<h3>
Reason:</h3>
<p>
<textarea name="Reason" class="block"></textarea>
</p>
}
</div>
<script type="text/javascript">
$('#jobDetailTabItems').append('<li><a href="#jobDetailTab-Flags">Flags</a></li>');
$(function () {
var $flagCheckboxes = $('#jobFlags').find('input[type="checkbox"]');
var $dialogFlagsAction = $('#dialogFlagsAction');
var $flagCheckbox;
var updateFlags = function () {
$flagCheckbox = $(this);
var flagValue = $flagCheckbox.val();
if ($flagCheckbox.is(':checked')) {
// Add
$('#dialogFlagsActionFlag').val(flagValue);
var title = 'Add Flag: ' + $flagCheckbox.closest('tr').find('th .flagGroupName').text() + ': ' + $('#jobFlagLabel_' + flagValue).text();
$dialogFlagsAction.dialog('option', 'title', title);
$dialogFlagsAction.dialog('open');
} else {
// Remove
var $ajaxLoading = $flagCheckbox.closest('tr').find('span.ajaxLoading');
$ajaxLoading.show();
$.getJSON('@(Url.Action(MVC.API.Job.UpdateFlag(Model.Job.Id, null, null, false)))', { Flag: '-' + flagValue }, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Flag:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
}
};
$dialogFlagsAction.dialog({
resizable: false,
height: 240,
modal: true,
autoOpen: false,
buttons: {
"Add": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
$this.find('form').first().submit();
},
Cancel: function () {
$(this).dialog("close");
}
},
close: function () {
$flagCheckbox.attr('checked', false);
}
});
$flagCheckboxes.click(updateFlags);
});
</script>
</div>
@model Disco.Web.Models.Job.ShowModel
@{
var validFlags = Model.Job.ValidFlagsGrouped();
}
<div id="jobDetailTab-Flags" class="jobPart">
<table id="jobFlags">
@foreach (var flagGroup in validFlags)
{
<tr>
<th>
<span class="flagGroupName">@flagGroup.Key</span><br />
@AjaxHelpers.AjaxLoader()
</th>
<td>
@foreach (var flagItem in flagGroup.Value)
{
<div>
<input type="checkbox" value="@flagItem.Item1" id="jobFlag_@(flagItem.Item1)" @(flagItem.Item3 ? new HtmlString("checked=\"checked\"") : new HtmlString(string.Empty)) /><label id="jobFlagLabel_@(flagItem.Item1)" for="jobFlag_@(flagItem.Item1)">@flagItem.Item2</label></div>
}
</td>
</tr>
}
</table>
<div id="dialogFlagsAction" title="Add Flag">
@using (Html.BeginForm(MVC.API.Job.UpdateFlag(Model.Job.Id, null, null, true)))
{
<input id="dialogFlagsActionFlag" type="hidden" name="Flag" value="0" />
<h3>
Reason:</h3>
<p>
<textarea name="Reason" class="block"></textarea>
</p>
}
</div>
<script type="text/javascript">
$('#jobDetailTabItems').append('<li><a href="#jobDetailTab-Flags">Flags</a></li>');
$(function () {
var $flagCheckboxes = $('#jobFlags').find('input[type="checkbox"]');
var $dialogFlagsAction = $('#dialogFlagsAction');
var $flagCheckbox;
var updateFlags = function () {
$flagCheckbox = $(this);
var flagValue = $flagCheckbox.val();
if ($flagCheckbox.is(':checked')) {
// Add
$('#dialogFlagsActionFlag').val(flagValue);
var title = 'Add Flag: ' + $flagCheckbox.closest('tr').find('th .flagGroupName').text() + ': ' + $('#jobFlagLabel_' + flagValue).text();
$dialogFlagsAction.dialog('option', 'title', title);
$dialogFlagsAction.dialog('open');
} else {
// Remove
var $ajaxLoading = $flagCheckbox.closest('tr').find('span.ajaxLoading');
$ajaxLoading.show();
$.getJSON('@(Url.Action(MVC.API.Job.UpdateFlag(Model.Job.Id, null, null, false)))', { Flag: '-' + flagValue }, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Flag:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
}
};
$dialogFlagsAction.dialog({
resizable: false,
height: 240,
modal: true,
autoOpen: false,
buttons: {
"Add": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
$this.find('form').first().submit();
},
Cancel: function () {
$(this).dialog("close");
}
},
close: function () {
$flagCheckbox.prop('checked', false);
}
});
$flagCheckboxes.click(updateFlags);
});
</script>
</div>
+327 -327
View File
@@ -1,327 +1,327 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Job.JobParts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Job/JobParts/Flags.cshtml")]
public class Flags : System.Web.Mvc.WebViewPage<Disco.Web.Models.Job.ShowModel>
{
public Flags()
{
}
public override void Execute()
{
#line 2 "..\..\Views\Job\JobParts\Flags.cshtml"
var validFlags = Model.Job.ValidFlagsGrouped();
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"jobDetailTab-Flags\"");
WriteLiteral(" class=\"jobPart\"");
WriteLiteral(">\r\n <table");
WriteLiteral(" id=\"jobFlags\"");
WriteLiteral(">\r\n");
#line 7 "..\..\Views\Job\JobParts\Flags.cshtml"
#line default
#line hidden
#line 7 "..\..\Views\Job\JobParts\Flags.cshtml"
foreach (var flagGroup in validFlags)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <th>\r\n <span");
WriteLiteral(" class=\"flagGroupName\"");
WriteLiteral(">");
#line 11 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(flagGroup.Key);
#line default
#line hidden
WriteLiteral("</span><br />\r\n");
WriteLiteral(" ");
#line 12 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </th>\r\n <td>\r\n");
#line 15 "..\..\Views\Job\JobParts\Flags.cshtml"
#line default
#line hidden
#line 15 "..\..\Views\Job\JobParts\Flags.cshtml"
foreach (var flagItem in flagGroup.Value)
{
#line default
#line hidden
WriteLiteral(" <div>\r\n <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("value", Tuple.Create(" value=\"", 609), Tuple.Create("\"", 632)
#line 18 "..\..\Views\Job\JobParts\Flags.cshtml"
, Tuple.Create(Tuple.Create("", 617), Tuple.Create<System.Object, System.Int32>(flagItem.Item1
#line default
#line hidden
, 617), false)
);
WriteAttribute("id", Tuple.Create(" id=\"", 633), Tuple.Create("\"", 663)
, Tuple.Create(Tuple.Create("", 638), Tuple.Create("jobFlag_", 638), true)
#line 18 "..\..\Views\Job\JobParts\Flags.cshtml"
, Tuple.Create(Tuple.Create("", 646), Tuple.Create<System.Object, System.Int32>(flagItem.Item1
#line default
#line hidden
, 646), false)
);
WriteLiteral(" ");
#line 18 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(flagItem.Item3 ? new HtmlString("checked=\"checked\"") : new HtmlString(string.Empty));
#line default
#line hidden
WriteLiteral(" /><label");
WriteAttribute("id", Tuple.Create(" id=\"", 762), Tuple.Create("\"", 797)
, Tuple.Create(Tuple.Create("", 767), Tuple.Create("jobFlagLabel_", 767), true)
#line 18 "..\..\Views\Job\JobParts\Flags.cshtml"
, Tuple.Create(Tuple.Create("", 780), Tuple.Create<System.Object, System.Int32>(flagItem.Item1
#line default
#line hidden
, 780), false)
);
WriteAttribute("for", Tuple.Create(" for=\"", 798), Tuple.Create("\"", 829)
, Tuple.Create(Tuple.Create("", 804), Tuple.Create("jobFlag_", 804), true)
#line 18 "..\..\Views\Job\JobParts\Flags.cshtml"
, Tuple.Create(Tuple.Create("", 812), Tuple.Create<System.Object, System.Int32>(flagItem.Item1
#line default
#line hidden
, 812), false)
);
WriteLiteral(">");
#line 18 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(flagItem.Item2);
#line default
#line hidden
WriteLiteral("</label></div>\r\n");
#line 19 "..\..\Views\Job\JobParts\Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 22 "..\..\Views\Job\JobParts\Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </table>\r\n <div");
WriteLiteral(" id=\"dialogFlagsAction\"");
WriteLiteral(" title=\"Add Flag\"");
WriteLiteral(">\r\n");
#line 25 "..\..\Views\Job\JobParts\Flags.cshtml"
#line default
#line hidden
#line 25 "..\..\Views\Job\JobParts\Flags.cshtml"
using (Html.BeginForm(MVC.API.Job.UpdateFlag(Model.Job.Id, null, null, true)))
{
#line default
#line hidden
WriteLiteral(" <input");
WriteLiteral(" id=\"dialogFlagsActionFlag\"");
WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"Flag\"");
WriteLiteral(" value=\"0\"");
WriteLiteral(" />\r\n");
WriteLiteral(" <h3>\r\n Reason:</h3>\r\n");
WriteLiteral(" <p>\r\n <textarea");
WriteLiteral(" name=\"Reason\"");
WriteLiteral(" class=\"block\"");
WriteLiteral("></textarea>\r\n </p>\r\n");
#line 33 "..\..\Views\Job\JobParts\Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$('#jobDetailTabItems').append('<li><a href=""#jobDetailTab-Flags"">Flags</a></li>');
$(function () {
var $flagCheckboxes = $('#jobFlags').find('input[type=""checkbox""]');
var $dialogFlagsAction = $('#dialogFlagsAction');
var $flagCheckbox;
var updateFlags = function () {
$flagCheckbox = $(this);
var flagValue = $flagCheckbox.val();
if ($flagCheckbox.is(':checked')) {
// Add
$('#dialogFlagsActionFlag').val(flagValue);
var title = 'Add Flag: ' + $flagCheckbox.closest('tr').find('th .flagGroupName').text() + ': ' + $('#jobFlagLabel_' + flagValue).text();
$dialogFlagsAction.dialog('option', 'title', title);
$dialogFlagsAction.dialog('open');
} else {
// Remove
var $ajaxLoading = $flagCheckbox.closest('tr').find('span.ajaxLoading');
$ajaxLoading.show();
$.getJSON('");
#line 56 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(Url.Action(MVC.API.Job.UpdateFlag(Model.Job.Id, null, null, false)));
#line default
#line hidden
WriteLiteral(@"', { Flag: '-' + flagValue }, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Flag:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
}
};
$dialogFlagsAction.dialog({
resizable: false,
height: 240,
modal: true,
autoOpen: false,
buttons: {
""Add"": function () {
var $this = $(this);
$this.dialog(""disable"");
$this.dialog(""option"", ""buttons"", null);
$this.find('form').first().submit();
},
Cancel: function () {
$(this).dialog(""close"");
}
},
close: function () {
$flagCheckbox.attr('checked', false);
}
});
$flagCheckboxes.click(updateFlags);
});
</script>
</div>
");
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Job.JobParts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Job/JobParts/Flags.cshtml")]
public class Flags : System.Web.Mvc.WebViewPage<Disco.Web.Models.Job.ShowModel>
{
public Flags()
{
}
public override void Execute()
{
#line 2 "..\..\Views\Job\JobParts\Flags.cshtml"
var validFlags = Model.Job.ValidFlagsGrouped();
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"jobDetailTab-Flags\"");
WriteLiteral(" class=\"jobPart\"");
WriteLiteral(">\r\n <table");
WriteLiteral(" id=\"jobFlags\"");
WriteLiteral(">\r\n");
#line 7 "..\..\Views\Job\JobParts\Flags.cshtml"
#line default
#line hidden
#line 7 "..\..\Views\Job\JobParts\Flags.cshtml"
foreach (var flagGroup in validFlags)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <th>\r\n <span");
WriteLiteral(" class=\"flagGroupName\"");
WriteLiteral(">");
#line 11 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(flagGroup.Key);
#line default
#line hidden
WriteLiteral("</span><br />\r\n");
WriteLiteral(" ");
#line 12 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </th>\r\n <td>\r\n");
#line 15 "..\..\Views\Job\JobParts\Flags.cshtml"
#line default
#line hidden
#line 15 "..\..\Views\Job\JobParts\Flags.cshtml"
foreach (var flagItem in flagGroup.Value)
{
#line default
#line hidden
WriteLiteral(" <div>\r\n <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("value", Tuple.Create(" value=\"", 609), Tuple.Create("\"", 632)
#line 18 "..\..\Views\Job\JobParts\Flags.cshtml"
, Tuple.Create(Tuple.Create("", 617), Tuple.Create<System.Object, System.Int32>(flagItem.Item1
#line default
#line hidden
, 617), false)
);
WriteAttribute("id", Tuple.Create(" id=\"", 633), Tuple.Create("\"", 663)
, Tuple.Create(Tuple.Create("", 638), Tuple.Create("jobFlag_", 638), true)
#line 18 "..\..\Views\Job\JobParts\Flags.cshtml"
, Tuple.Create(Tuple.Create("", 646), Tuple.Create<System.Object, System.Int32>(flagItem.Item1
#line default
#line hidden
, 646), false)
);
WriteLiteral(" ");
#line 18 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(flagItem.Item3 ? new HtmlString("checked=\"checked\"") : new HtmlString(string.Empty));
#line default
#line hidden
WriteLiteral(" /><label");
WriteAttribute("id", Tuple.Create(" id=\"", 762), Tuple.Create("\"", 797)
, Tuple.Create(Tuple.Create("", 767), Tuple.Create("jobFlagLabel_", 767), true)
#line 18 "..\..\Views\Job\JobParts\Flags.cshtml"
, Tuple.Create(Tuple.Create("", 780), Tuple.Create<System.Object, System.Int32>(flagItem.Item1
#line default
#line hidden
, 780), false)
);
WriteAttribute("for", Tuple.Create(" for=\"", 798), Tuple.Create("\"", 829)
, Tuple.Create(Tuple.Create("", 804), Tuple.Create("jobFlag_", 804), true)
#line 18 "..\..\Views\Job\JobParts\Flags.cshtml"
, Tuple.Create(Tuple.Create("", 812), Tuple.Create<System.Object, System.Int32>(flagItem.Item1
#line default
#line hidden
, 812), false)
);
WriteLiteral(">");
#line 18 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(flagItem.Item2);
#line default
#line hidden
WriteLiteral("</label></div>\r\n");
#line 19 "..\..\Views\Job\JobParts\Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 22 "..\..\Views\Job\JobParts\Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </table>\r\n <div");
WriteLiteral(" id=\"dialogFlagsAction\"");
WriteLiteral(" title=\"Add Flag\"");
WriteLiteral(">\r\n");
#line 25 "..\..\Views\Job\JobParts\Flags.cshtml"
#line default
#line hidden
#line 25 "..\..\Views\Job\JobParts\Flags.cshtml"
using (Html.BeginForm(MVC.API.Job.UpdateFlag(Model.Job.Id, null, null, true)))
{
#line default
#line hidden
WriteLiteral(" <input");
WriteLiteral(" id=\"dialogFlagsActionFlag\"");
WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"Flag\"");
WriteLiteral(" value=\"0\"");
WriteLiteral(" />\r\n");
WriteLiteral(" <h3>\r\n Reason:</h3>\r\n");
WriteLiteral(" <p>\r\n <textarea");
WriteLiteral(" name=\"Reason\"");
WriteLiteral(" class=\"block\"");
WriteLiteral("></textarea>\r\n </p>\r\n");
#line 33 "..\..\Views\Job\JobParts\Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$('#jobDetailTabItems').append('<li><a href=""#jobDetailTab-Flags"">Flags</a></li>');
$(function () {
var $flagCheckboxes = $('#jobFlags').find('input[type=""checkbox""]');
var $dialogFlagsAction = $('#dialogFlagsAction');
var $flagCheckbox;
var updateFlags = function () {
$flagCheckbox = $(this);
var flagValue = $flagCheckbox.val();
if ($flagCheckbox.is(':checked')) {
// Add
$('#dialogFlagsActionFlag').val(flagValue);
var title = 'Add Flag: ' + $flagCheckbox.closest('tr').find('th .flagGroupName').text() + ': ' + $('#jobFlagLabel_' + flagValue).text();
$dialogFlagsAction.dialog('option', 'title', title);
$dialogFlagsAction.dialog('open');
} else {
// Remove
var $ajaxLoading = $flagCheckbox.closest('tr').find('span.ajaxLoading');
$ajaxLoading.show();
$.getJSON('");
#line 56 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(Url.Action(MVC.API.Job.UpdateFlag(Model.Job.Id, null, null, false)));
#line default
#line hidden
WriteLiteral(@"', { Flag: '-' + flagValue }, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Flag:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
}
};
$dialogFlagsAction.dialog({
resizable: false,
height: 240,
modal: true,
autoOpen: false,
buttons: {
""Add"": function () {
var $this = $(this);
$this.dialog(""disable"");
$this.dialog(""option"", ""buttons"", null);
$this.find('form').first().submit();
},
Cancel: function () {
$(this).dialog(""close"");
}
},
close: function () {
$flagCheckbox.prop('checked', false);
}
});
$flagCheckboxes.click(updateFlags);
});
</script>
</div>
");
}
}
}
#pragma warning restore 1591
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,34 +0,0 @@
@model Disco.Web.Models.Job.CreateModel
<table class="subtleHighlight">
<tr>
<td style="width: 50%">
<h2>
Device</h2>
@if (Model.Device == null)
{
<span class="smallMessage">No Device referenced to this Job</span>
}
else
{
<span><strong>Serial Number:</strong> @Html.ActionLink(Model.Device.SerialNumber, MVC.Device.Show(Model.Device.SerialNumber))</span><br />
<span><strong>Name:</strong> @Model.Device.ComputerName</span><br />
<span><strong>Model:</strong> @Model.Device.DeviceModel.ToString()</span><br />
<img alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(Model.Device.DeviceModelId, Model.Device.DeviceModel.ImageHash()))" />
}
</td>
<td style="width: 50%">
<h2>
User</h2>
@if (Model.User == null)
{
<span class="smallMessage">No User referenced to this Job</span>
}
else
{
<span><strong>Id:</strong> @Html.ActionLink(Model.User.Id, MVC.User.Show(Model.User.Id))</span><br />
<span><strong>Name:</strong> @Model.User.DisplayName</span><br />
<span><strong>Type:</strong> @Model.User.Type</span>
}
</td>
</tr>
</table>
@@ -1,229 +0,0 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Job
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Job/_CreateSubject-Old.cshtml")]
public class CreateSubject_Old : System.Web.Mvc.WebViewPage<Disco.Web.Models.Job.CreateModel>
{
public CreateSubject_Old()
{
}
public override void Execute()
{
WriteLiteral("<table");
WriteLiteral(" class=\"subtleHighlight\"");
WriteLiteral(">\r\n <tr>\r\n <td");
WriteLiteral(" style=\"width: 50%\"");
WriteLiteral(">\r\n <h2>\r\n Device</h2>\r\n");
#line 7 "..\..\Views\Job\_CreateSubject-Old.cshtml"
#line default
#line hidden
#line 7 "..\..\Views\Job\_CreateSubject-Old.cshtml"
if (Model.Device == null)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">No Device referenced to this Job</span>\r\n");
#line 10 "..\..\Views\Job\_CreateSubject-Old.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <span><strong>Serial Number:</strong> ");
#line 13 "..\..\Views\Job\_CreateSubject-Old.cshtml"
Write(Html.ActionLink(Model.Device.SerialNumber, MVC.Device.Show(Model.Device.SerialNumber)));
#line default
#line hidden
WriteLiteral("</span>");
WriteLiteral("<br />\r\n");
WriteLiteral(" <span><strong>Name:</strong> ");
#line 14 "..\..\Views\Job\_CreateSubject-Old.cshtml"
Write(Model.Device.ComputerName);
#line default
#line hidden
WriteLiteral("</span>");
WriteLiteral("<br />\r\n");
WriteLiteral(" <span><strong>Model:</strong> ");
#line 15 "..\..\Views\Job\_CreateSubject-Old.cshtml"
Write(Model.Device.DeviceModel.ToString());
#line default
#line hidden
WriteLiteral("</span>");
WriteLiteral("<br />\r\n");
WriteLiteral(" <img");
WriteLiteral(" alt=\"Model Image\"");
WriteAttribute("src", Tuple.Create(" src=\"", 730), Tuple.Create("\"", 840)
#line 16 "..\..\Views\Job\_CreateSubject-Old.cshtml"
, Tuple.Create(Tuple.Create("", 736), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(Model.Device.DeviceModelId, Model.Device.DeviceModel.ImageHash()))
#line default
#line hidden
, 736), false)
);
WriteLiteral(" />\r\n");
#line 17 "..\..\Views\Job\_CreateSubject-Old.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n <td");
WriteLiteral(" style=\"width: 50%\"");
WriteLiteral(">\r\n <h2>\r\n User</h2>\r\n");
#line 22 "..\..\Views\Job\_CreateSubject-Old.cshtml"
#line default
#line hidden
#line 22 "..\..\Views\Job\_CreateSubject-Old.cshtml"
if (Model.User == null)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">No User referenced to this Job</span>\r\n");
#line 25 "..\..\Views\Job\_CreateSubject-Old.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <span><strong>Id:</strong> ");
#line 28 "..\..\Views\Job\_CreateSubject-Old.cshtml"
Write(Html.ActionLink(Model.User.Id, MVC.User.Show(Model.User.Id)));
#line default
#line hidden
WriteLiteral("</span>");
WriteLiteral("<br />\r\n");
WriteLiteral(" <span><strong>Name:</strong> ");
#line 29 "..\..\Views\Job\_CreateSubject-Old.cshtml"
Write(Model.User.DisplayName);
#line default
#line hidden
WriteLiteral("</span>");
WriteLiteral("<br />\r\n");
WriteLiteral(" <span><strong>Type:</strong> ");
#line 30 "..\..\Views\Job\_CreateSubject-Old.cshtml"
Write(Model.User.Type);
#line default
#line hidden
WriteLiteral("</span>\r\n");
#line 31 "..\..\Views\Job\_CreateSubject-Old.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n</table>");
}
}
}
#pragma warning restore 1591