feature: scheduled flag removal

This commit is contained in:
Gary Sharp
2025-09-19 12:18:45 +10:00
parent 356762c811
commit 7603cac01a
34 changed files with 2210 additions and 1055 deletions
@@ -36,7 +36,7 @@ namespace Disco.Models.Repository
get => FlagPermission.FromFlag(this); get => FlagPermission.FromFlag(this);
set => PermissionsJson = value?.ToJson(); set => PermissionsJson = value?.ToJson();
} }
[Range(0, int.MaxValue)]
public int? DefaultRemoveDays { get; set; } public int? DefaultRemoveDays { get; set; }
public virtual IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; } public virtual IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
@@ -36,7 +36,7 @@ namespace Disco.Models.Repository
get => FlagPermission.FromFlag(this); get => FlagPermission.FromFlag(this);
set => PermissionsJson = value?.ToJson(); set => PermissionsJson = value?.ToJson();
} }
[Range(0, int.MaxValue)]
public int? DefaultRemoveDays { get; set; } public int? DefaultRemoveDays { get; set; }
public virtual IList<UserFlagAssignment> UserFlagAssignments { get; set; } public virtual IList<UserFlagAssignment> UserFlagAssignments { get; set; }
@@ -14,19 +14,26 @@ namespace Disco.Services
public static class DeviceFlagExtensions public static class DeviceFlagExtensions
{ {
#region Edit Comments #region Edit
public static bool CanEdit(this DeviceFlagAssignment fa) public static bool CanEdit(this DeviceFlagAssignment fa)
{ {
var (_, permission) = DeviceFlagService.GetDeviceFlag(fa.DeviceFlagId); var (_, permission) = DeviceFlagService.GetDeviceFlag(fa.DeviceFlagId);
return permission.CanEdit(); return permission.CanEdit();
} }
public static void OnEdit(this DeviceFlagAssignment fa, string comments) public static void OnEdit(this DeviceFlagAssignment fa, string comments, DateTime? removeDate)
{ {
if (!fa.CanEdit()) if (!fa.CanEdit())
throw new InvalidOperationException("Editing comments for device flags is denied"); throw new InvalidOperationException("Editing comments for device flags is denied");
fa.Comments = string.IsNullOrWhiteSpace(comments) ? null : comments.Trim(); fa.Comments = string.IsNullOrWhiteSpace(comments) ? null : comments.Trim();
if (fa.CanRemove() && removeDate != fa.RemoveDate &&
(!removeDate.HasValue || removeDate.Value >= DateTime.Today))
{
fa.RemoveDate = removeDate?.Date;
fa.RemoveUserId = UserService.CurrentUser.UserId;
}
} }
#endregion #endregion
@@ -49,6 +56,11 @@ namespace Disco.Services
} }
public static void OnRemoveUnsafe(this DeviceFlagAssignment fa, DiscoDataContext database, User removingUser) public static void OnRemoveUnsafe(this DeviceFlagAssignment fa, DiscoDataContext database, User removingUser)
{
OnRemoveUnsafe(fa, database, removingUser, isScheduled: false);
}
internal static void OnRemoveUnsafe(this DeviceFlagAssignment fa, DiscoDataContext database, User removingUser, bool isScheduled)
{ {
fa = database.DeviceFlagAssignments fa = database.DeviceFlagAssignments
.Include(a => a.DeviceFlag) .Include(a => a.DeviceFlag)
@@ -58,6 +70,13 @@ namespace Disco.Services
fa.RemovedDate = DateTime.Now; fa.RemovedDate = DateTime.Now;
fa.RemovedUserId = removingUser.UserId; fa.RemovedUserId = removingUser.UserId;
if (!isScheduled)
{
fa.RemoveDate = null;
fa.RemoveUser = null;
fa.RemoveUserId = null;
}
if (!string.IsNullOrWhiteSpace(fa.DeviceFlag.OnUnassignmentExpression)) if (!string.IsNullOrWhiteSpace(fa.DeviceFlag.OnUnassignmentExpression))
{ {
try try
@@ -89,15 +108,45 @@ namespace Disco.Services
return permission.CanAssign(); return permission.CanAssign();
} }
public static bool CanRemoveDeviceFlag(this Device d, DeviceFlag flag)
{
var (_, permission) = DeviceFlagService.GetDeviceFlag(flag.Id);
return permission.CanRemove();
}
public static DeviceFlagAssignment OnAddDeviceFlag(this Device d, DiscoDataContext database, DeviceFlag flag, string comments) public static DeviceFlagAssignment OnAddDeviceFlag(this Device d, DiscoDataContext database, DeviceFlag flag, string comments)
{ {
if (!d.CanAddDeviceFlag(flag)) if (!d.CanAddDeviceFlag(flag))
throw new InvalidOperationException("Adding device flag is denied"); throw new InvalidOperationException("Adding device flag is denied");
return d.OnAddDeviceFlagUnsafe(database, flag, UserService.CurrentUser, comments); var removeDate = (DateTime?)null;
if (flag.DefaultRemoveDays.HasValue)
removeDate = DateTime.Today.AddDays(flag.DefaultRemoveDays.Value);
return OnAddDeviceFlag(d, database, flag, comments, removeDate);
}
public static DeviceFlagAssignment OnAddDeviceFlag(this Device d, DiscoDataContext database, DeviceFlag flag, string comments, DateTime? removeDate)
{
if (!d.CanAddDeviceFlag(flag))
throw new InvalidOperationException("Adding device flag is denied");
if (d.CanRemoveDeviceFlag(flag))
return d.OnAddDeviceFlagUnsafe(database, flag, UserService.CurrentUser, comments, removeDate);
else
return d.OnAddDeviceFlagUnsafe(database, flag, UserService.CurrentUser, comments);
} }
public static DeviceFlagAssignment OnAddDeviceFlagUnsafe(this Device d, DiscoDataContext database, DeviceFlag flag, User addingUser, string comments) public static DeviceFlagAssignment OnAddDeviceFlagUnsafe(this Device d, DiscoDataContext database, DeviceFlag flag, User addingUser, string comments)
{
var removeDate = (DateTime?)null;
if (flag.DefaultRemoveDays.HasValue)
removeDate = DateTime.Today.AddDays(flag.DefaultRemoveDays.Value);
return OnAddDeviceFlagUnsafe(d, database, flag, addingUser, comments, removeDate);
}
public static DeviceFlagAssignment OnAddDeviceFlagUnsafe(this Device d, DiscoDataContext database, DeviceFlag flag, User addingUser, string comments, DateTime? removeDate)
{ {
flag = database.DeviceFlags.First(f => f.Id == flag.Id); flag = database.DeviceFlags.First(f => f.Id == flag.Id);
d = database.Devices.First(de => de.SerialNumber == d.SerialNumber); d = database.Devices.First(de => de.SerialNumber == d.SerialNumber);
@@ -113,6 +162,13 @@ namespace Disco.Services
Comments = string.IsNullOrWhiteSpace(comments) ? null : comments.Trim() Comments = string.IsNullOrWhiteSpace(comments) ? null : comments.Trim()
}; };
if (removeDate.HasValue)
{
fa.RemoveDate = removeDate.Value.Date;
fa.RemoveUser = addingUser;
fa.RemoveUserId = addingUser.UserId;
}
database.DeviceFlagAssignments.Add(fa); database.DeviceFlagAssignments.Add(fa);
if (!string.IsNullOrWhiteSpace(flag.OnAssignmentExpression)) if (!string.IsNullOrWhiteSpace(flag.OnAssignmentExpression))
@@ -0,0 +1,65 @@
using Disco.Data.Repository;
using Disco.Services.Tasks;
using Quartz;
using System;
using System.Data.Entity;
using System.Linq;
namespace Disco.Services.Devices.DeviceFlags
{
public class FlagRemovalTask : ScheduledTask
{
public override string TaskName { get; } = "Flags - Scheduled Removal";
public override bool SingleInstanceTask { get; } = false;
public override bool CancelInitiallySupported { get; } = false;
public override bool LogExceptionsOnly { get; } = true;
public override void InitalizeScheduledTask(DiscoDataContext Database)
{
// Schedule in 1mins
var trigger = TriggerBuilder.Create()
.StartAt(DateTimeOffset.Now.AddMinutes(1));
ScheduleTask(trigger);
// Schedule every day at midnight
trigger = TriggerBuilder.Create()
.WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(0, 0));
ScheduleTask(trigger);
}
protected override void ExecuteTask()
{
using (DiscoDataContext database = new DiscoDataContext())
{
var assignments = database.DeviceFlagAssignments
.Include(a => a.RemoveUser)
.Include(a => a.AddedUser)
.Where(a => a.RemovedDate == null && a.RemoveDate <= DateTime.Today)
.ToList();
foreach (var assignment in assignments)
{
assignment.OnRemoveUnsafe(database, assignment.RemoveUser ?? assignment.AddedUser, isScheduled: true);
}
database.SaveChanges();
}
using (DiscoDataContext database = new DiscoDataContext())
{
var assignments = database.UserFlagAssignments
.Include(a => a.RemoveUser)
.Include(a => a.AddedUser)
.Where(a => a.RemovedDate == null && a.RemoveDate <= DateTime.Today)
.ToList();
foreach (var assignment in assignments)
{
assignment.OnRemoveUnsafe(database, assignment.RemoveUser ?? assignment.AddedUser, isScheduled: true);
}
database.SaveChanges();
}
}
}
}
+1
View File
@@ -348,6 +348,7 @@
<Compile Include="Devices\DeviceDetailExtensions.cs" /> <Compile Include="Devices\DeviceDetailExtensions.cs" />
<Compile Include="Devices\DeviceExtensions.cs" /> <Compile Include="Devices\DeviceExtensions.cs" />
<Compile Include="Devices\DeviceFlags\DeviceFlagExport.cs" /> <Compile Include="Devices\DeviceFlags\DeviceFlagExport.cs" />
<Compile Include="Devices\DeviceFlags\FlagRemovalTask.cs" />
<Compile Include="Devices\DeviceModelExtensions.cs" /> <Compile Include="Devices\DeviceModelExtensions.cs" />
<Compile Include="Devices\DeviceProfileExtensions.cs" /> <Compile Include="Devices\DeviceProfileExtensions.cs" />
<Compile Include="Devices\DeviceBatchUpdatesHub.cs" /> <Compile Include="Devices\DeviceBatchUpdatesHub.cs" />
@@ -13,19 +13,26 @@ namespace Disco.Services
public static class UserFlagExtensions public static class UserFlagExtensions
{ {
#region Edit Comments #region Edit
public static bool CanEdit(this UserFlagAssignment fa) public static bool CanEdit(this UserFlagAssignment fa)
{ {
var (_, permission) = UserFlagService.GetUserFlag(fa.UserFlagId); var (_, permission) = UserFlagService.GetUserFlag(fa.UserFlagId);
return permission.CanEdit(); return permission.CanEdit();
} }
public static void OnEdit(this UserFlagAssignment fa, string comments) public static void OnEdit(this UserFlagAssignment fa, string comments, DateTime? removeDate)
{ {
if (!fa.CanEdit()) if (!fa.CanEdit())
throw new InvalidOperationException("Editing comments for user flags is denied"); throw new InvalidOperationException("Editing comments for user flags is denied");
fa.Comments = string.IsNullOrWhiteSpace(comments) ? null : comments.Trim(); fa.Comments = string.IsNullOrWhiteSpace(comments) ? null : comments.Trim();
if (fa.CanRemove() && removeDate != fa.RemoveDate &&
(!removeDate.HasValue || removeDate.Value >= DateTime.Today))
{
fa.RemoveDate = removeDate?.Date;
fa.RemoveUserId = UserService.CurrentUser.UserId;
}
} }
#endregion #endregion
@@ -48,6 +55,11 @@ namespace Disco.Services
} }
public static void OnRemoveUnsafe(this UserFlagAssignment fa, DiscoDataContext database, User removingUser) public static void OnRemoveUnsafe(this UserFlagAssignment fa, DiscoDataContext database, User removingUser)
{
OnRemoveUnsafe(fa, database, removingUser, false);
}
internal static void OnRemoveUnsafe(this UserFlagAssignment fa, DiscoDataContext database, User removingUser, bool isScheduled)
{ {
fa = database.UserFlagAssignments.First(a => a.Id == fa.Id); fa = database.UserFlagAssignments.First(a => a.Id == fa.Id);
removingUser = database.Users.First(u => u.UserId == removingUser.UserId); removingUser = database.Users.First(u => u.UserId == removingUser.UserId);
@@ -55,6 +67,13 @@ namespace Disco.Services
fa.RemovedDate = DateTime.Now; fa.RemovedDate = DateTime.Now;
fa.RemovedUserId = removingUser.UserId; fa.RemovedUserId = removingUser.UserId;
if (!isScheduled)
{
fa.RemoveDate = null;
fa.RemoveUser = null;
fa.RemoveUserId = null;
}
if (!string.IsNullOrWhiteSpace(fa.UserFlag.OnUnassignmentExpression)) if (!string.IsNullOrWhiteSpace(fa.UserFlag.OnUnassignmentExpression))
{ {
try try
@@ -87,14 +106,40 @@ namespace Disco.Services
return permission.CanAssign(); return permission.CanAssign();
} }
public static UserFlagAssignment OnAddUserFlag(this User u, DiscoDataContext database, UserFlag flag, string comments) public static UserFlagAssignment OnAddUserFlag(this User u, DiscoDataContext database, UserFlag flag, string comments)
{
var removeDate = (DateTime?)null;
if (flag.DefaultRemoveDays.HasValue)
removeDate = DateTime.Today.AddDays(flag.DefaultRemoveDays.Value);
return OnAddUserFlag(u, database, flag, comments, removeDate);
}
public static UserFlagAssignment OnAddUserFlag(this User u, DiscoDataContext database, UserFlag flag, string comments, DateTime? removeDate)
{ {
if (!u.CanAddUserFlag(flag)) if (!u.CanAddUserFlag(flag))
throw new InvalidOperationException("Adding user flag is denied"); throw new InvalidOperationException("Adding user flag is denied");
return u.OnAddUserFlagUnsafe(database, flag, UserService.CurrentUser, comments); if (u.CanRemoveUserFlag(flag))
return u.OnAddUserFlagUnsafe(database, flag, UserService.CurrentUser, comments, removeDate);
else
return u.OnAddUserFlagUnsafe(database, flag, UserService.CurrentUser, comments);
}
public static bool CanRemoveUserFlag(this User u, UserFlag flag)
{
var (_, permission) = UserFlagService.GetUserFlag(flag.Id);
return permission.CanRemove();
} }
public static UserFlagAssignment OnAddUserFlagUnsafe(this User u, DiscoDataContext database, UserFlag flag, User addingUser, string comments) public static UserFlagAssignment OnAddUserFlagUnsafe(this User u, DiscoDataContext database, UserFlag flag, User addingUser, string comments)
{
var removeDate = (DateTime?)null;
if (flag.DefaultRemoveDays.HasValue)
removeDate = DateTime.Today.AddDays(flag.DefaultRemoveDays.Value);
return OnAddUserFlagUnsafe(u, database, flag, addingUser, comments, removeDate);
}
public static UserFlagAssignment OnAddUserFlagUnsafe(this User u, DiscoDataContext database, UserFlag flag, User addingUser, string comments, DateTime? removeDate)
{ {
flag = database.UserFlags.First(f => f.Id == flag.Id); flag = database.UserFlags.First(f => f.Id == flag.Id);
u = database.Users.First(user => user.UserId == u.UserId); u = database.Users.First(user => user.UserId == u.UserId);
@@ -110,6 +155,13 @@ namespace Disco.Services
Comments = string.IsNullOrWhiteSpace(comments) ? null : comments.Trim() Comments = string.IsNullOrWhiteSpace(comments) ? null : comments.Trim()
}; };
if (removeDate.HasValue)
{
fa.RemoveDate = removeDate.Value.Date;
fa.RemoveUser = addingUser;
fa.RemoveUserId = addingUser.UserId;
}
database.UserFlagAssignments.Add(fa); database.UserFlagAssignments.Add(fa);
if (!string.IsNullOrWhiteSpace(flag.OnAssignmentExpression)) if (!string.IsNullOrWhiteSpace(flag.OnAssignmentExpression))
@@ -238,7 +238,7 @@ namespace Disco.Services.Users.UserFlags
var chunkResults = chunk.Select((user, index) => var chunkResults = chunk.Select((user, index) =>
{ {
status.UpdateStatus((chunkIndexOffset + index) * progressInterval, string.Format("Assigning Flag: {0}", user.ToString())); status.UpdateStatus((chunkIndexOffset + index) * progressInterval, $"Assigning Flag: {user}");
return user.OnAddUserFlagUnsafe(database, userFlag, techUser, comments); return user.OnAddUserFlagUnsafe(database, userFlag, techUser, comments);
}).ToList(); }).ToList();
@@ -1,5 +1,4 @@
using Disco.Models.Repository; using Disco.Services;
using Disco.Services;
using Disco.Services.Web; using Disco.Services.Web;
using System; using System;
using System.Data.Entity; using System.Data.Entity;
@@ -10,34 +9,25 @@ namespace Disco.Web.Areas.API.Controllers
{ {
public partial class DeviceFlagAssignmentController : AuthorizedDatabaseController public partial class DeviceFlagAssignmentController : AuthorizedDatabaseController
{ {
const string pComments = "comments";
[HttpPost, ValidateAntiForgeryToken] [HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null) public virtual ActionResult Edit(int id, string comments, DateTime? removeDate, bool? redirect = null)
{ {
try try
{ {
if (id < 0) if (id < 0)
throw new ArgumentOutOfRangeException(nameof(id)); throw new ArgumentOutOfRangeException(nameof(id));
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException(nameof(key));
var assignment = Database.DeviceFlagAssignments var assignment = Database.DeviceFlagAssignments
.Include(a => a.DeviceFlag) .Include(a => a.DeviceFlag)
.FirstOrDefault(a => a.Id == id); .FirstOrDefault(a => a.Id == id)
if (assignment != null) ?? throw new Exception("Invalid Device Flag Assignment Id");
{
switch (key.ToLower()) if (!assignment.CanEdit())
{ throw new InvalidOperationException("Editing comments for device flags is denied");
case pComments:
UpdateComments(assignment, value); assignment.OnEdit(comments, removeDate);
break; Database.SaveChanges();
default:
throw new Exception("Invalid Update Key");
}
}
else
{
throw new Exception("Invalid Device Flag Assignment Id");
}
if (redirect.HasValue && redirect.Value) if (redirect.HasValue && redirect.Value)
return Redirect($"{Url.Action(MVC.Device.Show(assignment.DeviceSerialNumber))}#DeviceDetailTab-Flags"); return Redirect($"{Url.Action(MVC.Device.Show(assignment.DeviceSerialNumber))}#DeviceDetailTab-Flags");
else else
@@ -52,43 +42,30 @@ namespace Disco.Web.Areas.API.Controllers
} }
} }
#region Update Shortcut Methods
[HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult UpdateComments(int id, string Comments = null, bool? redirect = null)
{
return Update(id, pComments, Comments, redirect);
}
#endregion
#region Update Properties
private void UpdateComments(DeviceFlagAssignment assignment, string comments)
{
if (!assignment.CanEdit())
throw new InvalidOperationException("Editing comments for device flags is denied");
assignment.OnEdit(comments);
Database.SaveChanges();
}
#endregion
#region Actions #region Actions
[HttpPost, ValidateAntiForgeryToken] [HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult AddDevice(int id, string deviceSerialNumber, string comments) public virtual ActionResult AddDevice(int id, string deviceSerialNumber, string comments, DateTime? removeDate)
{ {
Database.Configuration.LazyLoadingEnabled = true; Database.Configuration.LazyLoadingEnabled = true;
var flag = Database.DeviceFlags.Find(id); var flag = Database.DeviceFlags.Find(id)
if (flag == null) ?? throw new ArgumentException("Invalid Device Flag Id", nameof(id));
throw new ArgumentException("Invalid Device Flag Id", nameof(id));
var device = Database.Devices.Include(u => u.DeviceFlagAssignments).FirstOrDefault(d => d.SerialNumber == deviceSerialNumber); var device = Database.Devices
if (device == null) .Include(u => u.DeviceFlagAssignments)
throw new ArgumentException("Invalid Device Serial Number", nameof(deviceSerialNumber)); .FirstOrDefault(d => d.SerialNumber == deviceSerialNumber)
?? throw new ArgumentException("Invalid Device Serial Number", nameof(deviceSerialNumber));
if (!device.CanAddDeviceFlag(flag)) if (!device.CanAddDeviceFlag(flag))
return Unauthorized("Adding device flag is denied"); return Unauthorized("Adding device flag is denied");
var assignment = device.OnAddDeviceFlag(Database, flag, comments); if (removeDate.HasValue && removeDate.Value < DateTime.Today.AddDays(1))
removeDate = null;
if (device.CanRemoveDeviceFlag(flag))
device.OnAddDeviceFlag(Database, flag, comments, removeDate);
else
device.OnAddDeviceFlag(Database, flag, comments);
Database.SaveChanges(); Database.SaveChanges();
@@ -102,9 +79,8 @@ namespace Disco.Web.Areas.API.Controllers
var assignment = Database.DeviceFlagAssignments var assignment = Database.DeviceFlagAssignments
.Include(a => a.DeviceFlag) .Include(a => a.DeviceFlag)
.FirstOrDefault(a => a.Id == id); .FirstOrDefault(a => a.Id == id)
if (assignment == null) ?? throw new ArgumentException("Invalid Device Flag Assignment Id", nameof(id));
throw new ArgumentException("Invalid Device Flag Assignment Id", nameof(id));
if (!assignment.CanRemove()) if (!assignment.CanRemove())
return Unauthorized("Removing device flag assignment is denied"); return Unauthorized("Removing device flag assignment is denied");
@@ -10,6 +10,7 @@ using Disco.Web.Areas.API.Models.Shared;
using Disco.Web.Areas.Config.Models.DeviceFlag; using Disco.Web.Areas.Config.Models.DeviceFlag;
using Disco.Web.Extensions; using Disco.Web.Extensions;
using System; using System;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Web.Mvc; using System.Web.Mvc;
@@ -17,12 +18,13 @@ namespace Disco.Web.Areas.API.Controllers
{ {
public partial class DeviceFlagController : AuthorizedDatabaseController public partial class DeviceFlagController : AuthorizedDatabaseController
{ {
const string pName = "name"; private const string pName = "name";
const string pDescription = "description"; private const string pDescription = "description";
const string pIcon = "icon"; private const string pIcon = "icon";
const string pIconColour = "iconcolour"; private const string pIconColour = "iconcolour";
const string pOnAssignmentExpression = "onassignmentexpression"; private const string pDefaultRemoveDays = "defaultremovedays";
const string pOnUnassignmentExpression = "onunassignmentexpression"; private const string pOnAssignmentExpression = "onassignmentexpression";
private const string pOnUnassignmentExpression = "onunassignmentexpression";
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)] [DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
[HttpPost, ValidateAntiForgeryToken] [HttpPost, ValidateAntiForgeryToken]
@@ -53,6 +55,9 @@ namespace Disco.Web.Areas.API.Controllers
case pIconColour: case pIconColour:
UpdateIconColour(flag, value); UpdateIconColour(flag, value);
break; break;
case pDefaultRemoveDays:
UpdateDefaultRemoveDays(flag, value);
break;
case pOnAssignmentExpression: case pOnAssignmentExpression:
UpdateOnAssignmentExpression(flag, value); UpdateOnAssignmentExpression(flag, value);
break; break;
@@ -143,6 +148,12 @@ namespace Disco.Web.Areas.API.Controllers
} }
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)] [DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
[HttpPost, ValidateAntiForgeryToken] [HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult UpdateDefaultRemoveDays(int id, [Range(1, int.MaxValue)] int? defaultRemoveDays = null, bool? redirect = null)
{
return Update(id, pDefaultRemoveDays, defaultRemoveDays?.ToString(), redirect);
}
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
[HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult UpdateOnAssignmentExpression(int id, string OnAssignmentExpression = null, bool redirect = false) public virtual ActionResult UpdateOnAssignmentExpression(int id, string OnAssignmentExpression = null, bool redirect = false)
{ {
return Update(id, pOnAssignmentExpression, OnAssignmentExpression, redirect); return Update(id, pOnAssignmentExpression, OnAssignmentExpression, redirect);
@@ -280,6 +291,23 @@ namespace Disco.Web.Areas.API.Controllers
} }
} }
private void UpdateDefaultRemoveDays(DeviceFlag deviceFlag, string defaultRemoveDays)
{
if (string.IsNullOrWhiteSpace(defaultRemoveDays))
{
deviceFlag.DefaultRemoveDays = null;
}
else
{
if (!int.TryParse(defaultRemoveDays, out var days) || days < 1)
throw new ArgumentOutOfRangeException(nameof(defaultRemoveDays), "Unable to parse days");
deviceFlag.DefaultRemoveDays = days;
}
DeviceFlagService.Update(Database, deviceFlag);
}
private void UpdateOnAssignmentExpression(DeviceFlag deviceFlag, string onAssignmentExpression) private void UpdateOnAssignmentExpression(DeviceFlag deviceFlag, string onAssignmentExpression)
{ {
if (string.IsNullOrWhiteSpace(onAssignmentExpression)) if (string.IsNullOrWhiteSpace(onAssignmentExpression))
@@ -1,5 +1,4 @@
using Disco.Models.Repository; using Disco.Services;
using Disco.Services;
using Disco.Services.Web; using Disco.Services.Web;
using System; using System;
using System.Data.Entity; using System.Data.Entity;
@@ -10,34 +9,25 @@ namespace Disco.Web.Areas.API.Controllers
{ {
public partial class UserFlagAssignmentController : AuthorizedDatabaseController public partial class UserFlagAssignmentController : AuthorizedDatabaseController
{ {
const string pComments = "comments";
[HttpPost, ValidateAntiForgeryToken] [HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null) public virtual ActionResult Edit(int id, string comments, DateTime? removeDate, bool? redirect = null)
{ {
try try
{ {
if (id < 0) if (id < 0)
throw new ArgumentOutOfRangeException(nameof(id)); throw new ArgumentOutOfRangeException(nameof(id));
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException(nameof(key));
var userFlagAssignment = Database.UserFlagAssignments var userFlagAssignment = Database.UserFlagAssignments
.Include(a => a.UserFlag) .Include(a => a.UserFlag)
.FirstOrDefault(a => a.Id == id); .FirstOrDefault(a => a.Id == id)
if (userFlagAssignment != null) ?? throw new Exception("Invalid User Flag Assignment Id");
{
switch (key.ToLower()) if (!userFlagAssignment.CanEdit())
{ throw new InvalidOperationException("Editing comments for user flags is denied");
case pComments:
UpdateComments(userFlagAssignment, value); userFlagAssignment.OnEdit(comments, removeDate);
break; Database.SaveChanges();
default:
throw new Exception("Invalid Update Key");
}
}
else
{
throw new Exception("Invalid User Flag Assignment Id");
}
if (redirect.HasValue && redirect.Value) if (redirect.HasValue && redirect.Value)
return Redirect($"{Url.Action(MVC.User.Show(userFlagAssignment.UserId))}#UserDetailTab-Flags"); return Redirect($"{Url.Action(MVC.User.Show(userFlagAssignment.UserId))}#UserDetailTab-Flags");
else else
@@ -52,44 +42,31 @@ namespace Disco.Web.Areas.API.Controllers
} }
} }
#region Update Shortcut Methods
[HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult UpdateComments(int id, string Comments = null, bool? redirect = null)
{
return Update(id, pComments, Comments, redirect);
}
#endregion
#region Update Properties
private void UpdateComments(UserFlagAssignment userFlagAssignment, string comments)
{
if (!userFlagAssignment.CanEdit())
throw new InvalidOperationException("Editing comments for user flags is denied");
userFlagAssignment.OnEdit(comments);
Database.SaveChanges();
}
#endregion
#region Actions #region Actions
[HttpPost, ValidateAntiForgeryToken] [HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult AddUser(int id, string UserId, string Comments) public virtual ActionResult AddUser(int id, string UserId, string Comments, DateTime? RemoveDate)
{ {
Database.Configuration.LazyLoadingEnabled = true; Database.Configuration.LazyLoadingEnabled = true;
var userFlag = Database.UserFlags.Find(id); var userFlag = Database.UserFlags.Find(id)
if (userFlag == null) ?? throw new ArgumentException("Invalid User Flag Id", nameof(id));
throw new ArgumentException("Invalid User Flag Id", nameof(id));
var user = Database.Users.Include(u => u.UserFlagAssignments).FirstOrDefault(u => u.UserId == UserId); var user = Database.Users
if (user == null) .Include(u => u.UserFlagAssignments)
throw new ArgumentException("Invalid User Id", nameof(UserId)); .FirstOrDefault(u => u.UserId == UserId)
?? throw new ArgumentException("Invalid User Id", nameof(UserId));
if (!user.CanAddUserFlag(userFlag)) if (!user.CanAddUserFlag(userFlag))
return Unauthorized("Adding user flag is denied"); return Unauthorized("Adding user flag is denied");
var userFlagAssignment = user.OnAddUserFlag(Database, userFlag, Comments); if (RemoveDate.HasValue && RemoveDate.Value < DateTime.Today.AddDays(1))
RemoveDate = null;
if (user.CanRemoveUserFlag(userFlag))
user.OnAddUserFlag(Database, userFlag, Comments, RemoveDate);
else
user.OnAddUserFlag(Database, userFlag, Comments);
Database.SaveChanges(); Database.SaveChanges();
@@ -103,9 +80,8 @@ namespace Disco.Web.Areas.API.Controllers
var userFlagAssignment = Database.UserFlagAssignments var userFlagAssignment = Database.UserFlagAssignments
.Include(a => a.UserFlag) .Include(a => a.UserFlag)
.FirstOrDefault(a => a.Id == id); .FirstOrDefault(a => a.Id == id)
if (userFlagAssignment == null) ?? throw new ArgumentException("Invalid User Flag Assignment Id", nameof(id));
throw new ArgumentException("Invalid User Flag Assignment Id", nameof(id));
if (!userFlagAssignment.CanRemove()) if (!userFlagAssignment.CanRemove())
return Unauthorized("Removing user flag assignment is denied"); return Unauthorized("Removing user flag assignment is denied");
@@ -10,6 +10,7 @@ using Disco.Web.Areas.API.Models.Shared;
using Disco.Web.Areas.Config.Models.UserFlag; using Disco.Web.Areas.Config.Models.UserFlag;
using Disco.Web.Extensions; using Disco.Web.Extensions;
using System; using System;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Web.Mvc; using System.Web.Mvc;
@@ -17,12 +18,13 @@ namespace Disco.Web.Areas.API.Controllers
{ {
public partial class UserFlagController : AuthorizedDatabaseController public partial class UserFlagController : AuthorizedDatabaseController
{ {
const string pName = "name"; private const string pName = "name";
const string pDescription = "description"; private const string pDescription = "description";
const string pIcon = "icon"; private const string pIcon = "icon";
const string pIconColour = "iconcolour"; private const string pIconColour = "iconcolour";
const string pOnAssignmentExpression = "onassignmentexpression"; private const string pDefaultRemoveDays = "defaultremovedays";
const string pOnUnassignmentExpression = "onunassignmentexpression"; private const string pOnAssignmentExpression = "onassignmentexpression";
private const string pOnUnassignmentExpression = "onunassignmentexpression";
[DiscoAuthorize(Claims.Config.UserFlag.Configure)] [DiscoAuthorize(Claims.Config.UserFlag.Configure)]
[HttpPost, ValidateAntiForgeryToken] [HttpPost, ValidateAntiForgeryToken]
@@ -53,6 +55,9 @@ namespace Disco.Web.Areas.API.Controllers
case pIconColour: case pIconColour:
UpdateIconColour(flag, value); UpdateIconColour(flag, value);
break; break;
case pDefaultRemoveDays:
UpdateDefaultRemoveDays(flag, value);
break;
case pOnAssignmentExpression: case pOnAssignmentExpression:
UpdateOnAssignmentExpression(flag, value); UpdateOnAssignmentExpression(flag, value);
break; break;
@@ -143,6 +148,12 @@ namespace Disco.Web.Areas.API.Controllers
} }
[DiscoAuthorize(Claims.Config.UserFlag.Configure)] [DiscoAuthorize(Claims.Config.UserFlag.Configure)]
[HttpPost, ValidateAntiForgeryToken] [HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult UpdateDefaultRemoveDays(int id, [Range(1, int.MaxValue)] int? defaultRemoveDays = null, bool? redirect = null)
{
return Update(id, pDefaultRemoveDays, defaultRemoveDays?.ToString(), redirect);
}
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
[HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult UpdateOnAssignmentExpression(int id, string OnAssignmentExpression = null, bool redirect = false) public virtual ActionResult UpdateOnAssignmentExpression(int id, string OnAssignmentExpression = null, bool redirect = false)
{ {
return Update(id, pOnAssignmentExpression, OnAssignmentExpression, redirect); return Update(id, pOnAssignmentExpression, OnAssignmentExpression, redirect);
@@ -280,6 +291,23 @@ namespace Disco.Web.Areas.API.Controllers
} }
} }
private void UpdateDefaultRemoveDays(UserFlag userFlag, string defaultRemoveDays)
{
if (string.IsNullOrWhiteSpace(defaultRemoveDays))
{
userFlag.DefaultRemoveDays = null;
}
else
{
if (!int.TryParse(defaultRemoveDays, out var days) || days < 1)
throw new ArgumentOutOfRangeException(nameof(defaultRemoveDays), "Unable to parse days");
userFlag.DefaultRemoveDays = days;
}
UserFlagService.Update(Database, userFlag);
}
private void UpdateOnAssignmentExpression(UserFlag UserFlag, string OnAssignmentExpression) private void UpdateOnAssignmentExpression(UserFlag UserFlag, string OnAssignmentExpression)
{ {
if (string.IsNullOrWhiteSpace(OnAssignmentExpression)) if (string.IsNullOrWhiteSpace(OnAssignmentExpression))
@@ -3,7 +3,7 @@
Authorization.Require(Claims.Config.DeviceFlag.Show); Authorization.Require(Claims.Config.DeviceFlag.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags"); ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags");
var showTags = Model.DeviceFlags.Keys.Any(i => i.DevicesLinkedGroup != null || i.DeviceUsersLinkedGroup != null || var showTags = Model.DeviceFlags.Keys.Any(i => i.DevicesLinkedGroup != null || i.DeviceUsersLinkedGroup != null ||
i.OnAssignmentExpression != null || i.OnUnassignmentExpression != null); i.OnAssignmentExpression != null || i.OnUnassignmentExpression != null || i.DefaultRemoveDays.HasValue);
} }
<div id="Config_DeviceFlags_Index"> <div id="Config_DeviceFlags_Index">
@if (Model.DeviceFlags.Count == 0) @if (Model.DeviceFlags.Count == 0)
@@ -59,6 +59,10 @@
{ {
<i class="fa fa-bolt fa-lg alert" title="Has Expressions"></i> <i class="fa fa-bolt fa-lg alert" title="Has Expressions"></i>
} }
@if (item.DefaultRemoveDays.HasValue)
{
<i class="fa fa-clock-o fa-lg" title="Has Default Unassignment"></i>
}
</td> </td>
} }
</tr> </tr>
@@ -49,7 +49,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceFlag
Authorization.Require(Claims.Config.DeviceFlag.Show); Authorization.Require(Claims.Config.DeviceFlag.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags"); ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags");
var showTags = Model.DeviceFlags.Keys.Any(i => i.DevicesLinkedGroup != null || i.DeviceUsersLinkedGroup != null || var showTags = Model.DeviceFlags.Keys.Any(i => i.DevicesLinkedGroup != null || i.DeviceUsersLinkedGroup != null ||
i.OnAssignmentExpression != null || i.OnUnassignmentExpression != null); i.OnAssignmentExpression != null || i.OnUnassignmentExpression != null || i.DefaultRemoveDays.HasValue);
#line default #line default
@@ -141,37 +141,37 @@ WriteLiteral(" </tr>\r\n");
#line hidden #line hidden
WriteLiteral(" <tr>\r\n <td>\r\n <a"); WriteLiteral(" <tr>\r\n <td>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 1229), Tuple.Create("\"", 1285) WriteAttribute("href", Tuple.Create(" href=\"", 1261), Tuple.Create("\"", 1317)
#line 33 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 33 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1236), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.DeviceFlag.Index(item.Id)) , Tuple.Create(Tuple.Create("", 1268), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.DeviceFlag.Index(item.Id))
#line default #line default
#line hidden #line hidden
, 1236), false) , 1268), false)
); );
WriteLiteral(">\r\n <i"); WriteLiteral(">\r\n <i");
WriteAttribute("class", Tuple.Create(" class=\"", 1319), Tuple.Create("\"", 1372) WriteAttribute("class", Tuple.Create(" class=\"", 1351), Tuple.Create("\"", 1404)
, Tuple.Create(Tuple.Create("", 1327), Tuple.Create("fa", 1327), true) , Tuple.Create(Tuple.Create("", 1359), Tuple.Create("fa", 1359), true)
, Tuple.Create(Tuple.Create(" ", 1329), Tuple.Create("fa-", 1330), true) , Tuple.Create(Tuple.Create(" ", 1361), Tuple.Create("fa-", 1362), true)
#line 34 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 34 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1333), Tuple.Create<System.Object, System.Int32>(item.Icon , Tuple.Create(Tuple.Create("", 1365), Tuple.Create<System.Object, System.Int32>(item.Icon
#line default #line default
#line hidden #line hidden
, 1333), false) , 1365), false)
, Tuple.Create(Tuple.Create(" ", 1345), Tuple.Create("fa-lg", 1346), true) , Tuple.Create(Tuple.Create(" ", 1377), Tuple.Create("fa-lg", 1378), true)
, Tuple.Create(Tuple.Create(" ", 1351), Tuple.Create("d-", 1352), true) , Tuple.Create(Tuple.Create(" ", 1383), Tuple.Create("d-", 1384), true)
#line 34 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 34 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1354), Tuple.Create<System.Object, System.Int32>(item.IconColour , Tuple.Create(Tuple.Create("", 1386), Tuple.Create<System.Object, System.Int32>(item.IconColour
#line default #line default
#line hidden #line hidden
, 1354), false) , 1386), false)
); );
WriteLiteral("></i>\r\n"); WriteLiteral("></i>\r\n");
@@ -313,12 +313,37 @@ WriteLiteral("></i>\r\n");
} }
#line default
#line hidden
WriteLiteral(" ");
#line 62 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
if (item.DefaultRemoveDays.HasValue)
{
#line default
#line hidden
WriteLiteral(" <i");
WriteLiteral(" class=\"fa fa-clock-o fa-lg\"");
WriteLiteral(" title=\"Has Default Unassignment\"");
WriteLiteral("></i>\r\n");
#line 65 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
}
#line default #line default
#line hidden #line hidden
WriteLiteral(" </td>\r\n"); WriteLiteral(" </td>\r\n");
#line 63 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 67 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
} }
@@ -327,7 +352,7 @@ WriteLiteral(" </td>\r\n");
WriteLiteral(" </tr>\r\n"); WriteLiteral(" </tr>\r\n");
#line 65 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 69 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
} }
@@ -336,7 +361,7 @@ WriteLiteral(" </tr>\r\n");
WriteLiteral(" </table>\r\n"); WriteLiteral(" </table>\r\n");
#line 67 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 71 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
} }
@@ -349,13 +374,13 @@ WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 69 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 73 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
#line default #line default
#line hidden #line hidden
#line 69 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 73 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
if (Authorization.Has(Claims.Config.DeviceFlag.Export) && Model.DeviceFlags.Count > 0) if (Authorization.Has(Claims.Config.DeviceFlag.Export) && Model.DeviceFlags.Count > 0)
{ {
@@ -363,14 +388,14 @@ WriteLiteral(">\r\n");
#line default #line default
#line hidden #line hidden
#line 71 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 75 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
Write(Html.ActionLinkButton("Export", MVC.Config.DeviceFlag.Export())); Write(Html.ActionLinkButton("Export", MVC.Config.DeviceFlag.Export()));
#line default #line default
#line hidden #line hidden
#line 71 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 75 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
} }
@@ -380,7 +405,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" "); WriteLiteral(" ");
#line 73 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 77 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
if (Authorization.Has(Claims.Config.DeviceFlag.Create)) if (Authorization.Has(Claims.Config.DeviceFlag.Create))
{ {
@@ -388,14 +413,14 @@ WriteLiteral(" ");
#line default #line default
#line hidden #line hidden
#line 75 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 79 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
Write(Html.ActionLinkButton("Create Device Flag", MVC.Config.DeviceFlag.Create())); Write(Html.ActionLinkButton("Create Device Flag", MVC.Config.DeviceFlag.Create()));
#line default #line default
#line hidden #line hidden
#line 75 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml" #line 79 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
} }
@@ -212,6 +212,50 @@
} }
</td> </td>
</tr> </tr>
<tr>
<th>
Scheduled Unassignment:
</th>
<td>
@if (canConfig)
{
<input id="DeviceFlag_DefaultRemoveDays" type="number" min="1" max="@int.MaxValue" value="@Model.DeviceFlag.DefaultRemoveDays" />
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
@:days
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#DeviceFlag_DefaultRemoveDays'),
'Invalid Value',
'@(Url.Action(MVC.API.DeviceFlag.UpdateDefaultRemoveDays(Model.DeviceFlag.Id)))',
'defaultRemoveDays'
);
});
</script>
}
else
{
if (Model.DeviceFlag.DefaultRemoveDays.HasValue)
{
<span><strong>@Model.DeviceFlag.DefaultRemoveDays</strong> days</span>
}
else
{
<span><em>Not Enabled</em></span>
}
}
<div class="info-box">
<p class="fa-p">
<i class="fa fa-fw fa-info-circle"></i>
Optionally specify the number of days a flag is removed from a device.
If one (1), the flag will be removed that night (midnight).<br />
If the user has permission, the date can be adjusted when assigning the flag.
Changing this value does not affect existing assignments.
</p>
</div>
</td>
</tr>
@if (hideAdvanced) @if (hideAdvanced)
{ {
<tr> <tr>
File diff suppressed because it is too large Load Diff
@@ -3,7 +3,7 @@
Authorization.Require(Claims.Config.UserFlag.Show); Authorization.Require(Claims.Config.UserFlag.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "User Flags"); ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "User Flags");
var showTags = Model.UserFlags.Keys.Any(i => i.UserDevicesLinkedGroup != null || i.UsersLinkedGroup != null || var showTags = Model.UserFlags.Keys.Any(i => i.UserDevicesLinkedGroup != null || i.UsersLinkedGroup != null ||
i.OnAssignmentExpression != null || i.OnUnassignmentExpression != null); i.OnAssignmentExpression != null || i.OnUnassignmentExpression != null || i.DefaultRemoveDays.HasValue);
} }
<div id="Config_UserFlags_Index"> <div id="Config_UserFlags_Index">
@if (Model.UserFlags.Count == 0) @if (Model.UserFlags.Count == 0)
@@ -59,6 +59,10 @@
{ {
<i class="fa fa-bolt fa-lg alert" title="Has Expressions"></i> <i class="fa fa-bolt fa-lg alert" title="Has Expressions"></i>
} }
@if (item.DefaultRemoveDays.HasValue)
{
<i class="fa fa-clock-o fa-lg" title="Has Default Unassignment"></i>
}
</td> </td>
} }
</tr> </tr>
@@ -49,7 +49,7 @@ namespace Disco.Web.Areas.Config.Views.UserFlag
Authorization.Require(Claims.Config.UserFlag.Show); Authorization.Require(Claims.Config.UserFlag.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "User Flags"); ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "User Flags");
var showTags = Model.UserFlags.Keys.Any(i => i.UserDevicesLinkedGroup != null || i.UsersLinkedGroup != null || var showTags = Model.UserFlags.Keys.Any(i => i.UserDevicesLinkedGroup != null || i.UsersLinkedGroup != null ||
i.OnAssignmentExpression != null || i.OnUnassignmentExpression != null); i.OnAssignmentExpression != null || i.OnUnassignmentExpression != null || i.DefaultRemoveDays.HasValue);
#line default #line default
@@ -141,37 +141,37 @@ WriteLiteral(" </tr>\r\n");
#line hidden #line hidden
WriteLiteral(" <tr>\r\n <td>\r\n <a"); WriteLiteral(" <tr>\r\n <td>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 1211), Tuple.Create("\"", 1265) WriteAttribute("href", Tuple.Create(" href=\"", 1243), Tuple.Create("\"", 1297)
#line 33 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 33 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1218), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.UserFlag.Index(item.Id)) , Tuple.Create(Tuple.Create("", 1250), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.UserFlag.Index(item.Id))
#line default #line default
#line hidden #line hidden
, 1218), false) , 1250), false)
); );
WriteLiteral(">\r\n <i"); WriteLiteral(">\r\n <i");
WriteAttribute("class", Tuple.Create(" class=\"", 1299), Tuple.Create("\"", 1352) WriteAttribute("class", Tuple.Create(" class=\"", 1331), Tuple.Create("\"", 1384)
, Tuple.Create(Tuple.Create("", 1307), Tuple.Create("fa", 1307), true) , Tuple.Create(Tuple.Create("", 1339), Tuple.Create("fa", 1339), true)
, Tuple.Create(Tuple.Create(" ", 1309), Tuple.Create("fa-", 1310), true) , Tuple.Create(Tuple.Create(" ", 1341), Tuple.Create("fa-", 1342), true)
#line 34 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 34 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1313), Tuple.Create<System.Object, System.Int32>(item.Icon , Tuple.Create(Tuple.Create("", 1345), Tuple.Create<System.Object, System.Int32>(item.Icon
#line default #line default
#line hidden #line hidden
, 1313), false) , 1345), false)
, Tuple.Create(Tuple.Create(" ", 1325), Tuple.Create("fa-lg", 1326), true) , Tuple.Create(Tuple.Create(" ", 1357), Tuple.Create("fa-lg", 1358), true)
, Tuple.Create(Tuple.Create(" ", 1331), Tuple.Create("d-", 1332), true) , Tuple.Create(Tuple.Create(" ", 1363), Tuple.Create("d-", 1364), true)
#line 34 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 34 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1334), Tuple.Create<System.Object, System.Int32>(item.IconColour , Tuple.Create(Tuple.Create("", 1366), Tuple.Create<System.Object, System.Int32>(item.IconColour
#line default #line default
#line hidden #line hidden
, 1334), false) , 1366), false)
); );
WriteLiteral("></i>\r\n"); WriteLiteral("></i>\r\n");
@@ -313,12 +313,37 @@ WriteLiteral("></i>\r\n");
} }
#line default
#line hidden
WriteLiteral(" ");
#line 62 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
if (item.DefaultRemoveDays.HasValue)
{
#line default
#line hidden
WriteLiteral(" <i");
WriteLiteral(" class=\"fa fa-clock-o fa-lg\"");
WriteLiteral(" title=\"Has Default Unassignment\"");
WriteLiteral("></i>\r\n");
#line 65 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
}
#line default #line default
#line hidden #line hidden
WriteLiteral(" </td>\r\n"); WriteLiteral(" </td>\r\n");
#line 63 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 67 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
} }
@@ -327,7 +352,7 @@ WriteLiteral(" </td>\r\n");
WriteLiteral(" </tr>\r\n"); WriteLiteral(" </tr>\r\n");
#line 65 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 69 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
} }
@@ -336,7 +361,7 @@ WriteLiteral(" </tr>\r\n");
WriteLiteral(" </table>\r\n"); WriteLiteral(" </table>\r\n");
#line 67 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 71 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
} }
@@ -349,13 +374,13 @@ WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 69 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 73 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
#line default #line default
#line hidden #line hidden
#line 69 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 73 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
if (Authorization.Has(Claims.Config.UserFlag.Export) && Model.UserFlags.Count > 0) if (Authorization.Has(Claims.Config.UserFlag.Export) && Model.UserFlags.Count > 0)
{ {
@@ -363,14 +388,14 @@ WriteLiteral(">\r\n");
#line default #line default
#line hidden #line hidden
#line 71 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 75 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
Write(Html.ActionLinkButton("Export", MVC.Config.UserFlag.Export())); Write(Html.ActionLinkButton("Export", MVC.Config.UserFlag.Export()));
#line default #line default
#line hidden #line hidden
#line 71 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 75 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
} }
@@ -380,7 +405,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" "); WriteLiteral(" ");
#line 73 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 77 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
if (Authorization.Has(Claims.Config.UserFlag.Create)) if (Authorization.Has(Claims.Config.UserFlag.Create))
{ {
@@ -388,14 +413,14 @@ WriteLiteral(" ");
#line default #line default
#line hidden #line hidden
#line 75 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 79 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
Write(Html.ActionLinkButton("Create User Flag", MVC.Config.UserFlag.Create())); Write(Html.ActionLinkButton("Create User Flag", MVC.Config.UserFlag.Create()));
#line default #line default
#line hidden #line hidden
#line 75 "..\..\Areas\Config\Views\UserFlag\Index.cshtml" #line 79 "..\..\Areas\Config\Views\UserFlag\Index.cshtml"
} }
@@ -213,6 +213,50 @@
} }
</td> </td>
</tr> </tr>
<tr>
<th>
Default Assignment Removal:
</th>
<td>
@if (canConfig)
{
<input id="UserFlag_DefaultRemoveDays" type="number" min="1" max="@int.MaxValue" value="@Model.UserFlag.DefaultRemoveDays" />
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
@:days
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#UserFlag_DefaultRemoveDays'),
'Invalid Value',
'@(Url.Action(MVC.API.UserFlag.UpdateDefaultRemoveDays(Model.UserFlag.Id)))',
'defaultRemoveDays'
);
});
</script>
}
else
{
if (Model.UserFlag.DefaultRemoveDays.HasValue)
{
<span><strong>@Model.UserFlag.DefaultRemoveDays</strong> days</span>
}
else
{
<span><em>Not Enabled</em></span>
}
}
<div class="info-box">
<p class="fa-p">
<i class="fa fa-fw fa-info-circle"></i>
Optionally specify the number of days a flag is removed from a user.
If one (1), the flag will be removed that night (midnight).<br />
If the user has permission, the date can be adjusted when assigning the flag.
Changing this value does not affect existing assignments.
</p>
</div>
</td>
</tr>
@if (hideAdvanced) @if (hideAdvanced)
{ {
<tr> <tr>
File diff suppressed because it is too large Load Diff
+4
View File
@@ -2054,3 +2054,7 @@ h1.Config_DocumentTemplates {
margin-top: 4px; margin-top: 4px;
font-size: 0.8em; font-size: 0.8em;
} }
#UserFlag_DefaultRemoveDays,
#DeviceFlag_DefaultRemoveDays {
width: 50px;
}
+4
View File
@@ -2487,3 +2487,7 @@ h1.Config_DocumentTemplates {
} }
} }
} }
#UserFlag_DefaultRemoveDays, #DeviceFlag_DefaultRemoveDays {
width: 50px;
}
File diff suppressed because one or more lines are too long
@@ -61,15 +61,9 @@ namespace Disco.Web.Areas.API.Controllers
[NonAction] [NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult Update() public virtual System.Web.Mvc.ActionResult Edit()
{ {
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Update); return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateComments()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateComments);
} }
[NonAction] [NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -99,8 +93,7 @@ namespace Disco.Web.Areas.API.Controllers
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNamesClass public class ActionNamesClass
{ {
public readonly string Update = "Update"; public readonly string Edit = "Edit";
public readonly string UpdateComments = "UpdateComments";
public readonly string AddDevice = "AddDevice"; public readonly string AddDevice = "AddDevice";
public readonly string RemoveDevice = "RemoveDevice"; public readonly string RemoveDevice = "RemoveDevice";
} }
@@ -108,32 +101,21 @@ namespace Disco.Web.Areas.API.Controllers
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNameConstants public class ActionNameConstants
{ {
public const string Update = "Update"; public const string Edit = "Edit";
public const string UpdateComments = "UpdateComments";
public const string AddDevice = "AddDevice"; public const string AddDevice = "AddDevice";
public const string RemoveDevice = "RemoveDevice"; public const string RemoveDevice = "RemoveDevice";
} }
static readonly ActionParamsClass_Update s_params_Update = new ActionParamsClass_Update(); static readonly ActionParamsClass_Edit s_params_Edit = new ActionParamsClass_Edit();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_Update UpdateParams { get { return s_params_Update; } } public ActionParamsClass_Edit EditParams { get { return s_params_Edit; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Update public class ActionParamsClass_Edit
{ {
public readonly string id = "id"; public readonly string id = "id";
public readonly string key = "key"; public readonly string comments = "comments";
public readonly string value = "value"; public readonly string removeDate = "removeDate";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateComments s_params_UpdateComments = new ActionParamsClass_UpdateComments();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateComments UpdateCommentsParams { get { return s_params_UpdateComments; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateComments
{
public readonly string id = "id";
public readonly string Comments = "Comments";
public readonly string redirect = "redirect"; public readonly string redirect = "redirect";
} }
static readonly ActionParamsClass_AddDevice s_params_AddDevice = new ActionParamsClass_AddDevice(); static readonly ActionParamsClass_AddDevice s_params_AddDevice = new ActionParamsClass_AddDevice();
@@ -145,6 +127,7 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string id = "id"; public readonly string id = "id";
public readonly string deviceSerialNumber = "deviceSerialNumber"; public readonly string deviceSerialNumber = "deviceSerialNumber";
public readonly string comments = "comments"; public readonly string comments = "comments";
public readonly string removeDate = "removeDate";
} }
static readonly ActionParamsClass_RemoveDevice s_params_RemoveDevice = new ActionParamsClass_RemoveDevice(); static readonly ActionParamsClass_RemoveDevice s_params_RemoveDevice = new ActionParamsClass_RemoveDevice();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -174,45 +157,32 @@ namespace Disco.Web.Areas.API.Controllers
public T4MVC_DeviceFlagAssignmentController() : base(Dummy.Instance) { } public T4MVC_DeviceFlagAssignmentController() : base(Dummy.Instance) { }
[NonAction] [NonAction]
partial void UpdateOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string key, string value, bool? redirect); partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string comments, System.DateTime? removeDate, bool? redirect);
[NonAction] [NonAction]
public override System.Web.Mvc.ActionResult Update(int id, string key, string value, bool? redirect) public override System.Web.Mvc.ActionResult Edit(int id, string comments, System.DateTime? removeDate, bool? redirect)
{ {
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Update); var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "key", key); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "comments", comments);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "value", value); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "removeDate", removeDate);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateOverride(callInfo, id, key, value, redirect); EditOverride(callInfo, id, comments, removeDate, redirect);
return callInfo; return callInfo;
} }
[NonAction] [NonAction]
partial void UpdateCommentsOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string Comments, bool? redirect); partial void AddDeviceOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string deviceSerialNumber, string comments, System.DateTime? removeDate);
[NonAction] [NonAction]
public override System.Web.Mvc.ActionResult UpdateComments(int id, string Comments, bool? redirect) public override System.Web.Mvc.ActionResult AddDevice(int id, string deviceSerialNumber, string comments, System.DateTime? removeDate)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateComments);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Comments", Comments);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateCommentsOverride(callInfo, id, Comments, redirect);
return callInfo;
}
[NonAction]
partial void AddDeviceOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string deviceSerialNumber, string comments);
[NonAction]
public override System.Web.Mvc.ActionResult AddDevice(int id, string deviceSerialNumber, string comments)
{ {
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AddDevice); var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AddDevice);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "deviceSerialNumber", deviceSerialNumber); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "deviceSerialNumber", deviceSerialNumber);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "comments", comments); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "comments", comments);
AddDeviceOverride(callInfo, id, deviceSerialNumber, comments); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "removeDate", removeDate);
AddDeviceOverride(callInfo, id, deviceSerialNumber, comments, removeDate);
return callInfo; return callInfo;
} }
@@ -97,6 +97,12 @@ namespace Disco.Web.Areas.API.Controllers
} }
[NonAction] [NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateDefaultRemoveDays()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateDefaultRemoveDays);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateOnAssignmentExpression() public virtual System.Web.Mvc.ActionResult UpdateOnAssignmentExpression()
{ {
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateOnAssignmentExpression); return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateOnAssignmentExpression);
@@ -183,6 +189,7 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string UpdateIcon = "UpdateIcon"; public readonly string UpdateIcon = "UpdateIcon";
public readonly string UpdateIconColour = "UpdateIconColour"; public readonly string UpdateIconColour = "UpdateIconColour";
public readonly string UpdateIconAndColour = "UpdateIconAndColour"; public readonly string UpdateIconAndColour = "UpdateIconAndColour";
public readonly string UpdateDefaultRemoveDays = "UpdateDefaultRemoveDays";
public readonly string UpdateOnAssignmentExpression = "UpdateOnAssignmentExpression"; public readonly string UpdateOnAssignmentExpression = "UpdateOnAssignmentExpression";
public readonly string UpdateOnUnassignmentExpression = "UpdateOnUnassignmentExpression"; public readonly string UpdateOnUnassignmentExpression = "UpdateOnUnassignmentExpression";
public readonly string UpdateDevicesLinkedGroup = "UpdateDevicesLinkedGroup"; public readonly string UpdateDevicesLinkedGroup = "UpdateDevicesLinkedGroup";
@@ -205,6 +212,7 @@ namespace Disco.Web.Areas.API.Controllers
public const string UpdateIcon = "UpdateIcon"; public const string UpdateIcon = "UpdateIcon";
public const string UpdateIconColour = "UpdateIconColour"; public const string UpdateIconColour = "UpdateIconColour";
public const string UpdateIconAndColour = "UpdateIconAndColour"; public const string UpdateIconAndColour = "UpdateIconAndColour";
public const string UpdateDefaultRemoveDays = "UpdateDefaultRemoveDays";
public const string UpdateOnAssignmentExpression = "UpdateOnAssignmentExpression"; public const string UpdateOnAssignmentExpression = "UpdateOnAssignmentExpression";
public const string UpdateOnUnassignmentExpression = "UpdateOnUnassignmentExpression"; public const string UpdateOnUnassignmentExpression = "UpdateOnUnassignmentExpression";
public const string UpdateDevicesLinkedGroup = "UpdateDevicesLinkedGroup"; public const string UpdateDevicesLinkedGroup = "UpdateDevicesLinkedGroup";
@@ -281,6 +289,16 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string IconColour = "IconColour"; public readonly string IconColour = "IconColour";
public readonly string redirect = "redirect"; public readonly string redirect = "redirect";
} }
static readonly ActionParamsClass_UpdateDefaultRemoveDays s_params_UpdateDefaultRemoveDays = new ActionParamsClass_UpdateDefaultRemoveDays();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateDefaultRemoveDays UpdateDefaultRemoveDaysParams { get { return s_params_UpdateDefaultRemoveDays; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateDefaultRemoveDays
{
public readonly string id = "id";
public readonly string defaultRemoveDays = "defaultRemoveDays";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateOnAssignmentExpression s_params_UpdateOnAssignmentExpression = new ActionParamsClass_UpdateOnAssignmentExpression(); static readonly ActionParamsClass_UpdateOnAssignmentExpression s_params_UpdateOnAssignmentExpression = new ActionParamsClass_UpdateOnAssignmentExpression();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateOnAssignmentExpression UpdateOnAssignmentExpressionParams { get { return s_params_UpdateOnAssignmentExpression; } } public ActionParamsClass_UpdateOnAssignmentExpression UpdateOnAssignmentExpressionParams { get { return s_params_UpdateOnAssignmentExpression; } }
@@ -489,6 +507,20 @@ namespace Disco.Web.Areas.API.Controllers
return callInfo; return callInfo;
} }
[NonAction]
partial void UpdateDefaultRemoveDaysOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, int? defaultRemoveDays, bool? redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateDefaultRemoveDays(int id, int? defaultRemoveDays, bool? redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateDefaultRemoveDays);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "defaultRemoveDays", defaultRemoveDays);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateDefaultRemoveDaysOverride(callInfo, id, defaultRemoveDays, redirect);
return callInfo;
}
[NonAction] [NonAction]
partial void UpdateOnAssignmentExpressionOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string OnAssignmentExpression, bool redirect); partial void UpdateOnAssignmentExpressionOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string OnAssignmentExpression, bool redirect);
@@ -61,15 +61,9 @@ namespace Disco.Web.Areas.API.Controllers
[NonAction] [NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult Update() public virtual System.Web.Mvc.ActionResult Edit()
{ {
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Update); return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateComments()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateComments);
} }
[NonAction] [NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -99,8 +93,7 @@ namespace Disco.Web.Areas.API.Controllers
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNamesClass public class ActionNamesClass
{ {
public readonly string Update = "Update"; public readonly string Edit = "Edit";
public readonly string UpdateComments = "UpdateComments";
public readonly string AddUser = "AddUser"; public readonly string AddUser = "AddUser";
public readonly string RemoveUser = "RemoveUser"; public readonly string RemoveUser = "RemoveUser";
} }
@@ -108,32 +101,21 @@ namespace Disco.Web.Areas.API.Controllers
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNameConstants public class ActionNameConstants
{ {
public const string Update = "Update"; public const string Edit = "Edit";
public const string UpdateComments = "UpdateComments";
public const string AddUser = "AddUser"; public const string AddUser = "AddUser";
public const string RemoveUser = "RemoveUser"; public const string RemoveUser = "RemoveUser";
} }
static readonly ActionParamsClass_Update s_params_Update = new ActionParamsClass_Update(); static readonly ActionParamsClass_Edit s_params_Edit = new ActionParamsClass_Edit();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_Update UpdateParams { get { return s_params_Update; } } public ActionParamsClass_Edit EditParams { get { return s_params_Edit; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Update public class ActionParamsClass_Edit
{ {
public readonly string id = "id"; public readonly string id = "id";
public readonly string key = "key"; public readonly string comments = "comments";
public readonly string value = "value"; public readonly string removeDate = "removeDate";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateComments s_params_UpdateComments = new ActionParamsClass_UpdateComments();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateComments UpdateCommentsParams { get { return s_params_UpdateComments; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateComments
{
public readonly string id = "id";
public readonly string Comments = "Comments";
public readonly string redirect = "redirect"; public readonly string redirect = "redirect";
} }
static readonly ActionParamsClass_AddUser s_params_AddUser = new ActionParamsClass_AddUser(); static readonly ActionParamsClass_AddUser s_params_AddUser = new ActionParamsClass_AddUser();
@@ -145,6 +127,7 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string id = "id"; public readonly string id = "id";
public readonly string UserId = "UserId"; public readonly string UserId = "UserId";
public readonly string Comments = "Comments"; public readonly string Comments = "Comments";
public readonly string RemoveDate = "RemoveDate";
} }
static readonly ActionParamsClass_RemoveUser s_params_RemoveUser = new ActionParamsClass_RemoveUser(); static readonly ActionParamsClass_RemoveUser s_params_RemoveUser = new ActionParamsClass_RemoveUser();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -174,45 +157,32 @@ namespace Disco.Web.Areas.API.Controllers
public T4MVC_UserFlagAssignmentController() : base(Dummy.Instance) { } public T4MVC_UserFlagAssignmentController() : base(Dummy.Instance) { }
[NonAction] [NonAction]
partial void UpdateOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string key, string value, bool? redirect); partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string comments, System.DateTime? removeDate, bool? redirect);
[NonAction] [NonAction]
public override System.Web.Mvc.ActionResult Update(int id, string key, string value, bool? redirect) public override System.Web.Mvc.ActionResult Edit(int id, string comments, System.DateTime? removeDate, bool? redirect)
{ {
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Update); var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "key", key); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "comments", comments);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "value", value); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "removeDate", removeDate);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateOverride(callInfo, id, key, value, redirect); EditOverride(callInfo, id, comments, removeDate, redirect);
return callInfo; return callInfo;
} }
[NonAction] [NonAction]
partial void UpdateCommentsOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string Comments, bool? redirect); partial void AddUserOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string UserId, string Comments, System.DateTime? RemoveDate);
[NonAction] [NonAction]
public override System.Web.Mvc.ActionResult UpdateComments(int id, string Comments, bool? redirect) public override System.Web.Mvc.ActionResult AddUser(int id, string UserId, string Comments, System.DateTime? RemoveDate)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateComments);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Comments", Comments);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateCommentsOverride(callInfo, id, Comments, redirect);
return callInfo;
}
[NonAction]
partial void AddUserOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string UserId, string Comments);
[NonAction]
public override System.Web.Mvc.ActionResult AddUser(int id, string UserId, string Comments)
{ {
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AddUser); var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AddUser);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "UserId", UserId); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "UserId", UserId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Comments", Comments); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Comments", Comments);
AddUserOverride(callInfo, id, UserId, Comments); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "RemoveDate", RemoveDate);
AddUserOverride(callInfo, id, UserId, Comments, RemoveDate);
return callInfo; return callInfo;
} }
@@ -97,6 +97,12 @@ namespace Disco.Web.Areas.API.Controllers
} }
[NonAction] [NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateDefaultRemoveDays()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateDefaultRemoveDays);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateOnAssignmentExpression() public virtual System.Web.Mvc.ActionResult UpdateOnAssignmentExpression()
{ {
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateOnAssignmentExpression); return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateOnAssignmentExpression);
@@ -183,6 +189,7 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string UpdateIcon = "UpdateIcon"; public readonly string UpdateIcon = "UpdateIcon";
public readonly string UpdateIconColour = "UpdateIconColour"; public readonly string UpdateIconColour = "UpdateIconColour";
public readonly string UpdateIconAndColour = "UpdateIconAndColour"; public readonly string UpdateIconAndColour = "UpdateIconAndColour";
public readonly string UpdateDefaultRemoveDays = "UpdateDefaultRemoveDays";
public readonly string UpdateOnAssignmentExpression = "UpdateOnAssignmentExpression"; public readonly string UpdateOnAssignmentExpression = "UpdateOnAssignmentExpression";
public readonly string UpdateOnUnassignmentExpression = "UpdateOnUnassignmentExpression"; public readonly string UpdateOnUnassignmentExpression = "UpdateOnUnassignmentExpression";
public readonly string UpdateAssignedUsersLinkedGroup = "UpdateAssignedUsersLinkedGroup"; public readonly string UpdateAssignedUsersLinkedGroup = "UpdateAssignedUsersLinkedGroup";
@@ -205,6 +212,7 @@ namespace Disco.Web.Areas.API.Controllers
public const string UpdateIcon = "UpdateIcon"; public const string UpdateIcon = "UpdateIcon";
public const string UpdateIconColour = "UpdateIconColour"; public const string UpdateIconColour = "UpdateIconColour";
public const string UpdateIconAndColour = "UpdateIconAndColour"; public const string UpdateIconAndColour = "UpdateIconAndColour";
public const string UpdateDefaultRemoveDays = "UpdateDefaultRemoveDays";
public const string UpdateOnAssignmentExpression = "UpdateOnAssignmentExpression"; public const string UpdateOnAssignmentExpression = "UpdateOnAssignmentExpression";
public const string UpdateOnUnassignmentExpression = "UpdateOnUnassignmentExpression"; public const string UpdateOnUnassignmentExpression = "UpdateOnUnassignmentExpression";
public const string UpdateAssignedUsersLinkedGroup = "UpdateAssignedUsersLinkedGroup"; public const string UpdateAssignedUsersLinkedGroup = "UpdateAssignedUsersLinkedGroup";
@@ -281,6 +289,16 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string iconColour = "iconColour"; public readonly string iconColour = "iconColour";
public readonly string redirect = "redirect"; public readonly string redirect = "redirect";
} }
static readonly ActionParamsClass_UpdateDefaultRemoveDays s_params_UpdateDefaultRemoveDays = new ActionParamsClass_UpdateDefaultRemoveDays();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateDefaultRemoveDays UpdateDefaultRemoveDaysParams { get { return s_params_UpdateDefaultRemoveDays; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateDefaultRemoveDays
{
public readonly string id = "id";
public readonly string defaultRemoveDays = "defaultRemoveDays";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateOnAssignmentExpression s_params_UpdateOnAssignmentExpression = new ActionParamsClass_UpdateOnAssignmentExpression(); static readonly ActionParamsClass_UpdateOnAssignmentExpression s_params_UpdateOnAssignmentExpression = new ActionParamsClass_UpdateOnAssignmentExpression();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateOnAssignmentExpression UpdateOnAssignmentExpressionParams { get { return s_params_UpdateOnAssignmentExpression; } } public ActionParamsClass_UpdateOnAssignmentExpression UpdateOnAssignmentExpressionParams { get { return s_params_UpdateOnAssignmentExpression; } }
@@ -489,6 +507,20 @@ namespace Disco.Web.Areas.API.Controllers
return callInfo; return callInfo;
} }
[NonAction]
partial void UpdateDefaultRemoveDaysOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, int? defaultRemoveDays, bool? redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateDefaultRemoveDays(int id, int? defaultRemoveDays, bool? redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateDefaultRemoveDays);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "defaultRemoveDays", defaultRemoveDays);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateDefaultRemoveDaysOverride(callInfo, id, defaultRemoveDays, redirect);
return callInfo;
}
[NonAction] [NonAction]
partial void UpdateOnAssignmentExpressionOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string OnAssignmentExpression, bool redirect); partial void UpdateOnAssignmentExpressionOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string OnAssignmentExpression, bool redirect);
@@ -11,12 +11,12 @@
<tr> <tr>
<th class="name">Name</th> <th class="name">Name</th>
<th class="added">Added</th> <th class="added">Added</th>
<th class="sla">Comments</th> <th class="sla">Detail</th>
<th class="removed">Removed</th> <th class="removed">Removed</th>
</tr> </tr>
@foreach (var fa in flagAssignments.OrderByDescending(a => a.Item1.AddedDate)) @foreach (var fa in flagAssignments.OrderByDescending(a => a.Item1.AddedDate))
{ {
<tr data-deviceflagassignmentid="@fa.Item1.Id" data-flagassignmentaddeddate="@(fa.Item1.AddedDate.ToString("s"))" class="@(!fa.Item1.RemovedDate.HasValue ? "added" : "removed")"> <tr data-deviceflagassignmentid="@fa.Item1.Id" data-flagassignmentaddeddate="@(fa.Item1.AddedDate.ToString("s"))" class="@(!fa.Item1.RemovedDate.HasValue ? "added" : "removed")" data-canremove="@fa.Item1.CanRemove()" data-removeon="@(fa.Item1.RemoveDate.HasValue ? fa.Item1.RemoveDate.Value.ToString("yyyy-MM-dd") : null)">
<td class="name"> <td class="name">
<i class="fa fa-@(fa.Item2.flag.Icon) fa-fw fa-lg d-@(fa.Item2.flag.IconColour)"></i> <i class="fa fa-@(fa.Item2.flag.Icon) fa-fw fa-lg d-@(fa.Item2.flag.IconColour)"></i>
@if (Authorization.Has(Claims.Config.DeviceFlag.Show)) @if (Authorization.Has(Claims.Config.DeviceFlag.Show))
@@ -49,11 +49,19 @@
<div class="comments">@fa.Item1.Comments.ToHtmlComment()</div> <div class="comments">@fa.Item1.Comments.ToHtmlComment()</div>
<div class="commentsRaw">@fa.Item1.Comments</div> <div class="commentsRaw">@fa.Item1.Comments</div>
} }
@if (!fa.Item1.RemovedDate.HasValue && fa.Item1.RemoveDate.HasValue)
{
<div class="removeDate" data-date="@fa.Item1.RemoveDate.Value.ToString("yyyy-MM-dd")">Removing @CommonHelpers.FriendlyDate(fa.Item1.RemoveDate.Value)</div>
}
</td> </td>
<td class="removed@(!fa.Item1.RemovedDate.HasValue ? " na" : null)"> <td class="removed@(!fa.Item1.RemovedDate.HasValue ? " na" : null)">
@if (fa.Item1.RemovedDate.HasValue) @if (fa.Item1.RemovedDate.HasValue)
{ {
@CommonHelpers.FriendlyDateAndUser(fa.Item1.RemovedDate.Value, fa.Item1.RemovedUser) @CommonHelpers.FriendlyDateAndUser(fa.Item1.RemovedDate.Value, fa.Item1.RemovedUser)
if (fa.Item1.RemoveDate.HasValue)
{
<em>(scheduled)</em>
}
if (fa.Item1.OnUnassignmentExpressionResult != null) if (fa.Item1.OnUnassignmentExpressionResult != null)
{ {
<div class="expressionResult">@fa.Item1.OnUnassignmentExpressionResult</div> <div class="expressionResult">@fa.Item1.OnUnassignmentExpressionResult</div>
@@ -61,7 +69,7 @@
} }
else if (fa.Item1.CanRemove()) else if (fa.Item1.CanRemove())
{ {
<a href="#" class="button small remove">Remove</a> <button type="button" class="button small remove">Remove</button>
} }
</td> </td>
</tr> </tr>
@@ -77,8 +85,8 @@
</p> </p>
} }
</div> </div>
<div id="Device_Show_Flags_Actions_EditComments_Dialog" class="dialog" title="Edit the Comments"> <div id="Device_Show_Flags_Actions_EditComments_Dialog" class="dialog" title="Edit Details">
@using (Html.BeginForm(MVC.API.DeviceFlagAssignment.UpdateComments())) @using (Html.BeginForm(MVC.API.DeviceFlagAssignment.Edit()))
{ {
@Html.AntiForgeryToken() @Html.AntiForgeryToken()
<input id="Device_Show_Flags_Actions_EditComments_Dialog_Id" type="hidden" name="id" value="" /> <input id="Device_Show_Flags_Actions_EditComments_Dialog_Id" type="hidden" name="id" value="" />
@@ -87,18 +95,23 @@
<p> <p>
<textarea id="Device_Show_Flags_Actions_EditComments_Dialog_Comments" name="Comments" class="block"></textarea> <textarea id="Device_Show_Flags_Actions_EditComments_Dialog_Comments" name="Comments" class="block"></textarea>
</p> </p>
<div>
<h4>Remove On</h4>
<input name="RemoveDate" id="Device_Show_Flags_Actions_EditComments_Dialog_RemoveDate" type="date" min="@(DateTime.Today.AddDays(1).ToString("yyyy-MM-dd"))" />
<span>12:00 AM</span>
</div>
} }
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
var deviceFlags = $('#deviceFlags'); const deviceFlags = $('#deviceFlags');
var dialog = null; let dialog = null;
var dialogEditComments = null; let dialogEditComments = null;
deviceFlags.on('click', 'a.remove', function (e) { deviceFlags.on('click', 'button.remove', function (e) {
var $this = $(this); const $this = $(this);
var DeviceFlagAssignmentId = $this.closest('tr').attr('data-deviceflagassignmentid'); const DeviceFlagAssignmentId = $this.closest('tr').attr('data-deviceflagassignmentid');
if (!dialog) { if (!dialog) {
dialog = $('#Device_Show_Flags_Actions_Remove_Dialog'); dialog = $('#Device_Show_Flags_Actions_Remove_Dialog');
@@ -108,7 +121,7 @@
autoOpen: false, autoOpen: false,
buttons: { buttons: {
"Remove Flag": function () { "Remove Flag": function () {
var $this = $(this); const $this = $(this);
$this.dialog("disable"); $this.dialog("disable");
$this.dialog("option", "buttons", null); $this.dialog("option", "buttons", null);
$this.find('form').submit(); $this.find('form').submit();
@@ -128,8 +141,11 @@
}); });
deviceFlags.on('click', 'td.comments i.fa-edit', function (e) { deviceFlags.on('click', 'td.comments i.fa-edit', function (e) {
var $this = $(this); const $this = $(this);
var DeviceFlagAssignmentId = $this.closest('tr').attr('data-deviceflagassignmentid'); const $row = $this.closest('tr');
const DeviceFlagAssignmentId = $row.attr('data-deviceflagassignmentid');
const canRemove = $row.attr('data-canremove') === 'True';
const removeOn = $row.attr('data-removeon');
if (!dialogEditComments) { if (!dialogEditComments) {
dialogEditComments = $('#Device_Show_Flags_Actions_EditComments_Dialog'); dialogEditComments = $('#Device_Show_Flags_Actions_EditComments_Dialog');
@@ -140,7 +156,7 @@
autoOpen: false, autoOpen: false,
buttons: { buttons: {
"Save Changes": function () { "Save Changes": function () {
var $this = $(this); const $this = $(this);
$this.dialog("disable"); $this.dialog("disable");
$this.dialog("option", "buttons", null); $this.dialog("option", "buttons", null);
$this.find('form').submit(); $this.find('form').submit();
@@ -152,13 +168,28 @@
}); });
} }
var $comments = $this.closest('td').find('.commentsRaw'); const $comments = $this.closest('td').find('.commentsRaw');
if ($comments.hasClass('smallMessage')) { if ($comments.hasClass('smallMessage')) {
$('#Device_Show_Flags_Actions_EditComments_Dialog_Comments').val(''); $('#Device_Show_Flags_Actions_EditComments_Dialog_Comments').val('');
} else { } else {
$('#Device_Show_Flags_Actions_EditComments_Dialog_Comments').val($comments.text()); $('#Device_Show_Flags_Actions_EditComments_Dialog_Comments').val($comments.text());
} }
const removeOnInput = $('#Device_Show_Flags_Actions_EditComments_Dialog_RemoveDate');
if (canRemove) {
removeOnInput.prop('disabled', false);
if (removeOn) {
removeOnInput.val(removeOn);
} else {
removeOnInput.val('');
}
removeOnInput.closest('div').css('display', 'block');
} else {
removeOnInput.prop('disabled', true);
removeOnInput.val('');
removeOnInput.closest('div').css('display', 'none');
}
$('#Device_Show_Flags_Actions_EditComments_Dialog_Id').val(DeviceFlagAssignmentId); $('#Device_Show_Flags_Actions_EditComments_Dialog_Id').val(DeviceFlagAssignmentId);
dialogEditComments.dialog('open'); dialogEditComments.dialog('open');
e.preventDefault(); e.preventDefault();
@@ -96,7 +96,7 @@ WriteLiteral(">Added</th>\r\n <th");
WriteLiteral(" class=\"sla\""); WriteLiteral(" class=\"sla\"");
WriteLiteral(">Comments</th>\r\n <th"); WriteLiteral(">Detail</th>\r\n <th");
WriteLiteral(" class=\"removed\""); WriteLiteral(" class=\"removed\"");
@@ -140,42 +140,64 @@ WriteLiteral(" data-flagassignmentaddeddate=\"");
#line hidden #line hidden
WriteLiteral("\""); WriteLiteral("\"");
WriteAttribute("class", Tuple.Create(" class=\"", 967), Tuple.Create("\"", 1030) WriteAttribute("class", Tuple.Create(" class=\"", 965), Tuple.Create("\"", 1028)
#line 19 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 19 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 975), Tuple.Create<System.Object, System.Int32>(!fa.Item1.RemovedDate.HasValue ? "added" : "removed" , Tuple.Create(Tuple.Create("", 973), Tuple.Create<System.Object, System.Int32>(!fa.Item1.RemovedDate.HasValue ? "added" : "removed"
#line default #line default
#line hidden #line hidden
, 975), false) , 973), false)
); );
WriteLiteral(" data-canremove=\"");
#line 19 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(fa.Item1.CanRemove());
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-removeon=\"");
#line 19 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(fa.Item1.RemoveDate.HasValue ? fa.Item1.RemoveDate.Value.ToString("yyyy-MM-dd") : null);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <td"); WriteLiteral(">\r\n <td");
WriteLiteral(" class=\"name\""); WriteLiteral(" class=\"name\"");
WriteLiteral(">\r\n <i"); WriteLiteral(">\r\n <i");
WriteAttribute("class", Tuple.Create(" class=\"", 1099), Tuple.Create("\"", 1176) WriteAttribute("class", Tuple.Create(" class=\"", 1242), Tuple.Create("\"", 1319)
, Tuple.Create(Tuple.Create("", 1107), Tuple.Create("fa", 1107), true) , Tuple.Create(Tuple.Create("", 1250), Tuple.Create("fa", 1250), true)
, Tuple.Create(Tuple.Create(" ", 1109), Tuple.Create("fa-", 1110), true) , Tuple.Create(Tuple.Create(" ", 1252), Tuple.Create("fa-", 1253), true)
#line 21 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 21 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 1113), Tuple.Create<System.Object, System.Int32>(fa.Item2.flag.Icon , Tuple.Create(Tuple.Create("", 1256), Tuple.Create<System.Object, System.Int32>(fa.Item2.flag.Icon
#line default #line default
#line hidden #line hidden
, 1113), false) , 1256), false)
, Tuple.Create(Tuple.Create(" ", 1134), Tuple.Create("fa-fw", 1135), true) , Tuple.Create(Tuple.Create(" ", 1277), Tuple.Create("fa-fw", 1278), true)
, Tuple.Create(Tuple.Create(" ", 1140), Tuple.Create("fa-lg", 1141), true) , Tuple.Create(Tuple.Create(" ", 1283), Tuple.Create("fa-lg", 1284), true)
, Tuple.Create(Tuple.Create(" ", 1146), Tuple.Create("d-", 1147), true) , Tuple.Create(Tuple.Create(" ", 1289), Tuple.Create("d-", 1290), true)
#line 21 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 21 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 1149), Tuple.Create<System.Object, System.Int32>(fa.Item2.flag.IconColour , Tuple.Create(Tuple.Create("", 1292), Tuple.Create<System.Object, System.Int32>(fa.Item2.flag.IconColour
#line default #line default
#line hidden #line hidden
, 1149), false) , 1292), false)
); );
WriteLiteral("></i>\r\n"); WriteLiteral("></i>\r\n");
@@ -380,29 +402,72 @@ WriteLiteral("</div>\r\n");
#line default #line default
#line hidden #line hidden
WriteLiteral(" </td>\r\n <td"); WriteLiteral(" ");
WriteAttribute("class", Tuple.Create(" class=\"", 2763), Tuple.Create("\"", 2826)
, Tuple.Create(Tuple.Create("", 2771), Tuple.Create("removed", 2771), true)
#line 53 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 52 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 2778), Tuple.Create<System.Object, System.Int32>(!fa.Item1.RemovedDate.HasValue ? " na" : null if (!fa.Item1.RemovedDate.HasValue && fa.Item1.RemoveDate.HasValue)
{
#line default #line default
#line hidden #line hidden
, 2778), false) WriteLiteral(" <div");
WriteLiteral(" class=\"removeDate\"");
WriteLiteral(" data-date=\"");
#line 54 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(fa.Item1.RemoveDate.Value.ToString("yyyy-MM-dd"));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">Removing ");
#line 54 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(CommonHelpers.FriendlyDate(fa.Item1.RemoveDate.Value));
#line default
#line hidden
WriteLiteral("</div>\r\n");
#line 55 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n <td");
WriteAttribute("class", Tuple.Create(" class=\"", 3239), Tuple.Create("\"", 3302)
, Tuple.Create(Tuple.Create("", 3247), Tuple.Create("removed", 3247), true)
#line 57 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 3254), Tuple.Create<System.Object, System.Int32>(!fa.Item1.RemovedDate.HasValue ? " na" : null
#line default
#line hidden
, 3254), false)
); );
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 54 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 58 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
#line default #line default
#line hidden #line hidden
#line 54 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 58 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
if (fa.Item1.RemovedDate.HasValue) if (fa.Item1.RemovedDate.HasValue)
{ {
@@ -410,15 +475,26 @@ WriteLiteral(">\r\n");
#line default #line default
#line hidden #line hidden
#line 56 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 60 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(fa.Item1.RemovedDate.Value, fa.Item1.RemovedUser)); Write(CommonHelpers.FriendlyDateAndUser(fa.Item1.RemovedDate.Value, fa.Item1.RemovedUser));
#line default #line default
#line hidden #line hidden
#line 56 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 60 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
if (fa.Item1.RemoveDate.HasValue)
{
#line default
#line hidden
WriteLiteral(" <em>(scheduled)</em>\r\n");
#line 64 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
if (fa.Item1.OnUnassignmentExpressionResult != null) if (fa.Item1.OnUnassignmentExpressionResult != null)
{ {
@@ -432,7 +508,7 @@ WriteLiteral(" class=\"expressionResult\"");
WriteLiteral(">"); WriteLiteral(">");
#line 59 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 67 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(fa.Item1.OnUnassignmentExpressionResult); Write(fa.Item1.OnUnassignmentExpressionResult);
@@ -441,7 +517,7 @@ WriteLiteral(">");
WriteLiteral("</div>\r\n"); WriteLiteral("</div>\r\n");
#line 60 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 68 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
} }
} }
else if (fa.Item1.CanRemove()) else if (fa.Item1.CanRemove())
@@ -450,16 +526,16 @@ WriteLiteral("</div>\r\n");
#line default #line default
#line hidden #line hidden
WriteLiteral(" <a"); WriteLiteral(" <button");
WriteLiteral(" href=\"#\""); WriteLiteral(" type=\"button\"");
WriteLiteral(" class=\"button small remove\""); WriteLiteral(" class=\"button small remove\"");
WriteLiteral(">Remove</a>\r\n"); WriteLiteral(">Remove</button>\r\n");
#line 65 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 73 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
} }
@@ -468,7 +544,7 @@ WriteLiteral(">Remove</a>\r\n");
WriteLiteral(" </td>\r\n </tr>\r\n"); WriteLiteral(" </td>\r\n </tr>\r\n");
#line 68 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 76 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
} }
@@ -487,13 +563,13 @@ WriteLiteral(" title=\"Remove this flag from the device?\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 71 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 79 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
#line default #line default
#line hidden #line hidden
#line 71 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 79 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
using (Html.BeginForm(MVC.API.DeviceFlagAssignment.RemoveDevice())) using (Html.BeginForm(MVC.API.DeviceFlagAssignment.RemoveDevice()))
{ {
@@ -501,14 +577,14 @@ WriteLiteral(">\r\n");
#line default #line default
#line hidden #line hidden
#line 73 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 81 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(Html.AntiForgeryToken()); Write(Html.AntiForgeryToken());
#line default #line default
#line hidden #line hidden
#line 73 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 81 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
@@ -533,7 +609,7 @@ WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n"); WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n");
#line 78 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 86 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
} }
@@ -547,33 +623,33 @@ WriteLiteral(" id=\"Device_Show_Flags_Actions_EditComments_Dialog\"");
WriteLiteral(" class=\"dialog\""); WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Edit the Comments\""); WriteLiteral(" title=\"Edit Details\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 81 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 89 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
#line default #line default
#line hidden #line hidden
#line 81 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 89 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
using (Html.BeginForm(MVC.API.DeviceFlagAssignment.UpdateComments())) using (Html.BeginForm(MVC.API.DeviceFlagAssignment.Edit()))
{ {
#line default #line default
#line hidden #line hidden
#line 83 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 91 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(Html.AntiForgeryToken()); Write(Html.AntiForgeryToken());
#line default #line default
#line hidden #line hidden
#line 83 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 91 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
@@ -613,8 +689,29 @@ WriteLiteral(" class=\"block\"");
WriteLiteral("></textarea>\r\n </p>\r\n"); WriteLiteral("></textarea>\r\n </p>\r\n");
WriteLiteral(" <div>\r\n <h4>Remove On</h4>\r\n " +
" <input");
#line 90 "..\..\Views\Device\DeviceParts\_Flags.cshtml" WriteLiteral(" name=\"RemoveDate\"");
WriteLiteral(" id=\"Device_Show_Flags_Actions_EditComments_Dialog_RemoveDate\"");
WriteLiteral(" type=\"date\"");
WriteAttribute("min", Tuple.Create(" min=\"", 5593), Tuple.Create("\"", 5650)
#line 100 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 5599), Tuple.Create<System.Object, System.Int32>(DateTime.Today.AddDays(1).ToString("yyyy-MM-dd")
#line default
#line hidden
, 5599), false)
);
WriteLiteral(" />\r\n <span>12:00 AM</span>\r\n </div>\r\n");
#line 103 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
} }
@@ -626,53 +723,65 @@ WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\""); WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n var deviceFlags = $(\'#deviceFlags" + WriteLiteral(">\r\n $(function () {\r\n const deviceFlags = $(\'#deviceFla" +
"\');\r\n\r\n var dialog = null;\r\n var dialogEditComment" + "gs\');\r\n\r\n let dialog = null;\r\n let dialogEditComme" +
"s = null;\r\n\r\n deviceFlags.on(\'click\', \'a.remove\', function (e) {\r" + "nts = null;\r\n\r\n deviceFlags.on(\'click\', \'button.remove\', function" +
"\n var $this = $(this);\r\n var DeviceFlagAss" + " (e) {\r\n const $this = $(this);\r\n const De" +
"ignmentId = $this.closest(\'tr\').attr(\'data-deviceflagassignmentid\');\r\n\r\n " + "viceFlagAssignmentId = $this.closest(\'tr\').attr(\'data-deviceflagassignmentid\');\r" +
" if (!dialog) {\r\n dialog = $(\'#Device_Show_Fla" + "\n\r\n if (!dialog) {\r\n dialog = $(\'#Devi" +
"gs_Actions_Remove_Dialog\');\r\n dialog.dialog({\r\n " + "ce_Show_Flags_Actions_Remove_Dialog\');\r\n dialog.dialog({\r" +
" resizable: false,\r\n modal: true,\r\n " + "\n resizable: false,\r\n moda" +
" autoOpen: false,\r\n buttons" + "l: true,\r\n autoOpen: false,\r\n " +
": {\r\n \"Remove Flag\": function () {\r\n " + " buttons: {\r\n \"Remove Flag\": function () {\r\n " +
" var $this = $(this);\r\n " + " const $this = $(this);\r\n " +
" $this.dialog(\"disable\");\r\n $this.dialog(\"opt" + " $this.dialog(\"disable\");\r\n $thi" +
"ion\", \"buttons\", null);\r\n $this.find(\'form\')." + "s.dialog(\"option\", \"buttons\", null);\r\n $this." +
"submit();\r\n },\r\n C" + "find(\'form\').submit();\r\n },\r\n " +
"ancel: function () {\r\n $(this).dialog(\"close\"" + " Cancel: function () {\r\n $(this).d" +
");\r\n }\r\n }\r\n " + "ialog(\"close\");\r\n }\r\n " +
" });\r\n }\r\n\r\n $(\'#Device_Show_" + "}\r\n });\r\n }\r\n\r\n $(\'" +
"Flags_Actions_Remove_Dialog_Id\').val(DeviceFlagAssignmentId);\r\n " + "#Device_Show_Flags_Actions_Remove_Dialog_Id\').val(DeviceFlagAssignmentId);\r\n " +
" dialog.dialog(\'open\');\r\n\r\n e.preventDefault();\r\n " + " dialog.dialog(\'open\');\r\n\r\n e.preventDefault()" +
" return false;\r\n });\r\n\r\n deviceFlags.on(\'" + ";\r\n return false;\r\n });\r\n\r\n dev" +
"click\', \'td.comments i.fa-edit\', function (e) {\r\n var $this =" + "iceFlags.on(\'click\', \'td.comments i.fa-edit\', function (e) {\r\n " +
" $(this);\r\n var DeviceFlagAssignmentId = $this.closest(\'tr\')." + " const $this = $(this);\r\n const $row = $this.closest(\'tr\');\r" +
"attr(\'data-deviceflagassignmentid\');\r\n\r\n if (!dialogEditComme" + "\n const DeviceFlagAssignmentId = $row.attr(\'data-deviceflagas" +
"nts) {\r\n dialogEditComments = $(\'#Device_Show_Flags_Actio" + "signmentid\');\r\n const canRemove = $row.attr(\'data-canremove\')" +
"ns_EditComments_Dialog\');\r\n dialogEditComments.dialog({\r\n" + " === \'True\';\r\n const removeOn = $row.attr(\'data-removeon\');\r\n" +
" resizable: false,\r\n modal" + "\r\n if (!dialogEditComments) {\r\n dialog" +
": true,\r\n width: 320,\r\n au" + "EditComments = $(\'#Device_Show_Flags_Actions_EditComments_Dialog\');\r\n " +
"toOpen: false,\r\n buttons: {\r\n " + " dialogEditComments.dialog({\r\n resizable:" +
" \"Save Changes\": function () {\r\n var $" + " false,\r\n modal: true,\r\n w" +
"this = $(this);\r\n $this.dialog(\"disable\");\r\n " + "idth: 320,\r\n autoOpen: false,\r\n " +
" $this.dialog(\"option\", \"buttons\", null);\r\n " + " buttons: {\r\n \"Save Changes\": function () {\r" +
" $this.find(\'form\').submit();\r\n " + "\n const $this = $(this);\r\n " +
" },\r\n Cancel: function () {\r\n " + " $this.dialog(\"disable\");\r\n $" +
" $(this).dialog(\"close\");\r\n " + "this.dialog(\"option\", \"buttons\", null);\r\n $th" +
" }\r\n }\r\n });\r\n " + "is.find(\'form\').submit();\r\n },\r\n " +
" }\r\n\r\n var $comments = $this.closest(\'td\').find(\'.c" + " Cancel: function () {\r\n $(this" +
"ommentsRaw\');\r\n if ($comments.hasClass(\'smallMessage\')) {\r\n " + ").dialog(\"close\");\r\n }\r\n " +
" $(\'#Device_Show_Flags_Actions_EditComments_Dialog_Comments" + " }\r\n });\r\n }\r\n\r\n " +
"\').val(\'\');\r\n } else {\r\n $(\'#Device_Sh" + "const $comments = $this.closest(\'td\').find(\'.commentsRaw\');\r\n " +
"ow_Flags_Actions_EditComments_Dialog_Comments\').val($comments.text());\r\n " + " if ($comments.hasClass(\'smallMessage\')) {\r\n $(\'#Device_S" +
" }\r\n\r\n $(\'#Device_Show_Flags_Actions_EditComments_" + "how_Flags_Actions_EditComments_Dialog_Comments\').val(\'\');\r\n }" +
"Dialog_Id\').val(DeviceFlagAssignmentId);\r\n dialogEditComments" + " else {\r\n $(\'#Device_Show_Flags_Actions_EditComments_Dial" +
".dialog(\'open\');\r\n e.preventDefault();\r\n r" + "og_Comments\').val($comments.text());\r\n }\r\n\r\n " +
"eturn false;\r\n });\r\n });\r\n </script>\r\n"); " const removeOnInput = $(\'#Device_Show_Flags_Actions_EditComments_Dialog_Remov" +
"eDate\');\r\n if (canRemove) {\r\n removeOn" +
"Input.prop(\'disabled\', false);\r\n if (removeOn) {\r\n " +
" removeOnInput.val(removeOn);\r\n } els" +
"e {\r\n removeOnInput.val(\'\');\r\n " +
" }\r\n removeOnInput.closest(\'div\').css(\'display\', \'block\')" +
";\r\n } else {\r\n removeOnInput.prop(\'dis" +
"abled\', true);\r\n removeOnInput.val(\'\');\r\n " +
" removeOnInput.closest(\'div\').css(\'display\', \'none\');\r\n " +
" }\r\n\r\n $(\'#Device_Show_Flags_Actions_EditComments_Dialog_Id\'" +
").val(DeviceFlagAssignmentId);\r\n dialogEditComments.dialog(\'o" +
"pen\');\r\n e.preventDefault();\r\n return fals" +
"e;\r\n });\r\n });\r\n </script>\r\n");
#line 169 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 200 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
} }
else else
{ {
@@ -687,7 +796,7 @@ WriteLiteral(" class=\"none\"");
WriteLiteral(">This device has no associated flags</div>\r\n"); WriteLiteral(">This device has no associated flags</div>\r\n");
#line 173 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 204 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
} }
@@ -697,7 +806,7 @@ WriteLiteral(" <script>\r\n $(\'#DeviceDetailTabItems\').append(\'<li>
"ilTab-Flags\">Flags ["); "ilTab-Flags\">Flags [");
#line 175 "..\..\Views\Device\DeviceParts\_Flags.cshtml" #line 206 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(activeAssignmentCount); Write(activeAssignmentCount);
@@ -776,12 +776,12 @@
{ {
@Html.AntiForgeryToken() @Html.AntiForgeryToken()
<input id="Device_Show_Details_Actions_AddFlag_Dialog_Id" type="hidden" name="id" /> <input id="Device_Show_Details_Actions_AddFlag_Dialog_Id" type="hidden" name="id" />
<input id="Device_Show_Details_Actions_AddFlag_Dialog_DeviceSerialNumber" type="hidden" name="DeviceSerialNumber" value="@Model.Device.SerialNumber" /> <input id="Device_Show_Details_Actions_AddFlag_Dialog_DeviceSerialNumber" type="hidden" name="deviceSerialNumber" value="@Model.Device.SerialNumber" />
<div class="flagPicker"> <div class="flagPicker">
<input id="Device_Show_Details_Actions_AddFlag_Dialog_Filter" type="text" placeholder="Filter" autocomplete="off" /> <input id="Device_Show_Details_Actions_AddFlag_Dialog_Filter" type="text" placeholder="Filter" autocomplete="off" />
@foreach (var flag in Model.AvailableDeviceFlags.OrderBy(jq => jq.Name)) @foreach (var flag in Model.AvailableDeviceFlags.OrderBy(jq => jq.Name))
{ {
<div class="flag" data-flagid="@(flag.Id)" data-flagname="@flag.Name"> <div class="flag" data-flagid="@(flag.Id)" data-flagname="@flag.Name" data-flagcanremove="@Model.Device.CanRemoveDeviceFlag(flag)" data-flagremovedays="@flag.DefaultRemoveDays">
<i class="fa fa-@(flag.Icon) fa-fw fa-lg d-@(flag.IconColour)"></i>@flag.Name <i class="fa fa-@(flag.Icon) fa-fw fa-lg d-@(flag.IconColour)"></i>@flag.Name
</div> </div>
} }
@@ -789,7 +789,12 @@
<div class="details"> <div class="details">
<div> <div>
<h4>Comments</h4> <h4>Comments</h4>
<textarea name="Comments" id="Device_Show_Details_Actions_AddFlag_Dialog_Comments"></textarea> <textarea name="comments" id="Device_Show_Details_Actions_AddFlag_Dialog_Comments"></textarea>
</div>
<div>
<h4>Remove On</h4>
<input name="removeDate" id="Device_Show_Details_Actions_AddFlag_Dialog_RemoveDate" type="date" min="@(DateTime.Today.AddDays(1).ToString("yyyy-MM-dd"))" />
<span>12:00 AM</span>
</div> </div>
</div> </div>
} }
@@ -802,6 +807,7 @@
let flagPicker = null; let flagPicker = null;
let flagAddId = null; let flagAddId = null;
let flagAddComments = null; let flagAddComments = null;
let flagAddRemoveDate = null;
let details = null; let details = null;
function flagSelected() { function flagSelected() {
@@ -812,6 +818,26 @@
flagAddId.val(flag.attr('data-flagid')); flagAddId.val(flag.attr('data-flagid'));
const removeDays = flag.attr('data-flagremovedays');
if (removeDays) {
const date = new Date();
date.setDate(date.getDate() + parseInt(removeDays) - 1);
flagAddRemoveDate[0].valueAsDate = date;
flagAddRemoveDate.trigger('change');
} else {
flagAddRemoveDate[0].valueAsDate = null;
flagAddRemoveDate.trigger('change');
}
flagAddRemoveDate.closest('div').show();
if (flag.attr('data-flagcanremove') === 'True') {
flagAddRemoveDate.prop('disabled', false);
} else {
flagAddRemoveDate.prop('disabled', true);
if (!removeDays) {
flagAddRemoveDate.closest('div').hide();
}
}
details.show(); details.show();
flagAddComments.focus().select(); flagAddComments.focus().select();
@@ -844,6 +870,7 @@
flagAddId = $('#Device_Show_Details_Actions_AddFlag_Dialog_Id'); flagAddId = $('#Device_Show_Details_Actions_AddFlag_Dialog_Id');
flagAddComments = buttonDialog.find('#Device_Show_Details_Actions_AddFlag_Dialog_Comments'); flagAddComments = buttonDialog.find('#Device_Show_Details_Actions_AddFlag_Dialog_Comments');
flagAddRemoveDate = buttonDialog.find('#Device_Show_Details_Actions_AddFlag_Dialog_RemoveDate');
flagPicker = buttonDialog.find('.flagPicker'); flagPicker = buttonDialog.find('.flagPicker');
details = buttonDialog.find('.details'); details = buttonDialog.find('.details');
@@ -864,6 +891,13 @@
}); });
flagPicker.on('click', 'div.flag', flagSelected); flagPicker.on('click', 'div.flag', flagSelected);
flagAddRemoveDate.on('change', function () {
if (flagAddRemoveDate.val()) {
flagAddRemoveDate.next('span').show();
} else {
flagAddRemoveDate.next('span').hide();
}
});
} }
$('#Device_Show_Details_Actions_AddFlag_Dialog_Filter').val(''); $('#Device_Show_Details_Actions_AddFlag_Dialog_Filter').val('');
@@ -2843,7 +2843,7 @@ WriteLiteral(" id=\"Device_Show_Details_Actions_AddFlag_Dialog_DeviceSerialNumbe
WriteLiteral(" type=\"hidden\""); WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"DeviceSerialNumber\""); WriteLiteral(" name=\"deviceSerialNumber\"");
WriteAttribute("value", Tuple.Create(" value=\"", 49530), Tuple.Create("\"", 49564) WriteAttribute("value", Tuple.Create(" value=\"", 49530), Tuple.Create("\"", 49564)
@@ -2913,28 +2913,50 @@ WriteLiteral(" data-flagname=\"");
#line hidden #line hidden
WriteLiteral("\""); WriteLiteral("\"");
WriteLiteral(" data-flagcanremove=\"");
#line 784 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Model.Device.CanRemoveDeviceFlag(flag));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-flagremovedays=\"");
#line 784 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(flag.DefaultRemoveDays);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <i"); WriteLiteral(">\r\n <i");
WriteAttribute("class", Tuple.Create(" class=\"", 50041), Tuple.Create("\"", 50100) WriteAttribute("class", Tuple.Create(" class=\"", 50148), Tuple.Create("\"", 50207)
, Tuple.Create(Tuple.Create("", 50049), Tuple.Create("fa", 50049), true) , Tuple.Create(Tuple.Create("", 50156), Tuple.Create("fa", 50156), true)
, Tuple.Create(Tuple.Create(" ", 50051), Tuple.Create("fa-", 50052), true) , Tuple.Create(Tuple.Create(" ", 50158), Tuple.Create("fa-", 50159), true)
#line 785 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 785 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 50055), Tuple.Create<System.Object, System.Int32>(flag.Icon , Tuple.Create(Tuple.Create("", 50162), Tuple.Create<System.Object, System.Int32>(flag.Icon
#line default #line default
#line hidden #line hidden
, 50055), false) , 50162), false)
, Tuple.Create(Tuple.Create(" ", 50067), Tuple.Create("fa-fw", 50068), true) , Tuple.Create(Tuple.Create(" ", 50174), Tuple.Create("fa-fw", 50175), true)
, Tuple.Create(Tuple.Create(" ", 50073), Tuple.Create("fa-lg", 50074), true) , Tuple.Create(Tuple.Create(" ", 50180), Tuple.Create("fa-lg", 50181), true)
, Tuple.Create(Tuple.Create(" ", 50079), Tuple.Create("d-", 50080), true) , Tuple.Create(Tuple.Create(" ", 50186), Tuple.Create("d-", 50187), true)
#line 785 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 785 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 50082), Tuple.Create<System.Object, System.Int32>(flag.IconColour , Tuple.Create(Tuple.Create("", 50189), Tuple.Create<System.Object, System.Int32>(flag.IconColour
#line default #line default
#line hidden #line hidden
, 50082), false) , 50189), false)
); );
WriteLiteral("></i>"); WriteLiteral("></i>");
@@ -2964,15 +2986,35 @@ WriteLiteral(" class=\"details\"");
WriteLiteral(">\r\n <div>\r\n <h4>Comment" + WriteLiteral(">\r\n <div>\r\n <h4>Comment" +
"s</h4>\r\n <textarea"); "s</h4>\r\n <textarea");
WriteLiteral(" name=\"Comments\""); WriteLiteral(" name=\"comments\"");
WriteLiteral(" id=\"Device_Show_Details_Actions_AddFlag_Dialog_Comments\""); WriteLiteral(" id=\"Device_Show_Details_Actions_AddFlag_Dialog_Comments\"");
WriteLiteral("></textarea>\r\n </div>\r\n </div>\r" + WriteLiteral("></textarea>\r\n </div>\r\n <di" +
"\n"); "v>\r\n <h4>Remove On</h4>\r\n " +
" <input");
WriteLiteral(" name=\"removeDate\"");
WriteLiteral(" id=\"Device_Show_Details_Actions_AddFlag_Dialog_RemoveDate\"");
WriteLiteral(" type=\"date\"");
WriteAttribute("min", Tuple.Create(" min=\"", 50839), Tuple.Create("\"", 50896)
#line 796 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 50845), Tuple.Create<System.Object, System.Int32>(DateTime.Today.AddDays(1).ToString("yyyy-MM-dd")
#line default
#line hidden
, 50845), false)
);
WriteLiteral(" />\r\n <span>12:00 AM</span>\r\n " +
" </div>\r\n </div>\r\n");
#line 795 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 800 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
@@ -2988,56 +3030,78 @@ WriteLiteral(">\r\n $(function () {\r\n
"\'#Device_Show_Details_Actions_AddFlag_Button\');\r\n let but" + "\'#Device_Show_Details_Actions_AddFlag_Button\');\r\n let but" +
"tonDialog = null;\r\n\r\n let flagPicker = null;\r\n " + "tonDialog = null;\r\n\r\n let flagPicker = null;\r\n " +
" let flagAddId = null;\r\n let flagAddComments " + " let flagAddId = null;\r\n let flagAddComments " +
"= null;\r\n let details = null;\r\n\r\n " + "= null;\r\n let flagAddRemoveDate = null;\r\n " +
"function flagSelected() {\r\n const flag = $(this);\r\n\r\n" + " let details = null;\r\n\r\n function flagSelected() {" +
" flagPicker.children().removeClass(\'selected\');\r\n " + "\r\n const flag = $(this);\r\n\r\n " +
" flag.addClass(\'selected\');\r\n\r\n " + " flagPicker.children().removeClass(\'selected\');\r\n f" +
" flagAddId.val(flag.attr(\'data-flagid\'));\r\n\r\n detail" + "lag.addClass(\'selected\');\r\n\r\n flagAddId.val(flag.attr" +
"s.show();\r\n\r\n flagAddComments.focus().select();\r\n " + "(\'data-flagid\'));\r\n\r\n const removeDays = flag.attr(\'d" +
" }\r\n\r\n button.click(function (e) {\r\n " + "ata-flagremovedays\');\r\n if (removeDays) {\r\n " +
" if (!buttonDialog) {\r\n " + " const date = new Date();\r\n " +
"buttonDialog = $(\'#Device_Show_Details_Actions_AddFlag_Dialog\');\r\n " + "date.setDate(date.getDate() + parseInt(removeDays) - 1);\r\n " +
" buttonDialog.dialog({\r\n wid" + " flagAddRemoveDate[0].valueAsDate = date;\r\n " +
"th: 600,\r\n height: 410,\r\n " + " flagAddRemoveDate.trigger(\'change\');\r\n } else {\r\n" +
" resizable: false,\r\n modal: tr" + " flagAddRemoveDate[0].valueAsDate = null;\r\n " +
"ue,\r\n autoOpen: false,\r\n " + " flagAddRemoveDate.trigger(\'change\');\r\n " +
" buttons: {\r\n Cancel: funct" + " }\r\n flagAddRemoveDate.closest(\'div\').show" +
"ion () {\r\n $(this).dialog(\"close\");\r\n" + "();\r\n if (flag.attr(\'data-flagcanremove\') === \'True\')" +
" },\r\n " + " {\r\n flagAddRemoveDate.prop(\'disabled\', false);\r\n" +
" \"Add Flag\": function () {\r\n if (!" + " } else {\r\n flagAddRem" +
"!flagAddId.val()) {\r\n buttonDialo" + "oveDate.prop(\'disabled\', true);\r\n if (!removeDays" +
"g\r\n .dialog(\"option\", \"button" + ") {\r\n flagAddRemoveDate.closest(\'div\').hide()" +
"s\", null)\r\n .find(\'form\').sub" + ";\r\n }\r\n }\r\n\r\n " +
"mit();\r\n } else {\r\n " + " details.show();\r\n\r\n flagAddComment" +
" alert(\'Select a Device Flag\');\r\n " + "s.focus().select();\r\n }\r\n\r\n button" +
" }\r\n }\r\n " + ".click(function (e) {\r\n if (!buttonDialog) {\r\n " +
" }\r\n });\r\n\r\n " + " buttonDialog = $(\'#Device_Show_Details_Actions_AddFlag_" +
" flagAddId = $(\'#Device_Show_Details_Actions_AddFlag_Dialog" + "Dialog\');\r\n buttonDialog.dialog({\r\n " +
"_Id\');\r\n flagAddComments = buttonDialog.find(\'#De" + " width: 600,\r\n height: 4" +
"vice_Show_Details_Actions_AddFlag_Dialog_Comments\');\r\n " + "10,\r\n resizable: false,\r\n " +
" flagPicker = buttonDialog.find(\'.flagPicker\');\r\n " + " modal: true,\r\n autoOpen: fals" +
" details = buttonDialog.find(\'.details\');\r\n\r\n " + "e,\r\n buttons: {\r\n " +
" $(\'#Device_Show_Details_Actions_AddFlag_Dialog_Filter\').on(\'keyup\', function (" + " Cancel: function () {\r\n $" +
"e) {\r\n const filter = $(e.currentTarget).val(" + "(this).dialog(\"close\");\r\n },\r\n " +
").toLowerCase();\r\n if (filter) {\r\n " + " \"Add Flag\": function () {\r\n " +
" flagPicker.children(\'div.flag\').each(function () {\r" + " if (!!flagAddId.val()) {\r\n " +
"\n const $this = $(this);\r\n " + " buttonDialog\r\n " +
" if ($this.attr(\'data-flagname\').toLowerCase().i" + ".dialog(\"option\", \"buttons\", null)\r\n " +
"ndexOf(filter) >= 0) {\r\n $this.cs" + " .find(\'form\').submit();\r\n } e" +
"s(\'display\', \'block\');\r\n } else {\r\n " + "lse {\r\n alert(\'Select a Device Fl" +
" $this.css(\'display\', \'none\');\r\n " + "ag\');\r\n }\r\n " +
" }\r\n " + " }\r\n }\r\n " +
" });\r\n } else {\r\n " + " });\r\n\r\n flagAddId = $(\'#Device_Show_Detai" +
" flagPicker.children(\'div.flag\').each(function () { $(this).css(\'d" + "ls_Actions_AddFlag_Dialog_Id\');\r\n flagAddComments" +
"isplay\', \'block\'); });\r\n }\r\n " + " = buttonDialog.find(\'#Device_Show_Details_Actions_AddFlag_Dialog_Comments\');\r\n " +
" });\r\n\r\n flagPicker.on(\'click\', \'di" + " flagAddRemoveDate = buttonDialog.find(\'#Device_Sh" +
"v.flag\', flagSelected);\r\n }\r\n\r\n " + "ow_Details_Actions_AddFlag_Dialog_RemoveDate\');\r\n " +
" $(\'#Device_Show_Details_Actions_AddFlag_Dialog_Filter\').val(\'\');\r\n " + " flagPicker = buttonDialog.find(\'.flagPicker\');\r\n " +
" buttonDialog.dialog(\'open\');\r\n });\r\n " + " details = buttonDialog.find(\'.details\');\r\n\r\n $(\'" +
" });\r\n </script>\r\n"); "#Device_Show_Details_Actions_AddFlag_Dialog_Filter\').on(\'keyup\', function (e) {\r" +
"\n const filter = $(e.currentTarget).val().toL" +
"owerCase();\r\n if (filter) {\r\n " +
" flagPicker.children(\'div.flag\').each(function () {\r\n " +
" const $this = $(this);\r\n " +
" if ($this.attr(\'data-flagname\').toLowerCase().indexO" +
"f(filter) >= 0) {\r\n $this.css(\'di" +
"splay\', \'block\');\r\n } else {\r\n " +
" $this.css(\'display\', \'none\');\r\n " +
" }\r\n }" +
");\r\n } else {\r\n " +
" flagPicker.children(\'div.flag\').each(function () { $(this).css(\'displa" +
"y\', \'block\'); });\r\n }\r\n " +
" });\r\n\r\n flagPicker.on(\'click\', \'div.fla" +
"g\', flagSelected);\r\n flagAddRemoveDate.on(\'change" +
"\', function () {\r\n if (flagAddRemoveDate.val(" +
")) {\r\n flagAddRemoveDate.next(\'span\').sho" +
"w();\r\n } else {\r\n " +
" flagAddRemoveDate.next(\'span\').hide();\r\n " +
" }\r\n });\r\n }\r\n\r" +
"\n $(\'#Device_Show_Details_Actions_AddFlag_Dialog_Filt" +
"er\').val(\'\');\r\n buttonDialog.dialog(\'open\');\r\n " +
" });\r\n });\r\n </script>\r\n");
#line 874 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 908 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
@@ -3046,7 +3110,7 @@ WriteLiteral(">\r\n $(function () {\r\n
WriteLiteral(" "); WriteLiteral(" ");
#line 875 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 909 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
if (Model.Device.CanUpdateTrustEnrol()) if (Model.Device.CanUpdateTrustEnrol())
{ {
@@ -3074,13 +3138,13 @@ WriteLiteral(" title=\"Trust this Device?\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 879 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 913 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 879 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 913 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
using (Html.BeginForm(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, true.ToString(), true))) using (Html.BeginForm(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, true.ToString(), true)))
{ {
@@ -3088,14 +3152,14 @@ WriteLiteral(">\r\n");
#line default #line default
#line hidden #line hidden
#line 881 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 915 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Html.AntiForgeryToken()); Write(Html.AntiForgeryToken());
#line default #line default
#line hidden #line hidden
#line 881 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 915 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
@@ -3128,7 +3192,7 @@ WriteLiteral("></i>This action will allow a device <em>claiming</em> to have the
"\'"); "\'");
#line 891 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 925 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Model.Device.SerialNumber); Write(Model.Device.SerialNumber);
@@ -3176,7 +3240,7 @@ WriteLiteral(@">
"); ");
#line 924 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 958 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
@@ -3185,7 +3249,7 @@ WriteLiteral(@">
WriteLiteral(" "); WriteLiteral(" ");
#line 925 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 959 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
if (Model.Device.CanUpdateUntrustEnrol()) if (Model.Device.CanUpdateUntrustEnrol())
{ {
@@ -3213,13 +3277,13 @@ WriteLiteral(" title=\"Untrust this Device?\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 929 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 963 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 929 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 963 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
using (Html.BeginForm(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, false.ToString(), true))) using (Html.BeginForm(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, false.ToString(), true)))
{ {
@@ -3227,14 +3291,14 @@ WriteLiteral(">\r\n");
#line default #line default
#line hidden #line hidden
#line 931 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 965 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Html.AntiForgeryToken()); Write(Html.AntiForgeryToken());
#line default #line default
#line hidden #line hidden
#line 931 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 965 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
@@ -3297,7 +3361,7 @@ WriteLiteral(@">
"); ");
#line 968 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1002 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
@@ -3306,7 +3370,7 @@ WriteLiteral(@">
WriteLiteral(" "); WriteLiteral(" ");
#line 969 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1003 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
if (Model.Device.CanDecommission()) if (Model.Device.CanDecommission())
{ {
@@ -3334,13 +3398,13 @@ WriteLiteral(" title=\"Device Decommissioning\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 973 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1007 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 973 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1007 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
using (Html.BeginForm(MVC.API.Device.Decommission(Model.Device.SerialNumber, null, true))) using (Html.BeginForm(MVC.API.Device.Decommission(Model.Device.SerialNumber, null, true)))
{ {
@@ -3348,14 +3412,14 @@ WriteLiteral(">\r\n");
#line default #line default
#line hidden #line hidden
#line 975 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1009 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Html.AntiForgeryToken()); Write(Html.AntiForgeryToken());
#line default #line default
#line hidden #line hidden
#line 975 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1009 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
@@ -3381,13 +3445,13 @@ WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 981 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1015 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 981 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1015 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString())) foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString()))
{ {
@@ -3399,33 +3463,33 @@ WriteLiteral(" <li>\r\n
WriteLiteral(" type=\"radio\""); WriteLiteral(" type=\"radio\"");
WriteAttribute("id", Tuple.Create(" id=\"", 61379), Tuple.Create("\"", 61457) WriteAttribute("id", Tuple.Create(" id=\"", 63637), Tuple.Create("\"", 63715)
, Tuple.Create(Tuple.Create("", 61384), Tuple.Create("Device_Show_Device_Actions_Decommission_Reason_", 61384), true) , Tuple.Create(Tuple.Create("", 63642), Tuple.Create("Device_Show_Device_Actions_Decommission_Reason_", 63642), true)
#line 984 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1018 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 61431), Tuple.Create<System.Object, System.Int32>((int)decommissionReason , Tuple.Create(Tuple.Create("", 63689), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
#line default #line default
#line hidden #line hidden
, 61431), false) , 63689), false)
); );
WriteLiteral("\r\n name=\"Reason\""); WriteLiteral("\r\n name=\"Reason\"");
WriteAttribute("value", Tuple.Create(" value=\"", 61520), Tuple.Create("\"", 61554) WriteAttribute("value", Tuple.Create(" value=\"", 63778), Tuple.Create("\"", 63812)
#line 985 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1019 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 61528), Tuple.Create<System.Object, System.Int32>((int)decommissionReason , Tuple.Create(Tuple.Create("", 63786), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
#line default #line default
#line hidden #line hidden
, 61528), false) , 63786), false)
); );
WriteLiteral(" "); WriteLiteral(" ");
#line 985 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1019 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty); Write((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty);
@@ -3433,21 +3497,21 @@ WriteLiteral(" ");
#line hidden #line hidden
WriteLiteral(" />\r\n <label"); WriteLiteral(" />\r\n <label");
WriteAttribute("for", Tuple.Create(" for=\"", 61702), Tuple.Create("\"", 61781) WriteAttribute("for", Tuple.Create(" for=\"", 63960), Tuple.Create("\"", 64039)
, Tuple.Create(Tuple.Create("", 61708), Tuple.Create("Device_Show_Device_Actions_Decommission_Reason_", 61708), true) , Tuple.Create(Tuple.Create("", 63966), Tuple.Create("Device_Show_Device_Actions_Decommission_Reason_", 63966), true)
#line 986 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1020 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 61755), Tuple.Create<System.Object, System.Int32>((int)decommissionReason , Tuple.Create(Tuple.Create("", 64013), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
#line default #line default
#line hidden #line hidden
, 61755), false) , 64013), false)
); );
WriteLiteral(">"); WriteLiteral(">");
#line 986 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1020 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(decommissionReason.ReasonMessage()); Write(decommissionReason.ReasonMessage());
@@ -3456,7 +3520,7 @@ WriteLiteral(">");
WriteLiteral("</label>\r\n </li>\r\n"); WriteLiteral("</label>\r\n </li>\r\n");
#line 988 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1022 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
@@ -3465,7 +3529,7 @@ WriteLiteral("</label>\r\n </li>\r\n");
WriteLiteral(" </ul>\r\n </div>\r\n"); WriteLiteral(" </ul>\r\n </div>\r\n");
#line 991 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1025 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
@@ -3506,7 +3570,7 @@ WriteLiteral(@">
"); ");
#line 1019 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1053 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
@@ -3515,7 +3579,7 @@ WriteLiteral(@">
WriteLiteral(" "); WriteLiteral(" ");
#line 1020 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1054 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
if (Model.Device.CanRecommission()) if (Model.Device.CanRecommission())
{ {
@@ -3543,13 +3607,13 @@ WriteLiteral(" title=\"Recommission this Device?\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 1024 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1058 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 1024 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1058 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
using (Html.BeginForm(MVC.API.Device.Recommission(Model.Device.SerialNumber, true))) using (Html.BeginForm(MVC.API.Device.Recommission(Model.Device.SerialNumber, true)))
{ {
@@ -3557,14 +3621,14 @@ WriteLiteral(">\r\n");
#line default #line default
#line hidden #line hidden
#line 1026 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1060 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Html.AntiForgeryToken()); Write(Html.AntiForgeryToken());
#line default #line default
#line hidden #line hidden
#line 1026 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1060 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
@@ -3611,7 +3675,7 @@ WriteLiteral(@">
"); ");
#line 1059 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1093 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
@@ -3620,7 +3684,7 @@ WriteLiteral(@">
WriteLiteral(" "); WriteLiteral(" ");
#line 1060 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1094 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
if (Model.Device.CanDelete()) if (Model.Device.CanDelete())
{ {
@@ -3648,13 +3712,13 @@ WriteLiteral(" title=\"Delete this Device?\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 1064 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1098 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 1064 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1098 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
using (Html.BeginForm(MVC.API.Device.Delete(Model.Device.SerialNumber, true))) using (Html.BeginForm(MVC.API.Device.Delete(Model.Device.SerialNumber, true)))
{ {
@@ -3662,14 +3726,14 @@ WriteLiteral(">\r\n");
#line default #line default
#line hidden #line hidden
#line 1066 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1100 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Html.AntiForgeryToken()); Write(Html.AntiForgeryToken());
#line default #line default
#line hidden #line hidden
#line 1066 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1100 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
@@ -3721,7 +3785,7 @@ WriteLiteral(@">
"); ");
#line 1101 "..\..\Views\Device\DeviceParts\_Subject.cshtml" #line 1135 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
} }
+45 -14
View File
@@ -11,12 +11,12 @@
<tr> <tr>
<th class="name">Name</th> <th class="name">Name</th>
<th class="added">Added</th> <th class="added">Added</th>
<th class="sla">Comments</th> <th class="sla">Detail</th>
<th class="removed">Removed</th> <th class="removed">Removed</th>
</tr> </tr>
@foreach (var fa in flagAssignments.OrderByDescending(a => a.Item1.AddedDate)) @foreach (var fa in flagAssignments.OrderByDescending(a => a.Item1.AddedDate))
{ {
<tr data-userflagassignmentid="@fa.Item1.Id" data-flagassignmentaddeddate="@(fa.Item1.AddedDate.ToString("s"))" class="@(!fa.Item1.RemovedDate.HasValue ? "added" : "removed")"> <tr data-userflagassignmentid="@fa.Item1.Id" data-flagassignmentaddeddate="@(fa.Item1.AddedDate.ToString("s"))" class="@(!fa.Item1.RemovedDate.HasValue ? "added" : "removed")" data-canremove="@fa.Item1.CanRemove()" data-removeon="@(fa.Item1.RemoveDate.HasValue ? fa.Item1.RemoveDate.Value.ToString("yyyy-MM-dd") : null)">
<td class="name"> <td class="name">
<i class="fa fa-@(fa.Item2.flag.Icon) fa-fw fa-lg d-@(fa.Item2.flag.IconColour)"></i> <i class="fa fa-@(fa.Item2.flag.Icon) fa-fw fa-lg d-@(fa.Item2.flag.IconColour)"></i>
@if (Authorization.Has(Claims.Config.UserFlag.Show)) @if (Authorization.Has(Claims.Config.UserFlag.Show))
@@ -49,11 +49,19 @@
<div class="comments">@fa.Item1.Comments.ToHtmlComment()</div> <div class="comments">@fa.Item1.Comments.ToHtmlComment()</div>
<div class="commentsRaw">@fa.Item1.Comments</div> <div class="commentsRaw">@fa.Item1.Comments</div>
} }
@if (!fa.Item1.RemovedDate.HasValue && fa.Item1.RemoveDate.HasValue)
{
<div class="removeDate" data-date="@fa.Item1.RemoveDate.Value.ToString("yyyy-MM-dd")">Removing @CommonHelpers.FriendlyDate(fa.Item1.RemoveDate.Value)</div>
}
</td> </td>
<td class="removed@(!fa.Item1.RemovedDate.HasValue ? " na" : null)"> <td class="removed@(!fa.Item1.RemovedDate.HasValue ? " na" : null)">
@if (fa.Item1.RemovedDate.HasValue) @if (fa.Item1.RemovedDate.HasValue)
{ {
@CommonHelpers.FriendlyDateAndUser(fa.Item1.RemovedDate.Value, fa.Item1.RemovedUser) @CommonHelpers.FriendlyDateAndUser(fa.Item1.RemovedDate.Value, fa.Item1.RemovedUser)
if (fa.Item1.RemoveDate.HasValue)
{
<em>(scheduled)</em>
}
if (fa.Item1.OnUnassignmentExpressionResult != null) if (fa.Item1.OnUnassignmentExpressionResult != null)
{ {
<div class="expressionResult">@fa.Item1.OnUnassignmentExpressionResult</div> <div class="expressionResult">@fa.Item1.OnUnassignmentExpressionResult</div>
@@ -61,7 +69,7 @@
} }
else if (fa.Item1.CanRemove()) else if (fa.Item1.CanRemove())
{ {
<a href="#" class="button small remove">Remove</a> <button type="button" class="button small remove">Remove</button>
} }
</td> </td>
</tr> </tr>
@@ -77,8 +85,8 @@
</p> </p>
} }
</div> </div>
<div id="User_Show_Flags_Actions_EditComments_Dialog" class="dialog" title="Edit the Comments"> <div id="User_Show_Flags_Actions_EditComments_Dialog" class="dialog" title="Edit Details">
@using (Html.BeginForm(MVC.API.UserFlagAssignment.UpdateComments())) @using (Html.BeginForm(MVC.API.UserFlagAssignment.Edit()))
{ {
@Html.AntiForgeryToken() @Html.AntiForgeryToken()
<input id="User_Show_Flags_Actions_EditComments_Dialog_Id" type="hidden" name="id" value="" /> <input id="User_Show_Flags_Actions_EditComments_Dialog_Id" type="hidden" name="id" value="" />
@@ -87,18 +95,23 @@
<p> <p>
<textarea id="User_Show_Flags_Actions_EditComments_Dialog_Comments" name="Comments" class="block"></textarea> <textarea id="User_Show_Flags_Actions_EditComments_Dialog_Comments" name="Comments" class="block"></textarea>
</p> </p>
<div>
<h4>Remove On</h4>
<input name="RemoveDate" id="User_Show_Flags_Actions_EditComments_Dialog_RemoveDate" type="date" min="@(DateTime.Today.AddDays(1).ToString("yyyy-MM-dd"))" />
<span>12:00 AM</span>
</div>
} }
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
var userFlags = $('#userFlags'); const userFlags = $('#userFlags');
var dialog = null; let dialog = null;
var dialogEditComments = null; let dialogEditComments = null;
userFlags.on('click', 'a.remove', function (e) { userFlags.on('click', 'button.remove', function (e) {
var $this = $(this); const $this = $(this);
var UserFlagAssignmentId = $this.closest('tr').attr('data-userflagassignmentid'); const UserFlagAssignmentId = $this.closest('tr').attr('data-userflagassignmentid');
if (!dialog) { if (!dialog) {
dialog = $('#User_Show_Flags_Actions_Remove_Dialog'); dialog = $('#User_Show_Flags_Actions_Remove_Dialog');
@@ -108,7 +121,7 @@
autoOpen: false, autoOpen: false,
buttons: { buttons: {
"Remove Flag": function () { "Remove Flag": function () {
var $this = $(this); const $this = $(this);
$this.dialog("disable"); $this.dialog("disable");
$this.dialog("option", "buttons", null); $this.dialog("option", "buttons", null);
$this.find('form').submit(); $this.find('form').submit();
@@ -128,8 +141,11 @@
}); });
userFlags.on('click', 'td.comments i.fa-edit', function (e) { userFlags.on('click', 'td.comments i.fa-edit', function (e) {
var $this = $(this); const $this = $(this);
var UserFlagAssignmentId = $this.closest('tr').attr('data-userflagassignmentid'); const $row = $this.closest('tr');
const UserFlagAssignmentId = $row.attr('data-userflagassignmentid');
const canRemove = $row.attr('data-canremove') === 'True';
const removeOn = $row.attr('data-removeon');
if (!dialogEditComments) { if (!dialogEditComments) {
dialogEditComments = $('#User_Show_Flags_Actions_EditComments_Dialog'); dialogEditComments = $('#User_Show_Flags_Actions_EditComments_Dialog');
@@ -159,6 +175,21 @@
$('#User_Show_Flags_Actions_EditComments_Dialog_Comments').val($comments.text()); $('#User_Show_Flags_Actions_EditComments_Dialog_Comments').val($comments.text());
} }
const removeOnInput = $('#User_Show_Flags_Actions_EditComments_Dialog_RemoveDate');
if (canRemove) {
removeOnInput.prop('disabled', false);
if (removeOn) {
removeOnInput.val(removeOn);
} else {
removeOnInput.val('');
}
removeOnInput.closest('div').css('display', 'block');
} else {
removeOnInput.prop('disabled', true);
removeOnInput.val('');
removeOnInput.closest('div').css('display', 'none');
}
$('#User_Show_Flags_Actions_EditComments_Dialog_Id').val(UserFlagAssignmentId); $('#User_Show_Flags_Actions_EditComments_Dialog_Id').val(UserFlagAssignmentId);
dialogEditComments.dialog('open'); dialogEditComments.dialog('open');
e.preventDefault(); e.preventDefault();
@@ -96,7 +96,7 @@ WriteLiteral(">Added</th>\r\n <th");
WriteLiteral(" class=\"sla\""); WriteLiteral(" class=\"sla\"");
WriteLiteral(">Comments</th>\r\n <th"); WriteLiteral(">Detail</th>\r\n <th");
WriteLiteral(" class=\"removed\""); WriteLiteral(" class=\"removed\"");
@@ -140,42 +140,64 @@ WriteLiteral(" data-flagassignmentaddeddate=\"");
#line hidden #line hidden
WriteLiteral("\""); WriteLiteral("\"");
WriteAttribute("class", Tuple.Create(" class=\"", 943), Tuple.Create("\"", 1006) WriteAttribute("class", Tuple.Create(" class=\"", 941), Tuple.Create("\"", 1004)
#line 19 "..\..\Views\User\UserParts\_Flags.cshtml" #line 19 "..\..\Views\User\UserParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 951), Tuple.Create<System.Object, System.Int32>(!fa.Item1.RemovedDate.HasValue ? "added" : "removed" , Tuple.Create(Tuple.Create("", 949), Tuple.Create<System.Object, System.Int32>(!fa.Item1.RemovedDate.HasValue ? "added" : "removed"
#line default #line default
#line hidden #line hidden
, 951), false) , 949), false)
); );
WriteLiteral(" data-canremove=\"");
#line 19 "..\..\Views\User\UserParts\_Flags.cshtml"
Write(fa.Item1.CanRemove());
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-removeon=\"");
#line 19 "..\..\Views\User\UserParts\_Flags.cshtml"
Write(fa.Item1.RemoveDate.HasValue ? fa.Item1.RemoveDate.Value.ToString("yyyy-MM-dd") : null);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <td"); WriteLiteral(">\r\n <td");
WriteLiteral(" class=\"name\""); WriteLiteral(" class=\"name\"");
WriteLiteral(">\r\n <i"); WriteLiteral(">\r\n <i");
WriteAttribute("class", Tuple.Create(" class=\"", 1075), Tuple.Create("\"", 1152) WriteAttribute("class", Tuple.Create(" class=\"", 1218), Tuple.Create("\"", 1295)
, Tuple.Create(Tuple.Create("", 1083), Tuple.Create("fa", 1083), true) , Tuple.Create(Tuple.Create("", 1226), Tuple.Create("fa", 1226), true)
, Tuple.Create(Tuple.Create(" ", 1085), Tuple.Create("fa-", 1086), true) , Tuple.Create(Tuple.Create(" ", 1228), Tuple.Create("fa-", 1229), true)
#line 21 "..\..\Views\User\UserParts\_Flags.cshtml" #line 21 "..\..\Views\User\UserParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 1089), Tuple.Create<System.Object, System.Int32>(fa.Item2.flag.Icon , Tuple.Create(Tuple.Create("", 1232), Tuple.Create<System.Object, System.Int32>(fa.Item2.flag.Icon
#line default #line default
#line hidden #line hidden
, 1089), false) , 1232), false)
, Tuple.Create(Tuple.Create(" ", 1110), Tuple.Create("fa-fw", 1111), true) , Tuple.Create(Tuple.Create(" ", 1253), Tuple.Create("fa-fw", 1254), true)
, Tuple.Create(Tuple.Create(" ", 1116), Tuple.Create("fa-lg", 1117), true) , Tuple.Create(Tuple.Create(" ", 1259), Tuple.Create("fa-lg", 1260), true)
, Tuple.Create(Tuple.Create(" ", 1122), Tuple.Create("d-", 1123), true) , Tuple.Create(Tuple.Create(" ", 1265), Tuple.Create("d-", 1266), true)
#line 21 "..\..\Views\User\UserParts\_Flags.cshtml" #line 21 "..\..\Views\User\UserParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 1125), Tuple.Create<System.Object, System.Int32>(fa.Item2.flag.IconColour , Tuple.Create(Tuple.Create("", 1268), Tuple.Create<System.Object, System.Int32>(fa.Item2.flag.IconColour
#line default #line default
#line hidden #line hidden
, 1125), false) , 1268), false)
); );
WriteLiteral("></i>\r\n"); WriteLiteral("></i>\r\n");
@@ -380,29 +402,72 @@ WriteLiteral("</div>\r\n");
#line default #line default
#line hidden #line hidden
WriteLiteral(" </td>\r\n <td"); WriteLiteral(" ");
WriteAttribute("class", Tuple.Create(" class=\"", 2735), Tuple.Create("\"", 2798)
, Tuple.Create(Tuple.Create("", 2743), Tuple.Create("removed", 2743), true)
#line 53 "..\..\Views\User\UserParts\_Flags.cshtml" #line 52 "..\..\Views\User\UserParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 2750), Tuple.Create<System.Object, System.Int32>(!fa.Item1.RemovedDate.HasValue ? " na" : null if (!fa.Item1.RemovedDate.HasValue && fa.Item1.RemoveDate.HasValue)
{
#line default #line default
#line hidden #line hidden
, 2750), false) WriteLiteral(" <div");
WriteLiteral(" class=\"removeDate\"");
WriteLiteral(" data-date=\"");
#line 54 "..\..\Views\User\UserParts\_Flags.cshtml"
Write(fa.Item1.RemoveDate.Value.ToString("yyyy-MM-dd"));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">Removing ");
#line 54 "..\..\Views\User\UserParts\_Flags.cshtml"
Write(CommonHelpers.FriendlyDate(fa.Item1.RemoveDate.Value));
#line default
#line hidden
WriteLiteral("</div>\r\n");
#line 55 "..\..\Views\User\UserParts\_Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n <td");
WriteAttribute("class", Tuple.Create(" class=\"", 3211), Tuple.Create("\"", 3274)
, Tuple.Create(Tuple.Create("", 3219), Tuple.Create("removed", 3219), true)
#line 57 "..\..\Views\User\UserParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 3226), Tuple.Create<System.Object, System.Int32>(!fa.Item1.RemovedDate.HasValue ? " na" : null
#line default
#line hidden
, 3226), false)
); );
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 54 "..\..\Views\User\UserParts\_Flags.cshtml" #line 58 "..\..\Views\User\UserParts\_Flags.cshtml"
#line default #line default
#line hidden #line hidden
#line 54 "..\..\Views\User\UserParts\_Flags.cshtml" #line 58 "..\..\Views\User\UserParts\_Flags.cshtml"
if (fa.Item1.RemovedDate.HasValue) if (fa.Item1.RemovedDate.HasValue)
{ {
@@ -410,15 +475,26 @@ WriteLiteral(">\r\n");
#line default #line default
#line hidden #line hidden
#line 56 "..\..\Views\User\UserParts\_Flags.cshtml" #line 60 "..\..\Views\User\UserParts\_Flags.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(fa.Item1.RemovedDate.Value, fa.Item1.RemovedUser)); Write(CommonHelpers.FriendlyDateAndUser(fa.Item1.RemovedDate.Value, fa.Item1.RemovedUser));
#line default #line default
#line hidden #line hidden
#line 56 "..\..\Views\User\UserParts\_Flags.cshtml" #line 60 "..\..\Views\User\UserParts\_Flags.cshtml"
if (fa.Item1.RemoveDate.HasValue)
{
#line default
#line hidden
WriteLiteral(" <em>(scheduled)</em>\r\n");
#line 64 "..\..\Views\User\UserParts\_Flags.cshtml"
}
if (fa.Item1.OnUnassignmentExpressionResult != null) if (fa.Item1.OnUnassignmentExpressionResult != null)
{ {
@@ -432,7 +508,7 @@ WriteLiteral(" class=\"expressionResult\"");
WriteLiteral(">"); WriteLiteral(">");
#line 59 "..\..\Views\User\UserParts\_Flags.cshtml" #line 67 "..\..\Views\User\UserParts\_Flags.cshtml"
Write(fa.Item1.OnUnassignmentExpressionResult); Write(fa.Item1.OnUnassignmentExpressionResult);
@@ -441,7 +517,7 @@ WriteLiteral(">");
WriteLiteral("</div>\r\n"); WriteLiteral("</div>\r\n");
#line 60 "..\..\Views\User\UserParts\_Flags.cshtml" #line 68 "..\..\Views\User\UserParts\_Flags.cshtml"
} }
} }
else if (fa.Item1.CanRemove()) else if (fa.Item1.CanRemove())
@@ -450,16 +526,16 @@ WriteLiteral("</div>\r\n");
#line default #line default
#line hidden #line hidden
WriteLiteral(" <a"); WriteLiteral(" <button");
WriteLiteral(" href=\"#\""); WriteLiteral(" type=\"button\"");
WriteLiteral(" class=\"button small remove\""); WriteLiteral(" class=\"button small remove\"");
WriteLiteral(">Remove</a>\r\n"); WriteLiteral(">Remove</button>\r\n");
#line 65 "..\..\Views\User\UserParts\_Flags.cshtml" #line 73 "..\..\Views\User\UserParts\_Flags.cshtml"
} }
@@ -468,7 +544,7 @@ WriteLiteral(">Remove</a>\r\n");
WriteLiteral(" </td>\r\n </tr>\r\n"); WriteLiteral(" </td>\r\n </tr>\r\n");
#line 68 "..\..\Views\User\UserParts\_Flags.cshtml" #line 76 "..\..\Views\User\UserParts\_Flags.cshtml"
} }
@@ -487,13 +563,13 @@ WriteLiteral(" title=\"Remove this flag from the user?\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 71 "..\..\Views\User\UserParts\_Flags.cshtml" #line 79 "..\..\Views\User\UserParts\_Flags.cshtml"
#line default #line default
#line hidden #line hidden
#line 71 "..\..\Views\User\UserParts\_Flags.cshtml" #line 79 "..\..\Views\User\UserParts\_Flags.cshtml"
using (Html.BeginForm(MVC.API.UserFlagAssignment.RemoveUser())) using (Html.BeginForm(MVC.API.UserFlagAssignment.RemoveUser()))
{ {
@@ -501,14 +577,14 @@ WriteLiteral(">\r\n");
#line default #line default
#line hidden #line hidden
#line 73 "..\..\Views\User\UserParts\_Flags.cshtml" #line 81 "..\..\Views\User\UserParts\_Flags.cshtml"
Write(Html.AntiForgeryToken()); Write(Html.AntiForgeryToken());
#line default #line default
#line hidden #line hidden
#line 73 "..\..\Views\User\UserParts\_Flags.cshtml" #line 81 "..\..\Views\User\UserParts\_Flags.cshtml"
@@ -533,7 +609,7 @@ WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n"); WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n");
#line 78 "..\..\Views\User\UserParts\_Flags.cshtml" #line 86 "..\..\Views\User\UserParts\_Flags.cshtml"
} }
@@ -547,33 +623,33 @@ WriteLiteral(" id=\"User_Show_Flags_Actions_EditComments_Dialog\"");
WriteLiteral(" class=\"dialog\""); WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Edit the Comments\""); WriteLiteral(" title=\"Edit Details\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 81 "..\..\Views\User\UserParts\_Flags.cshtml" #line 89 "..\..\Views\User\UserParts\_Flags.cshtml"
#line default #line default
#line hidden #line hidden
#line 81 "..\..\Views\User\UserParts\_Flags.cshtml" #line 89 "..\..\Views\User\UserParts\_Flags.cshtml"
using (Html.BeginForm(MVC.API.UserFlagAssignment.UpdateComments())) using (Html.BeginForm(MVC.API.UserFlagAssignment.Edit()))
{ {
#line default #line default
#line hidden #line hidden
#line 83 "..\..\Views\User\UserParts\_Flags.cshtml" #line 91 "..\..\Views\User\UserParts\_Flags.cshtml"
Write(Html.AntiForgeryToken()); Write(Html.AntiForgeryToken());
#line default #line default
#line hidden #line hidden
#line 83 "..\..\Views\User\UserParts\_Flags.cshtml" #line 91 "..\..\Views\User\UserParts\_Flags.cshtml"
@@ -613,8 +689,29 @@ WriteLiteral(" class=\"block\"");
WriteLiteral("></textarea>\r\n </p>\r\n"); WriteLiteral("></textarea>\r\n </p>\r\n");
WriteLiteral(" <div>\r\n <h4>Remove On</h4>\r\n " +
" <input");
#line 90 "..\..\Views\User\UserParts\_Flags.cshtml" WriteLiteral(" name=\"RemoveDate\"");
WriteLiteral(" id=\"User_Show_Flags_Actions_EditComments_Dialog_RemoveDate\"");
WriteLiteral(" type=\"date\"");
WriteAttribute("min", Tuple.Create(" min=\"", 5545), Tuple.Create("\"", 5602)
#line 100 "..\..\Views\User\UserParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 5551), Tuple.Create<System.Object, System.Int32>(DateTime.Today.AddDays(1).ToString("yyyy-MM-dd")
#line default
#line hidden
, 5551), false)
);
WriteLiteral(" />\r\n <span>12:00 AM</span>\r\n </div>\r\n");
#line 103 "..\..\Views\User\UserParts\_Flags.cshtml"
} }
@@ -626,53 +723,65 @@ WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\""); WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n var userFlags = $(\'#userFlags\');\r" + WriteLiteral(">\r\n $(function () {\r\n const userFlags = $(\'#userFlags\')" +
"\n\r\n var dialog = null;\r\n var dialogEditComments = " + ";\r\n\r\n let dialog = null;\r\n let dialogEditComments " +
"null;\r\n\r\n userFlags.on(\'click\', \'a.remove\', function (e) {\r\n " + "= null;\r\n\r\n userFlags.on(\'click\', \'button.remove\', function (e) {" +
" var $this = $(this);\r\n var UserFlagAssignmentI" + "\r\n const $this = $(this);\r\n const UserFlag" +
"d = $this.closest(\'tr\').attr(\'data-userflagassignmentid\');\r\n\r\n " + "AssignmentId = $this.closest(\'tr\').attr(\'data-userflagassignmentid\');\r\n\r\n " +
" if (!dialog) {\r\n dialog = $(\'#User_Show_Flags_Actions_R" + " if (!dialog) {\r\n dialog = $(\'#User_Show_Flag" +
"emove_Dialog\');\r\n dialog.dialog({\r\n " + "s_Actions_Remove_Dialog\');\r\n dialog.dialog({\r\n " +
" resizable: false,\r\n modal: true,\r\n " + " resizable: false,\r\n modal: true,\r\n " +
" autoOpen: false,\r\n buttons: {\r\n " + " autoOpen: false,\r\n buttons:" +
" \"Remove Flag\": function () {\r\n " + " {\r\n \"Remove Flag\": function () {\r\n " +
" var $this = $(this);\r\n $this.dialo" + " const $this = $(this);\r\n " +
"g(\"disable\");\r\n $this.dialog(\"option\", \"butto" + " $this.dialog(\"disable\");\r\n $this.dialog(\"op" +
"ns\", null);\r\n $this.find(\'form\').submit();\r\n " + "tion\", \"buttons\", null);\r\n $this.find(\'form\')" +
" },\r\n Cancel: funct" + ".submit();\r\n },\r\n " +
"ion () {\r\n $(this).dialog(\"close\");\r\n " + "Cancel: function () {\r\n $(this).dialog(\"close" +
" }\r\n }\r\n " + "\");\r\n }\r\n }\r\n " +
" });\r\n }\r\n\r\n $(\'#User_Show_Flags_Actions_" + " });\r\n }\r\n\r\n $(\'#User_Show_F" +
"Remove_Dialog_Id\').val(UserFlagAssignmentId);\r\n dialog.dialog" + "lags_Actions_Remove_Dialog_Id\').val(UserFlagAssignmentId);\r\n " +
"(\'open\');\r\n\r\n e.preventDefault();\r\n return" + "dialog.dialog(\'open\');\r\n\r\n e.preventDefault();\r\n " +
" false;\r\n });\r\n\r\n userFlags.on(\'click\', \'td.commen" + " return false;\r\n });\r\n\r\n userFlags.on(\'click" +
"ts i.fa-edit\', function (e) {\r\n var $this = $(this);\r\n " + "\', \'td.comments i.fa-edit\', function (e) {\r\n const $this = $(" +
" var UserFlagAssignmentId = $this.closest(\'tr\').attr(\'data-userflaga" + "this);\r\n const $row = $this.closest(\'tr\');\r\n " +
"ssignmentid\');\r\n\r\n if (!dialogEditComments) {\r\n " + " const UserFlagAssignmentId = $row.attr(\'data-userflagassignmentid\');\r\n " +
" dialogEditComments = $(\'#User_Show_Flags_Actions_EditComments_Dialog\')" + " const canRemove = $row.attr(\'data-canremove\') === \'True\';\r\n " +
";\r\n dialogEditComments.dialog({\r\n " + " const removeOn = $row.attr(\'data-removeon\');\r\n\r\n " +
" resizable: false,\r\n modal: true,\r\n " + "if (!dialogEditComments) {\r\n dialogEditComments = $(\'#Use" +
" width: 320,\r\n autoOpen: false,\r\n " + "r_Show_Flags_Actions_EditComments_Dialog\');\r\n dialogEditC" +
" buttons: {\r\n \"Save Changes\": " + "omments.dialog({\r\n resizable: false,\r\n " +
"function () {\r\n var $this = $(this);\r\n " + " modal: true,\r\n width: 320,\r\n " +
" $this.dialog(\"disable\");\r\n " + " autoOpen: false,\r\n buttons: {\r\n " +
" $this.dialog(\"option\", \"buttons\", null);\r\n " + " \"Save Changes\": function () {\r\n " +
" $this.find(\'form\').submit();\r\n },\r\n " + " var $this = $(this);\r\n $this.dia" +
" Cancel: function () {\r\n " + "log(\"disable\");\r\n $this.dialog(\"option\", \"but" +
" $(this).dialog(\"close\");\r\n }\r\n " + "tons\", null);\r\n $this.find(\'form\').submit();\r" +
" }\r\n });\r\n }\r\n\r\n " + "\n },\r\n Cancel: fun" +
" var $comments = $this.closest(\'td\').find(\'.commentsRaw\');\r\n " + "ction () {\r\n $(this).dialog(\"close\");\r\n " +
" if ($comments.hasClass(\'smallMessage\')) {\r\n $(" + " }\r\n }\r\n " +
"\'#User_Show_Flags_Actions_EditComments_Dialog_Comments\').val(\'\');\r\n " + " });\r\n }\r\n\r\n var $comments = $this.clos" +
" } else {\r\n $(\'#User_Show_Flags_Actions_EditComment" + "est(\'td\').find(\'.commentsRaw\');\r\n if ($comments.hasClass(\'sma" +
"s_Dialog_Comments\').val($comments.text());\r\n }\r\n\r\n " + "llMessage\')) {\r\n $(\'#User_Show_Flags_Actions_EditComments" +
" $(\'#User_Show_Flags_Actions_EditComments_Dialog_Id\').val(UserFlagAssign" + "_Dialog_Comments\').val(\'\');\r\n } else {\r\n " +
"mentId);\r\n dialogEditComments.dialog(\'open\');\r\n " + " $(\'#User_Show_Flags_Actions_EditComments_Dialog_Comments\').val($comments.text" +
" e.preventDefault();\r\n return false;\r\n })" + "());\r\n }\r\n\r\n const removeOnInput = $(\'#Use" +
";\r\n });\r\n </script>\r\n"); "r_Show_Flags_Actions_EditComments_Dialog_RemoveDate\');\r\n if (" +
"canRemove) {\r\n removeOnInput.prop(\'disabled\', false);\r\n " +
" if (removeOn) {\r\n removeOnInput" +
".val(removeOn);\r\n } else {\r\n r" +
"emoveOnInput.val(\'\');\r\n }\r\n remove" +
"OnInput.closest(\'div\').css(\'display\', \'block\');\r\n } else {\r\n " +
" removeOnInput.prop(\'disabled\', true);\r\n " +
" removeOnInput.val(\'\');\r\n removeOnInput.closest(\'div" +
"\').css(\'display\', \'none\');\r\n }\r\n\r\n $(\'#Use" +
"r_Show_Flags_Actions_EditComments_Dialog_Id\').val(UserFlagAssignmentId);\r\n " +
" dialogEditComments.dialog(\'open\');\r\n e.preventD" +
"efault();\r\n return false;\r\n });\r\n }" +
");\r\n </script>\r\n");
#line 169 "..\..\Views\User\UserParts\_Flags.cshtml" #line 200 "..\..\Views\User\UserParts\_Flags.cshtml"
} }
else else
{ {
@@ -687,7 +796,7 @@ WriteLiteral(" class=\"none\"");
WriteLiteral(">This user has no associated flags</div>\r\n"); WriteLiteral(">This user has no associated flags</div>\r\n");
#line 173 "..\..\Views\User\UserParts\_Flags.cshtml" #line 204 "..\..\Views\User\UserParts\_Flags.cshtml"
} }
@@ -697,7 +806,7 @@ WriteLiteral(" <script>\r\n $(\'#UserDetailTabItems\').append(\'<li><a
"b-Flags\">Flags ["); "b-Flags\">Flags [");
#line 175 "..\..\Views\User\UserParts\_Flags.cshtml" #line 206 "..\..\Views\User\UserParts\_Flags.cshtml"
Write(activeAssignmentCount); Write(activeAssignmentCount);
+35 -1
View File
@@ -249,7 +249,7 @@
<input id="User_Show_Details_Actions_AddFlag_Dialog_Filter" type="text" placeholder="Filter" autocomplete="off" /> <input id="User_Show_Details_Actions_AddFlag_Dialog_Filter" type="text" placeholder="Filter" autocomplete="off" />
@foreach (var userFlag in Model.AvailableUserFlags.OrderBy(jq => jq.Name)) @foreach (var userFlag in Model.AvailableUserFlags.OrderBy(jq => jq.Name))
{ {
<div class="flag" data-userflagid="@(userFlag.Id)" data-userflagname="@userFlag.Name"> <div class="flag" data-userflagid="@(userFlag.Id)" data-userflagname="@userFlag.Name" data-userflagcanremove="@Model.User.CanRemoveUserFlag(userFlag)" data-userflagremovedays="@userFlag.DefaultRemoveDays">
<i class="fa fa-@(userFlag.Icon) fa-fw fa-lg d-@(userFlag.IconColour)"></i>@userFlag.Name <i class="fa fa-@(userFlag.Icon) fa-fw fa-lg d-@(userFlag.IconColour)"></i>@userFlag.Name
</div> </div>
} }
@@ -259,6 +259,11 @@
<h4>Comments</h4> <h4>Comments</h4>
<textarea name="Comments" id="User_Show_Details_Actions_AddFlag_Dialog_Comments"></textarea> <textarea name="Comments" id="User_Show_Details_Actions_AddFlag_Dialog_Comments"></textarea>
</div> </div>
<div>
<h4>Remove On</h4>
<input name="RemoveDate" id="User_Show_Details_Actions_AddFlag_Dialog_RemoveDate" type="date" min="@(DateTime.Today.AddDays(1).ToString("yyyy-MM-dd"))" />
<span>12:00 AM</span>
</div>
</div> </div>
} }
</div> </div>
@@ -270,6 +275,7 @@
let flagPicker = null; let flagPicker = null;
let flagAddId = null; let flagAddId = null;
let flagAddComments = null; let flagAddComments = null;
let flagAddRemoveDate = null;
let details = null; let details = null;
function flagSelected() { function flagSelected() {
@@ -280,6 +286,26 @@
flagAddId.val(flag.attr('data-userflagid')); flagAddId.val(flag.attr('data-userflagid'));
const removeDays = flag.attr('data-userflagremovedays');
if (removeDays) {
const date = new Date();
date.setDate(date.getDate() + parseInt(removeDays) - 1);
flagAddRemoveDate[0].valueAsDate = date;
flagAddRemoveDate.trigger('change');
} else {
flagAddRemoveDate[0].valueAsDate = null;
flagAddRemoveDate.trigger('change');
}
flagAddRemoveDate.closest('div').show();
if (flag.attr('data-userflagcanremove') === 'True') {
flagAddRemoveDate.prop('disabled', false);
} else {
flagAddRemoveDate.prop('disabled', true);
if (!removeDays) {
flagAddRemoveDate.closest('div').hide();
}
}
details.show(); details.show();
flagAddComments.focus().select(); flagAddComments.focus().select();
@@ -314,6 +340,7 @@
flagAddId = $('#User_Show_Details_Actions_AddFlag_Dialog_Id'); flagAddId = $('#User_Show_Details_Actions_AddFlag_Dialog_Id');
flagAddComments = buttonDialog.find('#User_Show_Details_Actions_AddFlag_Dialog_Comments'); flagAddComments = buttonDialog.find('#User_Show_Details_Actions_AddFlag_Dialog_Comments');
flagAddRemoveDate = buttonDialog.find('#User_Show_Details_Actions_AddFlag_Dialog_RemoveDate');
flagPicker = buttonDialog.find('.flagPicker'); flagPicker = buttonDialog.find('.flagPicker');
details = buttonDialog.find('.details'); details = buttonDialog.find('.details');
@@ -334,6 +361,13 @@
}); });
flagPicker.on('click', 'div.flag', flagSelected); flagPicker.on('click', 'div.flag', flagSelected);
flagAddRemoveDate.on('change', function () {
if (flagAddRemoveDate.val()) {
flagAddRemoveDate.next('span').show();
} else {
flagAddRemoveDate.next('span').hide();
}
});
} }
$('#User_Show_Details_Actions_AddFlag_Dialog_Filter').val(''); $('#User_Show_Details_Actions_AddFlag_Dialog_Filter').val('');
@@ -1033,28 +1033,50 @@ WriteLiteral(" data-userflagname=\"");
#line hidden #line hidden
WriteLiteral("\""); WriteLiteral("\"");
WriteLiteral(" data-userflagcanremove=\"");
#line 252 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(Model.User.CanRemoveUserFlag(userFlag));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-userflagremovedays=\"");
#line 252 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(userFlag.DefaultRemoveDays);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <i"); WriteLiteral(">\r\n <i");
WriteAttribute("class", Tuple.Create(" class=\"", 16614), Tuple.Create("\"", 16681) WriteAttribute("class", Tuple.Create(" class=\"", 16733), Tuple.Create("\"", 16800)
, Tuple.Create(Tuple.Create("", 16622), Tuple.Create("fa", 16622), true) , Tuple.Create(Tuple.Create("", 16741), Tuple.Create("fa", 16741), true)
, Tuple.Create(Tuple.Create(" ", 16624), Tuple.Create("fa-", 16625), true) , Tuple.Create(Tuple.Create(" ", 16743), Tuple.Create("fa-", 16744), true)
#line 253 "..\..\Views\User\UserParts\_Subject.cshtml" #line 253 "..\..\Views\User\UserParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 16628), Tuple.Create<System.Object, System.Int32>(userFlag.Icon , Tuple.Create(Tuple.Create("", 16747), Tuple.Create<System.Object, System.Int32>(userFlag.Icon
#line default #line default
#line hidden #line hidden
, 16628), false) , 16747), false)
, Tuple.Create(Tuple.Create(" ", 16644), Tuple.Create("fa-fw", 16645), true) , Tuple.Create(Tuple.Create(" ", 16763), Tuple.Create("fa-fw", 16764), true)
, Tuple.Create(Tuple.Create(" ", 16650), Tuple.Create("fa-lg", 16651), true) , Tuple.Create(Tuple.Create(" ", 16769), Tuple.Create("fa-lg", 16770), true)
, Tuple.Create(Tuple.Create(" ", 16656), Tuple.Create("d-", 16657), true) , Tuple.Create(Tuple.Create(" ", 16775), Tuple.Create("d-", 16776), true)
#line 253 "..\..\Views\User\UserParts\_Subject.cshtml" #line 253 "..\..\Views\User\UserParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 16659), Tuple.Create<System.Object, System.Int32>(userFlag.IconColour , Tuple.Create(Tuple.Create("", 16778), Tuple.Create<System.Object, System.Int32>(userFlag.IconColour
#line default #line default
#line hidden #line hidden
, 16659), false) , 16778), false)
); );
WriteLiteral("></i>"); WriteLiteral("></i>");
@@ -1090,10 +1112,31 @@ WriteLiteral(" name=\"Comments\"");
WriteLiteral(" id=\"User_Show_Details_Actions_AddFlag_Dialog_Comments\""); WriteLiteral(" id=\"User_Show_Details_Actions_AddFlag_Dialog_Comments\"");
WriteLiteral("></textarea>\r\n </div>\r\n " + WriteLiteral("></textarea>\r\n </div>\r\n " +
" </div>\r\n"); " <div>\r\n <h4>Remo" +
"ve On</h4>\r\n <input");
WriteLiteral(" name=\"RemoveDate\"");
WriteLiteral(" id=\"User_Show_Details_Actions_AddFlag_Dialog_RemoveDate\"");
WriteLiteral(" type=\"date\"");
WriteAttribute("min", Tuple.Create(" min=\"", 17564), Tuple.Create("\"", 17621)
#line 264 "..\..\Views\User\UserParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 17570), Tuple.Create<System.Object, System.Int32>(DateTime.Today.AddDays(1).ToString("yyyy-MM-dd")
#line default
#line hidden
, 17570), false)
);
WriteLiteral(" />\r\n <span>12:00 AM</span>\r\n " +
" </div>\r\n </div" +
">\r\n");
#line 263 "..\..\Views\User\UserParts\_Subject.cshtml" #line 268 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
@@ -1110,66 +1153,93 @@ WriteLiteral(">\r\n $(function () {\r\n
" let buttonDialog = null;\r\n\r\n " + " let buttonDialog = null;\r\n\r\n " +
" let flagPicker = null;\r\n let flagA" + " let flagPicker = null;\r\n let flagA" +
"ddId = null;\r\n let flagAddComments = null;\r\n " + "ddId = null;\r\n let flagAddComments = null;\r\n " +
" let details = null;\r\n\r\n " + " let flagAddRemoveDate = null;\r\n " +
" function flagSelected() {\r\n " + " let details = null;\r\n\r\n " +
" const flag = $(this);\r\n\r\n flagPicker.chi" + " function flagSelected() {\r\n const flag =" +
"ldren().removeClass(\'selected\');\r\n flag.a" + " $(this);\r\n\r\n flagPicker.children().remov" +
"ddClass(\'selected\');\r\n\r\n flagAddId.val(fl" + "eClass(\'selected\');\r\n flag.addClass(\'sele" +
"ag.attr(\'data-userflagid\'));\r\n\r\n details." + "cted\');\r\n\r\n flagAddId.val(flag.attr(\'data" +
"show();\r\n\r\n flagAddComments.focus().selec" + "-userflagid\'));\r\n\r\n const removeDays = fl" +
"t();\r\n }\r\n\r\n " + "ag.attr(\'data-userflagremovedays\');\r\n if " +
" button.click(function (e) {\r\n e.preven" + "(removeDays) {\r\n const date = new Dat" +
"tDefault();\r\n\r\n if (!buttonDialog) {\r\n " + "e();\r\n date.setDate(date.getDate() + " +
" buttonDialog = $(\'#User_Show_Details_Ac" + "parseInt(removeDays) - 1);\r\n flagAddR" +
"tions_AddFlag_Dialog\');\r\n buttonDialo" + "emoveDate[0].valueAsDate = date;\r\n fl" +
"g.dialog({\r\n width: 600,\r\n " + "agAddRemoveDate.trigger(\'change\');\r\n } el" +
" height: 410,\r\n " + "se {\r\n flagAddRemoveDate[0].valueAsDa" +
" resizable: false,\r\n " + "te = null;\r\n flagAddRemoveDate.trigge" +
" modal: true,\r\n autoOpen" + "r(\'change\');\r\n }\r\n " +
": false,\r\n buttons: {\r\n " + " flagAddRemoveDate.closest(\'div\').show();\r\n " +
" Cancel: function () {\r\n " + " if (flag.attr(\'data-userflagcanremove\') === \'True\') {\r\n " +
" $(this).dialog(\"close\");\r\n " + " flagAddRemoveDate.prop(\'disabled\', false);" +
" },\r\n " + "\r\n } else {\r\n " +
" \"Add Flag\": function () {\r\n " + " flagAddRemoveDate.prop(\'disabled\', true);\r\n " +
" if (!!flagAddId.val()) {\r\n " + " if (!removeDays) {\r\n " +
" buttonDialog\r\n " + " flagAddRemoveDate.closest(\'div\').hide();\r\n " +
" .dialog(\"option\", \"buttons\", null)\r\n " + " }\r\n }\r\n\r\n " +
" .find(\'form\').submit();\r\n " + " details.show();\r\n\r\n " +
" } else {\r\n " + " flagAddComments.focus().select();\r\n }\r\n\r\n" +
" alert(\'Select a User Flag\');\r\n " + " button.click(function (e) {\r\n " +
" }\r\n " + " e.preventDefault();\r\n\r\n " +
" }\r\n }\r\n " + " if (!buttonDialog) {\r\n button" +
" });\r\n\r\n " + "Dialog = $(\'#User_Show_Details_Actions_AddFlag_Dialog\');\r\n " +
" flagAddId = $(\'#User_Show_Details_Actions_AddFlag_Dialog_Id\');\r\n " + " buttonDialog.dialog({\r\n " +
" flagAddComments = buttonDialog.find(\'#User_Show_D" + " width: 600,\r\n height" +
"etails_Actions_AddFlag_Dialog_Comments\');\r\n " + ": 410,\r\n resizable: false,\r\n " +
" flagPicker = buttonDialog.find(\'.flagPicker\');\r\n " + " modal: true,\r\n " +
" details = buttonDialog.find(\'.details\');\r\n\r\n " + " autoOpen: false,\r\n " +
" $(\'#User_Show_Details_Actions_AddFlag_Dialog_Filter\')" + " buttons: {\r\n Cance" +
".on(\'keyup\', function (e) {\r\n con" + "l: function () {\r\n $(this" +
"st filter = $(e.currentTarget).val().toLowerCase();\r\n " + ").dialog(\"close\");\r\n },\r\n " +
" if (filter) {\r\n " + " \"Add Flag\": function () {\r\n " +
" flagPicker.children(\'div.flag\').each(function () {\r\n " + " if (!!flagAddId.val()) {\r\n " +
" const $this = $(this);\r\n " + " buttonDialog\r\n " +
" if ($this.attr(\'data-userflagname\').toLowerC" + " .dialog(\"option\", \"button" +
"ase().indexOf(filter) >= 0) {\r\n " + "s\", null)\r\n .find" +
" $this.css(\'display\', \'block\');\r\n " + "(\'form\').submit();\r\n } el" +
" } else {\r\n " + "se {\r\n alert(\'Select " +
" $this.css(\'display\', \'none\');\r\n " + "a User Flag\');\r\n }\r\n " +
" }\r\n });\r\n " + " }\r\n " +
" } else {\r\n " + " }\r\n });\r\n\r\n " +
" flagPicker.children(\'div.flag\').each(function () { $(t" + " flagAddId = $(\'#User_Show_Details_Actions_Ad" +
"his).css(\'display\', \'block\'); });\r\n " + "dFlag_Dialog_Id\');\r\n flagAddComments " +
" }\r\n });\r\n\r\n " + "= buttonDialog.find(\'#User_Show_Details_Actions_AddFlag_Dialog_Comments\');\r\n " +
" flagPicker.on(\'click\', \'div.flag\', flagSelected);\r\n " + " flagAddRemoveDate = buttonDialog.find(\'#" +
" }\r\n\r\n $(\'" + "User_Show_Details_Actions_AddFlag_Dialog_RemoveDate\');\r\n " +
"#User_Show_Details_Actions_AddFlag_Dialog_Filter\').val(\'\');\r\n " + " flagPicker = buttonDialog.find(\'.flagPicker\');\r\n " +
" buttonDialog.dialog(\'open\');\r\n " + " details = buttonDialog.find(\'.details\');\r\n\r\n " +
" return false;\r\n });\r\n " + " $(\'#User_Show_Details_Actions_AddFlag_Di" +
" });\r\n </script>\r\n"); "alog_Filter\').on(\'keyup\', function (e) {\r\n " +
" const filter = $(e.currentTarget).val().toLowerCase();\r\n " +
" if (filter) {\r\n " +
" flagPicker.children(\'div.flag\').each(function () {\r\n " +
" const $this = $(this);\r\n " +
" if ($this.attr(\'data-userflagna" +
"me\').toLowerCase().indexOf(filter) >= 0) {\r\n " +
" $this.css(\'display\', \'block\');\r\n " +
" } else {\r\n " +
" $this.css(\'display\', \'none\');\r\n " +
" }\r\n " +
" });\r\n } else {\r\n " +
" flagPicker.children(\'div.flag\').each(func" +
"tion () { $(this).css(\'display\', \'block\'); });\r\n " +
" }\r\n });\r\n\r\n " +
" flagPicker.on(\'click\', \'div.flag\', flagSelecte" +
"d);\r\n flagAddRemoveDate.on(\'change\', " +
"function () {\r\n if (flagAddRemove" +
"Date.val()) {\r\n flagAddRemove" +
"Date.next(\'span\').show();\r\n } els" +
"e {\r\n flagAddRemoveDate.next(" +
"\'span\').hide();\r\n }\r\n " +
" });\r\n }\r\n" +
"\r\n $(\'#User_Show_Details_Actions_AddFlag_" +
"Dialog_Filter\').val(\'\');\r\n buttonDialog.d" +
"ialog(\'open\');\r\n return false;\r\n " +
" });\r\n });\r\n " +
" </script>\r\n");
#line 345 "..\..\Views\User\UserParts\_Subject.cshtml" #line 379 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
@@ -1178,13 +1248,13 @@ WriteLiteral(">\r\n $(function () {\r\n
WriteLiteral(" </div>\r\n </div>\r\n </td>\r\n"); WriteLiteral(" </div>\r\n </div>\r\n </td>\r\n");
#line 349 "..\..\Views\User\UserParts\_Subject.cshtml" #line 383 "..\..\Views\User\UserParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 349 "..\..\Views\User\UserParts\_Subject.cshtml" #line 383 "..\..\Views\User\UserParts\_Subject.cshtml"
if (Authorization.Has(Claims.User.ShowAssignments)) if (Authorization.Has(Claims.User.ShowAssignments))
{ {
@@ -1202,13 +1272,13 @@ WriteLiteral(" id=\"User_Show_AssignedDevices_Active\"");
WriteLiteral(">\r\n <h3>Current Device Assignments</h3>\r\n"); WriteLiteral(">\r\n <h3>Current Device Assignments</h3>\r\n");
#line 355 "..\..\Views\User\UserParts\_Subject.cshtml" #line 389 "..\..\Views\User\UserParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 355 "..\..\Views\User\UserParts\_Subject.cshtml" #line 389 "..\..\Views\User\UserParts\_Subject.cshtml"
if (currentDeviceAssignments.Count > 0) if (currentDeviceAssignments.Count > 0)
{ {
foreach (var assignment in currentDeviceAssignments) foreach (var assignment in currentDeviceAssignments)
@@ -1224,7 +1294,7 @@ WriteLiteral(" class=\"User_Show_AssignedDevices_CurrentAssignment clearfix\"");
WriteLiteral(" data-deviceserialnumber=\""); WriteLiteral(" data-deviceserialnumber=\"");
#line 359 "..\..\Views\User\UserParts\_Subject.cshtml" #line 393 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(assignment.DeviceSerialNumber); Write(assignment.DeviceSerialNumber);
@@ -1235,13 +1305,13 @@ WriteLiteral("\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 360 "..\..\Views\User\UserParts\_Subject.cshtml" #line 394 "..\..\Views\User\UserParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 360 "..\..\Views\User\UserParts\_Subject.cshtml" #line 394 "..\..\Views\User\UserParts\_Subject.cshtml"
if (Authorization.Has(Claims.Device.Show)) if (Authorization.Has(Claims.Device.Show))
{ {
@@ -1250,14 +1320,14 @@ WriteLiteral(">\r\n");
#line hidden #line hidden
WriteLiteral(" <a"); WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 23264), Tuple.Create("\"", 23331) WriteAttribute("href", Tuple.Create(" href=\"", 25934), Tuple.Create("\"", 26001)
#line 362 "..\..\Views\User\UserParts\_Subject.cshtml" #line 396 "..\..\Views\User\UserParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 23271), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Device.Show(assignment.Device.SerialNumber)) , Tuple.Create(Tuple.Create("", 25941), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Device.Show(assignment.Device.SerialNumber))
#line default #line default
#line hidden #line hidden
, 23271), false) , 25941), false)
); );
WriteLiteral(">\r\n <img"); WriteLiteral(">\r\n <img");
@@ -1266,20 +1336,20 @@ WriteLiteral(" class=\"User_Show_AssignedDevices_CurrentAssignment_Image\"");
WriteLiteral(" alt=\"Model Image\""); WriteLiteral(" alt=\"Model Image\"");
WriteAttribute("src", Tuple.Create(" src=\"", 23463), Tuple.Create("\"", 23584) WriteAttribute("src", Tuple.Create(" src=\"", 26133), Tuple.Create("\"", 26254)
#line 363 "..\..\Views\User\UserParts\_Subject.cshtml" #line 397 "..\..\Views\User\UserParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 23469), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(assignment.Device.DeviceModel.Id, assignment.Device.DeviceModel.ImageHash())) , Tuple.Create(Tuple.Create("", 26139), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(assignment.Device.DeviceModel.Id, assignment.Device.DeviceModel.ImageHash()))
#line default #line default
#line hidden #line hidden
, 23469), false) , 26139), false)
); );
WriteLiteral(" />\r\n </a>\r\n"); WriteLiteral(" />\r\n </a>\r\n");
#line 365 "..\..\Views\User\UserParts\_Subject.cshtml" #line 399 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
else else
{ {
@@ -1293,20 +1363,20 @@ WriteLiteral(" class=\"User_Show_AssignedDevices_CurrentAssignment_Image\"");
WriteLiteral(" alt=\"Model Image\""); WriteLiteral(" alt=\"Model Image\"");
WriteAttribute("src", Tuple.Create(" src=\"", 23896), Tuple.Create("\"", 24017) WriteAttribute("src", Tuple.Create(" src=\"", 26566), Tuple.Create("\"", 26687)
#line 368 "..\..\Views\User\UserParts\_Subject.cshtml" #line 402 "..\..\Views\User\UserParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 23902), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(assignment.Device.DeviceModel.Id, assignment.Device.DeviceModel.ImageHash())) , Tuple.Create(Tuple.Create("", 26572), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(assignment.Device.DeviceModel.Id, assignment.Device.DeviceModel.ImageHash()))
#line default #line default
#line hidden #line hidden
, 23902), false) , 26572), false)
); );
WriteLiteral(" />\r\n"); WriteLiteral(" />\r\n");
#line 369 "..\..\Views\User\UserParts\_Subject.cshtml" #line 403 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
@@ -1334,13 +1404,13 @@ WriteLiteral(" class=\"User_Show_AssignedDevices_CurrentAssignment_SerialNumber\
WriteLiteral(" data-clipboard>\r\n"); WriteLiteral(" data-clipboard>\r\n");
#line 379 "..\..\Views\User\UserParts\_Subject.cshtml" #line 413 "..\..\Views\User\UserParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 379 "..\..\Views\User\UserParts\_Subject.cshtml" #line 413 "..\..\Views\User\UserParts\_Subject.cshtml"
if (Authorization.Has(Claims.Device.Show)) if (Authorization.Has(Claims.Device.Show))
{ {
@@ -1348,14 +1418,14 @@ WriteLiteral(" data-clipboard>\r\n");
#line default #line default
#line hidden #line hidden
#line 381 "..\..\Views\User\UserParts\_Subject.cshtml" #line 415 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(Html.ActionLink(assignment.Device.SerialNumber, MVC.Device.Show(assignment.Device.SerialNumber))); Write(Html.ActionLink(assignment.Device.SerialNumber, MVC.Device.Show(assignment.Device.SerialNumber)));
#line default #line default
#line hidden #line hidden
#line 381 "..\..\Views\User\UserParts\_Subject.cshtml" #line 415 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
else else
@@ -1365,14 +1435,14 @@ WriteLiteral(" data-clipboard>\r\n");
#line default #line default
#line hidden #line hidden
#line 385 "..\..\Views\User\UserParts\_Subject.cshtml" #line 419 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(assignment.Device.SerialNumber); Write(assignment.Device.SerialNumber);
#line default #line default
#line hidden #line hidden
#line 385 "..\..\Views\User\UserParts\_Subject.cshtml" #line 419 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
@@ -1382,13 +1452,13 @@ WriteLiteral(" data-clipboard>\r\n");
WriteLiteral(" </span>\r\n"); WriteLiteral(" </span>\r\n");
#line 388 "..\..\Views\User\UserParts\_Subject.cshtml" #line 422 "..\..\Views\User\UserParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 388 "..\..\Views\User\UserParts\_Subject.cshtml" #line 422 "..\..\Views\User\UserParts\_Subject.cshtml"
if (!string.IsNullOrWhiteSpace(assignment.Device.ComputerName)) if (!string.IsNullOrWhiteSpace(assignment.Device.ComputerName))
{ {
@@ -1404,7 +1474,7 @@ WriteLiteral(" class=\"User_Show_AssignedDevices_CurrentAssignment_ComputerName\
WriteLiteral(" data-clipboard>"); WriteLiteral(" data-clipboard>");
#line 390 "..\..\Views\User\UserParts\_Subject.cshtml" #line 424 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(assignment.Device.ComputerName); Write(assignment.Device.ComputerName);
@@ -1415,7 +1485,7 @@ WriteLiteral("</span>)");
WriteLiteral("\r\n"); WriteLiteral("\r\n");
#line 391 "..\..\Views\User\UserParts\_Subject.cshtml" #line 425 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
@@ -1425,13 +1495,13 @@ WriteLiteral(" </td>\r\n
" </tr>\r\n"); " </tr>\r\n");
#line 394 "..\..\Views\User\UserParts\_Subject.cshtml" #line 428 "..\..\Views\User\UserParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 394 "..\..\Views\User\UserParts\_Subject.cshtml" #line 428 "..\..\Views\User\UserParts\_Subject.cshtml"
if (!string.IsNullOrEmpty(assignment.Device.AssetNumber)) if (!string.IsNullOrEmpty(assignment.Device.AssetNumber))
{ {
@@ -1448,7 +1518,7 @@ WriteLiteral(" class=\"User_Show_AssignedDevices_CurrentAssignment_Asset\"");
WriteLiteral(" data-clipboard>"); WriteLiteral(" data-clipboard>");
#line 399 "..\..\Views\User\UserParts\_Subject.cshtml" #line 433 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(assignment.Device.AssetNumber); Write(assignment.Device.AssetNumber);
@@ -1458,7 +1528,7 @@ WriteLiteral("</span>\r\n
" </tr>\r\n"); " </tr>\r\n");
#line 402 "..\..\Views\User\UserParts\_Subject.cshtml" #line 436 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
@@ -1467,7 +1537,7 @@ WriteLiteral("</span>\r\n
WriteLiteral(" "); WriteLiteral(" ");
#line 403 "..\..\Views\User\UserParts\_Subject.cshtml" #line 437 "..\..\Views\User\UserParts\_Subject.cshtml"
if (assignment.Device.DeviceModelId.HasValue) if (assignment.Device.DeviceModelId.HasValue)
{ {
@@ -1486,7 +1556,7 @@ WriteLiteral(" class=\"User_Show_AssignedDevices_CurrentAssignment_Model\"");
WriteLiteral(">"); WriteLiteral(">");
#line 410 "..\..\Views\User\UserParts\_Subject.cshtml" #line 444 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(assignment.Device.DeviceModel.ToString()); Write(assignment.Device.DeviceModel.ToString());
@@ -1496,7 +1566,7 @@ WriteLiteral("</span>\r\n
" </tr>\r\n"); " </tr>\r\n");
#line 413 "..\..\Views\User\UserParts\_Subject.cshtml" #line 447 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
@@ -1514,7 +1584,7 @@ WriteLiteral(" class=\"User_Show_AssignedDevices_CurrentAssignment_Profile\"");
WriteLiteral(">"); WriteLiteral(">");
#line 419 "..\..\Views\User\UserParts\_Subject.cshtml" #line 453 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(assignment.Device.DeviceProfile.ToString()); Write(assignment.Device.DeviceProfile.ToString());
@@ -1524,13 +1594,13 @@ WriteLiteral("</span>\r\n
" </tr>\r\n"); " </tr>\r\n");
#line 422 "..\..\Views\User\UserParts\_Subject.cshtml" #line 456 "..\..\Views\User\UserParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 422 "..\..\Views\User\UserParts\_Subject.cshtml" #line 456 "..\..\Views\User\UserParts\_Subject.cshtml"
if (assignment.Device.DeviceBatchId.HasValue) if (assignment.Device.DeviceBatchId.HasValue)
{ {
@@ -1549,7 +1619,7 @@ WriteLiteral(" class=\"User_Show_AssignedDevices_CurrentAssignment_Batch\"");
WriteLiteral(">"); WriteLiteral(">");
#line 429 "..\..\Views\User\UserParts\_Subject.cshtml" #line 463 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(assignment.Device.DeviceBatch.ToString()); Write(assignment.Device.DeviceBatch.ToString());
@@ -1559,7 +1629,7 @@ WriteLiteral("</span>\r\n
" </tr>\r\n"); " </tr>\r\n");
#line 432 "..\..\Views\User\UserParts\_Subject.cshtml" #line 466 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
@@ -1575,7 +1645,7 @@ WriteLiteral(" class=\"User_Show_AssignedDevices_CurrentAssignment_Assigned\"");
WriteLiteral(">"); WriteLiteral(">");
#line 436 "..\..\Views\User\UserParts\_Subject.cshtml" #line 470 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(CommonHelpers.FriendlyDate(assignment.AssignedDate)); Write(CommonHelpers.FriendlyDate(assignment.AssignedDate));
@@ -1585,13 +1655,13 @@ WriteLiteral("</span>\r\n
" </tr>\r\n"); " </tr>\r\n");
#line 439 "..\..\Views\User\UserParts\_Subject.cshtml" #line 473 "..\..\Views\User\UserParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 439 "..\..\Views\User\UserParts\_Subject.cshtml" #line 473 "..\..\Views\User\UserParts\_Subject.cshtml"
if (assignment.Device.DeviceFlagAssignments.CanShowAny()) if (assignment.Device.DeviceFlagAssignments.CanShowAny())
{ {
@@ -1610,13 +1680,13 @@ WriteLiteral(" class=\"User_Show_Assigned_Devices_CurrentAssignment_Flags\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 444 "..\..\Views\User\UserParts\_Subject.cshtml" #line 478 "..\..\Views\User\UserParts\_Subject.cshtml"
#line default #line default
#line hidden #line hidden
#line 444 "..\..\Views\User\UserParts\_Subject.cshtml" #line 478 "..\..\Views\User\UserParts\_Subject.cshtml"
foreach (var flag in assignment.Device.DeviceFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, DeviceFlagService.GetDeviceFlag(f.DeviceFlagId)))) foreach (var flag in assignment.Device.DeviceFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, DeviceFlagService.GetDeviceFlag(f.DeviceFlagId))))
{ {
if (flag.Item2.permission.CanShow()) if (flag.Item2.permission.CanShow())
@@ -1627,26 +1697,26 @@ WriteLiteral(">\r\n");
#line hidden #line hidden
WriteLiteral(" <i"); WriteLiteral(" <i");
WriteAttribute("class", Tuple.Create(" class=\"", 30707), Tuple.Create("\"", 30787) WriteAttribute("class", Tuple.Create(" class=\"", 33377), Tuple.Create("\"", 33457)
, Tuple.Create(Tuple.Create("", 30715), Tuple.Create("flag", 30715), true) , Tuple.Create(Tuple.Create("", 33385), Tuple.Create("flag", 33385), true)
, Tuple.Create(Tuple.Create(" ", 30719), Tuple.Create("fa", 30720), true) , Tuple.Create(Tuple.Create(" ", 33389), Tuple.Create("fa", 33390), true)
, Tuple.Create(Tuple.Create(" ", 30722), Tuple.Create("fa-", 30723), true) , Tuple.Create(Tuple.Create(" ", 33392), Tuple.Create("fa-", 33393), true)
#line 448 "..\..\Views\User\UserParts\_Subject.cshtml" #line 482 "..\..\Views\User\UserParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 30726), Tuple.Create<System.Object, System.Int32>(flag.Item2.flag.Icon , Tuple.Create(Tuple.Create("", 33396), Tuple.Create<System.Object, System.Int32>(flag.Item2.flag.Icon
#line default #line default
#line hidden #line hidden
, 30726), false) , 33396), false)
, Tuple.Create(Tuple.Create(" ", 30749), Tuple.Create("fa-fw", 30750), true) , Tuple.Create(Tuple.Create(" ", 33419), Tuple.Create("fa-fw", 33420), true)
, Tuple.Create(Tuple.Create(" ", 30755), Tuple.Create("d-", 30756), true) , Tuple.Create(Tuple.Create(" ", 33425), Tuple.Create("d-", 33426), true)
#line 448 "..\..\Views\User\UserParts\_Subject.cshtml" #line 482 "..\..\Views\User\UserParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 30758), Tuple.Create<System.Object, System.Int32>(flag.Item2.flag.IconColour , Tuple.Create(Tuple.Create("", 33428), Tuple.Create<System.Object, System.Int32>(flag.Item2.flag.IconColour
#line default #line default
#line hidden #line hidden
, 30758), false) , 33428), false)
); );
WriteLiteral(">\r\n " + WriteLiteral(">\r\n " +
@@ -1662,7 +1732,7 @@ WriteLiteral(" class=\"name\"");
WriteLiteral(">"); WriteLiteral(">");
#line 450 "..\..\Views\User\UserParts\_Subject.cshtml" #line 484 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(flag.Item2.flag.Name); Write(flag.Item2.flag.Name);
@@ -1671,7 +1741,7 @@ WriteLiteral(">");
WriteLiteral("</span>"); WriteLiteral("</span>");
#line 450 "..\..\Views\User\UserParts\_Subject.cshtml" #line 484 "..\..\Views\User\UserParts\_Subject.cshtml"
if (flag.Item1.Comments != null) if (flag.Item1.Comments != null)
{ {
@@ -1684,7 +1754,7 @@ WriteLiteral(" class=\"comments\"");
WriteLiteral(">"); WriteLiteral(">");
#line 451 "..\..\Views\User\UserParts\_Subject.cshtml" #line 485 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(flag.Item1.Comments.ToHtmlComment()); Write(flag.Item1.Comments.ToHtmlComment());
@@ -1693,7 +1763,7 @@ WriteLiteral(">");
WriteLiteral("</span>"); WriteLiteral("</span>");
#line 451 "..\..\Views\User\UserParts\_Subject.cshtml" #line 485 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
#line default #line default
@@ -1705,7 +1775,7 @@ WriteLiteral(" class=\"added\"");
WriteLiteral(">"); WriteLiteral(">");
#line 451 "..\..\Views\User\UserParts\_Subject.cshtml" #line 485 "..\..\Views\User\UserParts\_Subject.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUserId)); Write(CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUserId));
@@ -1716,7 +1786,7 @@ WriteLiteral("</span>\r\n
" </i>\r\n"); " </i>\r\n");
#line 454 "..\..\Views\User\UserParts\_Subject.cshtml" #line 488 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
} }
@@ -1770,7 +1840,7 @@ WriteLiteral(">\r\n
" </tr>\r\n"); " </tr>\r\n");
#line 489 "..\..\Views\User\UserParts\_Subject.cshtml" #line 523 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
@@ -1781,7 +1851,7 @@ WriteLiteral(" </tbody>\r\n
" </div>\r\n"); " </div>\r\n");
#line 494 "..\..\Views\User\UserParts\_Subject.cshtml" #line 528 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
} }
else else
@@ -1797,7 +1867,7 @@ WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">No Current Device Assignments</span>\r\n"); WriteLiteral(">No Current Device Assignments</span>\r\n");
#line 499 "..\..\Views\User\UserParts\_Subject.cshtml" #line 533 "..\..\Views\User\UserParts\_Subject.cshtml"
} }
@@ -1807,7 +1877,7 @@ WriteLiteral(" </div>\r\n </div>\r\n
"\r\n"); "\r\n");
#line 503 "..\..\Views\User\UserParts\_Subject.cshtml" #line 537 "..\..\Views\User\UserParts\_Subject.cshtml"
} }