Feature #4: Pre-defined/Restricted Locations

Configurable list and location suggestions. Ability to restrict
locations. Shows 'occupied' locations.
This commit is contained in:
Gary Sharp
2014-02-17 21:44:34 +11:00
parent ed7caf8b4a
commit 5be747afbc
35 changed files with 2136 additions and 729 deletions
@@ -86,5 +86,22 @@ namespace Disco.Data.Configuration
return JsonConvert.DeserializeObject<ValueType>(jsonValue);
}
protected void SetAsEnum<EnumType>(EnumType Value, [CallerMemberName] string Key = null)
{
if (Value == null)
this.Set<string>(null, Key);
else
this.Set(Value.ToString(), Key);
}
protected EnumType GetFromEnum<EnumType>(EnumType Default, [CallerMemberName] string Key = null)
{
var stringValue = this.Get<string>(null, Key);
if (stringValue == null)
return Default;
else
return (EnumType)Enum.Parse(typeof(EnumType), stringValue);
}
}
}
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Disco.Models.BI.Job;
namespace Disco.Data.Configuration.Modules
{
@@ -42,5 +43,17 @@ namespace Disco.Data.Configuration.Modules
Set(value);
}
}
public LocationModes LocationMode
{
get { return GetFromEnum<LocationModes>(LocationModes.Unrestricted); }
set { SetAsEnum(value); }
}
public List<string> LocationList
{
get { return GetFromJson<List<string>>(new List<string>()); }
set { SetAsJson(value); }
}
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Models.BI.Job
{
public enum LocationModes
{
[Display(Name = "Unrestricted")]
Unrestricted,
[Display(Name = "Optional List")]
OptionalList,
[Display(Name = "Restricted List")]
RestrictedList
}
}
+3 -1
View File
@@ -45,6 +45,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BI\Job\LocationModes.cs" />
<Compile Include="Services\Authorization\IAuthorizationToken.cs" />
<Compile Include="Services\Authorization\IClaimNavigatorItem.cs" />
<Compile Include="Services\Authorization\IRoleToken.cs" />
@@ -103,6 +104,7 @@
<Compile Include="Repository\User\UserAttachment.cs" />
<Compile Include="Repository\User\UserDetail.cs" />
<Compile Include="Repository\User\AuthorizationRole.cs" />
<Compile Include="Services\Jobs\JobLists\JobLocationReference.cs" />
<Compile Include="Services\Jobs\JobLists\JobTableItemModel.cs" />
<Compile Include="Services\Jobs\JobLists\JobTableModel.cs" />
<Compile Include="Services\Jobs\JobLists\JobTableStatusItemModel.cs" />
@@ -166,7 +168,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_StartDate="2011/7/1" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" />
<UserProperties BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Models.Services.Jobs.JobLists
{
public class JobLocationReference
{
public string Location { get; set; }
public List<JobTableItemModel> References { get; set; }
}
}
@@ -1,4 +1,5 @@
using System;
using Disco.Models.BI.Job;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -10,8 +11,11 @@ namespace Disco.Models.UI.Config.JobPreferences
{
int LongRunningJobDaysThreshold { get; set; }
int StaleJobMinutesThreshold { get; set; }
LocationModes LocationMode { get; set; }
List<string> LocationList { get; set; }
List<KeyValuePair<int, string>> LongRunningJobDaysThresholdOptions();
List<KeyValuePair<int, string>> StaleJobMinutesThresholdOptions();
List<KeyValuePair<string, string>> LocationModeOptions();
}
}
+6 -4
View File
@@ -1,8 +1,7 @@
using System;
using Disco.Models.BI.Job;
using Disco.Models.Services.Jobs.JobLists;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Models.UI.Job
{
@@ -13,5 +12,8 @@ namespace Disco.Models.UI.Job
List<Repository.DocumentTemplate> AvailableDocumentTemplates { get; set; }
List<Repository.JobSubType> UpdatableJobSubTypes { get; set; }
List<Repository.JobQueue> AvailableQueues { get; set; }
LocationModes LocationMode { get; set; }
List<JobLocationReference> LocationOptions { get; set; }
}
}
@@ -258,5 +258,28 @@ namespace Disco.Services
var usersQueues = Jobs.JobQueues.JobQueueService.UsersQueues(Authorization).ToDictionary(q => q.JobQueue.Id);
return queueItems.Where(qi => usersQueues.ContainsKey(qi.QueueId));
}
public static IEnumerable<JobLocationReference> JobLocationReferences(this IEnumerable<JobTableItemModel> Items, IEnumerable<string> IncludeLocations)
{
var innerItems = Items.Where(i => !string.IsNullOrWhiteSpace(i.DeviceHeldLocation));
return IncludeLocations.GroupJoin(innerItems, o => o, i => i.DeviceHeldLocation,
(i, o) => new JobLocationReference
{
Location = i,
References = o.ToList()
},
StringComparer.InvariantCultureIgnoreCase);
}
public static IEnumerable<JobLocationReference> JobLocationReferences(this IEnumerable<JobTableItemModel> Items)
{
return Items.Where(i => !string.IsNullOrWhiteSpace(i.DeviceHeldLocation))
.GroupBy(i => i.DeviceHeldLocation, StringComparer.InvariantCultureIgnoreCase)
.Select(i => new JobLocationReference()
{
Location = i.Key,
References = i.ToList()
});
}
}
}
@@ -1,6 +1,9 @@
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Models.Services.Jobs.JobLists;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Jobs.JobLists;
using Disco.Services.Users;
using Disco.Services.Web;
using Disco.Web.Extensions;
@@ -522,10 +525,20 @@ namespace Disco.Web.Areas.API.Controllers
}
private void UpdateDeviceHeldLocation(Job job, string DeviceHeldLocation)
{
if (!string.IsNullOrWhiteSpace(DeviceHeldLocation) &&
Database.DiscoConfiguration.JobPreferences.LocationMode == Disco.Models.BI.Job.LocationModes.RestrictedList)
{
// Enforce Restricted List Mode
var value = DeviceHeldLocation.Trim();
if (!Database.DiscoConfiguration.JobPreferences.LocationList.Contains(value, StringComparer.InvariantCultureIgnoreCase))
throw new ArgumentException("The location was not found in the list (Mode: Restricted List)");
}
if (string.IsNullOrWhiteSpace(DeviceHeldLocation))
job.DeviceHeldLocation = null;
else
job.DeviceHeldLocation = DeviceHeldLocation;
job.DeviceHeldLocation = DeviceHeldLocation.Trim();
Database.SaveChanges();
}
@@ -2125,5 +2138,47 @@ namespace Disco.Web.Areas.API.Controllers
throw new ArgumentException("Invalid Job Id", "id");
}
}
[DiscoAuthorize(Claims.Job.Properties.DeviceHeldLocation)]
public virtual ActionResult DeviceHeldLocations()
{
List<string> locations;
switch (Database.DiscoConfiguration.JobPreferences.LocationMode)
{
case Disco.Models.BI.Job.LocationModes.Unrestricted:
var jobDateThreshold = DateTime.Now.AddYears(-1);
locations = Database.Jobs.Where(j => (j.OpenedDate > jobDateThreshold || !j.ClosedDate.HasValue) && j.DeviceHeldLocation != null).Select(j => j.DeviceHeldLocation).Distinct().OrderBy(l => l).ToList().Where(l => !string.IsNullOrWhiteSpace(l)).Select(l => l.Trim()).Distinct(StringComparer.InvariantCultureIgnoreCase).OrderBy(l => l).ToList();
break;
case Disco.Models.BI.Job.LocationModes.OptionalList:
case Disco.Models.BI.Job.LocationModes.RestrictedList:
locations = Database.DiscoConfiguration.JobPreferences.LocationList;
break;
default:
throw new InvalidOperationException("Unknown Location Mode Configured");
}
var locationReferences = ManagedJobList.OpenJobsTable(j => j).Items.JobLocationReferences().ToDictionary(lr => lr.Location);
var results = locations.Select(location =>
{
JobLocationReference reference;
if (locationReferences.TryGetValue(location, out reference))
{
return new Models.Job.DeviceHeldLocationModel()
{
Location = location,
References = (reference.References.Count == 1 ? string.Format("Job {0}", reference.References.First().JobId) : string.Format("{0} jobs", reference.References.Count))
};
}
else
{
return new Models.Job.DeviceHeldLocationModel() { Location = location };
}
}).ToList();
return Json(results, JsonRequestBehavior.AllowGet);
}
}
}
@@ -1,4 +1,5 @@
using Disco.Services.Authorization;
using Disco.Models.BI.Job;
using Disco.Services.Authorization;
using Disco.Services.Web;
using System;
using System.Collections.Generic;
@@ -33,5 +34,29 @@ namespace Disco.Web.Areas.API.Controllers
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
public virtual ActionResult UpdateLocationMode(LocationModes LocationMode, bool redirect = false)
{
Database.DiscoConfiguration.JobPreferences.LocationMode = LocationMode;
Database.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Config.JobPreferences.Index());
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
public virtual ActionResult UpdateLocationList(string[] LocationList, bool redirect = false)
{
Database.DiscoConfiguration.JobPreferences.LocationList = LocationList.Where(i => !string.IsNullOrWhiteSpace(i)).Select(i => i.Trim()).OrderBy(i => i).ToList();
Database.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Config.JobPreferences.Index());
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Job
{
public class DeviceHeldLocationModel
{
public string Location { get; set; }
public string References { get; set; }
}
}
@@ -18,7 +18,9 @@ namespace Disco.Web.Areas.Config.Controllers
var m = new Models.JobPreferences.IndexModel()
{
LongRunningJobDaysThreshold = Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold,
StaleJobMinutesThreshold = Database.DiscoConfiguration.JobPreferences.StaleJobMinutesThreshold
StaleJobMinutesThreshold = Database.DiscoConfiguration.JobPreferences.StaleJobMinutesThreshold,
LocationMode = Database.DiscoConfiguration.JobPreferences.LocationMode,
LocationList = Database.DiscoConfiguration.JobPreferences.LocationList
};
// UI Extensions
@@ -1,6 +1,8 @@
using Disco.Models.UI.Config.JobPreferences;
using Disco.Models.BI.Job;
using Disco.Models.UI.Config.JobPreferences;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
@@ -11,6 +13,8 @@ namespace Disco.Web.Areas.Config.Models.JobPreferences
{
public int LongRunningJobDaysThreshold { get; set; }
public int StaleJobMinutesThreshold { get; set; }
public LocationModes LocationMode { get; set; }
public List<string> LocationList { get; set; }
public List<KeyValuePair<int, string>> LongRunningJobDaysThresholdOptions()
{
@@ -76,5 +80,20 @@ namespace Disco.Web.Areas.Config.Models.JobPreferences
return options;
}
public List<KeyValuePair<string, string>> LocationModeOptions()
{
var type = typeof(LocationModes);
var names = Enum.GetNames(type);
return names.Select(n =>
{
var at = type.GetMember(n)[0].GetCustomAttributes(typeof(DisplayAttribute), false);
if (at != null && at.Length > 0)
return new KeyValuePair<string, string>(n, ((DisplayAttribute)at[0]).Name);
else
return new KeyValuePair<string, string>(n, n);
}).OrderBy(i => i.Key).ToList();
}
}
}
@@ -11,65 +11,6 @@
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
}
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.General);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Locations);
}
<div class="form" style="width: 530px;">
<h2>General Preferences</h2>
<table>
<tr>
<th style="width: 200px">Long Running Threshold:
</th>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.LongRunningJobDaysThreshold, Model.LongRunningJobDaysThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value }))
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#LongRunningJobDaysThreshold'),
null,
'@(Url.Action(MVC.API.JobPreferences.UpdateLongRunningJobDaysThreshold()))',
'LongRunningJobDaysThreshold');
});
</script>
}
else
{
@Model.LongRunningJobDaysThresholdOptions().First(o => o.Key == Model.LongRunningJobDaysThreshold).Value
}
<div class="smallMessage">
Jobs which have been open for longer than the threshold are considered 'long-running' and will appear in the <code>Long Running Jobs</code> list.
</div>
@if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) { @Html.ActionLinkSmallButton("Show Long Running Jobs", MVC.Job.LongRunning()) }
</td>
</tr>
<tr>
<th style="width: 200px">Stale Threshold:
</th>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.StaleJobMinutesThreshold, Model.StaleJobMinutesThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value }))
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#StaleJobMinutesThreshold'),
null,
'@(Url.Action(MVC.API.JobPreferences.UpdateStaleJobMinutesThreshold()))',
'StaleJobMinutesThreshold');
});
</script>
}
else
{
@Model.StaleJobMinutesThresholdOptions().First(o => o.Key == Model.StaleJobMinutesThreshold).Value
}
<div class="smallMessage">
Jobs which have no recoded action for longer than the threshold are considered 'stale' and will appear in the <code>Stale Jobs</code> list.
</div>
@if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) { @Html.ActionLinkSmallButton("Show Stale Jobs", MVC.Job.Stale()) }
</td>
</tr>
</table>
</div>
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -58,282 +58,12 @@ namespace Disco.Web.Areas.Config.Views.JobPreferences
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
}
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.General);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Locations);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 530px;\"");
WriteLiteral(">\r\n <h2>General Preferences</h2>\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px\"");
WriteLiteral(">Long Running Threshold:\r\n </th>\r\n <td>");
#line 21 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 23 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Html.DropDownListFor(model => model.LongRunningJobDaysThreshold, Model.LongRunningJobDaysThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value })));
#line default
#line hidden
#line 23 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
#line 24 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 24 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
#line 25 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 25 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#LongRunningJobDays" +
"Threshold\'),\r\n null,\r\n \'");
#line 31 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Url.Action(MVC.API.JobPreferences.UpdateLongRunningJobDaysThreshold()));
#line default
#line hidden
WriteLiteral("\',\r\n \'LongRunningJobDaysThreshold\');\r\n " +
" });\r\n </script>\r\n");
#line 35 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
}
else
{
#line default
#line hidden
#line 38 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Model.LongRunningJobDaysThresholdOptions().First(o => o.Key == Model.LongRunningJobDaysThreshold).Value);
#line default
#line hidden
#line 38 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">\r\n Jobs which have been open for longer than the threshold ar" +
"e considered \'long-running\' and will appear in the <code>Long Running Jobs</code" +
"> list.\r\n </div>\r\n");
#line 43 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
#line 43 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) {
#line default
#line hidden
#line 43 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Html.ActionLinkSmallButton("Show Long Running Jobs", MVC.Job.LongRunning()));
#line default
#line hidden
#line 43 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px\"");
WriteLiteral(">Stale Threshold:\r\n </th>\r\n <td>");
#line 49 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 51 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Html.DropDownListFor(model => model.StaleJobMinutesThreshold, Model.StaleJobMinutesThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value })));
#line default
#line hidden
#line 51 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
#line 52 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 52 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
#line 53 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 53 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#StaleJobMinutesThr" +
"eshold\'),\r\n null,\r\n \'");
#line 59 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Url.Action(MVC.API.JobPreferences.UpdateStaleJobMinutesThreshold()));
#line default
#line hidden
WriteLiteral("\',\r\n \'StaleJobMinutesThreshold\');\r\n " +
" });\r\n </script>\r\n");
#line 63 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
}
else
{
#line default
#line hidden
#line 66 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Model.StaleJobMinutesThresholdOptions().First(o => o.Key == Model.StaleJobMinutesThreshold).Value);
#line default
#line hidden
#line 66 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">\r\n Jobs which have no recoded action for longer than the thre" +
"shold are considered \'stale\' and will appear in the <code>Stale Jobs</code> list" +
".\r\n </div>\r\n");
#line 71 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) {
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Html.ActionLinkSmallButton("Show Stale Jobs", MVC.Job.Stale()));
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n</div>\r\n");
}
}
}
@@ -0,0 +1,67 @@
@model Disco.Web.Areas.Config.Models.JobPreferences.IndexModel
@{
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
}
<div class="form" style="width: 530px;">
<h2>General Preferences</h2>
<table>
<tr>
<th style="width: 200px">Long Running Threshold:
</th>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.LongRunningJobDaysThreshold, Model.LongRunningJobDaysThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value }))
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#LongRunningJobDaysThreshold'),
null,
'@(Url.Action(MVC.API.JobPreferences.UpdateLongRunningJobDaysThreshold()))',
'LongRunningJobDaysThreshold');
});
</script>
}
else
{
@Model.LongRunningJobDaysThresholdOptions().First(o => o.Key == Model.LongRunningJobDaysThreshold).Value
}
<div class="smallMessage">
Jobs which have been open for longer than the threshold are considered 'long-running' and will appear in the <code>Long Running Jobs</code> list.
</div>
@if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) { @Html.ActionLinkSmallButton("Show Long Running Jobs", MVC.Job.LongRunning()) }
</td>
</tr>
<tr>
<th style="width: 200px">Stale Threshold:
</th>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.StaleJobMinutesThreshold, Model.StaleJobMinutesThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value }))
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#StaleJobMinutesThreshold'),
null,
'@(Url.Action(MVC.API.JobPreferences.UpdateStaleJobMinutesThreshold()))',
'StaleJobMinutesThreshold');
});
</script>
}
else
{
@Model.StaleJobMinutesThresholdOptions().First(o => o.Key == Model.StaleJobMinutesThreshold).Value
}
<div class="smallMessage">
Jobs which have no recoded action for longer than the threshold are considered 'stale' and will appear in the <code>Stale Jobs</code> list.
</div>
@if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) { @Html.ActionLinkSmallButton("Show Stale Jobs", MVC.Job.Stale()) }
</td>
</tr>
</table>
</div>
@@ -0,0 +1,332 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.JobPreferences.Parts
{
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.BI.Extensions;
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("~/Areas/Config/Views/JobPreferences/Parts/General.cshtml")]
public partial class General : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.JobPreferences.IndexModel>
{
public General()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 530px;\"");
WriteLiteral(">\r\n <h2>General Preferences</h2>\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px\"");
WriteLiteral(">Long Running Threshold:\r\n </th>\r\n <td>");
#line 13 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Html.DropDownListFor(model => model.LongRunningJobDaysThreshold, Model.LongRunningJobDaysThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value })));
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
#line 16 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 16 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#LongRunningJobDays" +
"Threshold\'),\r\n null,\r\n \'");
#line 23 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Url.Action(MVC.API.JobPreferences.UpdateLongRunningJobDaysThreshold()));
#line default
#line hidden
WriteLiteral("\',\r\n \'LongRunningJobDaysThreshold\');\r\n " +
" });\r\n </script>\r\n");
#line 27 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
}
else
{
#line default
#line hidden
#line 30 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Model.LongRunningJobDaysThresholdOptions().First(o => o.Key == Model.LongRunningJobDaysThreshold).Value);
#line default
#line hidden
#line 30 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
}
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">\r\n Jobs which have been open for longer than the threshold ar" +
"e considered \'long-running\' and will appear in the <code>Long Running Jobs</code" +
"> list.\r\n </div>\r\n");
#line 35 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
#line 35 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) {
#line default
#line hidden
#line 35 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Html.ActionLinkSmallButton("Show Long Running Jobs", MVC.Job.LongRunning()));
#line default
#line hidden
#line 35 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px\"");
WriteLiteral(">Stale Threshold:\r\n </th>\r\n <td>");
#line 41 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 43 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Html.DropDownListFor(model => model.StaleJobMinutesThreshold, Model.StaleJobMinutesThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value })));
#line default
#line hidden
#line 43 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
#line 44 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 44 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
#line 45 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 45 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#StaleJobMinutesThr" +
"eshold\'),\r\n null,\r\n \'");
#line 51 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Url.Action(MVC.API.JobPreferences.UpdateStaleJobMinutesThreshold()));
#line default
#line hidden
WriteLiteral("\',\r\n \'StaleJobMinutesThreshold\');\r\n " +
" });\r\n </script>\r\n");
#line 55 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
}
else
{
#line default
#line hidden
#line 58 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Model.StaleJobMinutesThresholdOptions().First(o => o.Key == Model.StaleJobMinutesThreshold).Value);
#line default
#line hidden
#line 58 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
}
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">\r\n Jobs which have no recoded action for longer than the thre" +
"shold are considered \'stale\' and will appear in the <code>Stale Jobs</code> list" +
".\r\n </div>\r\n");
#line 63 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
#line 63 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) {
#line default
#line hidden
#line 63 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Html.ActionLinkSmallButton("Show Stale Jobs", MVC.Job.Stale()));
#line default
#line hidden
#line 63 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n</div>");
}
}
}
#pragma warning restore 1591
@@ -0,0 +1,233 @@
@model Disco.Web.Areas.Config.Models.JobPreferences.IndexModel
@{
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
}
<div id="Config_Location" class="form" style="width: 530px;">
<h2>Job Locations</h2>
<table>
<tr>
<th style="width: 200px">Mode:
</th>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.LocationMode, Model.LocationModeOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value }))
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<div id="Config_Location_Unrestricted">
<div style="padding: 0.7em 0.7em;" class="ui-state-highlight ui-corner-all">
<i class="fa fa-info-circle information"></i>&nbsp;Technicians will be able to specify <em>any</em> value when entering a location. A selection of locations used historically will be offered.
</div>
</div>
<div id="Config_Location_List">
<a id="Config_Location_List_Button" href="#" class="button small">Update List</a>
<div id="Config_Location_List_Dialog" class="dialog" title="Locations">
<div id="Config_Location_List_Dialog_ListContainer">
<span id="Config_Location_List_Dialog_None" class="smallMessage">The List is Empty</span>
<ul id="Config_Location_List_Dialog_List" class="none">
@foreach (var loc in Model.LocationList)
{
<li data-location="@loc">@loc<i class="fa fa-times-circle remove"></i></li>
}
</ul>
</div>
<div id="Config_Location_List_Dialog_AddContainer">
<input type="text" id="Config_Location_List_Dialog_TextAdd" />
<a id="Config_Location_List_Dialog_Add" href="#" class="button small">Add</a>
</div>
<form id="Config_Location_List_Dialog_Form" action="@(Url.Action(MVC.API.JobPreferences.UpdateLocationList(null, redirect: true)))" method="post"></form>
</div>
</div>
<div id="Config_Location_Optional">
<div style="padding: 0.7em 0.7em;" class="ui-state-highlight ui-corner-all">
<i class="fa fa-info-circle information"></i>&nbsp;Technicians will be able to specify <em>any</em> value when entering a location. A defined list of location options is suggested.
</div>
</div>
<div id="Config_Location_Restricted">
<div style="padding: 0.7em 0.7em;" class="ui-state-highlight ui-corner-all">
<i class="fa fa-info-circle information"></i>&nbsp;Technicians are restricted to select a location from the defined list.
</div>
</div>
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#LocationMode'),
null,
'@(Url.Action(MVC.API.JobPreferences.UpdateLocationMode()))',
'LocationMode');
var $locationMode = $('#LocationMode');
function update() {
var $Config_Location_List = $('#Config_Location_List');
var $Config_Location_Unrestricted = $('#Config_Location_Unrestricted');
var $Config_Location_Optional = $('#Config_Location_Optional');
var $Config_Location_Restricted = $('#Config_Location_Restricted');
switch ($locationMode.val()) {
case 'Unrestricted':
$Config_Location_List.hide();
$Config_Location_Optional.hide();
$Config_Location_Restricted.hide();
$Config_Location_Unrestricted.show();
break;
case 'OptionalList':
$Config_Location_Unrestricted.hide();
$Config_Location_Restricted.hide();
$Config_Location_List.show();
$Config_Location_Optional.show();
break;
case 'RestrictedList':
$Config_Location_Unrestricted.hide();
$Config_Location_Optional.hide();
$Config_Location_List.show();
$Config_Location_Restricted.show();
break;
}
}
update();
$locationMode.change(update);
var dialog, textAdd, list, noList, form;
$('#Config_Location_List_Button').click(showDialog);
function showDialog() {
if (!dialog) {
dialog = $('#Config_Location_List_Dialog').dialog({
resizable: false,
modal: true,
autoOpen: false,
width: 350,
height: 420,
buttons: {
"Save Changes": saveChanges,
Cancel: cancel
}
});
dialog.on('click', '.remove', remove);
list = $('#Config_Location_List_Dialog_List');
noList = $('#Config_Location_List_Dialog_None');
textAdd = $('#Config_Location_List_Dialog_TextAdd');
textAdd.watermark('Location');
textAdd.keydown(function (e) {
if (e.keyCode == 13)
add();
});
$('#Config_Location_List_Dialog_Add').click(add);
}
dialog.dialog('open');
updateNoList();
return false;
}
function cancel() {
$(this).dialog("close");
list.find('li').each(function () {
$this = $(this);
if ($this.is('[data-status="new"]')) {
$this.remove();
} else {
if ($this.is('[data-status="removed"]')) {
$this.show();
$this.attr('data-status', '')
}
}
});
}
function remove() {
$this = $(this).closest('li');
if ($this.is('[data-status="new"]')) {
$this.remove();
} else {
$this.attr('data-status', 'removed').hide();
}
updateNoList();
}
function add() {
var value = textAdd.val();
// Trim
value = jQuery.trim(value);
if (!value) {
alert('Enter a location to be added');
return;
}
// Already Exists
var existingValues = list.find('li[data-location]').filter('[data-status!="removed"]').map(function () { return $(this).attr('data-location') }).get();
if (jQuery.inArray(value, existingValues) >= 0) {
alert('That item already exists in the list');
return;
}
// Add Item
var li = $('<li>')
.append($('<span>').text(value))
.append($('<i>').addClass('fa fa-times-circle remove'))
.attr('data-location', value)
.attr('data-status', 'new');
list.append(li);
textAdd.focus();
updateNoList();
}
function updateNoList() {
if (list.find('li:visible').length > 0)
noList.hide();
else
noList.show();
}
function saveChanges() {
var form = $('#Config_Location_List_Dialog_Form').empty();
list.find('li[data-status!="removed"]').each(function () {
var location = $(this).attr('data-location');
form.append($('<input>').attr({
'name': 'LocationList',
'type': 'hidden'
}).val(location));
}).get();
form.submit();
dialog.dialog("disable");
dialog.dialog("option", "buttons", null);
}
});
</script>
}
else
{
@Model.LocationModeOptions().First(o => o.Key == Model.LocationMode.ToString()).Value
}
</td>
</tr>
</table>
</div>
@@ -0,0 +1,435 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.JobPreferences.Parts
{
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.BI.Extensions;
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("~/Areas/Config/Views/JobPreferences/Parts/Locations.cshtml")]
public partial class Locations : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.JobPreferences.IndexModel>
{
public Locations()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"Config_Location\"");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 530px;\"");
WriteLiteral(">\r\n <h2>Job Locations</h2>\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px\"");
WriteLiteral(">Mode:\r\n </th>\r\n <td>");
#line 13 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(Html.DropDownListFor(model => model.LocationMode, Model.LocationModeOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value })));
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
#line default
#line hidden
#line 16 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 16 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"Config_Location_Unrestricted\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" style=\"padding: 0.7em 0.7em;\"");
WriteLiteral(" class=\"ui-state-highlight ui-corner-all\"");
WriteLiteral(">\r\n <i");
WriteLiteral(" class=\"fa fa-info-circle information\"");
WriteLiteral("></i>&nbsp;Technicians will be able to specify <em>any</em> value when entering a" +
" location. A selection of locations used historically will be offered.\r\n " +
" </div>\r\n </div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" id=\"Config_Location_List\"");
WriteLiteral(">\r\n <a");
WriteLiteral(" id=\"Config_Location_List_Button\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"button small\"");
WriteLiteral(">Update List</a>\r\n <div");
WriteLiteral(" id=\"Config_Location_List_Dialog\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Locations\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"Config_Location_List_Dialog_ListContainer\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" id=\"Config_Location_List_Dialog_None\"");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">The List is Empty</span>\r\n <ul");
WriteLiteral(" id=\"Config_Location_List_Dialog_List\"");
WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n");
#line 29 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
#line default
#line hidden
#line 29 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
foreach (var loc in Model.LocationList)
{
#line default
#line hidden
WriteLiteral(" <li");
WriteLiteral(" data-location=\"");
#line 31 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(loc);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">");
#line 31 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(loc);
#line default
#line hidden
WriteLiteral("<i");
WriteLiteral(" class=\"fa fa-times-circle remove\"");
WriteLiteral("></i></li>\r\n");
#line 32 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
}
#line default
#line hidden
WriteLiteral(" </ul>\r\n </div>\r\n " +
" <div");
WriteLiteral(" id=\"Config_Location_List_Dialog_AddContainer\"");
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"text\"");
WriteLiteral(" id=\"Config_Location_List_Dialog_TextAdd\"");
WriteLiteral(" />\r\n <a");
WriteLiteral(" id=\"Config_Location_List_Dialog_Add\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"button small\"");
WriteLiteral(">Add</a>\r\n </div>\r\n <form");
WriteLiteral(" id=\"Config_Location_List_Dialog_Form\"");
WriteAttribute("action", Tuple.Create(" action=\"", 2359), Tuple.Create("\"", 2446)
#line 39 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
, Tuple.Create(Tuple.Create("", 2368), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.JobPreferences.UpdateLocationList(null, redirect: true))
#line default
#line hidden
, 2368), false)
);
WriteLiteral(" method=\"post\"");
WriteLiteral("></form>\r\n </div>\r\n </div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" id=\"Config_Location_Optional\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" style=\"padding: 0.7em 0.7em;\"");
WriteLiteral(" class=\"ui-state-highlight ui-corner-all\"");
WriteLiteral(">\r\n <i");
WriteLiteral(" class=\"fa fa-info-circle information\"");
WriteLiteral("></i>&nbsp;Technicians will be able to specify <em>any</em> value when entering a" +
" location. A defined list of location options is suggested.\r\n " +
" </div>\r\n </div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" id=\"Config_Location_Restricted\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" style=\"padding: 0.7em 0.7em;\"");
WriteLiteral(" class=\"ui-state-highlight ui-corner-all\"");
WriteLiteral(">\r\n <i");
WriteLiteral(" class=\"fa fa-info-circle information\"");
WriteLiteral("></i>&nbsp;Technicians are restricted to select a location from the defined list." +
"\r\n </div>\r\n </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#LocationMode\'),\r\n " +
" null,\r\n \'");
#line 57 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(Url.Action(MVC.API.JobPreferences.UpdateLocationMode()));
#line default
#line hidden
WriteLiteral("\',\r\n \'LocationMode\');\r\n\r\n var $" +
"locationMode = $(\'#LocationMode\');\r\n\r\n function update() " +
"{\r\n var $Config_Location_List = $(\'#Config_Location_L" +
"ist\');\r\n\r\n var $Config_Location_Unrestricted = $(\'#Co" +
"nfig_Location_Unrestricted\');\r\n var $Config_Location_" +
"Optional = $(\'#Config_Location_Optional\');\r\n var $Con" +
"fig_Location_Restricted = $(\'#Config_Location_Restricted\');\r\n\r\n\r\n " +
" switch ($locationMode.val()) {\r\n cas" +
"e \'Unrestricted\':\r\n $Config_Location_List.hid" +
"e();\r\n $Config_Location_Optional.hide();\r\n " +
" $Config_Location_Restricted.hide();\r\n\r\n " +
" $Config_Location_Unrestricted.show();\r\n " +
" break;\r\n case \'OptionalLis" +
"t\':\r\n $Config_Location_Unrestricted.hide();\r\n" +
" $Config_Location_Restricted.hide();\r\n\r\n " +
" $Config_Location_List.show();\r\n " +
" $Config_Location_Optional.show();\r\n " +
" break;\r\n case \'RestrictedList\':\r\n " +
" $Config_Location_Unrestricted.hide();\r\n " +
" $Config_Location_Optional.hide();\r\n\r\n " +
" $Config_Location_List.show();\r\n " +
" $Config_Location_Restricted.show();\r\n bre" +
"ak;\r\n }\r\n }\r\n " +
" update();\r\n $locationMode.change(update);\r\n\r\n " +
" var dialog, textAdd, list, noList, form;\r\n\r\n " +
" $(\'#Config_Location_List_Button\').click(showDialog);\r\n\r\n " +
" function showDialog() {\r\n if (!dialog) {\r\n " +
" dialog = $(\'#Config_Location_List_Dialog\').dialog({\r" +
"\n resizable: false,\r\n " +
" modal: true,\r\n autoOpen: false,\r\n" +
" width: 350,\r\n " +
" height: 420,\r\n buttons: {\r\n " +
" \"Save Changes\": saveChanges,\r\n " +
" Cancel: cancel\r\n }\r\n " +
" });\r\n\r\n dialog.on(\'click\'" +
", \'.remove\', remove);\r\n\r\n list = $(\'#Config_Locat" +
"ion_List_Dialog_List\');\r\n noList = $(\'#Config_Loc" +
"ation_List_Dialog_None\');\r\n\r\n textAdd = $(\'#Confi" +
"g_Location_List_Dialog_TextAdd\');\r\n\r\n textAdd.wat" +
"ermark(\'Location\');\r\n textAdd.keydown(function (e" +
") {\r\n if (e.keyCode == 13)\r\n " +
" add();\r\n });\r\n\r\n " +
" $(\'#Config_Location_List_Dialog_Add\').click(add);\r\n " +
" }\r\n\r\n dialog.dialog(\'open\');\r\n\r\n" +
" updateNoList();\r\n return " +
"false;\r\n }\r\n\r\n function cancel() {" +
"\r\n $(this).dialog(\"close\");\r\n\r\n " +
" list.find(\'li\').each(function () {\r\n $this " +
"= $(this);\r\n if ($this.is(\'[data-status=\"new\"]\'))" +
" {\r\n $this.remove();\r\n " +
" } else {\r\n if ($this.is(\'[data-statu" +
"s=\"removed\"]\')) {\r\n $this.show();\r\n " +
" $this.attr(\'data-status\', \'\')\r\n " +
" }\r\n }\r\n " +
" });\r\n }\r\n\r\n function remove" +
"() {\r\n $this = $(this).closest(\'li\');\r\n\r\n " +
" if ($this.is(\'[data-status=\"new\"]\')) {\r\n " +
" $this.remove();\r\n } else {\r\n " +
" $this.attr(\'data-status\', \'removed\').hide();\r\n " +
" }\r\n\r\n updateNoList();\r\n " +
" }\r\n\r\n function add() {\r\n\r\n " +
"var value = textAdd.val();\r\n\r\n // Trim\r\n " +
" value = jQuery.trim(value);\r\n\r\n if (!v" +
"alue) {\r\n alert(\'Enter a location to be added\');\r" +
"\n return;\r\n }\r\n\r\n " +
" // Already Exists\r\n var existi" +
"ngValues = list.find(\'li[data-location]\').filter(\'[data-status!=\"removed\"]\').map" +
"(function () { return $(this).attr(\'data-location\') }).get();\r\n " +
" if (jQuery.inArray(value, existingValues) >= 0) {\r\n " +
" alert(\'That item already exists in the list\');\r\n " +
" return;\r\n }\r\n\r\n " +
" // Add Item\r\n var li = $(\'<li>\')\r\n " +
" .append($(\'<span>\').text(value))\r\n " +
" .append($(\'<i>\').addClass(\'fa fa-times-circle remove\'))\r\n " +
" .attr(\'data-location\', value)\r\n .attr" +
"(\'data-status\', \'new\');\r\n\r\n list.append(li);\r\n\r\n " +
" textAdd.focus();\r\n\r\n updateNoL" +
"ist();\r\n }\r\n\r\n function updateNoLi" +
"st() {\r\n if (list.find(\'li:visible\').length > 0)\r\n " +
" noList.hide();\r\n else\r\n " +
" noList.show();\r\n }\r\n\r\n " +
" function saveChanges() {\r\n var fo" +
"rm = $(\'#Config_Location_List_Dialog_Form\').empty();\r\n\r\n " +
" list.find(\'li[data-status!=\"removed\"]\').each(function () {\r\n " +
" var location = $(this).attr(\'data-location\');\r\n\r\n " +
" form.append($(\'<input>\').attr({\r\n " +
" \'name\': \'LocationList\',\r\n \'type\': \'hidd" +
"en\'\r\n }).val(location));\r\n\r\n " +
" }).get();\r\n\r\n form.submit();\r\n\r\n " +
" dialog.dialog(\"disable\");\r\n dialog.dial" +
"og(\"option\", \"buttons\", null);\r\n }\r\n }" +
");\r\n </script>\r\n");
#line 225 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
}
else
{
#line default
#line hidden
#line 228 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(Model.LocationModeOptions().First(o => o.Key == Model.LocationMode.ToString()).Value);
#line default
#line hidden
#line 228 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
@@ -405,6 +405,7 @@
} else {
if ($this.is('[data-subjectstatus="removed"]')) {
$this.show();
$this.attr('data-status', '')
}
}
});
@@ -432,7 +433,7 @@
data: { Id: id }
}).done(function (response) {
if (response) {
if (list.find('li[data-subjectid="' + response.Id + '"]').length == 0) {
if (list.find('li[data-subjectid="' + response.Id + '"]').filter('[data-status!="removed"]').length == 0) {
var liIcon = $('<i>').addClass('fa fa-lg');
if (response.Type === 'user')
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -1352,21 +1352,22 @@ WriteLiteral("\',\r\n minLength:
" $this.remove();\r\n " +
" } else {\r\n if ($this.is(\'[" +
"data-subjectstatus=\"removed\"]\')) {\r\n " +
" $this.show();\r\n }\r\n " +
" }\r\n });\r\n " +
" }\r\n\r\n function remove() {\r\n" +
" $this = $(this).closest(\'li\');\r\n\r\n " +
" if ($this.is(\'[data-subjectstatus=\"new\"]\')) {\r\n " +
" $this.remove();\r\n " +
" } else {\r\n $this.attr(\'data-subject" +
"status\', \'removed\').hide();\r\n }\r\n\r\n " +
" updateNoSubjects();\r\n }" +
"\r\n\r\n function add() {\r\n\r\n " +
" var id = textAdd.val();\r\n\r\n $.aja" +
"x({\r\n url: \'");
" $this.show();\r\n $this.attr(\'d" +
"ata-status\', \'\')\r\n }\r\n " +
" }\r\n });\r\n " +
" }\r\n\r\n function remove() {\r\n " +
" $this = $(this).closest(\'li\');\r\n\r\n " +
" if ($this.is(\'[data-subjectstatus=\"new\"]\')) {\r\n " +
" $this.remove();\r\n " +
" } else {\r\n $this.attr(\'data-subjects" +
"tatus\', \'removed\').hide();\r\n }\r\n\r\n " +
" updateNoSubjects();\r\n }\r" +
"\n\r\n function add() {\r\n\r\n " +
" var id = textAdd.val();\r\n\r\n $.ajax" +
"({\r\n url: \'");
#line 430 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 431 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(Url.Action(MVC.API.JobQueue.Subject()));
@@ -1376,52 +1377,52 @@ WriteLiteral("\',\r\n method: \'get\',\r\
" data: { Id: id }\r\n }).done" +
"(function (response) {\r\n if (response) {\r" +
"\n if (list.find(\'li[data-subjectid=\"\'" +
" + response.Id + \'\"]\').length == 0) {\r\n\r\n " +
" var liIcon = $(\'<i>\').addClass(\'fa fa-lg\');\r\n " +
" if (response.Type === \'user\')\r\n " +
" liIcon.addClass(\'fa-user\');\r\n " +
" else\r\n " +
"liIcon.addClass(\'fa-users\');\r\n\r\n " +
"var li = $(\'<li>\')\r\n .append(" +
"liIcon)\r\n .append($(\'<span>\')" +
".text(response.Id == response.Name ? response.Id : response.Name + \' [\' + respon" +
"se.Id + \']\'))\r\n .append($(\'<i" +
">\').addClass(\'fa fa-times-circle remove\'))\r\n " +
" .addClass(response.Type)\r\n " +
" .attr(\'data-subjectid\', response.Id)\r\n " +
" .attr(\'data-subjectstatus\', \'new\');\r\n\r\n " +
" list.append(li);\r\n\r\n " +
" updateNoSubjects();\r\n " +
" } else {\r\n alert(\'That subjec" +
"t has already been added\');\r\n }\r\n " +
" } else {\r\n " +
" alert(\'Unknown Id\');\r\n }\r\n " +
" }).fail(function (jqXHR, textStatus, errorThrown)" +
" {\r\n alert(\'Error: \' + errorThrown);\r\n " +
" });\r\n }\r\n\r\n " +
" function updateNoSubjects() {\r\n " +
" if (list.find(\'li:visible\').length > 0)\r\n " +
" noSubjects.hide();\r\n else\r" +
"\n noSubjects.show();\r\n " +
" }\r\n\r\n function saveChanges() {\r\n " +
" var form = $(\'#Config_JobQueues_Subjects_Update_" +
"Dialog_Form\').empty();\r\n\r\n list.find(\'li[data" +
"-subjectstatus!=\"removed\"]\').each(function () {\r\n " +
" var subjectId = $(this).attr(\'data-subjectid\');\r\n\r\n " +
" form.append($(\'<input>\').attr({\r\n " +
" \'name\': \'Subjects\',\r\n " +
" \'type\': \'hidden\'\r\n }).val(subjectId));\r" +
"\n\r\n }).get();\r\n\r\n " +
" form.submit();\r\n\r\n dialog.dialog(\"dis" +
"able\");\r\n dialog.dialog(\"option\", \"buttons\", " +
"null);\r\n }\r\n\r\n $(f" +
"unction () {\r\n $(\'#Config_JobQueues_Subjects_" +
"Update\').click(showDialog);\r\n });\r\n\r\n " +
" })();\r\n </script>\r\n </" +
"div>\r\n");
" + response.Id + \'\"]\').filter(\'[data-status!=\"removed\"]\').length == 0) {\r\n\r\n " +
" var liIcon = $(\'<i>\').addClass(\'fa f" +
"a-lg\');\r\n if (response.Type === \'" +
"user\')\r\n liIcon.addClass(\'fa-" +
"user\');\r\n else\r\n " +
" liIcon.addClass(\'fa-users\');\r\n\r\n " +
" var li = $(\'<li>\')\r\n " +
" .append(liIcon)\r\n " +
" .append($(\'<span>\').text(response.Id == response.Name ? response" +
".Id : response.Name + \' [\' + response.Id + \']\'))\r\n " +
" .append($(\'<i>\').addClass(\'fa fa-times-circle remove\'))\r\n " +
" .addClass(response.Type)\r\n " +
" .attr(\'data-subjectid\', respons" +
"e.Id)\r\n .attr(\'data-subjectst" +
"atus\', \'new\');\r\n\r\n list.append(li" +
");\r\n\r\n updateNoSubjects();\r\n " +
" } else {\r\n " +
" alert(\'That subject has already been added\');\r\n " +
" }\r\n } else {\r" +
"\n alert(\'Unknown Id\');\r\n " +
" }\r\n }).fail(functi" +
"on (jqXHR, textStatus, errorThrown) {\r\n a" +
"lert(\'Error: \' + errorThrown);\r\n });\r\n " +
" }\r\n\r\n function updat" +
"eNoSubjects() {\r\n if (list.find(\'li:visible\')" +
".length > 0)\r\n noSubjects.hide();\r\n " +
" else\r\n noSu" +
"bjects.show();\r\n }\r\n\r\n " +
" function saveChanges() {\r\n var form = $(" +
"\'#Config_JobQueues_Subjects_Update_Dialog_Form\').empty();\r\n\r\n " +
" list.find(\'li[data-subjectstatus!=\"removed\"]\').each(function ()" +
" {\r\n var subjectId = $(this).attr(\'data-s" +
"ubjectid\');\r\n\r\n form.append($(\'<input>\')." +
"attr({\r\n \'name\': \'Subjects\',\r\n " +
" \'type\': \'hidden\'\r\n " +
" }).val(subjectId));\r\n\r\n }).get" +
"();\r\n\r\n form.submit();\r\n\r\n " +
" dialog.dialog(\"disable\");\r\n " +
"dialog.dialog(\"option\", \"buttons\", null);\r\n }\r\n\r\n" +
" $(function () {\r\n " +
" $(\'#Config_JobQueues_Subjects_Update\').click(showDialog);\r\n " +
" });\r\n\r\n })();\r\n " +
" </script>\r\n </div>\r\n");
#line 498 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 499 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
@@ -1431,13 +1432,13 @@ WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n
" Jobs:</th>\r\n <td>\r\n <div>\r\n");
#line 505 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 506 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line default
#line hidden
#line 505 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 506 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
if (Model.Token.JobQueue.JobSubTypes.Count > 0)
{
@@ -1447,13 +1448,13 @@ WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n
WriteLiteral(" <ul>\r\n");
#line 508 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 509 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line default
#line hidden
#line 508 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 509 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
foreach (var jobType in Model.Token.JobQueue.JobSubTypes.GroupBy(jst => jst.JobType).OrderBy(jtg => jtg.Key.Description))
{
@@ -1465,7 +1466,7 @@ WriteLiteral(" <li>\r\n");
WriteLiteral(" ");
#line 511 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 512 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(jobType.Key.Description);
@@ -1474,13 +1475,13 @@ WriteLiteral(" ");
WriteLiteral("\r\n <ul>\r\n");
#line 513 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 514 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line default
#line hidden
#line 513 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 514 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
if (jobType.Count() == Model.JobTypes.FirstOrDefault(jt => jt.Id == jobType.Key.Id).JobSubTypes.Count)
{
@@ -1494,7 +1495,7 @@ WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">[All Sub Types]</span></li>\r\n");
#line 516 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 517 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
else
{
@@ -1507,7 +1508,7 @@ WriteLiteral(">[All Sub Types]</span></li>\r\n");
WriteLiteral(" <li>");
#line 521 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 522 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(jobSubType.Description);
@@ -1516,7 +1517,7 @@ WriteLiteral(" <li>");
WriteLiteral("</li>\r\n");
#line 522 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 523 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
}
@@ -1527,7 +1528,7 @@ WriteLiteral(" </ul>\r\n
"\n");
#line 526 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 527 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
@@ -1536,7 +1537,7 @@ WriteLiteral(" </ul>\r\n
WriteLiteral(" </ul>\r\n");
#line 528 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 529 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
else
{
@@ -1551,7 +1552,7 @@ WriteLiteral("&lt;None&gt;");
WriteLiteral("\r\n");
#line 532 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 533 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
@@ -1560,13 +1561,13 @@ WriteLiteral("\r\n");
WriteLiteral(" </div>\r\n");
#line 534 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 535 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line default
#line hidden
#line 534 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 535 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
if (canConfig)
{
@@ -1594,13 +1595,13 @@ WriteLiteral(" title=\"Job Queue Automatic Types\"");
WriteLiteral(">\r\n");
#line 538 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 539 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line default
#line hidden
#line 538 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 539 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
using (Html.BeginForm(MVC.API.JobQueue.UpdateJobSubTypes(Model.Token.JobQueue.Id, null, true)))
{
var selectedTypes = Model.Token.JobQueue.JobSubTypes.Select(jst => jst.JobType).Distinct().ToList();
@@ -1612,15 +1613,15 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <div");
WriteAttribute("id", Tuple.Create(" id=\"", 28412), Tuple.Create("\"", 28434)
, Tuple.Create(Tuple.Create("", 28417), Tuple.Create("trJobType", 28417), true)
WriteAttribute("id", Tuple.Create(" id=\"", 28526), Tuple.Create("\"", 28548)
, Tuple.Create(Tuple.Create("", 28531), Tuple.Create("trJobType", 28531), true)
#line 543 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28426), Tuple.Create<System.Object, System.Int32>(jt.Id
#line 544 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28540), Tuple.Create<System.Object, System.Int32>(jt.Id
#line default
#line hidden
, 28426), false)
, 28540), false)
);
WriteLiteral(" class=\"jobTypes\"");
@@ -1628,35 +1629,35 @@ WriteLiteral(" class=\"jobTypes\"");
WriteLiteral(">\r\n <h4>\r\n <inp" +
"ut");
WriteAttribute("id", Tuple.Create(" id=\"", 28535), Tuple.Create("\"", 28554)
, Tuple.Create(Tuple.Create("", 28540), Tuple.Create("Types_", 28540), true)
WriteAttribute("id", Tuple.Create(" id=\"", 28649), Tuple.Create("\"", 28668)
, Tuple.Create(Tuple.Create("", 28654), Tuple.Create("Types_", 28654), true)
#line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28546), Tuple.Create<System.Object, System.Int32>(jt.Id
#line 546 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28660), Tuple.Create<System.Object, System.Int32>(jt.Id
#line default
#line hidden
, 28546), false)
, 28660), false)
);
WriteLiteral(" class=\"jobType\"");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("value", Tuple.Create(" value=\"", 28587), Tuple.Create("\"", 28603)
WriteAttribute("value", Tuple.Create(" value=\"", 28701), Tuple.Create("\"", 28717)
#line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28595), Tuple.Create<System.Object, System.Int32>(jt.Id
#line 546 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28709), Tuple.Create<System.Object, System.Int32>(jt.Id
#line default
#line hidden
, 28595), false)
, 28709), false)
);
WriteLiteral(" ");
#line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 546 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(selectedTypes.Contains(jt) ? "checked=\"checked\"" : null);
@@ -1664,21 +1665,21 @@ WriteLiteral(" ");
#line hidden
WriteLiteral(" /><label");
WriteAttribute("for", Tuple.Create(" for=\"", 28674), Tuple.Create("\"", 28694)
, Tuple.Create(Tuple.Create("", 28680), Tuple.Create("Types_", 28680), true)
WriteAttribute("for", Tuple.Create(" for=\"", 28788), Tuple.Create("\"", 28808)
, Tuple.Create(Tuple.Create("", 28794), Tuple.Create("Types_", 28794), true)
#line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28686), Tuple.Create<System.Object, System.Int32>(jt.Id
#line 546 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28800), Tuple.Create<System.Object, System.Int32>(jt.Id
#line default
#line hidden
, 28686), false)
, 28800), false)
);
WriteLiteral(">");
#line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 546 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(jt.Description);
@@ -1686,15 +1687,15 @@ WriteLiteral(">");
#line hidden
WriteLiteral("</label></h4>\r\n <div");
WriteAttribute("id", Tuple.Create(" id=\"", 28762), Tuple.Create("\"", 28784)
, Tuple.Create(Tuple.Create("", 28767), Tuple.Create("SubTypes_", 28767), true)
WriteAttribute("id", Tuple.Create(" id=\"", 28876), Tuple.Create("\"", 28898)
, Tuple.Create(Tuple.Create("", 28881), Tuple.Create("SubTypes_", 28881), true)
#line 546 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28776), Tuple.Create<System.Object, System.Int32>(jt.Id
#line 547 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28890), Tuple.Create<System.Object, System.Int32>(jt.Id
#line default
#line hidden
, 28776), false)
, 28890), false)
);
WriteLiteral(" class=\"jobSubTypes\"");
@@ -1704,7 +1705,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 547 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 548 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id), "div"));
@@ -1715,7 +1716,7 @@ WriteLiteral("\r\n");
WriteLiteral(" ");
#line 548 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 549 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(CommonHelpers.CheckBoxList("JobSubTypes", jt.JobSubTypes.OrderBy(jst => jst.Description).ToSelectListItems(Model.Token.JobQueue.JobSubTypes), 2));
@@ -1725,7 +1726,7 @@ WriteLiteral("\r\n </div>\r\n
"");
#line 551 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 552 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
}
@@ -1773,7 +1774,7 @@ WriteLiteral(" <script>\r\n (function
" })();\r\n </script>\r\n");
#line 616 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 617 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
@@ -1794,7 +1795,7 @@ WriteLiteral("></i>&nbsp;When jobs of these types are created, they will automat
" </table>\r\n</div>\r\n");
#line 624 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 625 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
if (canDelete || canShowJobs)
{
@@ -1810,7 +1811,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 627 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 628 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(Html.ActionLinkButton("Delete", MVC.API.JobQueue.Delete(Model.Token.JobQueue.Id, true), "Config_JobQueues_Actions_Delete_Button"));
@@ -1865,7 +1866,7 @@ WriteLiteral(@">
WriteLiteral(" ");
#line 664 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 665 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(Html.ActionLinkButton(string.Format("Show {0} job{1}", Model.OpenJobCount, (Model.OpenJobCount == 1 ? null : "s")), MVC.Job.Queue(Model.Token.JobQueue.Id), "Config_JobQueues_Actions_ShowJobs_Button"));
@@ -1874,7 +1875,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </div>\r\n");
#line 666 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 667 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
#line default
@@ -4140,6 +4140,11 @@ select {
border: 1px solid #ccc;
padding: 2px;
color: #444;
min-width: 200px;
}
select.small {
padding: 0;
min-width: 150px;
}
input[type="submit"],
button {
File diff suppressed because one or more lines are too long
+50
View File
@@ -938,6 +938,56 @@ div.logEventsViewport table.logEventsViewport > tbody > tr > td.eventType {
#Config_AuthRoles_Subjects_Update_Dialog #Config_AuthRoles_Subjects_Update_Dialog_List li .remove:hover {
opacity: 1;
}
#Config_Location {
margin-top: 10px;
}
#Config_Location #Config_Location_Unrestricted,
#Config_Location #Config_Location_List,
#Config_Location #Config_Location_Optional,
#Config_Location #Config_Location_Restricted {
display: none;
margin-top: 6px;
}
#Config_Location_List_Dialog {
display: none;
}
#Config_Location_List_Dialog #Config_Location_List_Dialog_ListContainer {
height: 280px;
overflow-y: auto;
background-color: #ffffff;
border: 1px solid #d8d8d8;
}
#Config_Location_List_Dialog #Config_Location_List_Dialog_None {
padding-top: 15px;
display: block;
text-align: center;
}
#Config_Location_List_Dialog #Config_Location_List_Dialog_AddContainer {
padding-top: 10px;
padding-left: 10px;
}
#Config_Location_List_Dialog #Config_Location_List_Dialog_List li {
padding: 2px 0 2px 4px;
cursor: pointer;
}
#Config_Location_List_Dialog #Config_Location_List_Dialog_List li:hover {
background-color: #f4f4f4;
}
#Config_Location_List_Dialog #Config_Location_List_Dialog_List li:hover .remove {
opacity: .8;
}
#Config_Location_List_Dialog #Config_Location_List_Dialog_List li .remove {
margin-top: 2px;
padding-right: 6px;
float: right;
cursor: pointer;
opacity: 0;
color: #e51400;
font-size: 1.3em;
}
#Config_Location_List_Dialog #Config_Location_List_Dialog_List li .remove:hover {
opacity: 1;
}
#Config_JobQueues_Index i {
width: 1.2857142857142858em;
text-align: center;
+60
View File
@@ -1066,6 +1066,66 @@ div.logEventsViewport {
}
}
#Config_Location {
margin-top: 10px;
#Config_Location_Unrestricted, #Config_Location_List, #Config_Location_Optional, #Config_Location_Restricted {
display: none;
margin-top: 6px;
}
}
#Config_Location_List_Dialog {
display: none;
#Config_Location_List_Dialog_ListContainer {
height: 280px;
overflow-y: auto;
background-color: @white;
border: 1px solid @TableDataDarkBorderColour;
}
#Config_Location_List_Dialog_None {
padding-top: 15px;
display: block;
text-align: center;
}
#Config_Location_List_Dialog_AddContainer {
padding-top: 10px;
padding-left: 10px;
}
#Config_Location_List_Dialog_List {
li {
padding: 2px 0 2px 4px;
cursor: pointer;
&:hover {
background-color: @TableDataBorderColour;
.remove {
opacity: .8;
}
}
.remove {
margin-top: 2px;
padding-right: 6px;
float: right;
cursor: pointer;
opacity: 0;
color: @StatusRemove;
font-size: 1.3em;
&:hover {
opacity: 1;
}
}
}
}
}
#Config_JobQueues_Index {
i {
width: 1.2857142857142858em;
File diff suppressed because one or more lines are too long
+5
View File
@@ -939,6 +939,11 @@ select {
border: 1px solid #ccc;
padding: 2px;
color: #444;
min-width: 200px;
}
select.small {
padding: 0;
min-width: 150px;
}
input[type="submit"],
button {
+6
View File
@@ -893,6 +893,12 @@ select {
border: 1px solid #ccc;
padding: 2px;
color: #444;
min-width: 200px;
}
select.small {
padding: 0;
min-width: 150px;
}
input[type="submit"], button {
File diff suppressed because one or more lines are too long
+8
View File
@@ -1,5 +1,6 @@
using Disco.BI.Extensions;
using Disco.Data.Repository;
using Disco.Models.BI.Job;
using Disco.Models.Repository;
using Disco.Models.Services.Jobs.JobLists;
using Disco.Models.UI.Job;
@@ -349,6 +350,13 @@ namespace Disco.Web.Controllers
jobQueues = JobQueueService.UsersQueues(CurrentUser);
m.AvailableQueues = jobQueues == null ? null : jobQueues.Select(qt => qt.JobQueue).Where(q => m.Job.CanAddQueue(q)).ToList();
if (Authorization.Has(Claims.Job.Properties.DeviceHeldLocation))
{
m.LocationMode = Database.DiscoConfiguration.JobPreferences.LocationMode;
if (m.LocationMode == LocationModes.RestrictedList)
m.LocationOptions = ManagedJobList.OpenJobsTable(j => j).Items.JobLocationReferences(Database.DiscoConfiguration.JobPreferences.LocationList).ToList();
}
// UI Extensions
UIExtensions.ExecuteExtensions<JobShowModel>(this.ControllerContext, m);
+20 -1
View File
@@ -195,6 +195,7 @@
<Compile Include="Areas\API\Controllers\SearchController.cs" />
<Compile Include="Areas\API\Models\AuthorizationRole\SubjectItem.cs" />
<Compile Include="Areas\API\Models\JobQueue\SubjectItem.cs" />
<Compile Include="Areas\API\Models\Job\DeviceHeldLocationModel.cs" />
<Compile Include="Areas\Config\Controllers\AuthorizationRoleController.cs" />
<Compile Include="Areas\Config\Controllers\JobPreferencesController.cs" />
<Compile Include="Areas\Config\Controllers\JobQueueController.cs" />
@@ -233,6 +234,16 @@
<DesignTime>True</DesignTime>
<DependentUpon>Index.cshtml</DependentUpon>
</Compile>
<Compile Include="Areas\Config\Views\JobPreferences\Parts\General.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>General.cshtml</DependentUpon>
</Compile>
<Compile Include="Areas\Config\Views\JobPreferences\Parts\Locations.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Locations.cshtml</DependentUpon>
</Compile>
<Compile Include="Areas\Config\Views\JobQueue\Create.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -924,6 +935,14 @@
<Generator>RazorGenerator</Generator>
<LastGenOutput>Index.generated.cs</LastGenOutput>
</None>
<None Include="Areas\Config\Views\JobPreferences\Parts\General.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>General.generated.cs</LastGenOutput>
</None>
<None Include="Areas\Config\Views\JobPreferences\Parts\Locations.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>Locations.generated.cs</LastGenOutput>
</None>
<None Include="Areas\Config\Views\JobQueue\Show.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>Show.generated.cs</LastGenOutput>
@@ -2014,7 +2033,7 @@
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" BuildVersion_StartDate="2011/7/1" />
<UserProperties BuildVersion_StartDate="2011/7/1" BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+9 -6
View File
@@ -1,11 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI.Extensions;
using Disco.Models.BI.Job;
using Disco.Models.Services.Jobs.JobLists;
using Disco.Models.UI.Job;
using Disco.Web.Extensions;
using System;
using System.Collections.Generic;
using System.Web.Mvc;
namespace Disco.Web.Models.Job
{
@@ -29,5 +28,9 @@ namespace Disco.Web.Models.Job
return list;
}
}
public LocationModes LocationMode { get; set; }
public List<JobLocationReference> LocationOptions { get; set; }
}
}
+82
View File
@@ -6172,6 +6172,7 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string ComponentRemove = "ComponentRemove";
public readonly string StatisticsDailyOpenedClosed = "StatisticsDailyOpenedClosed";
public readonly string GeneratePdf = "GeneratePdf";
public readonly string DeviceHeldLocations = "DeviceHeldLocations";
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -6243,6 +6244,7 @@ namespace Disco.Web.Areas.API.Controllers
public const string ComponentRemove = "ComponentRemove";
public const string StatisticsDailyOpenedClosed = "StatisticsDailyOpenedClosed";
public const string GeneratePdf = "GeneratePdf";
public const string DeviceHeldLocations = "DeviceHeldLocations";
}
@@ -7656,6 +7658,15 @@ namespace Disco.Web.Areas.API.Controllers
return callInfo;
}
partial void DeviceHeldLocationsOverride(T4MVC_System_Web_Mvc_ActionResult callInfo);
public override System.Web.Mvc.ActionResult DeviceHeldLocations()
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.DeviceHeldLocations);
DeviceHeldLocationsOverride(callInfo);
return callInfo;
}
}
}
@@ -7695,6 +7706,18 @@ namespace Disco.Web.Areas.API.Controllers
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateStaleJobMinutesThreshold);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateLocationMode()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateLocationMode);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateLocationList()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateLocationList);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public JobPreferencesController Actions { get { return MVC.API.JobPreferences; } }
@@ -7713,6 +7736,8 @@ namespace Disco.Web.Areas.API.Controllers
{
public readonly string UpdateLongRunningJobDaysThreshold = "UpdateLongRunningJobDaysThreshold";
public readonly string UpdateStaleJobMinutesThreshold = "UpdateStaleJobMinutesThreshold";
public readonly string UpdateLocationMode = "UpdateLocationMode";
public readonly string UpdateLocationList = "UpdateLocationList";
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -7720,6 +7745,8 @@ namespace Disco.Web.Areas.API.Controllers
{
public const string UpdateLongRunningJobDaysThreshold = "UpdateLongRunningJobDaysThreshold";
public const string UpdateStaleJobMinutesThreshold = "UpdateStaleJobMinutesThreshold";
public const string UpdateLocationMode = "UpdateLocationMode";
public const string UpdateLocationList = "UpdateLocationList";
}
@@ -7741,6 +7768,24 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string StaleJobMinutesThreshold = "StaleJobMinutesThreshold";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateLocationMode s_params_UpdateLocationMode = new ActionParamsClass_UpdateLocationMode();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateLocationMode UpdateLocationModeParams { get { return s_params_UpdateLocationMode; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateLocationMode
{
public readonly string LocationMode = "LocationMode";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateLocationList s_params_UpdateLocationList = new ActionParamsClass_UpdateLocationList();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateLocationList UpdateLocationListParams { get { return s_params_UpdateLocationList; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateLocationList
{
public readonly string LocationList = "LocationList";
public readonly string redirect = "redirect";
}
static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ViewsClass Views { get { return s_views; } }
@@ -7782,6 +7827,28 @@ namespace Disco.Web.Areas.API.Controllers
return callInfo;
}
partial void UpdateLocationModeOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Disco.Models.BI.Job.LocationModes LocationMode, bool redirect);
public override System.Web.Mvc.ActionResult UpdateLocationMode(Disco.Models.BI.Job.LocationModes LocationMode, bool redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateLocationMode);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "LocationMode", LocationMode);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateLocationModeOverride(callInfo, LocationMode, redirect);
return callInfo;
}
partial void UpdateLocationListOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string[] LocationList, bool redirect);
public override System.Web.Mvc.ActionResult UpdateLocationList(string[] LocationList, bool redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateLocationList);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "LocationList", LocationList);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateLocationListOverride(callInfo, LocationList, redirect);
return callInfo;
}
}
}
@@ -10621,6 +10688,21 @@ namespace Disco.Web.Areas.Config.Controllers
public readonly string Index = "Index";
}
public readonly string Index = "~/Areas/Config/Views/JobPreferences/Index.cshtml";
static readonly _PartsClass s_Parts = new _PartsClass();
public _PartsClass Parts { get { return s_Parts; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public partial class _PartsClass
{
static readonly _ViewNamesClass s_ViewNames = new _ViewNamesClass();
public _ViewNamesClass ViewNames { get { return s_ViewNames; } }
public class _ViewNamesClass
{
public readonly string General = "General";
public readonly string Locations = "Locations";
}
public readonly string General = "~/Areas/Config/Views/JobPreferences/Parts/General.cshtml";
public readonly string Locations = "~/Areas/Config/Views/JobPreferences/Parts/Locations.cshtml";
}
}
}
+112 -31
View File
@@ -261,15 +261,32 @@
</div>
@if (Model.Job.DeviceHeld.HasValue)
{
var canEditLocation = Authorization.Has(Claims.Job.Properties.DeviceHeldLocation);
<div id="Job_Show_Device_DeviceHeld" class="status">
<table class="none">
<tr>
<td>Location:</td>
<td>
<span id="Job_Show_Device_DeviceHeld_Location">
@if (Authorization.Has(Claims.Job.Properties.DeviceHeldLocation))
@if (canEditLocation)
{
@Html.TextBoxFor(m => m.Job.DeviceHeldLocation, new { @class = "small discreet" }) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader()
switch (Model.LocationMode)
{
case Disco.Models.BI.Job.LocationModes.Unrestricted:
case Disco.Models.BI.Job.LocationModes.OptionalList:
@Html.TextBoxFor(m => m.Job.DeviceHeldLocation, new { @class = "small discreet" })
break;
case Disco.Models.BI.Job.LocationModes.RestrictedList:
List<SelectListItem> listOptions = new List<SelectListItem>() { new SelectListItem() { Value = "", Text = "<Unknown>" } };
if (!string.IsNullOrWhiteSpace(Model.Job.DeviceHeldLocation) && !Model.LocationOptions.Any(l => l.Location.Equals(Model.Job.DeviceHeldLocation)))
{
listOptions.Add(new SelectListItem() { Value = Model.Job.DeviceHeldLocation, Text = string.Format("Custom: {0}", Model.Job.DeviceHeldLocation) });
}
listOptions.AddRange(Model.LocationOptions.Select(l => new SelectListItem() { Value = l.Location, Text = (l.References.Count == 0 ? l.Location : (l.References.Count == 1 ? string.Format("{0} [Job {1}]", l.Location, l.References[0].JobId) : string.Format("{0} [{1} jobs]", l.Location, l.References.Count))) }));
@Html.DropDownListFor(m => m.Job.DeviceHeldLocation, listOptions, new { @class = "small discreet" });
break;
}
@AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader()
}
else if (string.IsNullOrEmpty(Model.Job.DeviceHeldLocation))
{
@@ -301,16 +318,65 @@
</tr>
}
</table>
@if (Authorization.Has(Claims.Job.Properties.DeviceHeldLocation))
@if (canEditLocation)
{
<script type="text/javascript">
$(function () {
@switch (Model.LocationMode)
{
case Disco.Models.BI.Job.LocationModes.Unrestricted:
case Disco.Models.BI.Job.LocationModes.OptionalList:
<text>
var $deviceHeldLocation = $('#Job_DeviceHeldLocation');
var $ajaxSave = $deviceHeldLocation.next('.ajaxSave');
var autocompleteLoaded = false;
$deviceHeldLocation
.watermark('Unknown')
.focus(function () { $deviceHeldLocation.select() })
.focus(function () {
$deviceHeldLocation.select();
// Load AutoComplete
if (!autocompleteLoaded){
$.ajax({
url: '@(Url.Action(MVC.API.Job.DeviceHeldLocations()))',
dataType: 'json',
success: function (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('search', '');
}
});
autocompleteLoaded = true;
}else{
$deviceHeldLocation.autocomplete('search', '');
}
})
.keydown(function (e) {
$ajaxSave.show();
if (e.which == 13) {
@@ -341,6 +407,20 @@
}
});
});
</text>
break;
case Disco.Models.BI.Job.LocationModes.RestrictedList:
<text>
document.DiscoFunctions.PropertyChangeHelper(
$('#Job_DeviceHeldLocation'),
null,
'@Url.Action(MVC.API.Job.UpdateDeviceHeldLocation(Model.Job.Id, null))',
'DeviceHeldLocation');
</text>
break;
}
});
</script>
}
@@ -361,10 +441,10 @@
<div id="Job_Show_User_Id" title="Id">@Model.Job.UserId</div>
@if (Authorization.Has(Claims.User.ShowDetails))
{
if (!string.IsNullOrWhiteSpace(Model.Job.User.PhoneNumber))
{<div id="Job_Show_User_PhoneNumber" title="Phone Number">Phone: @Model.Job.User.PhoneNumber</div>}
if (!string.IsNullOrWhiteSpace(Model.Job.User.EmailAddress))
{<div id="Job_Show_User_EmailAddress" title="Email Address">Email: <a href="mailto:@(Model.Job.User.EmailAddress)">@Model.Job.User.EmailAddress</a></div>}
if (!string.IsNullOrWhiteSpace(Model.Job.User.PhoneNumber))
{<div id="Job_Show_User_PhoneNumber" title="Phone Number">Phone: @Model.Job.User.PhoneNumber</div>}
if (!string.IsNullOrWhiteSpace(Model.Job.User.EmailAddress))
{<div id="Job_Show_User_EmailAddress" title="Email Address">Email: <a href="mailto:@(Model.Job.User.EmailAddress)">@Model.Job.User.EmailAddress</a></div>}
}
@if (Model.Job.WaitingForUserAction.HasValue)
{
@@ -559,31 +639,32 @@
@Html.ActionLinkSmallButton("Add to Queue", MVC.API.JobQueueJob.AddJob(), "Job_Show_Job_Actions_AddQueue_Button")
<div id="Job_Show_Job_Actions_AddQueue_Dialog" class="dialog" title="Add Job to Queue">
@using (Html.BeginForm(MVC.API.JobQueueJob.AddJob())){
<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">
@foreach (var jobQueue in Model.AvailableQueues.OrderBy(jq => jq.Name))
{
<div class="queue" data-queueid="@(jobQueue.Id)" data-queuesla="@(jobQueue.DefaultSLAExpiry.HasValue ? jobQueue.DefaultSLAExpiry.Value.ToString() : null)" data-queuepriority="@(jobQueue.Priority.ToString())">
<i class="fa fa-@(jobQueue.Icon) fa-fw fa-lg d-@(jobQueue.IconColour)"></i>@jobQueue.Name
@using (Html.BeginForm(MVC.API.JobQueueJob.AddJob()))
{
<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">
@foreach (var jobQueue in Model.AvailableQueues.OrderBy(jq => jq.Name))
{
<div class="queue" data-queueid="@(jobQueue.Id)" data-queuesla="@(jobQueue.DefaultSLAExpiry.HasValue ? jobQueue.DefaultSLAExpiry.Value.ToString() : null)" data-queuepriority="@(jobQueue.Priority.ToString())">
<i class="fa fa-@(jobQueue.Icon) fa-fw fa-lg d-@(jobQueue.IconColour)"></i>@jobQueue.Name
</div>
}
</div>
<div class="details">
<div>
<h4>Job Priority</h4>
@Html.DropDownList("Priority", priorityItems) <i class="fa d-priority-@(priorityValue.ToLower())" title="@(priorityValue) Priority"></i>
</div>
<div>
<h4>SLA Target</h4>
@Html.DropDownList("SLAExpiresMinutes", slaOptions)
</div>
<div>
<h4>Tasks/Comment</h4>
@Html.TextArea("Comment")
</div>
}
</div>
<div class="details">
<div>
<h4>Job Priority</h4>
@Html.DropDownList("Priority", priorityItems) <i class="fa d-priority-@(priorityValue.ToLower())" title="@(priorityValue) Priority"></i>
</div>
<div>
<h4>SLA Target</h4>
@Html.DropDownList("SLAExpiresMinutes", slaOptions)
</div>
<div>
<h4>Tasks/Comment</h4>
@Html.TextArea("Comment")
</div>
</div>
}
</div>
<script type="text/javascript">
File diff suppressed because it is too large Load Diff