789 lines
28 KiB
C#
789 lines
28 KiB
C#
#pragma warning disable 1591
|
|
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This code was generated by a tool.
|
|
// Runtime Version:4.0.30319.42000
|
|
//
|
|
// Changes to this file may cause incorrect behavior and will be lost if
|
|
// the code is regenerated.
|
|
// </auto-generated>
|
|
//------------------------------------------------------------------------------
|
|
|
|
namespace Disco.Web.Views.Job
|
|
{
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Helpers;
|
|
using System.Web.Mvc;
|
|
using System.Web.Mvc.Ajax;
|
|
using System.Web.Mvc.Html;
|
|
using System.Web.Routing;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.WebPages;
|
|
using Disco;
|
|
using Disco.Models.Repository;
|
|
using Disco.Services;
|
|
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/Create.cshtml")]
|
|
public partial class Create : Disco.Services.Web.WebViewPage<Disco.Web.Models.Job.CreateModel>
|
|
{
|
|
public Create()
|
|
{
|
|
}
|
|
public override void Execute()
|
|
{
|
|
|
|
#line 2 "..\..\Views\Job\Create.cshtml"
|
|
|
|
Authorization.Require(Claims.Job.Actions.Create);
|
|
|
|
Layout = MVC.Shared.Views._DialogLayout;
|
|
ViewBag.Title = Html.ToBreadcrumb("Jobs", MVC.Job.Index(), "Create");
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n<div");
|
|
|
|
WriteLiteral(" id=\"createJob_Container\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 9 "..\..\Views\Job\Create.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 9 "..\..\Views\Job\Create.cshtml"
|
|
using (Html.BeginForm(MVC.Job.Create()))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 11 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.AntiForgeryToken());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 11 "..\..\Views\Job\Create.cshtml"
|
|
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 12 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.HiddenFor(m => m.DeviceSerialNumber));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 12 "..\..\Views\Job\Create.cshtml"
|
|
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 13 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.HiddenFor(m => m.UserId));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 13 "..\..\Views\Job\Create.cshtml"
|
|
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 14 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.HiddenFor(m => m.SourceUrl));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 14 "..\..\Views\Job\Create.cshtml"
|
|
|
|
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 16 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.Partial(MVC.Job.Views._CreateSubject, Model));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 16 "..\..\Views\Job\Create.cshtml"
|
|
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 17 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.ValidationSummary(true));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 17 "..\..\Views\Job\Create.cshtml"
|
|
|
|
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <div");
|
|
|
|
WriteLiteral(" id=\"createJob_Types\"");
|
|
|
|
WriteLiteral(" class=\"createJob_Component\"");
|
|
|
|
WriteLiteral(">\r\n <div");
|
|
|
|
WriteLiteral(" id=\"createJob_Type\"");
|
|
|
|
WriteLiteral(">\r\n <h3>Type</h3>\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 22 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.ValidationMessageFor(m => m.Type));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 23 "..\..\Views\Job\Create.cshtml"
|
|
Write(CommonHelpers.RadioButtonList("Type", Model.JobTypes.ToSelectListItems(Model.Type), 3));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 24 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.ValidationMessageFor(m => m.SubTypes));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </div>\r\n <div");
|
|
|
|
WriteLiteral(" id=\"createJob_SubTypes\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 27 "..\..\Views\Job\Create.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 27 "..\..\Views\Job\Create.cshtml"
|
|
foreach (var jt in Model.JobTypes)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <div");
|
|
|
|
WriteAttribute("id", Tuple.Create(" id=\"", 1116), Tuple.Create("\"", 1147)
|
|
, Tuple.Create(Tuple.Create("", 1121), Tuple.Create("createJob_SubType_", 1121), true)
|
|
|
|
#line 29 "..\..\Views\Job\Create.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 1139), Tuple.Create<System.Object, System.Int32>(jt.Id
|
|
|
|
#line default
|
|
#line hidden
|
|
, 1139), false)
|
|
);
|
|
|
|
WriteLiteral(" class=\"createJob_SubType\"");
|
|
|
|
WriteLiteral(">\r\n <div");
|
|
|
|
WriteLiteral(" class=\"createJob_SubTypes\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 31 "..\..\Views\Job\Create.cshtml"
|
|
Write(CommonHelpers.CheckBoxList("SubTypes", jt.JobSubTypes.ToSelectListItems(Model.SubTypes, true), 3, true, null, false));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </div>\r\n </div>\r\n");
|
|
|
|
|
|
#line 34 "..\..\Views\Job\Create.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </div>\r\n </div>\r\n");
|
|
|
|
|
|
#line 37 "..\..\Views\Job\Create.cshtml"
|
|
if (Authorization.Has(Claims.Job.Properties.DeviceHeld)){
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <div");
|
|
|
|
WriteLiteral(" id=\"createJob_DeviceHeldContainer\"");
|
|
|
|
WriteLiteral(" class=\"createJob_Component\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 39 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.ValidationMessageFor(m => m.DeviceHeld));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 40 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.HiddenFor(m => m.DeviceHeld));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n <table>\r\n <tr>\r\n <td>\r\n " +
|
|
" <h3>Device Held</h3>\r\n </td>\r\n " +
|
|
" <td>\r\n <input");
|
|
|
|
WriteLiteral(" id=\"createJob_DeviceHeld\"");
|
|
|
|
WriteLiteral(" name=\"_DeviceHeld\"");
|
|
|
|
WriteLiteral(" type=\"radio\"");
|
|
|
|
WriteLiteral(" value=\"true\"");
|
|
|
|
WriteLiteral(" /><label");
|
|
|
|
WriteLiteral(" for=\"createJob_DeviceHeld\"");
|
|
|
|
WriteLiteral(">Held</label>\r\n </td>\r\n <td>\r\n " +
|
|
" <input");
|
|
|
|
WriteLiteral(" id=\"createJob_DeviceNotHeld\"");
|
|
|
|
WriteLiteral(" name=\"_DeviceHeld\"");
|
|
|
|
WriteLiteral(" type=\"radio\"");
|
|
|
|
WriteLiteral(" value=\"false\"");
|
|
|
|
WriteLiteral(" /><label");
|
|
|
|
WriteLiteral(" for=\"createJob_DeviceNotHeld\"");
|
|
|
|
WriteLiteral(">Not Held</label>\r\n </td>\r\n </tr>\r\n " +
|
|
"</table>\r\n </div>\r\n");
|
|
|
|
|
|
#line 55 "..\..\Views\Job\Create.cshtml"
|
|
}else{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 56 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.Hidden("DeviceHeld", false));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 56 "..\..\Views\Job\Create.cshtml"
|
|
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <div");
|
|
|
|
WriteLiteral(" id=\"createJob_CommentsContainer\"");
|
|
|
|
WriteLiteral(" class=\"createJob_Component\"");
|
|
|
|
WriteLiteral(" data-dynamic=\"");
|
|
|
|
|
|
#line 58 "..\..\Views\Job\Create.cshtml"
|
|
Write(Model.RegenerateCommentsOnTypeChange ? Url.Action(MVC.API.Job.InitialComments()) : null);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\"");
|
|
|
|
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <td>\r\n " +
|
|
" <h3>Comments</h3>\r\n </td>\r\n " +
|
|
" <td>\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 65 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.EditorFor(m => m.Comments));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n " +
|
|
" </div>\r\n");
|
|
|
|
|
|
#line 70 "..\..\Views\Job\Create.cshtml"
|
|
if (Authorization.Has(Claims.Job.Actions.Close)){
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <div");
|
|
|
|
WriteLiteral(" id=\"createJob_QuickLogContainer\"");
|
|
|
|
WriteLiteral(" class=\"createJob_Component\"");
|
|
|
|
WriteLiteral(">\r\n <div");
|
|
|
|
WriteLiteral(" id=\"createJob_QuickLogAutoCloseContainer\"");
|
|
|
|
WriteLiteral(">\r\n <input");
|
|
|
|
WriteLiteral(" id=\"createJob_QuickLog\"");
|
|
|
|
WriteLiteral(" name=\"QuickLog\"");
|
|
|
|
WriteLiteral(" type=\"checkbox\"");
|
|
|
|
WriteLiteral(" value=\"true\"");
|
|
|
|
WriteLiteral(" /><label");
|
|
|
|
WriteLiteral(" for=\"createJob_QuickLog\"");
|
|
|
|
WriteLiteral(">Automatically close this job</label>\r\n </div>\r\n <div");
|
|
|
|
WriteLiteral(" id=\"createJob_QuickLogTaskTimeContainer\"");
|
|
|
|
WriteLiteral(">\r\n <h4>Task Time:</h4>\r\n <input");
|
|
|
|
WriteLiteral(" type=\"radio\"");
|
|
|
|
WriteLiteral(" id=\"createJob_TaskTime5\"");
|
|
|
|
WriteLiteral(" name=\"QuickLogTaskTimeMinutes\"");
|
|
|
|
WriteLiteral(" value=\"5\"");
|
|
|
|
WriteLiteral(" /><label");
|
|
|
|
WriteLiteral(" for=\"createJob_TaskTime5\"");
|
|
|
|
WriteLiteral(">5 Minutes</label>\r\n <input");
|
|
|
|
WriteLiteral(" type=\"radio\"");
|
|
|
|
WriteLiteral(" id=\"createJob_TaskTime10\"");
|
|
|
|
WriteLiteral(" name=\"QuickLogTaskTimeMinutes\"");
|
|
|
|
WriteLiteral(" value=\"10\"");
|
|
|
|
WriteLiteral(" /><label");
|
|
|
|
WriteLiteral(" for=\"createJob_TaskTime10\"");
|
|
|
|
WriteLiteral(">10 Minutes</label>\r\n <input");
|
|
|
|
WriteLiteral(" type=\"radio\"");
|
|
|
|
WriteLiteral(" id=\"createJob_TaskTime30\"");
|
|
|
|
WriteLiteral(" name=\"QuickLogTaskTimeMinutes\"");
|
|
|
|
WriteLiteral(" value=\"30\"");
|
|
|
|
WriteLiteral(" /><label");
|
|
|
|
WriteLiteral(" for=\"createJob_TaskTime30\"");
|
|
|
|
WriteLiteral(">30 Minutes</label>\r\n <input");
|
|
|
|
WriteLiteral(" type=\"radio\"");
|
|
|
|
WriteLiteral(" id=\"createJob_TaskTime60\"");
|
|
|
|
WriteLiteral(" name=\"QuickLogTaskTimeMinutes\"");
|
|
|
|
WriteLiteral(" value=\"60\"");
|
|
|
|
WriteLiteral(" /><label");
|
|
|
|
WriteLiteral(" for=\"createJob_TaskTime60\"");
|
|
|
|
WriteLiteral(">1 Hour</label>\r\n <input");
|
|
|
|
WriteLiteral(" type=\"radio\"");
|
|
|
|
WriteLiteral(" id=\"createJob_TaskTime120\"");
|
|
|
|
WriteLiteral(" name=\"QuickLogTaskTimeMinutes\"");
|
|
|
|
WriteLiteral(" value=\"120\"");
|
|
|
|
WriteLiteral(" /><label");
|
|
|
|
WriteLiteral(" for=\"createJob_TaskTime120\"");
|
|
|
|
WriteLiteral(">2 Hours</label>\r\n <input");
|
|
|
|
WriteLiteral(" type=\"radio\"");
|
|
|
|
WriteLiteral(" id=\"createJob_TaskTimeOther\"");
|
|
|
|
WriteLiteral(" name=\"QuickLogTaskTimeMinutes\"");
|
|
|
|
WriteLiteral(" value=\"\"");
|
|
|
|
WriteLiteral(" /><label");
|
|
|
|
WriteLiteral(" for=\"createJob_TaskTimeOther\"");
|
|
|
|
WriteLiteral(">Other</label>\r\n <span");
|
|
|
|
WriteLiteral(" id=\"createJob_TaskTimeOtherMinutesContainer\"");
|
|
|
|
WriteLiteral(">\r\n <input");
|
|
|
|
WriteLiteral(" type=\"number\"");
|
|
|
|
WriteLiteral(" id=\"createJob_TaskTimeOtherMinutes\"");
|
|
|
|
WriteLiteral(" name=\"QuickLogTaskTimeMinutesOther\"");
|
|
|
|
WriteLiteral(" value=\"\"");
|
|
|
|
WriteLiteral(" disabled=\"disabled\"");
|
|
|
|
WriteLiteral(" />\r\n Minutes\r\n </span>\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 87 "..\..\Views\Job\Create.cshtml"
|
|
Write(Html.ValidationMessageFor(m => m.QuickLogTaskTimeMinutes));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </div>\r\n </div>\r\n");
|
|
|
|
|
|
#line 90 "..\..\Views\Job\Create.cshtml"
|
|
}
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <script");
|
|
|
|
WriteLiteral(" type=\"text/javascript\"");
|
|
|
|
WriteLiteral(">\r\n $(function () {\r\n var discoDialogMethods;\r\n var " +
|
|
"init = true;\r\n //#region Parent Dialog\r\n if (window.parent" +
|
|
" && window.parent.document) {\r\n $(\'#SourceUrl\').val(window.parent" +
|
|
".window.location.href);\r\n\r\n var parentDialog = $(\'#createJobDialo" +
|
|
"g\', window.parent.document);\r\n if (parentDialog.length > 0) {\r\n " +
|
|
" discoDialogMethods = parentDialog[0].discoDialogMethods;\r\n " +
|
|
" var buttons = {\r\n \"Create Job\": function " +
|
|
"() {\r\n createJobForm.submit()\r\n " +
|
|
" },\r\n Cancel: function () {\r\n " +
|
|
" discoDialogMethods.close();\r\n }\r\n }\r\n" +
|
|
"\r\n discoDialogMethods.setButtons(buttons);\r\n }" +
|
|
"\r\n }\r\n //#endregion\r\n\r\n\r\n var createJobForm = $" +
|
|
"(\'form\');\r\n var validator = createJobForm.data(\'validator\');\r\n " +
|
|
" var unobtrusiveValidation = createJobForm.data(\'unobtrusiveValidation\');\r\n\r" +
|
|
"\n // Validate all Fields\r\n validator.settings.ignore = \'\';" +
|
|
"\r\n\r\n //#region Job Type/SubTypes\r\n var $jobTypeContainer =" +
|
|
" $(\'#createJob_Type\');\r\n var $typeValidationMessage = $(\'[data-valmsg" +
|
|
"-for=\"Type\"]\', $jobTypeContainer)\r\n var $subTypesValidationMessage = " +
|
|
"$(\'[data-valmsg-for=\"SubTypes\"]\', $jobTypeContainer)\r\n var $jobTypes " +
|
|
"= $jobTypeContainer.find(\'input[type=\"radio\"]\').change(jobTypeChange);\r\n " +
|
|
" $(\'#createJob_SubTypes\').find(\'input[type=\"checkbox\"]\').change(jobSubTypeHig" +
|
|
"hlight).each(jobSubTypeHighlight);\r\n jobTypeChange();\r\n fu" +
|
|
"nction jobSubTypeHighlight() {\r\n var $this = $(this);\r\n " +
|
|
" if ($this.is(\':checked\'))\r\n $this.closest(\'li\').addClas" +
|
|
"s(\'highlight\');\r\n else\r\n $this.closest(\'li\').r" +
|
|
"emoveClass(\'highlight\');\r\n }\r\n function jobTypeChange() {\r" +
|
|
"\n var $checkedItem = $jobTypes.filter(\':checked\');\r\n\r\n " +
|
|
" $jobTypes.closest(\'li\').removeClass(\'highlight\');\r\n\r\n $check" +
|
|
"edItem.closest(\'li\').addClass(\'highlight\');\r\n\r\n if (init) {\r\n " +
|
|
" var jobType = $checkedItem.val();\r\n $(\'#creat" +
|
|
"eJob_SubType_\' + jobType).show();\r\n } else {\r\n " +
|
|
" $(\'#createJob_SubTypes\').find(\'.createJob_SubType:visible\').slideUp();\r\n " +
|
|
" var jobType = $checkedItem.val();\r\n $(\'#createJo" +
|
|
"b_SubType_\' + jobType).slideDown();\r\n }\r\n }\r\n\r\n " +
|
|
" const initialCommentsUrl = $(\'#createJob_CommentsContainer\').attr(\'data-dyn" +
|
|
"amic\');\r\n if (!!initialCommentsUrl) {\r\n let commentsDi" +
|
|
"rty = false;\r\n $(\'#Comments\').on(\'change\', function () {\r\n " +
|
|
" commentsDirty = true;\r\n });\r\n $(\'#cre" +
|
|
"ateJob_Types\').on(\'change\', \'input\', async function () {\r\n if" +
|
|
" (commentsDirty) {\r\n return;\r\n }\r\n " +
|
|
" const body = new FormData(createJobForm.get(0));\r\n " +
|
|
" const response = await fetch(initialCommentsUrl, {\r\n " +
|
|
" method: \'POST\',\r\n body: body\r\n });\r\n" +
|
|
" if (response.ok) {\r\n const comments =" +
|
|
" await response.json();\r\n $(\'#Comments\').val(comments);\r\n" +
|
|
" } else {\r\n console.error(\'Failed to f" +
|
|
"etch updated initial comments\');\r\n }\r\n })\r\n " +
|
|
" }\r\n\r\n var additionalValidation = function (form) {\r\n " +
|
|
" var isValid = true;\r\n\r\n // Validate Type\r\n " +
|
|
" var typeValue = $jobTypes.filter(\':checked\').val();\r\n if (typeVa" +
|
|
"lue) {\r\n $typeValidationMessage.removeClass(\'field-validation" +
|
|
"-error\').addClass(\'field-validation-valid\');\r\n // Validate Su" +
|
|
"bTypes\r\n if ($(\'#createJob_SubType_\' + typeValue).find(\'input" +
|
|
":checked\').length > 0) {\r\n $subTypesValidationMessage.rem" +
|
|
"oveClass(\'field-validation-error\').addClass(\'field-validation-valid\');\r\n " +
|
|
" } else {\r\n $subTypesValidationMessage.text(\'A" +
|
|
"t least one Job Sub Type is required\').removeClass(\'field-validation-valid\').add" +
|
|
"Class(\'field-validation-error\');\r\n isValid = false;\r\n " +
|
|
" }\r\n } else {\r\n $typeValidation" +
|
|
"Message.text(\'A Job Type is required\').removeClass(\'field-validation-valid\').add" +
|
|
"Class(\'field-validation-error\');\r\n isValid = false;\r\n " +
|
|
" }\r\n\r\n");
|
|
|
|
|
|
#line 199 "..\..\Views\Job\Create.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 199 "..\..\Views\Job\Create.cshtml"
|
|
if (Authorization.Has(Claims.Job.Actions.Close)){
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
WriteLiteral(@"
|
|
// Validate QuickLog Task Time
|
|
if ($quickLog.is(':checked')) {
|
|
var selectedTime = $quickLogTaskTimes.filter(':checked');
|
|
if (selectedTime.length > 0) {
|
|
if (selectedTime.val() === '') {
|
|
// Handle 'Other'
|
|
var otherTime = parseInt($quickLogTaskTimeOtherMinutes.val());
|
|
if (!otherTime || otherTime <= 0) {
|
|
$quickLogTaskTimeValidationMessage.text('A Task Time is required').removeClass('field-validation-valid').addClass('field-validation-error');
|
|
isValid = false;
|
|
}
|
|
} else {
|
|
$quickLogTaskTimeValidationMessage.removeClass('field-validation-valid').addClass('field-validation-error');
|
|
}
|
|
} else {
|
|
$quickLogTaskTimeValidationMessage.text('A Task Time is required').removeClass('field-validation-valid').addClass('field-validation-error');
|
|
isValid = false;
|
|
}
|
|
} else {
|
|
$quickLogTaskTimeValidationMessage.removeClass('field-validation-valid').addClass('field-validation-error');
|
|
}
|
|
");
|
|
|
|
WriteLiteral("\r\n");
|
|
|
|
|
|
#line 223 "..\..\Views\Job\Create.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(@"
|
|
return isValid;
|
|
}
|
|
|
|
validator.settings.submitHandler = function (form) {
|
|
if (additionalValidation()) {
|
|
discoDialogMethods.setButtons({});
|
|
form.submit();
|
|
}
|
|
}
|
|
//#endregion
|
|
|
|
//#region DeviceHeld
|
|
var $deviceHeld = $('#DeviceHeld');
|
|
|
|
");
|
|
|
|
|
|
#line 239 "..\..\Views\Job\Create.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 239 "..\..\Views\Job\Create.cshtml"
|
|
if (Authorization.Has(Claims.Job.Properties.DeviceHeld)){
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n if ($(\'#DeviceSerialNumber\').val()) {\r\n switch ($dev" +
|
|
"iceHeld.val()) {\r\n case \'True\':\r\n $(\'#" +
|
|
"createJob_DeviceHeld\').prop(\'checked\', true);\r\n $(\'#creat" +
|
|
"eJob_DeviceNotHeld\').prop(\'checked\', false);\r\n break;\r\n " +
|
|
" case \'False\':\r\n $(\'#createJob_DeviceHel" +
|
|
"d\').prop(\'checked\', false);\r\n $(\'#createJob_DeviceNotHeld" +
|
|
"\').prop(\'checked\', true);\r\n break;\r\n d" +
|
|
"efault:\r\n $(\'#createJob_DeviceHeld\').prop(\'checked\', fals" +
|
|
"e);\r\n $(\'#createJob_DeviceNotHeld\').prop(\'checked\', false" +
|
|
");\r\n break;\r\n }\r\n $(\'#creat" +
|
|
"eJob_DeviceHeldContainer\').find(\'input[type=\"radio\"]\').change(function () {\r\n " +
|
|
" // Update Hidden Field with Boolean Value\r\n " +
|
|
"// Set DeviceHeld\r\n var deviceHeldValue = \'\';\r\n " +
|
|
" if ($(\'#createJob_DeviceHeld\').is(\':checked\'))\r\n de" +
|
|
"viceHeldValue = \'True\';\r\n if ($(\'#createJob_DeviceNotHeld\').i" +
|
|
"s(\':checked\'))\r\n deviceHeldValue = \'False\';\r\n " +
|
|
" $deviceHeld.val(deviceHeldValue).change();\r\n });\r\n " +
|
|
" } else {\r\n // No Device Associated\r\n $deviceH" +
|
|
"eld.val(\'False\');\r\n $(\'#createJob_DeviceHeldContainer\').hide();\r\n" +
|
|
" }\r\n ");
|
|
|
|
|
|
#line 270 "..\..\Views\Job\Create.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" //#endregion\r\n\r\n");
|
|
|
|
|
|
#line 273 "..\..\Views\Job\Create.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 273 "..\..\Views\Job\Create.cshtml"
|
|
if (Authorization.Has(Claims.Job.Actions.Close)){
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
WriteLiteral("\r\n //#region QuickLog\r\n var $quickLog = $(\'#createJob_Quick" +
|
|
"Log\');\r\n var $quickLogContainer = $(\'#createJob_QuickLogContainer\');\r" +
|
|
"\n var $quickLogTaskTimeContainer = $(\'#createJob_QuickLogTaskTimeCont" +
|
|
"ainer\');\r\n var $quickLogTaskTimes = $quickLogTaskTimeContainer.find(\'" +
|
|
"input[type=\"radio\"]\');\r\n var $quickLogTaskTimeOtherMinutes = $(\'#crea" +
|
|
"teJob_TaskTimeOtherMinutes\');\r\n var $quickLogTaskTimeValidationMessag" +
|
|
"e = $quickLogTaskTimeContainer.find(\'[data-valmsg-for=\"QuickLogTaskTimeMinutes\"]" +
|
|
"\');\r\n\r\n $deviceHeld.change(validateQuickLog);\r\n $jobTypes." +
|
|
"change(validateQuickLog);\r\n validateQuickLog();\r\n\r\n functi" +
|
|
"on validateQuickLog() {\r\n var quickLogAllowed = false;\r\n\r\n " +
|
|
" if ($deviceHeld.val() === \'True\') {\r\n quickLogAllowe" +
|
|
"d = false;\r\n } else {\r\n // Allow Quick-Log onl" +
|
|
"y for certain Job Types\r\n var selectedType = $jobTypes.filter" +
|
|
"(\':checked\').val();\r\n switch (selectedType) {\r\n " +
|
|
" case \'HMisc\':\r\n case \'SApp\':\r\n " +
|
|
" case \'SImg\':\r\n case \'SOS\':\r\n " +
|
|
" case \'UMgmt\':\r\n quickLogAllowed = true;\r\n " +
|
|
" break;\r\n default:\r\n " +
|
|
" quickLogAllowed = false;\r\n break;\r\n " +
|
|
" }\r\n }\r\n\r\n if (quickLogAllowed) {\r\n " +
|
|
" $quickLogContainer.slideDown();\r\n } else {\r\n " +
|
|
" if (init)\r\n $quickLogContainer.hide();\r\n " +
|
|
" else\r\n $quickLogContainer.slideUp();\r\n " +
|
|
" $quickLog.prop(\'checked\', false).change();\r\n }\r\n" +
|
|
" }\r\n\r\n $quickLog.change(function () {\r\n if " +
|
|
"($(this).is(\':checked\')) {\r\n $quickLogTaskTimeContainer.slide" +
|
|
"Down();\r\n $(\'#createJob_SubTypes\').addClass(\'isQuickLog\');\r\n " +
|
|
" } else {\r\n $quickLogTaskTimeContainer.slideUp(" +
|
|
");\r\n $(\'#createJob_SubTypes\').removeClass(\'isQuickLog\');\r\n " +
|
|
" }\r\n });\r\n\r\n $quickLogTaskTimes.change(functio" +
|
|
"n () {\r\n if ($quickLogTaskTimes.filter(\':checked\').val() === \"\") " +
|
|
"{\r\n $(\'#createJob_TaskTimeOtherMinutesContainer\').show();\r\n " +
|
|
" $quickLogTaskTimeOtherMinutes.attr(\'disabled\', null).focus().s" +
|
|
"elect();\r\n } else {\r\n $(\'#createJob_TaskTimeOt" +
|
|
"herMinutesContainer\').hide();\r\n $quickLogTaskTimeOtherMinutes" +
|
|
".attr(\'disabled\', \'disabled\');\r\n }\r\n });\r\n " +
|
|
"//#endregion\r\n ");
|
|
|
|
WriteLiteral("\r\n");
|
|
|
|
|
|
#line 341 "..\..\Views\Job\Create.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n init = false;\r\n });\r\n </script>\r\n</div>\r\n");
|
|
|
|
}
|
|
}
|
|
}
|
|
#pragma warning restore 1591
|