Permissions & Authorization for Users #24
Initial Release; Includes Database and MVC refactoring
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18033
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -28,12 +28,14 @@ namespace Disco.Web.Views.Job.JobParts
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Job/JobParts/Components.cshtml")]
|
||||
public partial class Components : System.Web.Mvc.WebViewPage<Disco.Web.Models.Job.ShowModel>
|
||||
public partial class Components : Disco.Services.Web.WebViewPage<Disco.Web.Models.Job.ShowModel>
|
||||
{
|
||||
public Components()
|
||||
{
|
||||
@@ -43,8 +45,16 @@ namespace Disco.Web.Views.Job.JobParts
|
||||
|
||||
#line 2 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-NumberFormatter");
|
||||
|
||||
Authorization.Require(Claims.Job.ShowNonWarrantyComponents);
|
||||
|
||||
var hasEdit = Authorization.Has(Claims.Job.Properties.NonWarrantyProperties.EditComponents);
|
||||
var hasAdd = Authorization.Has(Claims.Job.Properties.NonWarrantyProperties.AddComponents);
|
||||
|
||||
if (hasEdit)
|
||||
{
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-NumberFormatter");
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
@@ -52,23 +62,50 @@ 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(">\r\n <tr>\r\n <th>Description\r\n </th>\r\n <th>Cost\r\n </" +
|
||||
"th>\r\n");
|
||||
|
||||
|
||||
#line 19 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 19 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
if (hasEdit)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <th");
|
||||
|
||||
WriteLiteral(" class=\"actions\"");
|
||||
|
||||
WriteLiteral(">\r\n \r\n </th>\r\n </tr>\r\n");
|
||||
WriteLiteral("> \r\n </th>\r\n");
|
||||
|
||||
|
||||
#line 17 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
#line 23 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </tr>\r\n");
|
||||
|
||||
|
||||
#line 25 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 17 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
foreach (var jc in Model.Job.JobComponents)
|
||||
#line 25 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
if (hasEdit)
|
||||
{
|
||||
foreach (var jc in Model.Job.JobComponents)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
@@ -78,7 +115,7 @@ WriteLiteral(" <tr");
|
||||
WriteLiteral(" data-jobcomponentid=\"");
|
||||
|
||||
|
||||
#line 19 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
#line 29 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
Write(jc.Id);
|
||||
|
||||
|
||||
@@ -92,14 +129,14 @@ WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteLiteral(" class=\"description\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 513), Tuple.Create("\"", 536)
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 853), Tuple.Create("\"", 876)
|
||||
|
||||
#line 21 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 521), Tuple.Create<System.Object, System.Int32>(jc.Description
|
||||
#line 31 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 861), Tuple.Create<System.Object, System.Int32>(jc.Description
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 521), false)
|
||||
, 861), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
|
||||
@@ -108,14 +145,14 @@ WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteLiteral(" class=\"cost\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 626), Tuple.Create("\"", 656)
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 966), Tuple.Create("\"", 996)
|
||||
|
||||
#line 24 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 634), Tuple.Create<System.Object, System.Int32>(jc.Cost.ToString("C")
|
||||
#line 34 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 974), Tuple.Create<System.Object, System.Int32>(jc.Cost.ToString("C")
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 634), false)
|
||||
, 974), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
|
||||
@@ -125,170 +162,310 @@ WriteLiteral(" class=\"remove\"");
|
||||
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 30 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
#line 40 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var jc in Model.Job.JobComponents)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr");
|
||||
|
||||
WriteLiteral(" data-jobcomponentid=\"");
|
||||
|
||||
|
||||
#line 46 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
Write(jc.Id);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <td>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"description\"");
|
||||
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 48 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
Write(jc.Description);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</span>\r\n </td>\r\n <td>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"cost\"");
|
||||
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 51 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
Write(jc.Cost.ToString("C"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</span>\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 54 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <td>\r\n <a");
|
||||
WriteLiteral("\r\n <tr>\r\n <td>\r\n");
|
||||
|
||||
|
||||
#line 59 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 59 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
if (hasEdit && hasAdd)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <a");
|
||||
|
||||
WriteLiteral(" href=\"#\"");
|
||||
|
||||
WriteLiteral(" id=\"jobComponentsAdd\"");
|
||||
|
||||
WriteLiteral(">Add Component</a>\r\n </td>\r\n <td");
|
||||
WriteLiteral(">Add Component</a>\r\n");
|
||||
|
||||
WriteLiteral(" colspan=\"2\"");
|
||||
|
||||
#line 62 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" \r\n </td>\r\n <td");
|
||||
|
||||
WriteAttribute("colspan", Tuple.Create(" colspan=\"", 1708), Tuple.Create("\"", 1736)
|
||||
|
||||
#line 65 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1718), Tuple.Create<System.Object, System.Int32>(hasEdit ? 2 : 1
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1718), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" class=\"totalCost\"");
|
||||
|
||||
WriteLiteral(">\r\n Total: <span");
|
||||
WriteLiteral(">Total: <span");
|
||||
|
||||
WriteLiteral(" id=\"jobComponentsTotalCost\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n</table>\r\n<div");
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 66 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 66 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
if (!hasEdit)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 68 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
Write(Model.Job.JobComponentsTotalCost().ToString("C"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 68 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </span>\r\n </td>\r\n </tr>\r\n</table>\r\n");
|
||||
|
||||
|
||||
#line 74 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
if (hasEdit)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" id=\"dialogRemoveComponent\"");
|
||||
|
||||
WriteLiteral(" title=\"Remove this Component?\"");
|
||||
|
||||
WriteLiteral(">\r\n <p>\r\n <span");
|
||||
WriteLiteral(">\r\n <p>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"ui-icon ui-icon-alert\"");
|
||||
|
||||
WriteLiteral(" style=\"float: left; margin: 0 7px 20px 0;\"");
|
||||
|
||||
WriteLiteral("></span>\r\n Are you sure?</p>\r\n</div>\r\n<script");
|
||||
WriteLiteral("></span>\r\n Are you sure?\r\n </p>\r\n </div>\r\n");
|
||||
|
||||
WriteLiteral(" <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" +
|
||||
": \'");
|
||||
WriteLiteral(">\r\n $(function () {\r\n var $jobComponents = $(\'#jobComponents\');" +
|
||||
"\r\n\r\n $jobComponents.on(\'change\', \'input\', updateComponent);\r\n " +
|
||||
" $jobComponents.on(\'focus\', \'input\', function () { $(this).select() });\r\n\r\n\r\n" +
|
||||
" $jobComponents.on(\'click\', \'span.remove\', removeComponent);\r\n\r\n " +
|
||||
" $(\'#jobComponentsAdd\').click(function () {\r\n var jc = $(\'<" +
|
||||
"tr><td><input type=\"text\" class=\"description\" /></td><td><input type=\"text\" clas" +
|
||||
"s=\"cost\" /></td><td><span class=\"remove\"></span></td></tr>\');\r\n j" +
|
||||
"c.find(\'input\').focus(function () { $(this).select() })\r\n jc.inse" +
|
||||
"rtBefore($jobComponents.find(\'tr\').last());\r\n jc.find(\'input.desc" +
|
||||
"ription\').focus();\r\n return false;\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 = compone" +
|
||||
"ntRow.attr(\'data-jobcomponentid\');\r\n if (id) {\r\n " +
|
||||
" var data = { id: id };\r\n\r\n var $dialogRemoveComponent = $(" +
|
||||
"\'#dialogRemoveComponent\');\r\n $dialogRemoveComponent.dialog(\"e" +
|
||||
"nable\");\r\n $dialogRemoveComponent.dialog(\'option\', \'buttons\'," +
|
||||
" {\r\n \"Remove\": function () {\r\n " +
|
||||
" $dialogRemoveComponent.dialog(\"disable\");\r\n $dialogR" +
|
||||
"emoveComponent.dialog(\"option\", \"buttons\", null);\r\n $" +
|
||||
".ajax({\r\n url: \'");
|
||||
|
||||
|
||||
#line 83 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
Write(Url.Action(MVC.API.Job.ComponentRemove()));
|
||||
#line 120 "..\..\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: \'");
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
|
||||
" data: data,\r\n success: function (d) {\r\n " +
|
||||
" if (d == \'OK\') {\r\n " +
|
||||
" componentRow.remove();\r\n update" +
|
||||
"TotalCost();\r\n } else {\r\n " +
|
||||
" alert(\'Unable to remove component: \' + d);\r\n " +
|
||||
" }\r\n $dialogRemoveComponen" +
|
||||
"t.dialog(\"close\");\r\n },\r\n " +
|
||||
" error: function (jqXHR, textStatus, errorThrown) {\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 $di" +
|
||||
"alogRemoveComponent.dialog(\"close\");\r\n }\r\n " +
|
||||
" });\r\n\r\n $dialogRemoveComponent.dialog(\'open\');\r\n\r\n " +
|
||||
" } else {\r\n // New - Remove\r\n com" +
|
||||
"ponentRow.remove();\r\n updateTotalCost();\r\n }\r\n" +
|
||||
" }\r\n function updateTotalCost() {\r\n var tot" +
|
||||
"alCost = 0;\r\n\r\n $jobComponents.find(\'input.cost\').each(function (" +
|
||||
") {\r\n var v = $(this).val();\r\n v = $.parse" +
|
||||
"Number(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\', loc" +
|
||||
"ale: \'au\' });\r\n $(\'#jobComponentsTotalCost\').text(\'$\' + totalCost" +
|
||||
"Formatted);\r\n }\r\n function updateComponent() {\r\n " +
|
||||
" var componentRow = $(this).closest(\'tr\');\r\n\r\n componentRow." +
|
||||
"find(\'input\').attr(\'disabled\', true).addClass(\'updating\');\r\n\r\n va" +
|
||||
"r id = componentRow.attr(\'data-jobcomponentid\');\r\n if (id) {\r\n " +
|
||||
" // Update\r\n var data = {\r\n " +
|
||||
" id: id,\r\n Description: componentRow.find(\'input.des" +
|
||||
"cription\').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 177 "..\..\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);
|
||||
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);
|
||||
}
|
||||
},
|
||||
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: '");
|
||||
});
|
||||
} 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 201 "..\..\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);
|
||||
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);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add component: ' + textStatus);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
updateTotalCost();
|
||||
}
|
||||
updateTotalCost();
|
||||
}
|
||||
updateTotalCost();
|
||||
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
|
||||
#line 225 "..\..\Views\Job\JobParts\Components.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user