security: use more antiforgery tokens

This commit is contained in:
Gary Sharp
2025-07-25 12:32:44 +10:00
parent fd43d85778
commit 7deead494b
222 changed files with 12919 additions and 11728 deletions
+104 -96
View File
@@ -10,15 +10,18 @@
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-NumberFormatter");
}
}
<table id="jobComponents">
<table id="jobComponents" data-addurl="@Url.Action(MVC.API.Job.ComponentAdd(Model.Job.Id, null, null))" data-removeurl="@Url.Action(MVC.API.Job.ComponentRemove())" data-updateurl="@Url.Action(MVC.API.Job.ComponentUpdate())">
<tr>
<th>Description
<th>
Description
</th>
<th>Cost
<th>
Cost
</th>
@if (hasEdit)
{
<th class="actions">&nbsp;
<th class="actions">
&nbsp;
</th>
}
</tr>
@@ -26,31 +29,31 @@
{
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 fa fa-times-circle"></span>
</td>
</tr>
<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 fa fa-times-circle"></span>
</td>
</tr>
}
}
else
{
foreach (var jc in Model.Job.JobComponents)
{
<tr data-jobcomponentid="@jc.Id">
<td>
<span class="description">@jc.Description</span>
</td>
<td>
<span class="cost">@jc.Cost.ToString("C")</span>
</td>
</tr>
<tr data-jobcomponentid="@jc.Id">
<td>
<span class="description">@jc.Description</span>
</td>
<td>
<span class="cost">@jc.Cost.ToString("C")</span>
</td>
</tr>
}
}
@@ -62,12 +65,13 @@
}
&nbsp;
</td>
<td colspan="@(hasEdit ? 2 : 1)" class="totalCost">Total: <span id="jobComponentsTotalCost">
@if (!hasEdit)
{
@Model.Job.JobComponentsTotalCost().ToString("C")
}
</span>
<td colspan="@(hasEdit ? 2 : 1)" class="totalCost">
Total: <span id="jobComponentsTotalCost">
@if (!hasEdit)
{
@Model.Job.JobComponentsTotalCost().ToString("C")
}
</span>
</td>
</tr>
</table>
@@ -80,7 +84,7 @@
</div>
<script type="text/javascript">
$(function () {
var $jobComponents = $('#jobComponents');
const $jobComponents = $('#jobComponents');
$jobComponents.on('change', 'input', updateComponent);
$jobComponents.on('focus', 'input', function () { $(this).select() });
@@ -89,7 +93,7 @@
$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 fa fa-times-circle"></span></td></tr>');
const jc = $('<tr><td><input type="text" class="description" /></td><td><input type="text" class="cost" /></td><td><span class="remove fa fa-times-circle"></span></td></tr>');
jc.find('input').focus(function () { $(this).select() })
jc.insertBefore($jobComponents.find('tr').last());
jc.find('input.description').focus();
@@ -104,35 +108,36 @@
});
function removeComponent() {
var componentRow = $(this).closest('tr');
var id = componentRow.attr('data-jobcomponentid');
const componentRow = $(this).closest('tr');
const 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");
async function removeComponentAsync(id) {
const body = new FormData();
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
body.append('id', id);
const response = await fetch($jobComponents.attr('data-removeurl'), {
method: 'POST',
body: body
});
if (response.ok) {
componentRow.remove();
updateTotalCost();
} else {
alert('Unable to remove component: ' + response.statusText);
}
});
$dialogRemoveComponent.dialog("close");
}
removeComponentAsync(id);
},
Cancel: function () {
$dialogRemoveComponent.dialog("close");
@@ -167,55 +172,58 @@
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);
async function updateComponentAsync(id, description, cost) {
const body = new FormData();
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
body.append('id', id);
body.append('description', description);
body.append('cost', cost);
const response = await fetch($jobComponents.attr('data-updateurl'), {
method: 'POST',
body: body
});
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (response.ok) {
const component = await response.json();
componentRow.find('input.description').val(component.Description);
componentRow.find('input.cost').val(component.Cost);
} else {
alert('Unable to update component: ' + response.statusText);
}
});
updateTotalCost();
}
updateComponentAsync(id, componentRow.find('input.description').val(), componentRow.find('input.cost').val());
} 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);
async function addComponentAsync(description, cost) {
const body = new FormData();
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
body.append('description', description);
body.append('cost', cost);
const response = await fetch($jobComponents.attr('data-addurl'), {
method: 'POST',
body: body
});
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (response.ok) {
const component = await response.json();
componentRow.attr('data-jobcomponentid', component.Id);
componentRow.find('input.description').val(component.Description);
componentRow.find('input.cost').val(component.Cost);
} else {
alert('Unable to add component: ' + response.statusText);
}
});
updateTotalCost();
}
addComponentAsync(componentRow.find('input.description').val(), componentRow.find('input.cost').val())
}
updateTotalCost();
}
updateTotalCost();
@@ -63,17 +63,50 @@ WriteLiteral("\r\n<table");
WriteLiteral(" id=\"jobComponents\"");
WriteLiteral(">\r\n <tr>\r\n <th>Description\r\n </th>\r\n <th>Cost\r\n </" +
"th>\r\n");
WriteLiteral(" data-addurl=\"");
#line 19 "..\..\Views\Job\JobParts\Components.cshtml"
#line 13 "..\..\Views\Job\JobParts\Components.cshtml"
Write(Url.Action(MVC.API.Job.ComponentAdd(Model.Job.Id, null, null)));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-removeurl=\"");
#line 13 "..\..\Views\Job\JobParts\Components.cshtml"
Write(Url.Action(MVC.API.Job.ComponentRemove()));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-updateurl=\"");
#line 13 "..\..\Views\Job\JobParts\Components.cshtml"
Write(Url.Action(MVC.API.Job.ComponentUpdate()));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <tr>\r\n <th>\r\n Description\r\n </th>\r\n <th>\r\n" +
" Cost\r\n </th>\r\n");
#line 21 "..\..\Views\Job\JobParts\Components.cshtml"
#line default
#line hidden
#line 19 "..\..\Views\Job\JobParts\Components.cshtml"
#line 21 "..\..\Views\Job\JobParts\Components.cshtml"
if (hasEdit)
{
@@ -84,10 +117,10 @@ WriteLiteral(" <th");
WriteLiteral(" class=\"actions\"");
WriteLiteral(">&nbsp;\r\n </th>\r\n");
WriteLiteral(">\r\n &nbsp;\r\n </th>\r\n");
#line 23 "..\..\Views\Job\JobParts\Components.cshtml"
#line 26 "..\..\Views\Job\JobParts\Components.cshtml"
}
@@ -96,13 +129,13 @@ WriteLiteral(">&nbsp;\r\n </th>\r\n");
WriteLiteral(" </tr>\r\n");
#line 25 "..\..\Views\Job\JobParts\Components.cshtml"
#line 28 "..\..\Views\Job\JobParts\Components.cshtml"
#line default
#line hidden
#line 25 "..\..\Views\Job\JobParts\Components.cshtml"
#line 28 "..\..\Views\Job\JobParts\Components.cshtml"
if (hasEdit)
{
foreach (var jc in Model.Job.JobComponents)
@@ -111,59 +144,59 @@ WriteLiteral(" </tr>\r\n");
#line default
#line hidden
WriteLiteral(" <tr");
WriteLiteral(" <tr");
WriteLiteral(" data-jobcomponentid=\"");
#line 29 "..\..\Views\Job\JobParts\Components.cshtml"
Write(jc.Id);
#line 32 "..\..\Views\Job\JobParts\Components.cshtml"
Write(jc.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <td>\r\n <input");
WriteLiteral(">\r\n <td>\r\n <input");
WriteLiteral(" type=\"text\"");
WriteLiteral(" class=\"description\"");
WriteAttribute("value", Tuple.Create(" value=\"", 853), Tuple.Create("\"", 876)
WriteAttribute("value", Tuple.Create(" value=\"", 1109), Tuple.Create("\"", 1132)
#line 31 "..\..\Views\Job\JobParts\Components.cshtml"
, Tuple.Create(Tuple.Create("", 861), Tuple.Create<System.Object, System.Int32>(jc.Description
#line 34 "..\..\Views\Job\JobParts\Components.cshtml"
, Tuple.Create(Tuple.Create("", 1117), Tuple.Create<System.Object, System.Int32>(jc.Description
#line default
#line hidden
, 861), false)
, 1117), false)
);
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
WriteLiteral(" type=\"text\"");
WriteLiteral(" class=\"cost\"");
WriteAttribute("value", Tuple.Create(" value=\"", 966), Tuple.Create("\"", 996)
WriteAttribute("value", Tuple.Create(" value=\"", 1234), Tuple.Create("\"", 1264)
#line 34 "..\..\Views\Job\JobParts\Components.cshtml"
, Tuple.Create(Tuple.Create("", 974), Tuple.Create<System.Object, System.Int32>(jc.Cost.ToString("C")
#line 37 "..\..\Views\Job\JobParts\Components.cshtml"
, Tuple.Create(Tuple.Create("", 1242), Tuple.Create<System.Object, System.Int32>(jc.Cost.ToString("C")
#line default
#line hidden
, 974), false)
, 1242), false)
);
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n");
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n");
#line 40 "..\..\Views\Job\JobParts\Components.cshtml"
#line 43 "..\..\Views\Job\JobParts\Components.cshtml"
}
}
else
@@ -174,49 +207,49 @@ WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n");
#line default
#line hidden
WriteLiteral(" <tr");
WriteLiteral(" <tr");
WriteLiteral(" data-jobcomponentid=\"");
#line 46 "..\..\Views\Job\JobParts\Components.cshtml"
Write(jc.Id);
#line 49 "..\..\Views\Job\JobParts\Components.cshtml"
Write(jc.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <td>\r\n <span");
WriteLiteral(">\r\n <td>\r\n <span");
WriteLiteral(" class=\"description\"");
WriteLiteral(">");
#line 48 "..\..\Views\Job\JobParts\Components.cshtml"
Write(jc.Description);
#line 51 "..\..\Views\Job\JobParts\Components.cshtml"
Write(jc.Description);
#line default
#line hidden
WriteLiteral("</span>\r\n </td>\r\n <td>\r\n <span");
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 54 "..\..\Views\Job\JobParts\Components.cshtml"
Write(jc.Cost.ToString("C"));
#line default
#line hidden
WriteLiteral("</span>\r\n </td>\r\n </tr>\r\n");
WriteLiteral("</span>\r\n </td>\r\n </tr>\r\n");
#line 54 "..\..\Views\Job\JobParts\Components.cshtml"
#line 57 "..\..\Views\Job\JobParts\Components.cshtml"
}
}
@@ -226,13 +259,13 @@ WriteLiteral("</span>\r\n </td>\r\n </tr>\r\n");
WriteLiteral("\r\n <tr>\r\n <td>\r\n");
#line 59 "..\..\Views\Job\JobParts\Components.cshtml"
#line 62 "..\..\Views\Job\JobParts\Components.cshtml"
#line default
#line hidden
#line 59 "..\..\Views\Job\JobParts\Components.cshtml"
#line 62 "..\..\Views\Job\JobParts\Components.cshtml"
if (hasEdit && hasAdd)
{
@@ -248,7 +281,7 @@ WriteLiteral(" id=\"jobComponentsAdd\"");
WriteLiteral(">Add Component</a>\r\n");
#line 62 "..\..\Views\Job\JobParts\Components.cshtml"
#line 65 "..\..\Views\Job\JobParts\Components.cshtml"
}
@@ -256,57 +289,57 @@ WriteLiteral(">Add Component</a>\r\n");
#line hidden
WriteLiteral(" &nbsp;\r\n </td>\r\n <td");
WriteAttribute("colspan", Tuple.Create(" colspan=\"", 1727), Tuple.Create("\"", 1755)
WriteAttribute("colspan", Tuple.Create(" colspan=\"", 2047), Tuple.Create("\"", 2075)
#line 65 "..\..\Views\Job\JobParts\Components.cshtml"
, Tuple.Create(Tuple.Create("", 1737), Tuple.Create<System.Object, System.Int32>(hasEdit ? 2 : 1
#line 68 "..\..\Views\Job\JobParts\Components.cshtml"
, Tuple.Create(Tuple.Create("", 2057), Tuple.Create<System.Object, System.Int32>(hasEdit ? 2 : 1
#line default
#line hidden
, 1737), false)
, 2057), false)
);
WriteLiteral(" class=\"totalCost\"");
WriteLiteral(">Total: <span");
WriteLiteral(">\r\n Total: <span");
WriteLiteral(" id=\"jobComponentsTotalCost\"");
WriteLiteral(">\r\n");
#line 66 "..\..\Views\Job\JobParts\Components.cshtml"
#line default
#line hidden
#line 66 "..\..\Views\Job\JobParts\Components.cshtml"
if (!hasEdit)
{
#line 70 "..\..\Views\Job\JobParts\Components.cshtml"
#line default
#line hidden
#line 68 "..\..\Views\Job\JobParts\Components.cshtml"
Write(Model.Job.JobComponentsTotalCost().ToString("C"));
#line 70 "..\..\Views\Job\JobParts\Components.cshtml"
if (!hasEdit)
{
#line default
#line hidden
#line 72 "..\..\Views\Job\JobParts\Components.cshtml"
Write(Model.Job.JobComponentsTotalCost().ToString("C"));
#line default
#line hidden
#line 68 "..\..\Views\Job\JobParts\Components.cshtml"
}
#line 72 "..\..\Views\Job\JobParts\Components.cshtml"
}
#line default
#line hidden
WriteLiteral(" </span>\r\n </td>\r\n </tr>\r\n</table>\r\n");
WriteLiteral(" </span>\r\n </td>\r\n </tr>\r\n</table>\r\n");
#line 74 "..\..\Views\Job\JobParts\Components.cshtml"
#line 78 "..\..\Views\Job\JobParts\Components.cshtml"
if (hasEdit)
{
@@ -329,138 +362,96 @@ 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 " +
" $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 fa fa-times-circle\"></span></td></tr>\');" +
"\r\n jc.find(\'input\').focus(function () { $(this).select() })\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 resiz" +
"able: false,\r\n height: 140,\r\n modal: true,\r\n " +
" autoOpen: false\r\n });\r\n\r\n function removeCompone" +
"nt() {\r\n var componentRow = $(this).closest(\'tr\');\r\n " +
" var id = componentRow.attr(\'data-jobcomponentid\');\r\n if (id) {" +
"\r\n var data = { id: id };\r\n\r\n var $dialogR" +
"emoveComponent = $(\'#dialogRemoveComponent\');\r\n $dialogRemove" +
"Component.dialog(\"enable\");\r\n $dialogRemoveComponent.dialog(\'" +
"option\', \'buttons\', {\r\n \"Remove\": function () {\r\n " +
" $dialogRemoveComponent.dialog(\"disable\");\r\n " +
" $dialogRemoveComponent.dialog(\"option\", \"buttons\", null);\r\n " +
" $.ajax({\r\n url: \'");
WriteLiteral(">\r\n $(function () {\r\n const $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 const jc = " +
"$(\'<tr><td><input type=\"text\" class=\"description\" /></td><td><input type=\"text\" " +
"class=\"cost\" /></td><td><span class=\"remove fa fa-times-circle\"></span></td></tr" +
">\');\r\n jc.find(\'input\').focus(function () { $(this).select() })\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 r" +
"esizable: false,\r\n height: 140,\r\n modal: true,\r\n " +
" autoOpen: false\r\n });\r\n\r\n function removeCom" +
"ponent() {\r\n const componentRow = $(this).closest(\'tr\');\r\n " +
" const id = componentRow.attr(\'data-jobcomponentid\');\r\n i" +
"f (id) {\r\n var $dialogRemoveComponent = $(\'#dialogRemoveCompo" +
"nent\');\r\n $dialogRemoveComponent.dialog(\"enable\");\r\n " +
" $dialogRemoveComponent.dialog(\'option\', \'buttons\', {\r\n " +
" \"Remove\": function () {\r\n $dialogRemoveCompo" +
"nent.dialog(\"disable\");\r\n $dialogRemoveComponent.dial" +
"og(\"option\", \"buttons\", null);\r\n\r\n async function rem" +
"oveComponentAsync(id) {\r\n\r\n const body = new Form" +
"Data();\r\n body.append(\'__RequestVerificationToken" +
"\', document.body.dataset.antiforgery);\r\n body.app" +
"end(\'id\', id);\r\n\r\n const response = await fetch($" +
"jobComponents.attr(\'data-removeurl\'), {\r\n met" +
"hod: \'POST\',\r\n body: body\r\n " +
" });\r\n\r\n if (response.ok) {\r\n " +
" componentRow.remove();\r\n " +
" updateTotalCost();\r\n } else {\r\n " +
" alert(\'Unable to remove component: \' + response.statu" +
"sText);\r\n }\r\n $dia" +
"logRemoveComponent.dialog(\"close\");\r\n }\r\n " +
" removeComponentAsync(id);\r\n },\r\n " +
" Cancel: function () {\r\n $dialogRemoveC" +
"omponent.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.r" +
"emove();\r\n updateTotalCost();\r\n }\r\n " +
" }\r\n function updateTotalCost() {\r\n var totalCost = 0;" +
"\r\n\r\n $jobComponents.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 tot" +
"alCostFormatted = $.formatNumber(totalCost, { format: \'#,##0.00\', locale: \'au\' }" +
");\r\n $(\'#jobComponentsTotalCost\').text(\'$\' + totalCostFormatted);" +
"\r\n }\r\n function updateComponent() {\r\n var c" +
"omponentRow = $(this).closest(\'tr\');\r\n\r\n componentRow.find(\'input" +
"\').attr(\'disabled\', true).addClass(\'updating\');\r\n\r\n var id = comp" +
"onentRow.attr(\'data-jobcomponentid\');\r\n if (id) {\r\n " +
" // Update\r\n async function updateComponentAsync(id, des" +
"cription, cost) {\r\n const body = new FormData();\r\n " +
" body.append(\'__RequestVerificationToken\', document.body.dataset" +
".antiforgery);\r\n body.append(\'id\', id);\r\n " +
" body.append(\'description\', description);\r\n body.a" +
"ppend(\'cost\', cost);\r\n\r\n const response = await fetch($jo" +
"bComponents.attr(\'data-updateurl\'), {\r\n method: \'POST" +
"\',\r\n body: body\r\n });\r\n\r\n " +
" componentRow.find(\'input\').attr(\'disabled\', false).removeClas" +
"s(\'updating\');\r\n\r\n if (response.ok) {\r\n " +
" const component = await response.json();\r\n " +
"componentRow.find(\'input.description\').val(component.Description);\r\n " +
" componentRow.find(\'input.cost\').val(component.Cost);\r\n " +
" } else {\r\n alert(\'Unable to update comp" +
"onent: \' + response.statusText);\r\n }\r\n " +
" updateTotalCost();\r\n }\r\n\r\n updateComp" +
"onentAsync(id, componentRow.find(\'input.description\').val(), componentRow.find(\'" +
"input.cost\').val());\r\n } else {\r\n // Add\r\n " +
" async function addComponentAsync(description, cost) {\r\n " +
" const body = new FormData();\r\n body.append" +
"(\'__RequestVerificationToken\', document.body.dataset.antiforgery);\r\n " +
" body.append(\'description\', description);\r\n bo" +
"dy.append(\'cost\', cost);\r\n\r\n const response = await fetch" +
"($jobComponents.attr(\'data-addurl\'), {\r\n method: \'POS" +
"T\',\r\n body: body\r\n });\r\n\r\n " +
" componentRow.find(\'input\').attr(\'disabled\', false).removeCla" +
"ss(\'updating\');\r\n\r\n if (response.ok) {\r\n " +
" const component = await response.json();\r\n " +
" componentRow.attr(\'data-jobcomponentid\', component.Id);\r\n " +
" componentRow.find(\'input.description\').val(component.Description);\r\n " +
" componentRow.find(\'input.cost\').val(component.Cost);\r\n " +
" } else {\r\n alert(\'Unable to add c" +
"omponent: \' + response.statusText);\r\n }\r\n " +
" updateTotalCost();\r\n }\r\n addCompon" +
"entAsync(componentRow.find(\'input.description\').val(), componentRow.find(\'input." +
"cost\').val())\r\n }\r\n }\r\n updateTotalCost();\r" +
"\n\r\n });\r\n </script>\r\n");
#line 119 "..\..\Views\Job\JobParts\Components.cshtml"
Write(Url.Action(MVC.API.Job.ComponentRemove()));
#line default
#line hidden
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
" data: data,\r\n success: function (d) {\r\n " +
" if (d == \'OK\') {\r\n " +
" 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 176 "..\..\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 200 "..\..\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>
");
#line 224 "..\..\Views\Job\JobParts\Components.cshtml"
#line 232 "..\..\Views\Job\JobParts\Components.cshtml"
}
#line default
+53 -39
View File
@@ -33,9 +33,10 @@
</table>
@if (canEdit)
{
<div id="dialogFlagsAction" title="Add Flag">
<div id="dialogFlagsAction" class="dialog" title="Add Flag">
@using (Html.BeginForm(MVC.API.Job.UpdateFlag(Model.Job.Id, null, null, true)))
{
@Html.AntiForgeryToken()
<input id="dialogFlagsActionFlag" type="hidden" name="Flag" value="0" />
<h3>Reason:</h3>
<p>
@@ -46,57 +47,70 @@
<script type="text/javascript">
$('#jobDetailTabItems').append('<li><a href="#jobDetailTab-Flags">Flags [@(validFlags.SelectMany(g => g.Value).Count(f => f.Item3))]</a></li>');
$(function () {
var $flagCheckboxes = $('#jobFlags').find('input[type="checkbox"]');
var $dialogFlagsAction = $('#dialogFlagsAction');
var $flagCheckbox;
const $flagCheckboxes = $('#jobFlags').find('input[type="checkbox"]');
let $dialogFlagsAction = null;
var updateFlags = function () {
$flagCheckbox = $(this);
var flagValue = $flagCheckbox.val();
const $flagCheckbox = $(this);
const 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();
const title = 'Add Flag: ' + $flagCheckbox.closest('tr').find('th .flagGroupName').text() + ': ' + $('#jobFlagLabel_' + flagValue).text();
if (!$dialogFlagsAction) {
$dialogFlagsAction = $('#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);
}
});
}
$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);
});
const body = new FormData();
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
body.append('Flag', '-' + flagValue);
fetch('@(Url.Action(MVC.API.Job.UpdateFlag(Model.Job.Id, null, null, false)))', {
method: 'post',
body: body
}).then(r => {
if (r.ok) {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
alert('Unable to change Flag:\n' + r.statusText);
$ajaxLoading.hide();
}
}).catch(e => {
alert('Unable to change Flag:\n' + e);
$ajaxLoading.hide();
});
}
}
$flagCheckboxes.on('click', updateFlags);
});
</script>
}
else
+69 -57
View File
@@ -240,6 +240,8 @@ WriteLiteral(" <div");
WriteLiteral(" id=\"dialogFlagsAction\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Add Flag\"");
WriteLiteral(">\r\n");
@@ -254,6 +256,20 @@ WriteLiteral(">\r\n");
#line 37 "..\..\Views\Job\JobParts\Flags.cshtml"
using (Html.BeginForm(MVC.API.Job.UpdateFlag(Model.Job.Id, null, null, true)))
{
#line default
#line hidden
#line 39 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
#line 39 "..\..\Views\Job\JobParts\Flags.cshtml"
#line default
@@ -281,7 +297,7 @@ WriteLiteral(" class=\"block\"");
WriteLiteral("></textarea>\r\n </p>\r\n");
#line 44 "..\..\Views\Job\JobParts\Flags.cshtml"
#line 45 "..\..\Views\Job\JobParts\Flags.cshtml"
}
@@ -297,79 +313,75 @@ WriteLiteral(">\r\n $(\'#jobDetailTabItems\').append(\'<li><a href=\"
"Flags [");
#line 47 "..\..\Views\Job\JobParts\Flags.cshtml"
#line 48 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(validFlags.SelectMany(g => g.Value).Count(f => f.Item3));
#line default
#line hidden
WriteLiteral(@"]</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('");
WriteLiteral("]</a></li>\');\r\n $(function () {\r\n const $flagCheckboxes" +
" = $(\'#jobFlags\').find(\'input[type=\"checkbox\"]\');\r\n let $dialogFl" +
"agsAction = null;\r\n\r\n var updateFlags = function () {\r\n " +
" const $flagCheckbox = $(this);\r\n const flagValue = " +
"$flagCheckbox.val();\r\n\r\n if ($flagCheckbox.is(\':checked\')) {\r" +
"\n // Add\r\n $(\'#dialogFlagsActionFl" +
"ag\').val(flagValue);\r\n const title = \'Add Flag: \' + $flag" +
"Checkbox.closest(\'tr\').find(\'th .flagGroupName\').text() + \': \' + $(\'#jobFlagLabe" +
"l_\' + flagValue).text();\r\n\r\n if (!$dialogFlagsAction) {\r\n" +
" $dialogFlagsAction = $(\'#dialogFlagsAction\').dialog(" +
"{\r\n resizable: false,\r\n " +
" height: 240,\r\n modal: true,\r\n " +
" autoOpen: false,\r\n buttons: {\r\n" +
" \"Add\": function () {\r\n " +
" var $this = $(this);\r\n " +
"$this.dialog(\"disable\");\r\n $this.dialog(\"" +
"option\", \"buttons\", null);\r\n $this.find(\'" +
"form\').first().submit();\r\n },\r\n " +
" Cancel: function () {\r\n " +
" $(this).dialog(\"close\");\r\n }\r\n " +
" },\r\n close: function () {\r\n" +
" $flagCheckbox.prop(\'checked\', false);\r\n " +
" }\r\n });\r\n " +
" }\r\n\r\n $dialogFlagsAction.dialog(\'option\', \'title\'," +
" title);\r\n $dialogFlagsAction.dialog(\'open\');\r\n " +
" } else {\r\n // Remove\r\n v" +
"ar $ajaxLoading = $flagCheckbox.closest(\'tr\').find(\'span.ajaxLoading\');\r\n " +
" $ajaxLoading.show();\r\n\r\n const body = ne" +
"w FormData();\r\n body.append(\'__RequestVerificationToken\'," +
" document.body.dataset.antiforgery);\r\n body.append(\'Flag\'" +
", \'-\' + flagValue);\r\n fetch(\'");
#line 67 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(Url.Action(MVC.API.Job.UpdateFlag(Model.Job.Id, null, null, false)));
#line 95 "..\..\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);
WriteLiteral(@"', {
method: 'post',
body: body
}).then(r => {
if (r.ok) {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
alert('Unable to change Flag:\n' + r.statusText);
$ajaxLoading.hide();
}
}).catch(e => {
alert('Unable to change Flag:\n' + e);
$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);
});
$flagCheckboxes.on('click', updateFlags);
});
</script>
");
#line 101 "..\..\Views\Job\JobParts\Flags.cshtml"
#line 115 "..\..\Views\Job\JobParts\Flags.cshtml"
}
else
{
@@ -381,7 +393,7 @@ WriteLiteral(" <script>\r\n $(\'#jobDetailTabItems\').append(\
"tailTab-Flags\">Flags [");
#line 105 "..\..\Views\Job\JobParts\Flags.cshtml"
#line 119 "..\..\Views\Job\JobParts\Flags.cshtml"
Write(validFlags.SelectMany(g => g.Value).Count(f => f.Item3));
@@ -390,7 +402,7 @@ WriteLiteral(" <script>\r\n $(\'#jobDetailTabItems\').append(\
WriteLiteral("]</a></li>\');\r\n </script>\r\n");
#line 107 "..\..\Views\Job\JobParts\Flags.cshtml"
#line 121 "..\..\Views\Job\JobParts\Flags.cshtml"
}
@@ -116,6 +116,7 @@
<div id="Job_Show_Queues_Actions_Remove_Dialog" class="dialog" title="Remove this Job from the queue?">
@using (Html.BeginForm(MVC.API.JobQueueJob.RemoveJob()))
{
@Html.AntiForgeryToken()
<input id="Job_Show_Queues_Actions_Remove_Dialog_Id" type="hidden" name="id" value="" />
<p>
<i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;Are you sure?
@@ -133,6 +134,7 @@
<div id="Job_Show_Queues_Actions_EditAddedComment_Dialog" class="dialog" title="Edit the Added Comment">
@using (Html.BeginForm(MVC.API.JobQueueJob.UpdateAddedComment()))
{
@Html.AntiForgeryToken()
<input id="Job_Show_Queues_Actions_EditAddedComment_Dialog_Id" type="hidden" name="id" value="" />
<input type="hidden" name="redirect" value="true" />
<h4>Comment:</h4>
@@ -144,6 +146,7 @@
<div id="Job_Show_Queues_Actions_EditRemovedComment_Dialog" class="dialog" title="Edit the Removed Comment">
@using (Html.BeginForm(MVC.API.JobQueueJob.UpdateRemovedComment()))
{
@Html.AntiForgeryToken()
<input id="Job_Show_Queues_Actions_EditRemovedComment_Dialog_Id" type="hidden" name="id" value="" />
<input type="hidden" name="redirect" value="true" />
<h4>Comment:</h4>
@@ -155,6 +158,7 @@
<div id="Job_Show_Queues_Actions_EditSla_Dialog" class="dialog" title="Edit the SLA">
@using (Html.BeginForm(MVC.API.JobQueueJob.UpdateSlaAndPriority()))
{
@Html.AntiForgeryToken()
<input id="Job_Show_Queues_Actions_EditSla_Dialog_Id" type="hidden" name="id" value="" />
<input type="hidden" name="redirect" value="true" />
<div class="priority">
@@ -762,6 +762,20 @@ WriteLiteral(">\r\n");
#line 117 "..\..\Views\Job\JobParts\Queues.cshtml"
using (Html.BeginForm(MVC.API.JobQueueJob.RemoveJob()))
{
#line default
#line hidden
#line 119 "..\..\Views\Job\JobParts\Queues.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
#line 119 "..\..\Views\Job\JobParts\Queues.cshtml"
#line default
@@ -815,7 +829,7 @@ WriteLiteral(" for=\"Job_Show_Queues_Actions_Remove_Dialog_CloseJob\"");
WriteLiteral(">Close the Job</label>\r\n </div>\r\n");
#line 131 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 132 "..\..\Views\Job\JobParts\Queues.cshtml"
}
@@ -834,15 +848,29 @@ WriteLiteral(" title=\"Edit the Added Comment\"");
WriteLiteral(">\r\n");
#line 134 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 135 "..\..\Views\Job\JobParts\Queues.cshtml"
#line default
#line hidden
#line 134 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 135 "..\..\Views\Job\JobParts\Queues.cshtml"
using (Html.BeginForm(MVC.API.JobQueueJob.UpdateAddedComment()))
{
#line default
#line hidden
#line 137 "..\..\Views\Job\JobParts\Queues.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
#line 137 "..\..\Views\Job\JobParts\Queues.cshtml"
#line default
@@ -882,7 +910,7 @@ WriteLiteral(" class=\"block\"");
WriteLiteral("></textarea>\r\n </p>\r\n");
#line 142 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 144 "..\..\Views\Job\JobParts\Queues.cshtml"
}
@@ -901,15 +929,29 @@ WriteLiteral(" title=\"Edit the Removed Comment\"");
WriteLiteral(">\r\n");
#line 145 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 147 "..\..\Views\Job\JobParts\Queues.cshtml"
#line default
#line hidden
#line 145 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 147 "..\..\Views\Job\JobParts\Queues.cshtml"
using (Html.BeginForm(MVC.API.JobQueueJob.UpdateRemovedComment()))
{
#line default
#line hidden
#line 149 "..\..\Views\Job\JobParts\Queues.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
#line 149 "..\..\Views\Job\JobParts\Queues.cshtml"
#line default
@@ -949,7 +991,7 @@ WriteLiteral(" class=\"block\"");
WriteLiteral("></textarea>\r\n </p>\r\n");
#line 153 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 156 "..\..\Views\Job\JobParts\Queues.cshtml"
}
@@ -968,15 +1010,29 @@ WriteLiteral(" title=\"Edit the SLA\"");
WriteLiteral(">\r\n");
#line 156 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 159 "..\..\Views\Job\JobParts\Queues.cshtml"
#line default
#line hidden
#line 156 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 159 "..\..\Views\Job\JobParts\Queues.cshtml"
using (Html.BeginForm(MVC.API.JobQueueJob.UpdateSlaAndPriority()))
{
#line default
#line hidden
#line 161 "..\..\Views\Job\JobParts\Queues.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
#line 161 "..\..\Views\Job\JobParts\Queues.cshtml"
#line default
@@ -1023,13 +1079,13 @@ WriteLiteral(" autofocus=\"autofocus\"");
WriteLiteral(">\r\n");
#line 165 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 169 "..\..\Views\Job\JobParts\Queues.cshtml"
#line default
#line hidden
#line 165 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 169 "..\..\Views\Job\JobParts\Queues.cshtml"
foreach (var priorityItem in Enum.GetNames(typeof(JobQueuePriority)))
{
@@ -1038,20 +1094,20 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <option");
WriteAttribute("value", Tuple.Create(" value=\"", 8819), Tuple.Create("\"", 8842)
WriteAttribute("value", Tuple.Create(" value=\"", 8971), Tuple.Create("\"", 8994)
#line 167 "..\..\Views\Job\JobParts\Queues.cshtml"
, Tuple.Create(Tuple.Create("", 8827), Tuple.Create<System.Object, System.Int32>(priorityItem
#line 171 "..\..\Views\Job\JobParts\Queues.cshtml"
, Tuple.Create(Tuple.Create("", 8979), Tuple.Create<System.Object, System.Int32>(priorityItem
#line default
#line hidden
, 8827), false)
, 8979), false)
);
WriteLiteral(">");
#line 167 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 171 "..\..\Views\Job\JobParts\Queues.cshtml"
Write(priorityItem);
@@ -1060,7 +1116,7 @@ WriteLiteral(">");
WriteLiteral("</option>\r\n");
#line 168 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 172 "..\..\Views\Job\JobParts\Queues.cshtml"
}
@@ -1086,7 +1142,7 @@ WriteLiteral(" placeholder=\"None\"");
WriteLiteral(" />\r\n </p>\r\n </div>\r\n");
#line 178 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 182 "..\..\Views\Job\JobParts\Queues.cshtml"
}
@@ -1109,7 +1165,7 @@ WriteLiteral(@">
var dialogEditSla_BothUrl = '");
#line 188 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 192 "..\..\Views\Job\JobParts\Queues.cshtml"
Write(Url.Action(MVC.API.JobQueueJob.UpdateSlaAndPriority()));
@@ -1118,7 +1174,7 @@ WriteLiteral(@">
WriteLiteral("\';\r\n var dialogEditSla_SlaUrl = \'");
#line 189 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 193 "..\..\Views\Job\JobParts\Queues.cshtml"
Write(Url.Action(MVC.API.JobQueueJob.UpdateSla()));
@@ -1127,7 +1183,7 @@ WriteLiteral("\';\r\n var dialogEditSla_SlaUrl = \'");
WriteLiteral("\';\r\n var dialogEditSla_PriorityUrl = \'");
#line 190 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 194 "..\..\Views\Job\JobParts\Queues.cshtml"
Write(Url.Action(MVC.API.JobQueueJob.UpdatePriority()));
@@ -1249,7 +1305,7 @@ WriteLiteral("\';\r\n\r\n jobQueues.on(\'click\', \'a.remove\', funct
"script>\r\n");
#line 392 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 396 "..\..\Views\Job\JobParts\Queues.cshtml"
}
else
{
@@ -1264,7 +1320,7 @@ WriteLiteral(" class=\"none\"");
WriteLiteral(">This job has no associated queue history</div>\r\n");
#line 396 "..\..\Views\Job\JobParts\Queues.cshtml"
#line 400 "..\..\Views\Job\JobParts\Queues.cshtml"
}
#line default
+29 -29
View File
@@ -30,7 +30,6 @@
{
<td id="CommentsContainer">
<div id="Comments" class="@(canAddLogs ? "canAddLogs" : "cannotAddLogs") @(canRemoveAnyLogs ? "canRemoveAnyLogs" : "cannotRemoveAnyLogs") @(canRemoveOwnLogs ? "canRemoveOwnLogs" : "cannotRemoveOwnLogs")" data-jobid="@Model.Job.Id" data-addurl="@Url.Action(MVC.API.Job.CommentAdd(Model.Job.Id))" data-removeurl="@Url.Action(MVC.API.Job.CommentRemove())" data-geturl="@Url.Action(MVC.API.Job.Comment())" data-userid="@CurrentUser.UserId">
@Html.AntiForgeryToken()
<div class="commentOutput">
@foreach (var jl in Model.Job.JobLogs.OrderBy(m => m.Timestamp))
{
@@ -54,8 +53,7 @@
@if (canShowAttachments)
{
<td id="AttachmentsContainer">
<div id="Attachments" class="@(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments") @(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments") @(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments")" data-userid="@CurrentUser.UserId" data-uploadurl="@(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)))" data-onlineuploadurl="@(Url.Action(MVC.API.Job.AttachmentOnlineUploadSession(Model.Job.Id)))" data-qrcodeurl="@Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js")">
@Html.AntiForgeryToken()
<div id="Attachments" class="@(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments") @(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments") @(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments")" data-userid="@CurrentUser.UserId" data-uploadurl="@(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)))" data-onlineuploadurl="@(Url.Action(MVC.API.Job.AttachmentOnlineUploadSession(Model.Job.Id)))" data-qrcodeurl="@Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js")" data-removeurl="@Url.Action(MVC.API.Job.AttachmentRemove())">
<div class="Disco-AttachmentUpload-DropTarget">
<h2>Drop Attachments Here</h2>
</div>
@@ -143,7 +141,7 @@
$CommentInput.prop('disabled', true);
const formData = new FormData();
formData.append('__RequestVerificationToken', $Comments.find('input[name="__RequestVerificationToken"]').val());
formData.append('__RequestVerificationToken', document.body.dataset.antiforgery);
formData.append('comment', comment);
const response = await fetch($Comments.attr('data-addurl'), {
@@ -171,7 +169,7 @@
async function removeComment(commentId) {
const formData = new FormData();
formData.append('__RequestVerificationToken', $Comments.find('input[name="__RequestVerificationToken"]').val());
formData.append('__RequestVerificationToken', document.body.dataset.antiforgery);
formData.append('id', commentId);
const response = await fetch($Comments.attr('data-removeurl'), {
@@ -221,7 +219,7 @@
async function loadLiveComment(id) {
const formData = new FormData();
formData.append('__RequestVerificationToken', $Comments.find('input[name="__RequestVerificationToken"]').val());
formData.append('__RequestVerificationToken', document.body.dataset.antiforgery);
formData.append('id', id);
const response = await fetch($Comments.attr('data-geturl'), {
@@ -361,8 +359,6 @@
function removeLocalAttachment() {
$this = $(this).closest('a');
var data = { id: $this.attr('data-attachmentid') };
if (!$dialogRemoveAttachment) {
$dialogRemoveAttachment = $('<div class="dialog" title="Remove this Attachment?"><p><i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;Are you sure?</p></div>')
.appendTo(document.body)
@@ -374,29 +370,33 @@
});
}
$dialogRemoveAttachment.dialog("enable").dialog('option', 'buttons', {
"Remove": function () {
$dialogRemoveAttachment.dialog("disable");
$dialogRemoveAttachment.dialog("option", "buttons", null);
$.ajax({
url: '@Url.Action(MVC.API.Job.AttachmentRemove())',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
// Should be removed via Repository Notifications
} else {
alert('Unable to remove attachment: ' + d);
}
$dialogRemoveAttachment.dialog("close");
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to remove attachment: ' + textStatus);
$dialogRemoveAttachment.dialog("close");
}
async function removeAttachmentAsync(id) {
const body = new FormData();
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
body.append('id', id);
try {
const response = await fetch($Attachments.attr('data-removeurl'), {
body: body,
method: 'POST'
});
if (!response.ok) {
alert('Unable to remove attachment: ' + response.statusText);
}
$dialogRemoveAttachment.dialog("close");
} catch (e) {
alert('Unable to remove attachment: ' + e);
$dialogRemoveAttachment.dialog("close");
}
}
const attachmentId = $this.attr('data-attachmentid');
$dialogRemoveAttachment.dialog('option', 'buttons', {
"Remove": function () {
$dialogRemoveAttachment.dialog("option", "buttons", null);
removeAttachmentAsync(attachmentId);
},
"Cancel": function () {
Cancel: function () {
$dialogRemoveAttachment.dialog("close");
}
}).dialog('open');
@@ -199,31 +199,20 @@ WriteLiteral(" data-userid=\"");
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(">\r\n <div");
WriteLiteral(" class=\"commentOutput\"");
WriteLiteral(">\r\n");
#line 35 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 34 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 35 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 34 "..\..\Views\Job\JobParts\Resources.cshtml"
foreach (var jl in Model.Job.JobLogs.OrderBy(m => m.Timestamp))
{
@@ -235,7 +224,7 @@ WriteLiteral(" <div");
WriteLiteral(" data-logid=\"");
#line 37 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 36 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Id);
@@ -250,7 +239,7 @@ WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 37 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.TechUser.ToStringFriendly());
@@ -259,7 +248,7 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 37 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{
@@ -272,7 +261,7 @@ WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 39 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
@@ -284,7 +273,7 @@ WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 39 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Timestamp.ToUnixEpoc());
@@ -292,20 +281,20 @@ WriteLiteral(" data-livestamp=\"");
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2481), Tuple.Create("\"", 2519)
WriteAttribute("title", Tuple.Create(" title=\"", 2435), Tuple.Create("\"", 2473)
#line 39 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2489), Tuple.Create<System.Object, System.Int32>(jl.Timestamp.ToFullDateTime()
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2443), Tuple.Create<System.Object, System.Int32>(jl.Timestamp.ToFullDateTime()
#line default
#line hidden
, 2489), false)
, 2443), false)
);
WriteLiteral(">");
#line 39 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Timestamp.ToFullDateTime());
@@ -318,7 +307,7 @@ WriteLiteral(" class=\"comment\"");
WriteLiteral(">");
#line 40 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 39 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Comments.ToHtmlComment());
@@ -327,7 +316,7 @@ WriteLiteral(">");
WriteLiteral("</div>\r\n </div>\r\n");
#line 42 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 41 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -336,13 +325,13 @@ WriteLiteral("</div>\r\n </div>\r\n");
WriteLiteral(" </div>\r\n");
#line 44 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 43 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 44 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 43 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddLogs)
{
@@ -370,7 +359,7 @@ WriteLiteral(" title=\"Add Comment\"");
WriteLiteral("></span>\r\n </div>\r\n");
#line 50 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 49 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -379,7 +368,7 @@ WriteLiteral("></span>\r\n </div>\r\n");
WriteLiteral(" </div>\r\n </td>\r\n");
#line 53 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 52 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -388,7 +377,7 @@ WriteLiteral(" </div>\r\n </td>\r\n");
WriteLiteral(" ");
#line 54 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 53 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments)
{
@@ -403,34 +392,34 @@ WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"Attachments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 3335), Tuple.Create("\"", 3582)
WriteAttribute("class", Tuple.Create(" class=\"", 3289), Tuple.Create("\"", 3536)
#line 57 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3343), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3297), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line default
#line hidden
, 3343), false)
, 3297), false)
#line 57 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 3410), Tuple.Create<System.Object, System.Int32>(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments"
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 3364), Tuple.Create<System.Object, System.Int32>(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments"
#line default
#line hidden
, 3411), false)
, 3365), false)
#line 57 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 3496), Tuple.Create<System.Object, System.Int32>(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments"
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 3450), Tuple.Create<System.Object, System.Int32>(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments"
#line default
#line hidden
, 3497), false)
, 3451), false)
);
WriteLiteral(" data-userid=\"");
#line 57 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(CurrentUser.UserId);
@@ -441,7 +430,7 @@ WriteLiteral("\"");
WriteLiteral(" data-uploadurl=\"");
#line 57 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)));
@@ -452,7 +441,7 @@ WriteLiteral("\"");
WriteLiteral(" data-onlineuploadurl=\"");
#line 57 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentOnlineUploadSession(Model.Job.Id)));
@@ -463,7 +452,7 @@ WriteLiteral("\"");
WriteLiteral(" data-qrcodeurl=\"");
#line 57 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js"));
@@ -471,18 +460,18 @@ WriteLiteral(" data-qrcodeurl=\"");
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
WriteLiteral(" data-removeurl=\"");
#line 58 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Html.AntiForgeryToken());
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentRemove()));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral("\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" class=\"Disco-AttachmentUpload-DropTarget\"");
@@ -494,13 +483,13 @@ WriteLiteral(" class=\"attachmentOutput\"");
WriteLiteral(">\r\n");
#line 63 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 61 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 63 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 61 "..\..\Views\Job\JobParts\Resources.cshtml"
foreach (var ja in Model.Job.JobAttachments.OrderByDescending(a => a.Id))
{
@@ -509,20 +498,20 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 4281), Tuple.Create("\"", 4338)
WriteAttribute("href", Tuple.Create(" href=\"", 4250), Tuple.Create("\"", 4307)
#line 65 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4288), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
#line 63 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4257), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
#line default
#line hidden
, 4288), false)
, 4257), false)
);
WriteLiteral(" data-attachmentid=\"");
#line 65 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 63 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Id);
@@ -533,7 +522,7 @@ WriteLiteral("\"");
WriteLiteral(" data-mimetype=\"");
#line 65 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 63 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.MimeType);
@@ -545,28 +534,28 @@ WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 4448), Tuple.Create("\"", 4468)
WriteAttribute("title", Tuple.Create(" title=\"", 4417), Tuple.Create("\"", 4437)
#line 66 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4456), Tuple.Create<System.Object, System.Int32>(ja.Filename
#line 64 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4425), Tuple.Create<System.Object, System.Int32>(ja.Filename
#line default
#line hidden
, 4456), false)
, 4425), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 4539), Tuple.Create("\"", 4598)
WriteAttribute("src", Tuple.Create(" src=\"", 4508), Tuple.Create("\"", 4567)
#line 67 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4545), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
#line 65 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4514), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
#line default
#line hidden
, 4545), false)
, 4514), false)
);
WriteLiteral(" />\r\n </span>\r\n <sp" +
@@ -574,40 +563,40 @@ WriteLiteral(" />\r\n </span>\r\n
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 4699), Tuple.Create("\"", 4719)
WriteAttribute("title", Tuple.Create(" title=\"", 4668), Tuple.Create("\"", 4688)
#line 69 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4707), Tuple.Create<System.Object, System.Int32>(ja.Comments
#line 67 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4676), Tuple.Create<System.Object, System.Int32>(ja.Comments
#line default
#line hidden
, 4707), false)
, 4676), false)
);
WriteLiteral(">\r\n");
#line 70 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 68 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 70 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 68 "..\..\Views\Job\JobParts\Resources.cshtml"
if (!string.IsNullOrEmpty(ja.DocumentTemplateId))
{
#line default
#line hidden
#line 71 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 69 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.DocumentTemplate.Description);
#line default
#line hidden
#line 71 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 69 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else
{
@@ -615,14 +604,14 @@ WriteLiteral(">\r\n");
#line default
#line hidden
#line 73 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 71 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Comments ?? ja.Filename);
#line default
#line hidden
#line 73 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 71 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
@@ -634,7 +623,7 @@ WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 74 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 72 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.TechUser.ToStringFriendly());
@@ -643,7 +632,7 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 74 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 72 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ja.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{
@@ -656,7 +645,7 @@ WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 75 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 73 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
@@ -668,7 +657,7 @@ WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 75 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 73 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Timestamp.ToUnixEpoc());
@@ -676,20 +665,20 @@ WriteLiteral(" data-livestamp=\"");
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 5404), Tuple.Create("\"", 5442)
WriteAttribute("title", Tuple.Create(" title=\"", 5373), Tuple.Create("\"", 5411)
#line 75 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 5412), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
#line 73 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 5381), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
#line default
#line hidden
, 5412), false)
, 5381), false)
);
WriteLiteral(">");
#line 75 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 73 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Timestamp.ToFullDateTime());
@@ -698,7 +687,7 @@ WriteLiteral(">");
WriteLiteral("</span>\r\n </a>\r\n");
#line 77 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 75 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -707,13 +696,13 @@ WriteLiteral("</span>\r\n </a>\r\n");
WriteLiteral(" </div>\r\n");
#line 79 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 77 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 79 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 77 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddAttachments)
{
@@ -751,7 +740,7 @@ WriteLiteral(" title=\"Upload with Online Services\"");
WriteLiteral("></span>\r\n </div>\r\n");
#line 85 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 83 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -760,7 +749,7 @@ WriteLiteral("></span>\r\n </div>\r\n");
WriteLiteral(" </div>\r\n </td>\r\n");
#line 88 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 86 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -769,7 +758,7 @@ WriteLiteral(" </div>\r\n </td>\r\n");
WriteLiteral(" </tr>\r\n</table>\r\n");
#line 91 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 89 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs)
{
@@ -801,13 +790,13 @@ WriteLiteral(@" <script>
");
#line 115 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 113 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 115 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 113 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddLogs)
{
@@ -827,18 +816,18 @@ WriteLiteral("\r\n //#region Add Logs\r\n\r\n const $Comme
" $CommentInput.focus();\r\n return;\r\n " +
" }\r\n\r\n $CommentInput.prop(\'disabled\', true);\r\n\r\n " +
" const formData = new FormData();\r\n formData.append(\'__Reque" +
"stVerificationToken\', $Comments.find(\'input[name=\"__RequestVerificationToken\"]\')" +
".val());\r\n formData.append(\'comment\', comment);\r\n\r\n " +
" const response = await fetch($Comments.attr(\'data-addurl\'), {\r\n " +
" method: \'POST\',\r\n body: formData\r\n });\r\n\r" +
"\n if (response.ok) {\r\n $CommentInput.val(\'\').p" +
"rop(\'disabled\', false).focus();\r\n } else {\r\n a" +
"lert(\'Unable to add comment: \' + response.statusText);\r\n $Com" +
"mentInput.prop(\'disabled\', false).focus();\r\n }\r\n }\r\n\r\n" +
" //#endregion\r\n ");
"stVerificationToken\', document.body.dataset.antiforgery);\r\n formD" +
"ata.append(\'comment\', comment);\r\n\r\n const response = await fetch(" +
"$Comments.attr(\'data-addurl\'), {\r\n method: \'POST\',\r\n " +
" body: formData\r\n });\r\n\r\n if (response.o" +
"k) {\r\n $CommentInput.val(\'\').prop(\'disabled\', false).focus();" +
"\r\n } else {\r\n alert(\'Unable to add comment: \' " +
"+ response.statusText);\r\n $CommentInput.prop(\'disabled\', fals" +
"e).focus();\r\n }\r\n }\r\n\r\n //#endregion\r\n " +
" ");
#line 163 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 161 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -847,7 +836,7 @@ WriteLiteral("\r\n //#region Add Logs\r\n\r\n const $Comme
WriteLiteral(" ");
#line 164 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 162 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs || canRemoveOwnLogs)
{
@@ -862,7 +851,7 @@ WriteLiteral(@"
async function removeComment(commentId) {
const formData = new FormData();
formData.append('__RequestVerificationToken', $Comments.find('input[name=""__RequestVerificationToken""]').val());
formData.append('__RequestVerificationToken', document.body.dataset.antiforgery);
formData.append('id', commentId);
const response = await fetch($Comments.attr('data-removeurl'), {
@@ -920,7 +909,7 @@ WriteLiteral(@"></i>&nbsp;Are you sure?</p></div>')
");
#line 219 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 217 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -928,50 +917,50 @@ WriteLiteral(@"></i>&nbsp;Are you sure?</p></div>')
#line hidden
WriteLiteral("\r\n async function loadLiveComment(id) {\r\n\r\n const formD" +
"ata = new FormData();\r\n formData.append(\'__RequestVerificationTok" +
"en\', $Comments.find(\'input[name=\"__RequestVerificationToken\"]\').val());\r\n " +
" formData.append(\'id\', id);\r\n\r\n const response = await fe" +
"tch($Comments.attr(\'data-geturl\'), {\r\n method: \'POST\',\r\n " +
" body: formData\r\n });\r\n\r\n if (!respo" +
"nse.ok) {\r\n alert(\'Unable to load live comment \' + id + \': \' " +
"+ response.statusText);\r\n } else {\r\n const com" +
"ment = await response.json();\r\n\r\n if ($Comments.hasClass(\'can" +
"RemoveAnyLogs\'))\r\n addComment(comment, false, true);\r\n " +
" else if ($Comments.hasClass(\'canRemoveOwnLogs\'))\r\n " +
" addComment(comment, false, (comment.AuthorId === $Comments.attr(\'data" +
"-userid\')));\r\n else\r\n addComment(comme" +
"nt, false, false);\r\n }\r\n }\r\n function liveR" +
"emoveComment(id) {\r\n $CommentOutput.children(\'div[data-logid=\"\' +" +
" id + \'\"]\').slideUp(300).delay(300).queue(function () {\r\n con" +
"st $this = $(this);\r\n $this.find(\'.timestamp\').livestamp(\'des" +
"troy\');\r\n $this.remove();\r\n });\r\n }" +
"\r\n function addComment(c, quick, canRemove) {\r\n let t " +
"= \'<div><span class=\"author\" />\';\r\n if (canRemove)\r\n " +
" t += \'<span class=\"remove fa fa-times-circle\" />\';\r\n t += " +
"\'<span class=\"timestamp\" /><div class=\"comment\" /></div>\';\r\n\r\n co" +
"nst e = $(t);\r\n e.attr(\'data-logid\', c.Id);\r\n e.fi" +
"nd(\'.author\').text(c.Author);\r\n e.find(\'.timestamp\').text(c.Times" +
"tampFull).attr(\'title\', c.TimestampFull).livestamp(c.TimestampUnixEpoc);\r\n " +
" e.find(\'.comment\').html(c.HtmlComments);\r\n\r\n $CommentOu" +
"tput.append(e);\r\n\r\n if (!quick) {\r\n e.animate(" +
"{ backgroundColor: \'#ffff99\' }, 500, function () {\r\n e.an" +
"imate({ backgroundColor: \'#fafafa\' }, 500, function () {\r\n " +
" e.css(\'background-color\', \'\');\r\n });\r\n " +
" });\r\n $CommentOutput.animate({ scrollTop: $CommentOutp" +
"ut[0].scrollHeight }, 250)\r\n }\r\n }\r\n\r\n // A" +
"dd Globally Available Functions\r\n document.DiscoFunctions.liveLoadCom" +
"ment = function (id) {\r\n loadLiveComment(id);\r\n };\r\n " +
" document.DiscoFunctions.liveRemoveComment = liveRemoveComment;\r\n " +
" //#endregion\r\n });\r\n </script>\r\n");
"en\', document.body.dataset.antiforgery);\r\n formData.append(\'id\', " +
"id);\r\n\r\n const response = await fetch($Comments.attr(\'data-geturl" +
"\'), {\r\n method: \'POST\',\r\n body: formData\r\n" +
" });\r\n\r\n if (!response.ok) {\r\n " +
"alert(\'Unable to load live comment \' + id + \': \' + response.statusText);\r\n " +
" } else {\r\n const comment = await response.json();\r\n" +
"\r\n if ($Comments.hasClass(\'canRemoveAnyLogs\'))\r\n " +
" addComment(comment, false, true);\r\n else if ($Comm" +
"ents.hasClass(\'canRemoveOwnLogs\'))\r\n addComment(comment, " +
"false, (comment.AuthorId === $Comments.attr(\'data-userid\')));\r\n " +
" else\r\n addComment(comment, false, false);\r\n " +
" }\r\n }\r\n function liveRemoveComment(id) {\r\n " +
" $CommentOutput.children(\'div[data-logid=\"\' + id + \'\"]\').slideUp(300).delay(" +
"300).queue(function () {\r\n const $this = $(this);\r\n " +
" $this.find(\'.timestamp\').livestamp(\'destroy\');\r\n $t" +
"his.remove();\r\n });\r\n }\r\n function addComme" +
"nt(c, quick, canRemove) {\r\n let t = \'<div><span class=\"author\" />" +
"\';\r\n if (canRemove)\r\n t += \'<span class=\"remov" +
"e fa fa-times-circle\" />\';\r\n t += \'<span class=\"timestamp\" /><div" +
" class=\"comment\" /></div>\';\r\n\r\n const e = $(t);\r\n " +
"e.attr(\'data-logid\', c.Id);\r\n e.find(\'.author\').text(c.Author);\r\n" +
" e.find(\'.timestamp\').text(c.TimestampFull).attr(\'title\', c.Times" +
"tampFull).livestamp(c.TimestampUnixEpoc);\r\n e.find(\'.comment\').ht" +
"ml(c.HtmlComments);\r\n\r\n $CommentOutput.append(e);\r\n\r\n " +
" if (!quick) {\r\n e.animate({ backgroundColor: \'#ffff99\' }," +
" 500, function () {\r\n e.animate({ backgroundColor: \'#fafa" +
"fa\' }, 500, function () {\r\n e.css(\'background-color\'," +
" \'\');\r\n });\r\n });\r\n " +
" $CommentOutput.animate({ scrollTop: $CommentOutput[0].scrollHeight }, 250)\r\n " +
" }\r\n }\r\n\r\n // Add Globally Available Functions" +
"\r\n document.DiscoFunctions.liveLoadComment = function (id) {\r\n " +
" loadLiveComment(id);\r\n };\r\n document.DiscoFunctio" +
"ns.liveRemoveComment = liveRemoveComment;\r\n //#endregion\r\n });" +
"\r\n </script>\r\n");
#line 284 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 282 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 285 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 283 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments)
{
@@ -992,7 +981,7 @@ WriteLiteral(@" <script>
var jobId = parseInt('");
#line 298 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 296 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id);
@@ -1003,13 +992,13 @@ WriteLiteral("\');\r\n\r\n //#region Attachments\r\n var $
"tput\');\r\n\r\n");
#line 304 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 302 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 304 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 302 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddAttachments)
{
@@ -1048,7 +1037,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n var attac
" ");
#line 351 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 349 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -1057,13 +1046,13 @@ WriteLiteral("\r\n //#region Add Attachments\r\n var attac
WriteLiteral("\r\n");
#line 353 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 351 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 353 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 351 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -1079,8 +1068,6 @@ WriteLiteral(@"
function removeLocalAttachment() {
$this = $(this).closest('a');
var data = { id: $this.attr('data-attachmentid') };
if (!$dialogRemoveAttachment) {
$dialogRemoveAttachment = $('<div");
@@ -1092,58 +1079,30 @@ WriteLiteral("><p><i");
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral(@"></i>&nbsp;Are you sure?</p></div>')
.appendTo(document.body)
.dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
}
$dialogRemoveAttachment.dialog(""enable"").dialog('option', 'buttons', {
""Remove"": function () {
$dialogRemoveAttachment.dialog(""disable"");
$dialogRemoveAttachment.dialog(""option"", ""buttons"", null);
$.ajax({
url: '");
#line 382 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentRemove()));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
// Should be removed via Repository Notifications
} else {
alert('Unable to remove attachment: ' + d);
}
$dialogRemoveAttachment.dialog(""close"");
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to remove attachment: ' + textStatus);
$dialogRemoveAttachment.dialog(""close"");
}
});
},
""Cancel"": function () {
$dialogRemoveAttachment.dialog(""close"");
}
}).dialog('open');
return false;
}
//#endregion
");
WriteLiteral("></i>&nbsp;Are you sure?</p></div>\')\r\n .appendTo(document." +
"body)\r\n .dialog({\r\n resizable:" +
" false,\r\n height: 140,\r\n m" +
"odal: true,\r\n autoOpen: false\r\n " +
" });\r\n }\r\n\r\n async function removeAttachmentAsync" +
"(id) {\r\n const body = new FormData();\r\n bo" +
"dy.append(\'__RequestVerificationToken\', document.body.dataset.antiforgery);\r\n " +
" body.append(\'id\', id);\r\n\r\n try {\r\n " +
" const response = await fetch($Attachments.attr(\'data-removeurl\'), " +
"{\r\n body: body,\r\n method: " +
"\'POST\'\r\n });\r\n if (!response.ok) {" +
"\r\n alert(\'Unable to remove attachment: \' + response.s" +
"tatusText);\r\n }\r\n $dialogRemoveAtt" +
"achment.dialog(\"close\");\r\n } catch (e) {\r\n " +
" alert(\'Unable to remove attachment: \' + e);\r\n $dialo" +
"gRemoveAttachment.dialog(\"close\");\r\n }\r\n }\r\n\r\n" +
" const attachmentId = $this.attr(\'data-attachmentid\');\r\n " +
" $dialogRemoveAttachment.dialog(\'option\', \'buttons\', {\r\n " +
" \"Remove\": function () {\r\n $dialogRemoveAttachment.dialo" +
"g(\"option\", \"buttons\", null);\r\n removeAttachmentAsync(att" +
"achmentId);\r\n },\r\n Cancel: function () {\r\n" +
" $dialogRemoveAttachment.dialog(\"close\");\r\n " +
" }\r\n }).dialog(\'open\');\r\n\r\n return false;\r\n " +
" }\r\n\r\n //#endregion\r\n\r\n ");
#line 409 "..\..\Views\Job\JobParts\Resources.cshtml"
+121 -94
View File
@@ -117,13 +117,14 @@
</table>
@if (Authorization.Has(Claims.Job.Actions.UpdateSubTypes))
{
<div id="Job_Show_Job_SubTypes_Update_Dialog" title="Update Job Types">
<div id="Job_Show_Job_SubTypes_Update_Dialog" class="dialog" title="Update Job Types">
<div>
<h2>
@Model.Job.JobType.Description
</h2>
@using (Html.BeginForm(MVC.API.Job.UpdateSubTypes(Model.Job.Id, redirect: true), FormMethod.Post, new { id = "formUpdateJobTypes" }))
{
@Html.AntiForgeryToken()
@CommonHelpers.CheckBoxList("SubTypes", Model.UpdatableJobSubTypes.ToSelectListItems(Model.Job.JobSubTypes.ToList()), 3)
<hr />
<div>
@@ -311,7 +312,7 @@
<tr>
<td>Location:</td>
<td>
<span id="Job_Show_Device_DeviceHeld_Location">
<span id="Job_Show_Device_DeviceHeld_Location" data-locationsurl="@Url.Action(MVC.API.Job.DeviceHeldLocations())" data-updateurl="@Url.Action(MVC.API.Job.UpdateDeviceHeldLocation(Model.Job.Id, null))">
@if (canEditLocation)
{
switch (Model.LocationMode)
@@ -371,9 +372,10 @@
case LocationModes.Unrestricted:
case LocationModes.OptionalList:
<text>
var $deviceHeldLocation = $('#Job_DeviceHeldLocation');
var $ajaxSave = $deviceHeldLocation.next('.ajaxSave');
var autocompleteLoaded = false;
const $deviceHeldLocationContainer = $('#Job_Show_Device_DeviceHeld_Location');
const $deviceHeldLocation = $('#Job_DeviceHeldLocation');
const $ajaxSave = $deviceHeldLocation.next('.ajaxSave');
let autocompleteLoaded = false;
$deviceHeldLocation
.watermark('Unknown')
@@ -381,41 +383,46 @@
$deviceHeldLocation.select();
// Load AutoComplete
if (!autocompleteLoaded){
$.ajax({
url: '@(Url.Action(MVC.API.Job.DeviceHeldLocations()))',
dataType: 'json',
success: function (d) {
if (!autocompleteLoaded) {
$.each(d, function(){
this.value = this.Location;
this.label = this.Location;
});
const body = new FormData();
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
fetch($deviceHeldLocationContainer.attr('data-locationsurl'), {
method: 'POST',
body: body
}).then(r => {
if (r.ok) {
r.json().then(d => {
$.each(d, function () {
this.value = this.Location;
this.label = this.Location;
});
$deviceHeldLocation.autocomplete({
source: d,
minLength: 0,
focus: function(e, ui){
return false;
},
select: function (e, ui) {
$deviceHeldLocation.val(ui.item.Location).blur().change();
return false;
}
}).data('ui-autocomplete')._renderItem = function (ul, item) {
var anchor = $('<a>').append($('<strong>').text(item.Location));
if (item.References){
anchor.append(document.createTextNode(' ['+item.References+']'));
}
var item = $("<li></li>")
.data("item.autocomplete", item)
.append(anchor);
return item.appendTo(ul);
};
$deviceHeldLocation.autocomplete({
source: d,
minLength: 0,
focus: function (e, ui) {
return false;
},
select: function (e, ui) {
$deviceHeldLocation.val(ui.item.Location).blur().change();
return false;
}
}).data('ui-autocomplete')._renderItem = function (ul, item) {
var anchor = $('<a>').append($('<strong>').text(item.Location));
if (item.References) {
anchor.append(document.createTextNode(' [' + item.References + ']'));
}
var item = $("<li></li>")
.data("item.autocomplete", item)
.append(anchor);
return item.appendTo(ul);
};
$deviceHeldLocation.autocomplete('search', '');
$deviceHeldLocation.autocomplete('search', '');
})
}
});
})
autocompleteLoaded = true;
}else{
$deviceHeldLocation.autocomplete('search', '');
@@ -432,23 +439,23 @@
.change(function () {
$ajaxSave.hide();
$ajaxLoading = $ajaxSave.next('.ajaxLoading').show();
var data = { DeviceHeldLocation: $deviceHeldLocation.val() };
$.ajax({
url: '@Url.Action(MVC.API.Job.UpdateDeviceHeldLocation(Model.Job.Id, null))',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to update device held location: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update device held location: ' + textStatus);
const body = new FormData();
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
body.append('DeviceHeldLocation', $deviceHeldLocation.val());
fetch($deviceHeldLocationContainer.attr('data-updateurl'), {
method: 'POST',
body: body
}).then(r => {
if (r.ok) {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to update device held location: ' + r.statusText);
}
}).catch(e => {
alert('Unable to update device held location: ' + e.textStatus);
$ajaxLoading.hide();
});
});
</text>
@@ -606,6 +613,7 @@
</div>
@using (Html.BeginForm(MVC.API.Job.ForceClose(Model.Job.Id, null, true)))
{
@Html.AntiForgeryToken()
<h3>Reason:</h3>
<p>
<textarea name="Reason" class="block"></textarea>
@@ -648,18 +656,21 @@
@if (Model.Job.CanCloseNormally())
{
@Html.ActionLinkSmallButton("Close", MVC.API.Job.Close(Model.Job.Id, true), "Job_Show_Job_Actions_Close_Button")
<button type="button" id="Job_Show_Job_Actions_Close_Button" class="button small">Close</button>
<div id="Job_Show_Job_Actions_Close_Dialog" class="dialog" title="Close this Job?">
@using (Html.BeginForm(MVC.API.Job.Close(Model.Job.Id, true)))
{
@Html.AntiForgeryToken()
}
<p>
<i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;Are you sure?
</p>
</div>
<script type="text/javascript">
$(function () {
var button = $('#Job_Show_Job_Actions_Close_Button');
var buttonDialog = null;
var buttonLink = button.attr('href');
button.attr('href', '#').click(function () {
const button = $('#Job_Show_Job_Actions_Close_Button');
let buttonDialog = null;
button.on('click', function () {
if (!buttonDialog) {
buttonDialog = $('#Job_Show_Job_Actions_Close_Dialog');
buttonDialog.dialog({
@@ -668,10 +679,9 @@
autoOpen: false,
buttons: {
"Close Job": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
window.location.href = buttonLink;
$(this)
.dialog("option", "buttons", null)
.find('form').trigger('submit');
},
Cancel: function () {
$(this).dialog("close");
@@ -688,18 +698,20 @@
}
@if (Model.Job.CanReopen())
{
@Html.ActionLinkSmallButton("Reopen Job", MVC.API.Job.Reopen(Model.Job.Id, true), "Job_Show_Job_Actions_Reopen_Button")
<button id="Job_Show_Job_Actions_Reopen_Button" type="button" class="button small">Reopen Job</button>
<div id="Job_Show_Job_Actions_Reopen_Dialog" class="dialog" title="Reopen this Job?">
@using (Html.BeginForm(MVC.API.Job.Reopen(Model.Job.Id, true)))
{
@Html.AntiForgeryToken()
}
<p>
<i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;Are you sure?
</p>
</div>
<script type="text/javascript">
$(function () {
var button = $('#Job_Show_Job_Actions_Reopen_Button');
var buttonDialog = null;
var buttonLink = button.attr('href');
button.attr('href', '#');
const button = $('#Job_Show_Job_Actions_Reopen_Button');
let buttonDialog = null;
button.click(function () {
if (!buttonDialog) {
buttonDialog = $('#Job_Show_Job_Actions_Reopen_Dialog');
@@ -709,10 +721,9 @@
autoOpen: false,
buttons: {
"Reopen": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
window.location.href = buttonLink;
$(this)
.dialog("option", "buttons", null)
.find('form').trigger('submit');
},
Cancel: function () {
$(this).dialog("close");
@@ -729,18 +740,20 @@
}
@if (Model.Job.CanDelete())
{
@Html.ActionLinkSmallButton("Delete", MVC.API.Job.Delete(Model.Job.Id, true), "Job_Show_Job_Actions_Delete_Button")
<button id="Job_Show_Job_Actions_Delete_Button" type="button" class="button small">Delete</button>
<div id="Job_Show_Job_Actions_Delete_Dialog" class="dialog" title="Delete this Job?">
@using (Html.BeginForm(MVC.API.Job.Delete(Model.Job.Id, true)))
{
@Html.AntiForgeryToken()
}
<p>
<i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;This item will be permanently deleted and cannot be recovered. Are you sure?
</p>
</div>
<script type="text/javascript">
$(function () {
var button = $('#Job_Show_Job_Actions_Delete_Button');
var buttonDialog = null;
var buttonLink = button.attr('href');
button.attr('href', '#');
const button = $('#Job_Show_Job_Actions_Delete_Button');
let buttonDialog = null;
button.click(function () {
if (!buttonDialog) {
buttonDialog = $('#Job_Show_Job_Actions_Delete_Dialog');
@@ -750,10 +763,9 @@
autoOpen: false,
buttons: {
"Delete": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
window.location.href = buttonLink;
$(this)
.dialog("option", "buttons", null)
.find('form').trigger('submit');
},
Cancel: function () {
$(this).dialog("close");
@@ -780,6 +792,7 @@
<div id="Job_Show_Job_Actions_AddQueue_Dialog" class="dialog" title="Add Job to Queue">
@using (Html.BeginForm(MVC.API.JobQueueJob.AddJob()))
{
@Html.AntiForgeryToken()
<input id="Job_Show_Job_Actions_AddQueue_Dialog_Id" type="hidden" name="id" />
<input id="Job_Show_Job_Actions_AddQueue_Dialog_JobId" type="hidden" name="JobId" value="@Model.Job.Id" />
<div class="queuePicker">
@@ -853,10 +866,9 @@
},
"Add to Queue": function () {
if (!!queueId.val()) {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
buttonDialog.find('form').submit();
$(this)
.dialog("option", "buttons", null)
.find('form').trigger('submit');
} else {
alert('Select a Job Queue');
}
@@ -906,8 +918,12 @@
}
@if (Model.Job.CanConvertHWarToHNWar())
{
@Html.ActionLinkSmallButton("Convert to Non-Warranty", MVC.API.Job.ConvertHWarToHNWar(Model.Job.Id, true), "Job_Show_Job_Actions_ConvertToHNWar_Button")
<button id="Job_Show_Job_Actions_ConvertToHNWar_Button" type="button" class="button small">Convert to Non-Warranty</button>
<div id="Job_Show_Job_Actions_ConvertToHNWar_Dialog" class="dialog" title="Convert this Job?">
@using (Html.BeginForm(MVC.API.Job.ConvertHWarToHNWar(Model.Job.Id, true)))
{
@Html.AntiForgeryToken()
}
<p>
<i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;This process is not reversible.<br />
Are you sure?
@@ -915,10 +931,8 @@
</div>
<script type="text/javascript">
$(function () {
var button = $('#Job_Show_Job_Actions_ConvertToHNWar_Button');
var buttonDialog = null;
var buttonLink = button.attr('href');
button.attr('href', '#');
const button = $('#Job_Show_Job_Actions_ConvertToHNWar_Button');
let buttonDialog = null;
button.click(function () {
if (!buttonDialog) {
buttonDialog = $('#Job_Show_Job_Actions_ConvertToHNWar_Dialog');
@@ -928,10 +942,9 @@
autoOpen: false,
buttons: {
"Convert": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
window.location.href = buttonLink;
$(this)
.dialog("option", "buttons", null)
.find('form').trigger('submit');
},
Cancel: function () {
$(this).dialog("close");
@@ -953,15 +966,27 @@
<td id="Job_Show_Device_Actions">
@if (Model.Job.CanDeviceHeld())
{
@Html.ActionLinkSmallButton("Device Held", MVC.API.Job.DeviceHeld(Model.Job.Id, true), "Job_Show_Device_Actions_Held_Button")
using (Html.BeginForm(MVC.API.Job.DeviceHeld(Model.Job.Id, true)))
{
@Html.AntiForgeryToken()
<button id="Job_Show_Device_Actions_Held_Button" type="submit" class="button small">Device Held</button>
}
}
@if (Model.Job.CanDeviceReadyForReturn())
{
@Html.ActionLinkSmallButton("Device Ready For Return", MVC.API.Job.DeviceReadyForReturn(Model.Job.Id, true), "Job_Show_Device_Actions_DeviceReadyForReturn_Button", "alert")
using (Html.BeginForm(MVC.API.Job.DeviceReadyForReturn(Model.Job.Id, true)))
{
@Html.AntiForgeryToken()
<button id="Job_Show_Device_Actions_DeviceReadyForReturn_Button" type="submit" class="button small alert">Device Ready For Return</button>
}
}
@if (Model.Job.CanDeviceReturned())
{
@Html.ActionLinkSmallButton("Device Returned", MVC.API.Job.DeviceReturned(Model.Job.Id, true), "Job_Show_Device_Actions_DeviceReturned_Button", Model.Job.CanDeviceReadyForReturn() ? null : "alert")
using (Html.BeginForm(MVC.API.Job.DeviceReturned(Model.Job.Id, true)))
{
@Html.AntiForgeryToken()
<button id="Job_Show_Device_Actions_DeviceReturned_Button" type="submit" class="button small @(Model.Job.CanDeviceReadyForReturn() ? null : "alert")">Device Returned</button>
}
}
</td>
}
@@ -976,6 +1001,7 @@
<div id="Job_Show_User_Actions_WaitingForUserAction_Dialog" class="dialog" title="Waiting for User Action">
@using (Html.BeginForm(MVC.API.Job.WaitingForUserAction(Model.Job.Id, null, true)))
{
@Html.AntiForgeryToken()
<h3>Reason:</h3>
<p>
<textarea name="Reason" class="block"></textarea>
@@ -1020,6 +1046,7 @@
<div id="Job_Show_User_Actions_NotWaitingForUserAction_Dialog" class="dialog" title="Not Waiting for User Action">
@using (Html.BeginForm(MVC.API.Job.NotWaitingForUserAction(Model.Job.Id, null, true)))
{
@Html.AntiForgeryToken()
<h3>Resolution:</h3>
<p>
<textarea name="Resolution" class="block"></textarea>
File diff suppressed because it is too large Load Diff