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
+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