From aa54d93e8e81574a23a458ae32edaeb08e7c38d1 Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Thu, 4 Jul 2013 15:29:46 +1000 Subject: [PATCH] Feature: Held Devices Noticeboard Provides a noticeboard for all devices, not just those assigned to users. --- .../HeldDeviceNotifications.cs | 72 +++ .../UserHeldDeviceNotifications.cs | 55 +- Disco.BI/Disco.BI.csproj | 3 +- Disco.BI/Properties/AssemblyInfo.cs | 4 +- Disco.Data/Properties/AssemblyInfo.cs | 4 +- Disco.Models/Properties/AssemblyInfo.cs | 4 +- Disco.Services/Properties/AssemblyInfo.cs | 4 +- .../Properties/AssemblyInfo.cs | 4 +- Disco.Web/App_Start/BundleConfig.cs | 4 +- .../Controllers/HeldDevicesController.cs | 107 ++++ .../Controllers/UserHeldDevicesController.cs | 91 +-- .../Models/HeldDevices/HeldDeviceModel.cs | 44 ++ .../HeldDevices/HeldDeviceQueryModel.cs | 61 ++ .../UserHeldDevices/HeldJobDeviceModel.cs | 14 - .../UserHeldDevices/UserHeldDeviceModel.cs | 1 - .../Areas/Public/PublicAreaRegistration.cs | 2 + .../Public/Views/HeldDevices/Index.cshtml | 97 +++ .../Views/HeldDevices/Index.generated.cs | 597 ++++++++++++++++++ .../Views/HeldDevices/Noticeboard.cshtml | 476 ++++++++++++++ .../HeldDevices/Noticeboard.generated.cs | 494 +++++++++++++++ .../Areas/Public/Views/Public/Index.cshtml | 17 +- .../Public/Views/Public/Index.generated.cs | 52 +- .../Public/Views/UserHeldDevices/Index.cshtml | 16 +- .../Views/UserHeldDevices/Index.generated.cs | 32 +- .../Views/UserHeldDevices/Noticeboard.cshtml | 31 +- .../UserHeldDevices/Noticeboard.generated.cs | 116 ++-- .../{UserHeldDevices.css => HeldDevices.css} | 8 +- ...{UserHeldDevices.less => HeldDevices.less} | 6 +- .../Style/Public/HeldDevices.min.css | 1 + ...ceboard.css => HeldDevicesNoticeboard.css} | 9 +- ...board.less => HeldDevicesNoticeboard.less} | 5 +- .../Public/HeldDevicesNoticeboard.min.css | 1 + .../Style/Public/UserHeldDevices.min.css | 1 - .../Public/UserHeldDevicesNoticeboard.min.css | 1 - Disco.Web/Disco.Web.csproj | 47 +- Disco.Web/Properties/AssemblyInfo.cs | 4 +- Disco.Web/T4MVC.cs | 179 +++++- 37 files changed, 2412 insertions(+), 252 deletions(-) create mode 100644 Disco.BI/BI/Interop/SignalRHandlers/HeldDeviceNotifications.cs create mode 100644 Disco.Web/Areas/Public/Controllers/HeldDevicesController.cs create mode 100644 Disco.Web/Areas/Public/Models/HeldDevices/HeldDeviceModel.cs create mode 100644 Disco.Web/Areas/Public/Models/HeldDevices/HeldDeviceQueryModel.cs create mode 100644 Disco.Web/Areas/Public/Views/HeldDevices/Index.cshtml create mode 100644 Disco.Web/Areas/Public/Views/HeldDevices/Index.generated.cs create mode 100644 Disco.Web/Areas/Public/Views/HeldDevices/Noticeboard.cshtml create mode 100644 Disco.Web/Areas/Public/Views/HeldDevices/Noticeboard.generated.cs rename Disco.Web/ClientSource/Style/Public/{UserHeldDevices.css => HeldDevices.css} (84%) rename Disco.Web/ClientSource/Style/Public/{UserHeldDevices.less => HeldDevices.less} (89%) create mode 100644 Disco.Web/ClientSource/Style/Public/HeldDevices.min.css rename Disco.Web/ClientSource/Style/Public/{UserHeldDevicesNoticeboard.css => HeldDevicesNoticeboard.css} (85%) rename Disco.Web/ClientSource/Style/Public/{UserHeldDevicesNoticeboard.less => HeldDevicesNoticeboard.less} (90%) create mode 100644 Disco.Web/ClientSource/Style/Public/HeldDevicesNoticeboard.min.css delete mode 100644 Disco.Web/ClientSource/Style/Public/UserHeldDevices.min.css delete mode 100644 Disco.Web/ClientSource/Style/Public/UserHeldDevicesNoticeboard.min.css diff --git a/Disco.BI/BI/Interop/SignalRHandlers/HeldDeviceNotifications.cs b/Disco.BI/BI/Interop/SignalRHandlers/HeldDeviceNotifications.cs new file mode 100644 index 00000000..566a2ce8 --- /dev/null +++ b/Disco.BI/BI/Interop/SignalRHandlers/HeldDeviceNotifications.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.AspNet.SignalR; +using System.Reactive.Linq; +using Disco.Data.Repository.Monitor; +using Disco.Models.Repository; + +namespace Disco.BI.Interop.SignalRHandlers +{ + public class HeldDeviceNotifications : PersistentConnection + { + private static bool subscribed = false; + private static object subscribeLock = new object(); + private static IPersistentConnectionContext notificationContext; + + static HeldDeviceNotifications() + { + if (!subscribed) + lock (subscribeLock) + if (!subscribed) + { + notificationContext = GlobalHost.ConnectionManager.GetConnectionContext(); + + Disco.Data.Repository.Monitor.RepositoryMonitor.StreamAfterCommit.Where(e => e.EntityType == typeof(Job)).Subscribe(JobUpdated); + + Disco.Data.Repository.Monitor.RepositoryMonitor.StreamAfterCommit.Where(e => + e.EntityType == typeof(Device) && + (e.ModifiedProperties.Contains("Location") || + e.ModifiedProperties.Contains("DeviceModelId") || + e.ModifiedProperties.Contains("DeviceProfileId") || + e.ModifiedProperties.Contains("DeviceBatchId") || + e.ModifiedProperties.Contains("ComputerName") || + e.ModifiedProperties.Contains("AssignedUserId")) + ).Subscribe(DeviceUpdated); + + Disco.Data.Repository.Monitor.RepositoryMonitor.StreamAfterCommit.Where(e => + e.EntityType == typeof(User) && + e.ModifiedProperties.Contains("DisplayName") + ).Subscribe(UserUpdated); + + subscribed = true; + } + } + + private static void JobUpdated(RepositoryMonitorEvent e) + { + Job j = (Job)e.Entity; + + if (j.DeviceSerialNumber != null) + notificationContext.Connection.Broadcast(j.DeviceSerialNumber); + } + private static void DeviceUpdated(RepositoryMonitorEvent e) + { + Device d = (Device)e.Entity; + + notificationContext.Connection.Broadcast(d.SerialNumber); + } + private static void UserUpdated(RepositoryMonitorEvent e) + { + User u = (User)e.Entity; + + var userDevices = e.dbContext.Devices.Where(d => d.AssignedUserId == u.Id); + + foreach (var userDevice in userDevices) + { + notificationContext.Connection.Broadcast(userDevice.SerialNumber); + } + } + } +} diff --git a/Disco.BI/BI/Interop/SignalRHandlers/UserHeldDeviceNotifications.cs b/Disco.BI/BI/Interop/SignalRHandlers/UserHeldDeviceNotifications.cs index 09a854b2..a45d036f 100644 --- a/Disco.BI/BI/Interop/SignalRHandlers/UserHeldDeviceNotifications.cs +++ b/Disco.BI/BI/Interop/SignalRHandlers/UserHeldDeviceNotifications.cs @@ -13,6 +13,7 @@ namespace Disco.BI.Interop.SignalRHandlers { private static bool subscribed = false; private static object subscribeLock = new object(); + private static IPersistentConnectionContext notificationContext; static UserHeldDeviceNotifications() { @@ -20,22 +21,62 @@ namespace Disco.BI.Interop.SignalRHandlers lock (subscribeLock) if (!subscribed) { - Disco.Data.Repository.Monitor.RepositoryMonitor.StreamAfterCommit.Where(e => e.EntityType == typeof(Job)).Subscribe(UserJobUpdated); + notificationContext = GlobalHost.ConnectionManager.GetConnectionContext(); + + Disco.Data.Repository.Monitor.RepositoryMonitor.StreamAfterCommit.Where(e => e.EntityType == typeof(Job)).Subscribe(JobUpdated); + + Disco.Data.Repository.Monitor.RepositoryMonitor.StreamBeforeCommit.Where(e => + e.EntityType == typeof(Device) && + (e.ModifiedProperties.Contains("DeviceModelId") || + e.ModifiedProperties.Contains("DeviceProfileId") || + e.ModifiedProperties.Contains("DeviceBatchId") || + e.ModifiedProperties.Contains("AssignedUserId")) + ).Subscribe(DeviceUpdated); + + Disco.Data.Repository.Monitor.RepositoryMonitor.StreamAfterCommit.Where(e => + e.EntityType == typeof(User) && + e.ModifiedProperties.Contains("DisplayName") + ).Subscribe(UserUpdated); + subscribed = true; } } - private static void UserJobUpdated(RepositoryMonitorEvent e) + private static void JobUpdated(RepositoryMonitorEvent e) { Job j = (Job)e.Entity; - if (j.UserId != null) + if (j.DeviceSerialNumber != null) { - var connectionManager = GlobalHost.ConnectionManager; - var connectionContext = connectionManager.GetConnectionContext(); - if (connectionContext != null) - connectionContext.Connection.Broadcast(j.UserId); + var jobDevice = e.dbContext.Devices.Where(d => d.SerialNumber == j.DeviceSerialNumber).FirstOrDefault(); + + if (jobDevice.AssignedUserId != null) + notificationContext.Connection.Broadcast(jobDevice.AssignedUserId); } } + private static void DeviceUpdated(RepositoryMonitorEvent e) + { + Device d = (Device)e.Entity; + + string previouslyAssignedUserId = null; + + if (e.ModifiedProperties.Contains("AssignedUserId")) + previouslyAssignedUserId = e.GetPreviousPropertyValue("AssignedUserId"); + + e.ExecuteAfterCommit(me => + { + if (previouslyAssignedUserId != null) + notificationContext.Connection.Broadcast(previouslyAssignedUserId); + + if (d.AssignedUserId != null) + notificationContext.Connection.Broadcast(d.AssignedUserId); + }); + } + private static void UserUpdated(RepositoryMonitorEvent e) + { + User u = (User)e.Entity; + + notificationContext.Connection.Broadcast(u.Id); + } } } diff --git a/Disco.BI/Disco.BI.csproj b/Disco.BI/Disco.BI.csproj index 9362d6fb..91ef7289 100644 --- a/Disco.BI/Disco.BI.csproj +++ b/Disco.BI/Disco.BI.csproj @@ -181,6 +181,7 @@ + @@ -250,7 +251,7 @@ - + diff --git a/Disco.BI/Properties/AssemblyInfo.cs b/Disco.BI/Properties/AssemblyInfo.cs index 42508fe7..01bd8682 100644 --- a/Disco.BI/Properties/AssemblyInfo.cs +++ b/Disco.BI/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0625.1305")] -[assembly: AssemblyFileVersion("1.2.0625.1305")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0704.1521")] +[assembly: AssemblyFileVersion("1.2.0704.1521")] \ No newline at end of file diff --git a/Disco.Data/Properties/AssemblyInfo.cs b/Disco.Data/Properties/AssemblyInfo.cs index 8f5dd9a1..eef28bd5 100644 --- a/Disco.Data/Properties/AssemblyInfo.cs +++ b/Disco.Data/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0625.1305")] -[assembly: AssemblyFileVersion("1.2.0625.1305")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0704.1521")] +[assembly: AssemblyFileVersion("1.2.0704.1521")] \ No newline at end of file diff --git a/Disco.Models/Properties/AssemblyInfo.cs b/Disco.Models/Properties/AssemblyInfo.cs index ed7acbbb..bc969053 100644 --- a/Disco.Models/Properties/AssemblyInfo.cs +++ b/Disco.Models/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0625.1305")] -[assembly: AssemblyFileVersion("1.2.0625.1305")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0704.1521")] +[assembly: AssemblyFileVersion("1.2.0704.1521")] \ No newline at end of file diff --git a/Disco.Services/Properties/AssemblyInfo.cs b/Disco.Services/Properties/AssemblyInfo.cs index 228b6bf6..e1b7e6ea 100644 --- a/Disco.Services/Properties/AssemblyInfo.cs +++ b/Disco.Services/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0625.1305")] -[assembly: AssemblyFileVersion("1.2.0625.1305")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0704.1521")] +[assembly: AssemblyFileVersion("1.2.0704.1521")] \ No newline at end of file diff --git a/Disco.Web.Extensions/Properties/AssemblyInfo.cs b/Disco.Web.Extensions/Properties/AssemblyInfo.cs index 11b1c0a3..2e0d6c3c 100644 --- a/Disco.Web.Extensions/Properties/AssemblyInfo.cs +++ b/Disco.Web.Extensions/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0625.1305")] -[assembly: AssemblyFileVersion("1.2.0625.1305")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0704.1521")] +[assembly: AssemblyFileVersion("1.2.0704.1521")] \ No newline at end of file diff --git a/Disco.Web/App_Start/BundleConfig.cs b/Disco.Web/App_Start/BundleConfig.cs index f4fdef78..3ac682ea 100644 --- a/Disco.Web/App_Start/BundleConfig.cs +++ b/Disco.Web/App_Start/BundleConfig.cs @@ -27,8 +27,8 @@ namespace Disco.Web BundleTable.Add(new Bundle("~/Style/Timeline", Links.ClientSource.Style.Timeline_min_css)); // Styles - Public Targeted - BundleTable.Add(new Bundle("~/Style/Public/UserHeldDevices", Links.ClientSource.Style.Public.UserHeldDevices_min_css)); - BundleTable.Add(new Bundle("~/Style/Public/UserHeldDevicesNoticeboard", Links.ClientSource.Style.Public.UserHeldDevicesNoticeboard_min_css)); + BundleTable.Add(new Bundle("~/Style/Public/HeldDevices", Links.ClientSource.Style.Public.HeldDevices_min_css)); + BundleTable.Add(new Bundle("~/Style/Public/HeldDevicesNoticeboard", Links.ClientSource.Style.Public.HeldDevicesNoticeboard_min_css)); // Scripts - Core diff --git a/Disco.Web/Areas/Public/Controllers/HeldDevicesController.cs b/Disco.Web/Areas/Public/Controllers/HeldDevicesController.cs new file mode 100644 index 00000000..60cf7f8d --- /dev/null +++ b/Disco.Web/Areas/Public/Controllers/HeldDevicesController.cs @@ -0,0 +1,107 @@ +using Disco.Data.Repository; +using Disco.Models.Repository; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; + +namespace Disco.Web.Areas.Public.Controllers +{ + public partial class HeldDevicesController : dbController + { + #region Helpers + + private List GetHeldDevices(IQueryable query) + { + var jobs = query.Where(j => + !j.ClosedDate.HasValue && + j.DeviceSerialNumber != null && + ((j.DeviceHeld.HasValue && !j.DeviceReturnedDate.HasValue) || j.WaitingForUserAction.HasValue) + ).Select(j => new Models.HeldDevices.HeldDeviceQueryModel + { + JobId = j.Id, + DeviceSerialNumber = j.DeviceSerialNumber, + DeviceComputerName = j.Device.ComputerName, + DeviceLocation = j.Device.Location, + DeviceProfileId = j.Device.DeviceProfileId, + DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress, + UserId = j.Device.AssignedUserId, + UserDisplayName = j.Device.AssignedUser.DisplayName, + WaitingForUserAction = j.WaitingForUserAction.HasValue || ((j.JobMetaNonWarranty.AccountingChargeRequiredDate.HasValue || j.JobMetaNonWarranty.AccountingChargeAddedDate.HasValue) && !j.JobMetaNonWarranty.AccountingChargePaidDate.HasValue), + WaitingForUserActionSince = j.WaitingForUserAction.HasValue ? j.WaitingForUserAction : (j.JobMetaNonWarranty.AccountingChargeRequiredDate.HasValue ? j.JobMetaNonWarranty.AccountingChargeRequiredDate : j.JobMetaNonWarranty.AccountingChargeAddedDate), + ReadyForReturn = j.DeviceReadyForReturn.HasValue, + EstimatedReturnTime = j.ExpectedClosedDate, + ReadyForReturnSince = j.DeviceReadyForReturn + }).GroupBy(j => j.DeviceSerialNumber); + + var thd = new List(); + foreach (var job in jobs) + { + if (job.Any(j => j.WaitingForUserAction)) + { + thd.Add(job.Where(j => j.WaitingForUserAction).OrderBy(j => j.WaitingForUserActionSince).FirstOrDefault().ToUserHeldDeviceModel(dbContext)); + } + else + { + if (job.All(j => j.ReadyForReturn)) + { + thd.Add(job.FirstOrDefault().ToUserHeldDeviceModel(dbContext)); + } + else + { + thd.Add(job.Where(j => !j.ReadyForReturn).OrderByDescending(j => j.EstimatedReturnTime).FirstOrDefault().ToUserHeldDeviceModel(dbContext)); + } + } + } + return thd; + } + + private List GetHeldDevices() + { + return GetHeldDevices(dbContext.Jobs); + } + private Models.HeldDevices.HeldDeviceModel GetHeldDevice(string DeviceSerialNumber) + { + return GetHeldDevices(dbContext.Jobs.Where(j => j.DeviceSerialNumber == DeviceSerialNumber)).FirstOrDefault(); + } + #endregion + + public virtual ActionResult Index() + { + return View(GetHeldDevices()); + } + + public virtual ActionResult ReadyForReturnXml() + { + var readyForReturn = GetHeldDevices().Where(j => j.ReadyForReturn && !j.WaitingForUserAction).ToArray(); + return new Extensions.XmlResult(readyForReturn); + } + public virtual ActionResult WaitingForUserActionXml() + { + var waitingForUserAction = GetHeldDevices().Where(j => j.WaitingForUserAction).ToArray(); + return new Extensions.XmlResult(waitingForUserAction); + } + public virtual ActionResult HeldDevicesXml() + { + var heldDevices = GetHeldDevices().Where(j => !j.ReadyForReturn && !j.WaitingForUserAction).ToArray(); + return new Extensions.XmlResult(heldDevices); + } + + public virtual ActionResult Noticeboard() + { + return View(); + } + + public virtual ActionResult HeldDevice(string id) + { + var uhd = GetHeldDevice(id); + return Json(uhd, JsonRequestBehavior.AllowGet); + } + public virtual ActionResult HeldDevices() + { + var uhd = GetHeldDevices(); + return Json(uhd, JsonRequestBehavior.AllowGet); + } + } +} diff --git a/Disco.Web/Areas/Public/Controllers/UserHeldDevicesController.cs b/Disco.Web/Areas/Public/Controllers/UserHeldDevicesController.cs index 6fb8e601..6234d347 100644 --- a/Disco.Web/Areas/Public/Controllers/UserHeldDevicesController.cs +++ b/Disco.Web/Areas/Public/Controllers/UserHeldDevicesController.cs @@ -5,90 +5,65 @@ using System.Web; using System.Web.Mvc; using Disco.BI; using Disco.BI.Extensions; +using Disco.Models.Repository; namespace Disco.Web.Areas.Public.Controllers { public partial class UserHeldDevicesController : dbController { - private List GetUserHeldDevices() + #region Helpers + + private List GetUserHeldDevices(IQueryable query) { - var usersJobs = dbContext.Jobs.Where(j => - !j.ClosedDate.HasValue && j.UserId != null && + var jobs = query.Where(j => + !j.ClosedDate.HasValue && j.Device.AssignedUserId != null && j.DeviceSerialNumber != null && ((j.DeviceHeld.HasValue && !j.DeviceReturnedDate.HasValue) || j.WaitingForUserAction.HasValue) ).Select(j => new Models.UserHeldDevices.HeldJobDeviceModel - { - JobId = j.Id, - WaitingForUserAction = j.WaitingForUserAction.HasValue || ((j.JobMetaNonWarranty.AccountingChargeRequiredDate.HasValue || j.JobMetaNonWarranty.AccountingChargeAddedDate.HasValue) && !j.JobMetaNonWarranty.AccountingChargePaidDate.HasValue), - WaitingForUserActionSince = j.WaitingForUserAction.HasValue ? j.WaitingForUserAction : (j.JobMetaNonWarranty.AccountingChargeRequiredDate.HasValue ? j.JobMetaNonWarranty.AccountingChargeRequiredDate : j.JobMetaNonWarranty.AccountingChargeAddedDate), - ReadyForReturn = j.DeviceReadyForReturn.HasValue, - EstimatedReturnTime = j.ExpectedClosedDate, - ReadyForReturnSince = j.DeviceReadyForReturn, - UserDisplayName = j.User.DisplayName, - UserId = j.UserId, - DeviceProfileId = j.Device.DeviceProfileId, - DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress - }).GroupBy(j => j.UserId); + { + JobId = j.Id, + WaitingForUserAction = j.WaitingForUserAction.HasValue || ((j.JobMetaNonWarranty.AccountingChargeRequiredDate.HasValue || j.JobMetaNonWarranty.AccountingChargeAddedDate.HasValue) && !j.JobMetaNonWarranty.AccountingChargePaidDate.HasValue), + WaitingForUserActionSince = j.WaitingForUserAction.HasValue ? j.WaitingForUserAction : (j.JobMetaNonWarranty.AccountingChargeRequiredDate.HasValue ? j.JobMetaNonWarranty.AccountingChargeRequiredDate : j.JobMetaNonWarranty.AccountingChargeAddedDate), + ReadyForReturn = j.DeviceReadyForReturn.HasValue, + EstimatedReturnTime = j.ExpectedClosedDate, + ReadyForReturnSince = j.DeviceReadyForReturn, + UserId = j.Device.AssignedUserId, + UserDisplayName = j.Device.AssignedUser.DisplayName, + DeviceProfileId = j.Device.DeviceProfileId, + DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress + }).GroupBy(j => j.UserId); var thd = new List(); - foreach (var userJobs in usersJobs) + foreach (var job in jobs) { - if (userJobs.Any(j => j.WaitingForUserAction)) + if (job.Any(j => j.WaitingForUserAction)) { - thd.Add(userJobs.Where(j => j.WaitingForUserAction).OrderBy(j => j.WaitingForUserActionSince).FirstOrDefault().ToUserHeldDeviceModel(dbContext)); + thd.Add(job.Where(j => j.WaitingForUserAction).OrderBy(j => j.WaitingForUserActionSince).FirstOrDefault().ToUserHeldDeviceModel(dbContext)); } else { - if (userJobs.All(j => j.ReadyForReturn)) + if (job.All(j => j.ReadyForReturn)) { - thd.Add(userJobs.FirstOrDefault().ToUserHeldDeviceModel(dbContext)); + thd.Add(job.FirstOrDefault().ToUserHeldDeviceModel(dbContext)); } else { - thd.Add(userJobs.Where(j => !j.ReadyForReturn).OrderByDescending(j => j.EstimatedReturnTime).FirstOrDefault().ToUserHeldDeviceModel(dbContext)); + thd.Add(job.Where(j => !j.ReadyForReturn).OrderByDescending(j => j.EstimatedReturnTime).FirstOrDefault().ToUserHeldDeviceModel(dbContext)); } } } return thd; } - private Models.UserHeldDevices.UserHeldDeviceModel GetUserHeldDevice(string userId) - { - var userJobs = dbContext.Jobs.Where(j => !j.ClosedDate.HasValue && j.UserId == userId && j.DeviceSerialNumber != null && ((j.DeviceHeld.HasValue && !j.DeviceReturnedDate.HasValue) || j.WaitingForUserAction.HasValue)).Select(j => new Models.UserHeldDevices.HeldJobDeviceModel - { - JobId = j.Id, - WaitingForUserAction = j.WaitingForUserAction.HasValue, - WaitingForUserActionSince = j.WaitingForUserAction, - ReadyForReturn = j.DeviceReadyForReturn.HasValue, - EstimatedReturnTime = j.ExpectedClosedDate, - ReadyForReturnSince = j.DeviceReadyForReturn, - UserDisplayName = j.User.DisplayName, - UserId = j.UserId, - DeviceProfileId = j.Device.DeviceProfileId, - DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress - }).ToList(); - if (userJobs == null || userJobs.Count == 0) - { - return null; - } - else - { - if (userJobs.Any(j => j.WaitingForUserAction)) - { - return userJobs.Where(j => j.WaitingForUserAction).OrderBy(j => j.WaitingForUserActionSince).FirstOrDefault().ToUserHeldDeviceModel(dbContext); - } - else - { - if (userJobs.All(j => j.ReadyForReturn)) - { - return userJobs.FirstOrDefault().ToUserHeldDeviceModel(dbContext); - } - else - { - return userJobs.Where(j => !j.ReadyForReturn).OrderByDescending(j => j.EstimatedReturnTime).FirstOrDefault().ToUserHeldDeviceModel(dbContext); - } - } - } + #endregion + + private List GetUserHeldDevices() + { + return GetUserHeldDevices(dbContext.Jobs); + } + private Models.UserHeldDevices.UserHeldDeviceModel GetUserHeldDevice(string UserId) + { + return GetUserHeldDevices(dbContext.Jobs.Where(j => j.Device.AssignedUserId == UserId)).FirstOrDefault(); } public virtual ActionResult Index() diff --git a/Disco.Web/Areas/Public/Models/HeldDevices/HeldDeviceModel.cs b/Disco.Web/Areas/Public/Models/HeldDevices/HeldDeviceModel.cs new file mode 100644 index 00000000..dabccc56 --- /dev/null +++ b/Disco.Web/Areas/Public/Models/HeldDevices/HeldDeviceModel.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web; + +namespace Disco.Web.Areas.Public.Models.HeldDevices +{ + public class HeldDeviceModel + { + public string DeviceSerialNumber { get; set; } + public string DeviceComputerName { get; set; } + public int DeviceProfileId { get; set; } + public string DeviceAddress { get; set; } + public string DeviceLocation { get; set; } + public string DeviceDescription + { + get + { + StringBuilder sb = new StringBuilder(this.DeviceSerialNumber); + + if (UserId != null) + sb.Append(" - ").Append(this.UserDisplayName).Append(" (").Append(this.UserId).Append(")"); + + if (!string.IsNullOrWhiteSpace(this.DeviceLocation)) + sb.Append(" - ").Append(this.DeviceLocation); + else if (UserId == null) + sb.Append(" - ").Append(this.DeviceComputerName); + + return sb.ToString(); + } + } + + public string UserId { get; set; } + public string UserDisplayName { get; set; } + public bool WaitingForUserAction { get; set; } + public string WaitingForUserActionSince { get; set; } + + public bool ReadyForReturn { get; set; } + public string EstimatedReturnTime { get; set; } + public string ReadyForReturnSince { get; set; } + public bool IsAlert { get; set; } + } +} \ No newline at end of file diff --git a/Disco.Web/Areas/Public/Models/HeldDevices/HeldDeviceQueryModel.cs b/Disco.Web/Areas/Public/Models/HeldDevices/HeldDeviceQueryModel.cs new file mode 100644 index 00000000..a3759333 --- /dev/null +++ b/Disco.Web/Areas/Public/Models/HeldDevices/HeldDeviceQueryModel.cs @@ -0,0 +1,61 @@ +using Disco.Data.Repository; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using Disco.BI.Extensions; + +namespace Disco.Web.Areas.Public.Models.HeldDevices +{ + public class HeldDeviceQueryModel + { + public int JobId { get; set; } + + public string DeviceSerialNumber { get; set; } + public string DeviceComputerName { get; set; } + public int DeviceProfileId { get; set; } + public int? DeviceAddressId { get; set; } + public string DeviceLocation { get; set; } + + public string UserId { get; set; } + public string UserDisplayName { get; set; } + + public bool ReadyForReturn { get; set; } + public bool WaitingForUserAction { get; set; } + public DateTime? EstimatedReturnTime { get; set; } + public DateTime? ReadyForReturnSince { get; set; } + public DateTime? WaitingForUserActionSince { get; set; } + + public HeldDeviceModel ToUserHeldDeviceModel(DiscoDataContext dbContext) + { + var uhdm = new HeldDeviceModel() + { + DeviceSerialNumber = this.DeviceSerialNumber, + DeviceComputerName = this.DeviceComputerName, + DeviceLocation = this.DeviceLocation, + DeviceProfileId = this.DeviceProfileId, + DeviceAddress = (this.DeviceAddressId.HasValue ? dbContext.DiscoConfiguration.OrganisationAddresses.GetAddress(this.DeviceAddressId.Value).ShortName : string.Empty), + UserId = this.UserId, + UserDisplayName = this.UserDisplayName, + ReadyForReturn = this.ReadyForReturn, + WaitingForUserAction = this.WaitingForUserAction + }; + var n = DateTime.Now; + if (!this.ReadyForReturn && this.EstimatedReturnTime.HasValue && this.EstimatedReturnTime.Value > n) + { + uhdm.EstimatedReturnTime = this.EstimatedReturnTime.ToFuzzy(); + } + if (this.ReadyForReturn) + { + uhdm.ReadyForReturnSince = this.ReadyForReturnSince.ToFuzzy(); + uhdm.IsAlert = (this.ReadyForReturnSince.Value < DateTime.Now.AddDays(-3)); + } + if (this.WaitingForUserAction) + { + uhdm.WaitingForUserActionSince = this.WaitingForUserActionSince.ToFuzzy(); + uhdm.IsAlert = (this.WaitingForUserActionSince.Value < n.AddDays(-6)); + } + return uhdm; + } + } +} \ No newline at end of file diff --git a/Disco.Web/Areas/Public/Models/UserHeldDevices/HeldJobDeviceModel.cs b/Disco.Web/Areas/Public/Models/UserHeldDevices/HeldJobDeviceModel.cs index 76631839..ba3751bd 100644 --- a/Disco.Web/Areas/Public/Models/UserHeldDevices/HeldJobDeviceModel.cs +++ b/Disco.Web/Areas/Public/Models/UserHeldDevices/HeldJobDeviceModel.cs @@ -37,20 +37,6 @@ namespace Disco.Web.Areas.Public.Models.UserHeldDevices if (!this.ReadyForReturn && this.EstimatedReturnTime.HasValue && this.EstimatedReturnTime.Value > n) { uhdm.EstimatedReturnTime = this.EstimatedReturnTime.ToFuzzy(); - if (this.EstimatedReturnTime.Value.Date == n.Date) - { - if (this.EstimatedReturnTime.Value < n.AddHours(2)) - { - if (this.EstimatedReturnTime.Value < n.AddMinutes(12)) - { - uhdm.UpdateAt = this.EstimatedReturnTime.Value; - } - else - { - uhdm.UpdateAt = this.EstimatedReturnTime.Value.AddMinutes(-10); - } - } - } } if (this.ReadyForReturn) { diff --git a/Disco.Web/Areas/Public/Models/UserHeldDevices/UserHeldDeviceModel.cs b/Disco.Web/Areas/Public/Models/UserHeldDevices/UserHeldDeviceModel.cs index 7958dfd4..35aa2de3 100644 --- a/Disco.Web/Areas/Public/Models/UserHeldDevices/UserHeldDeviceModel.cs +++ b/Disco.Web/Areas/Public/Models/UserHeldDevices/UserHeldDeviceModel.cs @@ -15,7 +15,6 @@ namespace Disco.Web.Areas.Public.Models.UserHeldDevices public bool IsAlert { get; set; } public bool WaitingForUserAction { get; set; } public string WaitingForUserActionSince { get; set; } - public Nullable UpdateAt { get; set; } public int DeviceProfileId { get; set; } public string DeviceAddress { get; set; } } diff --git a/Disco.Web/Areas/Public/PublicAreaRegistration.cs b/Disco.Web/Areas/Public/PublicAreaRegistration.cs index ad0d7ffb..29bd4678 100644 --- a/Disco.Web/Areas/Public/PublicAreaRegistration.cs +++ b/Disco.Web/Areas/Public/PublicAreaRegistration.cs @@ -19,6 +19,8 @@ namespace Disco.Web.Areas.Public { context.Routes.MapConnection( "Public_UserHeldDevices_Notifications", "Public/UserHeldDevices/Notifications", new ConnectionConfiguration(), SignalRAuthenticationWorkaround.AddMiddleware); + context.Routes.MapConnection( + "Public_HeldDevices_Notifications", "Public/HeldDevices/Notifications", new ConnectionConfiguration(), SignalRAuthenticationWorkaround.AddMiddleware); context.MapRoute( "Public_Credits", diff --git a/Disco.Web/Areas/Public/Views/HeldDevices/Index.cshtml b/Disco.Web/Areas/Public/Views/HeldDevices/Index.cshtml new file mode 100644 index 00000000..a524dc4a --- /dev/null +++ b/Disco.Web/Areas/Public/Views/HeldDevices/Index.cshtml @@ -0,0 +1,97 @@ +@model IEnumerable +@{ + ViewBag.Title = Html.ToBreadcrumb("Public Reports", MVC.Public.Public.Index(), "Held Devices", null); + Html.BundleDeferred("~/Style/Public/HeldDevices"); +} +
+
+ @{ + var DevicesInProcess = Model.Where(i => !i.ReadyForReturn && !i.WaitingForUserAction).ToArray(); + } +

In Process (@DevicesInProcess.Length)

+ + @foreach (var item in DevicesInProcess) + { + + + + + } +
+ @item.DeviceSerialNumber + + @if (item.UserId != null) + { + @item.UserDisplayName (@item.UserId) + } + @if (!string.IsNullOrWhiteSpace(item.DeviceLocation)) + { + if (item.UserId != null) + { + - + } + @item.DeviceLocation + } + else + { + if (item.UserId == null) + { + @item.DeviceComputerName + } + } + @if (!string.IsNullOrEmpty(item.EstimatedReturnTime)) + { + (Expected: @item.EstimatedReturnTime) + } +
+
+
+ @{ + var WaitingForUserActionJobs = Model.Where(i => i.WaitingForUserAction).ToArray(); + } +

Waiting for User Action (@WaitingForUserActionJobs.Length)

+ + @foreach (var item in WaitingForUserActionJobs) + { + + + + + + } +
+ @item.DeviceSerialNumber + + @item.UserDisplayName (@item.UserId) + @if (!string.IsNullOrWhiteSpace(item.DeviceLocation)) + { + - @item.DeviceLocation + } + Since @item.WaitingForUserActionSince +
+
+ @{ + var DevicesReadyForReturn = Model.Where(i => i.ReadyForReturn && !i.WaitingForUserAction).ToArray(); + } +

Ready for Return (@DevicesReadyForReturn.Length)

+ + @foreach (var item in DevicesReadyForReturn) + { + + + + + + } +
+ @item.DeviceSerialNumber + + @item.UserDisplayName (@item.UserId) + @if (!string.IsNullOrWhiteSpace(item.DeviceLocation)) + { + - @item.DeviceLocation + } + Ready @item.ReadyForReturnSince +
+
+
diff --git a/Disco.Web/Areas/Public/Views/HeldDevices/Index.generated.cs b/Disco.Web/Areas/Public/Views/HeldDevices/Index.generated.cs new file mode 100644 index 00000000..61088d16 --- /dev/null +++ b/Disco.Web/Areas/Public/Views/HeldDevices/Index.generated.cs @@ -0,0 +1,597 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18033 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Disco.Web.Areas.Public.Views.HeldDevices +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Text; + using System.Web; + using System.Web.Helpers; + using System.Web.Mvc; + using System.Web.Mvc.Ajax; + using System.Web.Mvc.Html; + using System.Web.Routing; + using System.Web.Security; + using System.Web.UI; + using System.Web.WebPages; + using Disco.BI.Extensions; + using Disco.Models.Repository; + using Disco.Web; + using Disco.Web.Extensions; + + [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] + [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Public/Views/HeldDevices/Index.cshtml")] + public partial class Index : System.Web.Mvc.WebViewPage> + { + public Index() + { + } + public override void Execute() + { + + #line 2 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + ViewBag.Title = Html.ToBreadcrumb("Public Reports", MVC.Public.Public.Index(), "Held Devices", null); + Html.BundleDeferred("~/Style/Public/HeldDevices"); + + + #line default + #line hidden +WriteLiteral("\r\n\r\n \r\n"); + + + #line 8 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + + #line default + #line hidden + + #line 8 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + var DevicesInProcess = Model.Where(i => !i.ReadyForReturn && !i.WaitingForUserAction).ToArray(); + + + #line default + #line hidden +WriteLiteral("\r\n

In Process ("); + + + #line 11 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(DevicesInProcess.Length); + + + #line default + #line hidden +WriteLiteral(")

\r\n \r\n"); + + + #line 13 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + + #line default + #line hidden + + #line 13 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + foreach (var item in DevicesInProcess) + { + + + #line default + #line hidden +WriteLiteral(" \r\n \r\n"); + +WriteLiteral(" "); + + + #line 17 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.DeviceSerialNumber); + + + #line default + #line hidden +WriteLiteral("\r\n \r\n \r\n"); + + + #line 20 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + + #line default + #line hidden + + #line 20 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + if (item.UserId != null) + { + + + #line default + #line hidden +WriteLiteral(" "); + + + #line 22 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.UserDisplayName); + + + #line default + #line hidden +WriteLiteral(" ("); + + + #line 22 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.UserId); + + + #line default + #line hidden +WriteLiteral(")\r\n"); + + + #line 23 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + } + + + #line default + #line hidden +WriteLiteral(" "); + + + #line 24 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + if (!string.IsNullOrWhiteSpace(item.DeviceLocation)) + { + if (item.UserId != null) + { + + + #line default + #line hidden +WriteLiteral(" "); + +WriteLiteral(" - "); + +WriteLiteral("\r\n"); + + + #line 29 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + } + + + #line default + #line hidden + + #line 30 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.DeviceLocation); + + + #line default + #line hidden + + #line 30 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + } + else + { + if (item.UserId == null) + { + + + #line default + #line hidden + + #line 36 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.DeviceComputerName); + + + #line default + #line hidden + + #line 36 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + } + } + + + #line default + #line hidden +WriteLiteral(" "); + + + #line 39 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + if (!string.IsNullOrEmpty(item.EstimatedReturnTime)) + { + + + #line default + #line hidden +WriteLiteral(" (Expected: "); + + + #line 41 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.EstimatedReturnTime); + + + #line default + #line hidden +WriteLiteral(")\r\n"); + + + #line 42 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + } + + + #line default + #line hidden +WriteLiteral(" \r\n \r\n"); + + + #line 45 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + } + + + #line default + #line hidden +WriteLiteral(" \r\n \r\n \r\n"); + + + #line 49 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + + #line default + #line hidden + + #line 49 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + var WaitingForUserActionJobs = Model.Where(i => i.WaitingForUserAction).ToArray(); + + + #line default + #line hidden +WriteLiteral("\r\n

Waiting for User Action ("); + + + #line 52 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(WaitingForUserActionJobs.Length); + + + #line default + #line hidden +WriteLiteral(")

\r\n \r\n"); + + + #line 54 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + + #line default + #line hidden + + #line 54 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + foreach (var item in WaitingForUserActionJobs) + { + + + #line default + #line hidden +WriteLiteral(" \r\n \r\n"); + +WriteLiteral(" "); + + + #line 58 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.DeviceSerialNumber); + + + #line default + #line hidden +WriteLiteral("\r\n \r\n \r\n "); + + + #line 61 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.UserDisplayName); + + + #line default + #line hidden +WriteLiteral(" ("); + + + #line 61 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.UserId); + + + #line default + #line hidden +WriteLiteral(")\r\n"); + + + #line 62 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + + #line default + #line hidden + + #line 62 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + if (!string.IsNullOrWhiteSpace(item.DeviceLocation)) + { + + + #line default + #line hidden +WriteLiteral(" "); + +WriteLiteral(" - "); + + + #line 64 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + + #line default + #line hidden + + #line 64 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.DeviceLocation); + + + #line default + #line hidden + + #line 64 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + } + + + #line default + #line hidden +WriteLiteral(" \r\n (item.IsAlert ? " Alert" : string.Empty + + #line default + #line hidden +, 2775), false) +); + +WriteLiteral(">Since "); + + + #line 67 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.WaitingForUserActionSince); + + + #line default + #line hidden +WriteLiteral("\r\n \r\n \r\n"); + + + #line 70 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + } + + + #line default + #line hidden +WriteLiteral(" \r\n
\r\n"); + + + #line 73 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + + #line default + #line hidden + + #line 73 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + var DevicesReadyForReturn = Model.Where(i => i.ReadyForReturn && !i.WaitingForUserAction).ToArray(); + + + #line default + #line hidden +WriteLiteral("\r\n

Ready for Return ("); + + + #line 76 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(DevicesReadyForReturn.Length); + + + #line default + #line hidden +WriteLiteral(")

\r\n \r\n"); + + + #line 78 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + + #line default + #line hidden + + #line 78 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + foreach (var item in DevicesReadyForReturn) + { + + + #line default + #line hidden +WriteLiteral(" \r\n \r\n"); + +WriteLiteral(" "); + + + #line 82 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.DeviceSerialNumber); + + + #line default + #line hidden +WriteLiteral("\r\n \r\n \r\n "); + + + #line 85 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.UserDisplayName); + + + #line default + #line hidden +WriteLiteral(" ("); + + + #line 85 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.UserId); + + + #line default + #line hidden +WriteLiteral(")\r\n"); + + + #line 86 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + + #line default + #line hidden + + #line 86 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + if (!string.IsNullOrWhiteSpace(item.DeviceLocation)) + { + + + #line default + #line hidden +WriteLiteral(" "); + +WriteLiteral(" - "); + + + #line 88 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + + #line default + #line hidden + + #line 88 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.DeviceLocation); + + + #line default + #line hidden + + #line 88 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + + } + + + #line default + #line hidden +WriteLiteral(" \r\n (item.IsAlert ? " Alert" : string.Empty + + #line default + #line hidden +, 3804), false) +); + +WriteLiteral(">Ready "); + + + #line 91 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + Write(item.ReadyForReturnSince); + + + #line default + #line hidden +WriteLiteral("\r\n \r\n \r\n"); + + + #line 94 "..\..\Areas\Public\Views\HeldDevices\Index.cshtml" + } + + + #line default + #line hidden +WriteLiteral(" \r\n \r\n\r\n"); + + } + } +} +#pragma warning restore 1591 diff --git a/Disco.Web/Areas/Public/Views/HeldDevices/Noticeboard.cshtml b/Disco.Web/Areas/Public/Views/HeldDevices/Noticeboard.cshtml new file mode 100644 index 00000000..2ba72722 --- /dev/null +++ b/Disco.Web/Areas/Public/Views/HeldDevices/Noticeboard.cshtml @@ -0,0 +1,476 @@ +@{ + Layout = null; + Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR"); + Html.BundleDeferred("~/ClientScripts/Core"); + Html.BundleDeferred("~/Style/Public/HeldDevicesNoticeboard"); +} + + + + + + Disco - Held Devices + @Html.BundleRenderDeferred() + + +
+
+ Held Devices +
+
+
+

In Process +

+
+
    +
+
+
+
+

Ready for Return +

+
+
    +
+
+
+
+

Waiting for User Action +

+
+
    +
+
+
+
+
+
+
+ + + +
+ Disco Logo + powered by Disco +
+ + diff --git a/Disco.Web/Areas/Public/Views/HeldDevices/Noticeboard.generated.cs b/Disco.Web/Areas/Public/Views/HeldDevices/Noticeboard.generated.cs new file mode 100644 index 00000000..b29700f6 --- /dev/null +++ b/Disco.Web/Areas/Public/Views/HeldDevices/Noticeboard.generated.cs @@ -0,0 +1,494 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18033 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Disco.Web.Areas.Public.Views.HeldDevices +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Text; + using System.Web; + using System.Web.Helpers; + using System.Web.Mvc; + using System.Web.Mvc.Ajax; + using System.Web.Mvc.Html; + using System.Web.Routing; + using System.Web.Security; + using System.Web.UI; + using System.Web.WebPages; + using Disco.BI.Extensions; + using Disco.Models.Repository; + using Disco.Web; + using Disco.Web.Extensions; + + [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] + [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Public/Views/HeldDevices/Noticeboard.cshtml")] + public partial class Noticeboard : System.Web.Mvc.WebViewPage + { + public Noticeboard() + { + } + public override void Execute() + { + + #line 1 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml" + + Layout = null; + Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR"); + Html.BundleDeferred("~/ClientScripts/Core"); + Html.BundleDeferred("~/Style/Public/HeldDevicesNoticeboard"); + + + #line default + #line hidden +WriteLiteral("\r\n\r\n\r\n\r\n \r\n \r\n Disco - Held Devices\r\n"); + +WriteLiteral(" "); + + + #line 13 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml" +Write(Html.BundleRenderDeferred()); + + + #line default + #line hidden +WriteLiteral("\r\n\r\n\r\n \r\n \r\n Held Devices\r\n \r\n \r\n \r\n

In Process \r\n

\r\n \r\n
    \r\n
\r\n \r\n " + +" \r\n \r\n

Ready for Return \r\n

\r\n \r\n
    \r\n
\r\n \r\n " + +" \r\n \r\n

Waiting for User Action \r\n

\r\n \r\n
    \r\n
\r\n \r\n " + +" \r\n \r\n
\r\n
\r\n " + +"\r\n \r\n // Resizing\r\n $(function () {\r\n var $inProcess = $(\'" + +"#inProcess\');\r\n var $inProcessContent = $inProcess.find(\'.content\');\r" + +"\n var $inProcessHeader = $inProcess.find(\'.h3\');\r\n var $re" + +"adyForReturn = $(\'#readyForReturn\');\r\n var $readyForReturnContent = $" + +"readyForReturn.find(\'.content\');\r\n var $readyForReturnHeader = $ready" + +"ForReturn.find(\'.h3\');\r\n var $waitingForUserAction = $(\'#waitingForUs" + +"erAction\');\r\n var $waitingForUserActionContent = $waitingForUserActio" + +"n.find(\'.content\');\r\n var $waitingForUserActionHeader = $waitingForUs" + +"erAction.find(\'.h3\');\r\n var $mainSection = $(\'#mainSection\');\r\n " + +" var $mainHeader = $(\'#mainHeader\');\r\n var $mainFooter = $(\'#mai" + +"nFooter\');\r\n\r\n var onResize = function () {\r\n var widt" + +"h = $mainSection.width();\r\n var height = $(window).height() - $ma" + +"inHeader.outerHeight() - $mainFooter.outerHeight() - 25;\r\n\r\n $inP" + +"rocess.height(height);\r\n $inProcess.width((width * .28) - 11);\r\n " + +" $inProcessContent.height(height - $inProcessHeader.outerHeight() " + +"- 56);\r\n\r\n $readyForReturn.height(height);\r\n $read" + +"yForReturn.width((width * .36) - 11);\r\n $readyForReturnContent.he" + +"ight(height - $readyForReturnHeader.outerHeight() - 56);\r\n\r\n $wai" + +"tingForUserAction.height(height);\r\n $waitingForUserAction.width((" + +"width * .36) - 11);\r\n $waitingForUserActionContent.height(height " + +"- $waitingForUserActionHeader.outerHeight() - 56);\r\n };\r\n\r\n " + +" $(window).resize(onResize);\r\n onResize();\r\n });\r\n \r\n + // Hide Mouse Mouse + $(function () { + var mouseVisible = true; + var mouseHideToken; + var documentBody = $('body'); + + var hideMouse = function () { + if (mouseVisible) { + documentBody.css('cursor', 'none'); + mouseVisible = false; + } + }; + var showMouse = function () { + if (!mouseVisible) { + documentBody.css('cursor', 'auto'); + mouseVisible = true; + } + }; + + $(document).mousemove(function () { + showMouse(); + if (mouseHideToken) + window.clearTimeout(mouseHideToken); + mouseHideToken = window.setTimeout(hideMouse, 2000); + }); + }); + + \r\n $(function () {\r\n var models = {};\r\n var modelsI" + +"nProcessSorted = [];\r\n var modelsInProcessCount = 0;\r\n var" + +" modelsReadyForReturnSorted = [];\r\n var modelsReadyForReturnCount = 0" + +";\r\n var modelsWaitingForUserActionSorted = [];\r\n var model" + +"sWaitingForUserActionCount = 0;\r\n var $inProcess = $(\'#inProcess\');\r\n" + +" var $inProcessContent = $inProcess.find(\'.content ul\');\r\n " + +" var $readyForReturn = $(\'#readyForReturn\');\r\n var $readyForReturnCon" + +"tent = $readyForReturn.find(\'.content ul\');\r\n var $waitingForUserActi" + +"on = $(\'#waitingForUserAction\');\r\n var $waitingForUserActionContent =" + +" $waitingForUserAction.find(\'.content ul\');\r\n var modelsInProcessInde" + +"xOffset = 0;\r\n var scrollInProcessToken = null;\r\n var mode" + +"lsReadyForReturnIndexOffset = 0;\r\n var scrollReadyForReturnToken = nu" + +"ll;\r\n var modelsWaitingForUserActionIndexOffset = 0;\r\n var" + +" scrollWaitingForUserActionToken = null;\r\n var scrollSpeed = 3000;\r\n " + +" var persistantConnection = null;\r\n var filterDeviceAddress" + +"Include;\r\n var filterDeviceAddressExclude;\r\n var filterDev" + +"iceProfileInclude;\r\n var filterDeviceProfileExclude;\r\n\r\n v" + +"ar getParameterByName = function (name) {\r\n name = name.replace(/" + +"[\\[]/, \"\\\\\\[\").replace(/[\\]]/, \"\\\\\\]\");\r\n var regexS = \"[\\\\?&]\" +" + +" name + \"=([^&#]*)\";\r\n var regex = new RegExp(regexS);\r\n " + +" var results = regex.exec(window.location.search);\r\n if (re" + +"sults == null)\r\n return \"\";\r\n else\r\n " + +" return decodeURIComponent(results[1].replace(/\\+/g, \" \"));\r\n " + +" }\r\n\r\n var buildFilters = function () {\r\n var deviceA" + +"ddressInclude = getParameterByName(\'deviceAddressInclude\');\r\n if " + +"(deviceAddressInclude) {\r\n filterDeviceAddressInclude = {};\r\n" + +" var split = deviceAddressInclude.split(\",\");\r\n " + +" for (var i = 0; i < split.length; i++) {\r\n filterDe" + +"viceAddressInclude[split[i].toLowerCase()] = true;\r\n }\r\n " + +" } else {\r\n var deviceAddressExclude = getParameter" + +"ByName(\'deviceAddressExclude\');\r\n if (deviceAddressExclude) {" + +"\r\n filterDeviceAddressExclude = {};\r\n " + +" var split = deviceAddressExclude.split(\",\");\r\n for (v" + +"ar i = 0; i < split.length; i++) {\r\n filterDeviceAddr" + +"essExclude[split[i].toLowerCase()] = true;\r\n }\r\n " + +" } else {\r\n var deviceProfileInclude = getParam" + +"eterByName(\'deviceProfileInclude\');\r\n if (deviceProfileIn" + +"clude) {\r\n filterDeviceProfileInclude = {};\r\n " + +" var deviceProfileIncludeSplit = deviceProfileInclude.split(\"" + +",\");\r\n for (var i = 0; i < deviceProfileIncludeSplit." + +"length; i++) {\r\n filterDeviceProfileInclude[parse" + +"Int(deviceProfileIncludeSplit[i])] = true;\r\n }\r\n " + +" } else {\r\n var deviceProfileExclud" + +"e = getParameterByName(\'deviceProfileExclude\');\r\n if " + +"(deviceProfileExclude) {\r\n filterDeviceProfileExc" + +"lude = {};\r\n var deviceProfileExcludeSplit = devi" + +"ceProfileExclude.split(\",\");\r\n for (var i = 0; i " + +"< deviceProfileExcludeSplit.length; i++) {\r\n " + +"filterDeviceProfileExclude[parseInt(deviceProfileExcludeSplit[i])] = true;\r\n " + +" }\r\n }\r\n " + +" }\r\n }\r\n }\r\n }\r\n va" + +"r calculateFilter = function (model) {\r\n if (model) {\r\n " + +" if (filterDeviceAddressInclude) {\r\n return (fil" + +"terDeviceAddressInclude[model.DeviceAddress.toLowerCase()] == true)\r\n " + +" }\r\n if (filterDeviceAddressExclude) {\r\n " + +" return (!filterDeviceAddressExclude[model.DeviceAddress.toLowerCase()" + +"])\r\n }\r\n if (filterDeviceProfileInclude) {" + +"\r\n return (filterDeviceProfileInclude[model.DeviceProfile" + +"Id] == true)\r\n }\r\n if (filterDeviceProfile" + +"Exclude) {\r\n return (!filterDeviceProfileExclude[model.De" + +"viceProfileId])\r\n }\r\n return true;\r\n " + +" }\r\n return false;\r\n }\r\n\r\n var sor" + +"tModels = function () {\r\n modelsInProcessSorted = [];\r\n " + +" modelsReadyForReturnSorted = [];\r\n modelsWaitingForUserActi" + +"onSorted = [];\r\n var modelSortFunc = function (a, b) {\r\n " + +" if (a.DeviceSerialNumber.toUpperCase() == b.DeviceSerialNumber.toUppe" + +"rCase()) {\r\n return 0;\r\n } else {\r\n " + +" if (a.DeviceSerialNumber.toUpperCase() < b.DeviceSerialNumb" + +"er.toUpperCase()) {\r\n return -1\r\n " + +" } else {\r\n return 1\r\n }\r\n " + +" }\r\n };\r\n for (var key in models" + +") {\r\n var model = models[key];\r\n if (model" + +") {\r\n if (model.WaitingForUserAction) {\r\n " + +" modelsWaitingForUserActionSorted.push(model);\r\n " + +" } else {\r\n if (model.ReadyForReturn) {\r\n " + +" modelsReadyForReturnSorted.push(model);\r\n " + +" } else {\r\n modelsInProcessSorted.push(" + +"model);\r\n }\r\n }\r\n " + +" }\r\n }\r\n modelsReadyForReturnSorted = models" + +"ReadyForReturnSorted.sort(modelSortFunc);\r\n modelsInProcessSorted" + +" = modelsInProcessSorted.sort(modelSortFunc);\r\n modelsWaitingForU" + +"serActionSorted = modelsWaitingForUserActionSorted.sort(modelSortFunc);\r\n\r\n " + +" if (modelsInProcessSorted.length != modelsInProcessCount) {\r\n " + +" modelsInProcessCount = modelsInProcessSorted.length;\r\n " + +" $(\'#inProcessCount\').text(\'(\' + modelsInProcessCount + \')\');\r\n " + +" }\r\n if (modelsReadyForReturnSorted.length != modelsReadyForRe" + +"turnCount) {\r\n modelsReadyForReturnCount = modelsReadyForRetu" + +"rnSorted.length;\r\n $(\'#readyForReturnCount\').text(\'(\' + model" + +"sReadyForReturnCount + \')\');\r\n }\r\n if (modelsWaiti" + +"ngForUserActionSorted.length != modelsWaitingForUserActionCount) {\r\n " + +" modelsWaitingForUserActionCount = modelsWaitingForUserActionSorted.lengt" + +"h;\r\n $(\'#waitingForUserActionCount\').text(\'(\' + modelsWaiting" + +"ForUserActionCount + \')\');\r\n }\r\n\r\n };\r\n\r\n v" + +"ar scrollReadyForReturn = function () {\r\n $readyForReturnContent." + +"find(\'li\').last().detach().prependTo($readyForReturnContent).hide().slideDown(\'s" + +"low\');\r\n modelsReadyForReturnIndexOffset++;\r\n if (" + +"modelsReadyForReturnIndexOffset >= modelsReadyForReturnSorted.length) {\r\n " + +" modelsReadyForReturnIndexOffset = 0;\r\n }\r\n " + +" scrollReadyForReturnToken = window.setTimeout(scrollReadyForReturn, scroll" + +"Speed);\r\n };\r\n var updateScrollReadyForReturn = function (" + +") {\r\n var containerHeight = $readyForReturn.find(\'.content\').heig" + +"ht();\r\n var contentHeight = $readyForReturnContent.height();\r\n " + +" if (containerHeight >= contentHeight && scrollReadyForReturnToken) " + +"{\r\n window.clearTimeout(scrollReadyForReturnToken);\r\n " + +" return;\r\n }\r\n if (containerHeight < co" + +"ntentHeight && scrollReadyForReturnToken == null) {\r\n scrollR" + +"eadyForReturnToken = window.setTimeout(scrollReadyForReturn, scrollSpeed);\r\n " + +" }\r\n };\r\n var scrollInProcess = function () {\r\n" + +" $inProcessContent.find(\'li\').last().detach().prependTo($inProces" + +"sContent).hide().slideDown(\'slow\');\r\n modelsInProcessIndexOffset+" + +"+;\r\n if (modelsInProcessIndexOffset >= modelsInProcessSorted.leng" + +"th) {\r\n modelsInProcessIndexOffset = 0;\r\n }\r\n " + +" scrollInProcessToken = window.setTimeout(scrollInProcess, scrollS" + +"peed);\r\n };\r\n var updateScrollInProcess = function () {\r\n " + +" var containerHeight = $inProcess.find(\'.content\').height();\r\n " + +" var contentHeight = $inProcessContent.height();\r\n if " + +"(containerHeight >= contentHeight && scrollInProcessToken) {\r\n " + +" window.clearTimeout(scrollInProcessToken);\r\n return;\r\n " + +" }\r\n if (containerHeight < contentHeight && scrollInPro" + +"cessToken == null) {\r\n scrollInProcessToken = window.setTimeo" + +"ut(scrollInProcess, scrollSpeed);\r\n }\r\n };\r\n " + +" var scrollWaitingForUserAction = function () {\r\n $waitingForUse" + +"rActionContent.find(\'li\').last().detach().prependTo($waitingForUserActionContent" + +").hide().slideDown(\'slow\');\r\n modelsInProcessIndexOffset++;\r\n " + +" if (modelsWaitingForUserActionIndexOffset >= modelsWaitingForUserAct" + +"ionSorted.length) {\r\n modelsWaitingForUserActionIndexOffset =" + +" 0;\r\n }\r\n scrollWaitingForUserActionToken = window" + +".setTimeout(scrollWaitingForUserAction, scrollSpeed);\r\n };\r\n " + +" var updateScrollWaitingForUserAction = function () {\r\n var con" + +"tainerHeight = $waitingForUserAction.find(\'.content\').height();\r\n " + +" var contentHeight = $waitingForUserActionContent.height();\r\n if " + +"(containerHeight >= contentHeight && scrollWaitingForUserActionToken) {\r\n " + +" window.clearTimeout(scrollWaitingForUserActionToken);\r\n " + +" return;\r\n }\r\n if (containerHeight < conten" + +"tHeight && scrollWaitingForUserActionToken == null) {\r\n scrol" + +"lWaitingForUserActionToken = window.setTimeout(scrollWaitingForUserAction, scrol" + +"lSpeed);\r\n }\r\n };\r\n\r\n var modelInsertIndex " + +"= function (model) {\r\n sortModels();\r\n var findInd" + +"ex = function (model, array, offset) {\r\n for (var i = 0; i < " + +"array.length; i++) {\r\n if (model.DeviceSerialNumber == ar" + +"ray[i].DeviceSerialNumber) {\r\n var index = i + offset" + +";\r\n if (index > (array.length - 1)) {\r\n " + +" index = index - (array.length - 1);\r\n " + +" }\r\n return index;\r\n }\r\n " + +" };\r\n };\r\n if (model.WaitingForUser" + +"Action) {\r\n return findIndex(model, modelsWaitingForUserActio" + +"nSorted, modelsWaitingForUserActionIndexOffset);\r\n } else {\r\n " + +" if (model.ReadyForReturn) {\r\n return find" + +"Index(model, modelsReadyForReturnSorted, modelsReadyForReturnIndexOffset);\r\n " + +" } else {\r\n return findIndex(model, models" + +"InProcessSorted, modelsInProcessIndexOffset);\r\n }\r\n " + +" }\r\n }\r\n var modelInsert = function (model) {\r\n " + +" var index = modelInsertIndex(model);\r\n var insertTo = f" + +"unction (model, host) {\r\n var hostLi = host.children(\'li\');\r\n" + +" if (hostLi.length == 0 || hostLi.length < index) {\r\n " + +" host.append(model.htmlLi);\r\n } else {\r\n " + +" if (index == 0) {\r\n host.prepend(mo" + +"del.htmlLi);\r\n } else {\r\n $(ho" + +"stLi.get(index - 1)).after(model.htmlLi);\r\n }\r\n " + +" }\r\n }\r\n if (model.WaitingForUserAction) " + +"{\r\n insertTo(model, $waitingForUserActionContent);\r\n " + +" window.setTimeout(updateScrollWaitingForUserAction, 100);\r\n " + +" } else {\r\n if (model.ReadyForReturn) {\r\n " + +" insertTo(model, $readyForReturnContent);\r\n windo" + +"w.setTimeout(updateScrollReadyForReturn, 100);\r\n } else {\r\n " + +" insertTo(model, $inProcessContent);\r\n " + +" window.setTimeout(updateScrollInProcess, 100);\r\n }\r\n " + +" }\r\n }\r\n\r\n var removeModel = function (model) {\r\n" + +" if (model) {\r\n model.htmlLi.slideUp(\'fast\', f" + +"unction () {\r\n model.htmlLi.remove();\r\n " + +" });\r\n }\r\n };\r\n\r\n var processModel = funct" + +"ion (id, model, init) {\r\n if (!calculateFilter(model)) {\r\n " + +" removeModel(models[id]);\r\n delete models[id];\r\n " + +" sortModels();\r\n } else {\r\n " + +"var existing = models[id];\r\n models[id] = model;\r\n\r\n " + +" // Add\r\n model.htmlContent = $(\'
\').text(model" + +".DeviceDescription);\r\n if (!model.ReadyForReturn && model.Est" + +"imatedReturnTime) {\r\n model.htmlContent.append($(\'\').text(\' (Expected: \' + model.EstimatedReturnTime + \')\'));\r\n " + +" }\r\n if (model.WaitingForUserAction) {\r\n " + +" model.htmlContent.append($(\'\').text(\' (Since" + +" \' + model.WaitingForUserActionSince + \')\'));\r\n } else {\r\n " + +" if (model.ReadyForReturn && model.ReadyForReturnSince) {\r\n " + +" model.htmlContent.append($(\'\').te" + +"xt(\' (Ready \' + model.ReadyForReturnSince + \')\'));\r\n }\r\n " + +" }\r\n\r\n if (existing) {\r\n " + +" if (existing.ReadyForReturn != model.ReadyForReturn || existing.WaitingForU" + +"serAction != model.WaitingForUserAction) {\r\n removeMo" + +"del(existing);\r\n model.htmlLi = $(\'
  • \').html(model." + +"htmlContent).data(\'ModelId\', id).hide();\r\n modelInser" + +"t(model);\r\n if (init) {\r\n " + +" model.htmlLi.fadeIn();\r\n } else {\r\n " + +" model.htmlLi.slideDown();\r\n }\r\n " + +" } else {\r\n model.htmlLi = existin" + +"g.htmlLi;\r\n model.htmlLi.slideUp(\'fast\', function () " + +"{\r\n model.htmlLi.html(model.htmlContent).slideDow" + +"n();\r\n });\r\n }\r\n " + +" } else {\r\n model.htmlLi = $(\'
  • \').html(model.html" + +"Content).data(\'ModelId\', id).hide();\r\n modelInsert(model)" + +";\r\n if (init) {\r\n model.htmlLi" + +".fadeIn();\r\n } else {\r\n model." + +"htmlLi.slideDown(\'slow\');\r\n }\r\n }\r\n " + +" if (model.htmlLi && model.IsAlert) {\r\n m" + +"odel.htmlLi.addClass(\'alert\');\r\n }\r\n }\r\n " + +" };\r\n\r\n var updatedModel = function (id) {\r\n var " + +"deviceSerialNumber = id.toString();\r\n\r\n $.ajax({\r\n " + +" dataType: \'json\',\r\n url: \'"); + + + #line 432 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml" + Write(Url.Action(MVC.Public.HeldDevices.HeldDevice())); + + + #line default + #line hidden +WriteLiteral(@"', + data: { id: deviceSerialNumber }, + success: function (data) { + processModel(deviceSerialNumber, data, false); + }, + error: function (jqXHR, textStatus, errorThrown) { + if (textStatus == 'parsererror') // null Result + processModel(deviceSerialNumber, null, false); + } + }) + }; + + var connectionError = function () { + if (persistantConnection) { + persistantConnection.stop(); + persistantConnection = null; + window.setTimeout(function () { + window.location.href = '"); + + + #line 449 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml" + Write(Url.Action(MVC.Public.HeldDevices.Noticeboard())); + + + #line default + #line hidden +WriteLiteral("\';\r\n }, 10000);\r\n }\r\n }\r\n\r\n " + +" var init = function () {\r\n buildFilters();\r\n " + +" persistantConnection = $.connection(\'"); + + + #line 456 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml" + Write(Url.Content("~/Public/HeldDevices/Notifications")); + + + #line default + #line hidden +WriteLiteral("\');\r\n persistantConnection.received(updatedModel);\r\n " + +" persistantConnection.error(connectionError);\r\n persistantConnec" + +"tion.start(function () {\r\n $.getJSON(\'"); + + + #line 460 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml" + Write(Url.Action(MVC.Public.HeldDevices.HeldDevices())); + + + #line default + #line hidden +WriteLiteral(@"', null, function (data) { + for (var i = 0; i < data.length; i++) { + processModel(data[i].DeviceSerialNumber, data[i], true); + } + }); + }); + }; + init(); + + }); + + \r\n (Links.ClientSource.Style.Images.Icon32_png + + #line default + #line hidden +, 22633), false) +); + +WriteLiteral(" alt=\"Disco Logo\""); + +WriteLiteral(" />\r\n powered by Disco\r\n
  • \r\n\r\n\r\n"); + + } + } +} +#pragma warning restore 1591 diff --git a/Disco.Web/Areas/Public/Views/Public/Index.cshtml b/Disco.Web/Areas/Public/Views/Public/Index.cshtml index a026d247..35c0f0b3 100644 --- a/Disco.Web/Areas/Public/Views/Public/Index.cshtml +++ b/Disco.Web/Areas/Public/Views/Public/Index.cshtml @@ -5,8 +5,7 @@ \r\n"); + +WriteLiteral(" "); + + + #line 32 "..\..\Areas\Public\Views\Public\Index.cshtml" + Write(Html.ActionLinkClass("Noticeboard", MVC.Public.HeldDevices.Noticeboard(), "noticeboard")); + + + #line default + #line hidden +WriteLiteral("\r\n + Display a full-screen active noticeboard screen which lists devices involved in current + jobs where the device is held by the technicians. Also displays devices which are ready to be collected. + + + + + +"); } } diff --git a/Disco.Web/Areas/Public/Views/UserHeldDevices/Index.cshtml b/Disco.Web/Areas/Public/Views/UserHeldDevices/Index.cshtml index a81345c6..8dd7ed99 100644 --- a/Disco.Web/Areas/Public/Views/UserHeldDevices/Index.cshtml +++ b/Disco.Web/Areas/Public/Views/UserHeldDevices/Index.cshtml @@ -1,7 +1,7 @@ @model IEnumerable @{ - ViewBag.Title = Html.ToBreadcrumb("Public Reports", MVC.Public.Public.Index(), "Technician Held Devices", null); - Html.BundleDeferred("~/Style/Public/UserHeldDevices"); + ViewBag.Title = Html.ToBreadcrumb("Public Reports", MVC.Public.Public.Index(), "Held Devices for Users", null); + Html.BundleDeferred("~/Style/Public/HeldDevices"); }
    @@ -14,10 +14,10 @@ @foreach (var item in DevicesInProcess) { - + @item.UserId - + @item.UserDisplayName@{ if (!string.IsNullOrEmpty(item.EstimatedReturnTime)) { @@ -39,10 +39,10 @@ @foreach (var item in WaitingForUserActionJobs) { - + @item.UserId - + @item.UserDisplayName @@ -61,10 +61,10 @@ @foreach (var item in DevicesReadyForReturn) { - + @item.UserId - + @item.UserDisplayName diff --git a/Disco.Web/Areas/Public/Views/UserHeldDevices/Index.generated.cs b/Disco.Web/Areas/Public/Views/UserHeldDevices/Index.generated.cs index 0083569a..a4d4149e 100644 --- a/Disco.Web/Areas/Public/Views/UserHeldDevices/Index.generated.cs +++ b/Disco.Web/Areas/Public/Views/UserHeldDevices/Index.generated.cs @@ -43,8 +43,8 @@ namespace Disco.Web.Areas.Public.Views.UserHeldDevices #line 2 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml" - ViewBag.Title = Html.ToBreadcrumb("Public Reports", MVC.Public.Public.Index(), "Technician Held Devices", null); - Html.BundleDeferred("~/Style/Public/UserHeldDevices"); + ViewBag.Title = Html.ToBreadcrumb("Public Reports", MVC.Public.Public.Index(), "Held Devices for Users", null); + Html.BundleDeferred("~/Style/Public/HeldDevices"); #line default @@ -104,7 +104,7 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" \r\n \r\n"); @@ -119,7 +119,7 @@ WriteLiteral(" "); #line hidden WriteLiteral("\r\n \r\n \r\n"); @@ -223,7 +223,7 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" \r\n \r\n"); @@ -238,7 +238,7 @@ WriteLiteral(" "); #line hidden WriteLiteral("\r\n \r\n \r\n"); @@ -253,15 +253,15 @@ WriteLiteral(" "); #line hidden WriteLiteral("\r\n \r\n (item.IsAlert ? " Alert" : string.Empty +, Tuple.Create(Tuple.Create("", 1812), Tuple.Create(item.IsAlert ? " Alert" : string.Empty #line default #line hidden -, 1833), false) +, 1812), false) ); WriteLiteral(">\r\n Since "); @@ -329,7 +329,7 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" \r\n \r\n"); @@ -344,7 +344,7 @@ WriteLiteral(" "); #line hidden WriteLiteral("\r\n \r\n \r\n"); @@ -359,15 +359,15 @@ WriteLiteral(" "); #line hidden WriteLiteral("\r\n \r\n (item.IsAlert ? " Alert" : string.Empty +, Tuple.Create(Tuple.Create("", 2629), Tuple.Create(item.IsAlert ? " Alert" : string.Empty #line default #line hidden -, 2658), false) +, 2629), false) ); WriteLiteral(">\r\n Ready "); diff --git a/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.cshtml b/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.cshtml index eaedc92e..017891fd 100644 --- a/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.cshtml +++ b/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.cshtml @@ -2,20 +2,20 @@ Layout = null; Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR"); Html.BundleDeferred("~/ClientScripts/Core"); - Html.BundleDeferred("~/Style/Public/UserHeldDevicesNoticeboard"); + Html.BundleDeferred("~/Style/Public/HeldDevicesNoticeboard"); } - Disco - Technician Held Devices + Disco - Technician Held Devices for Users @Html.BundleRenderDeferred()
    - Technician Held Devices + Technician Held Devices for Users
    @@ -368,33 +368,12 @@ var removeModel = function (model) { if (model) { - if (model.updateAtToken) { - window.clearTimeout(model.updateAtToken); - }; model.htmlLi.slideUp('fast', function () { model.htmlLi.remove(); }); } }; - var scheduleModelUpdate = function (model) { - if (model.updateAtToken) { - window.clearTimeout(model.updateAtToken); - }; - if (model.UpdateAt) { - if (typeof model.UpdateAt == 'string' && model.UpdateAt.indexOf('\/Date(') == 0) { - model.UpdateAt = new Date(parseInt(model.UpdateAt.substr(6))); - } - var nowMilliseconds = new Date().getTime(); - var updateAtMilliseconds = (model.UpdateAt - nowMilliseconds); - if (updateAtMilliseconds > 0) { - model.updateAtToken = window.setTimeout(function () { updatedModel(model.UserId); }, updateAtMilliseconds); - } else { - model.UpdateAt = null; - } - } - }; - var processModel = function (id, model, init) { if (!calculateFilter(model)) { removeModel(models[id]); @@ -428,9 +407,6 @@ model.htmlLi.slideDown(); } } else { - if (existing.updateAtToken) { - window.clearTimeout(existing.updateAtToken); - }; model.htmlLi = existing.htmlLi; model.htmlLi.slideUp('fast', function () { model.htmlLi.html(model.htmlContent).slideDown(); @@ -448,7 +424,6 @@ if (model.htmlLi && model.IsAlert) { model.htmlLi.addClass('alert'); } - scheduleModelUpdate(model); } }; diff --git a/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.generated.cs b/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.generated.cs index 5a211489..a3bbdeb1 100644 --- a/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.generated.cs +++ b/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.generated.cs @@ -46,7 +46,7 @@ namespace Disco.Web.Areas.Public.Views.UserHeldDevices Layout = null; Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR"); Html.BundleDeferred("~/ClientScripts/Core"); - Html.BundleDeferred("~/Style/Public/UserHeldDevicesNoticeboard"); + Html.BundleDeferred("~/Style/Public/HeldDevicesNoticeboard"); #line default @@ -61,7 +61,7 @@ WriteLiteral(" http-equiv=\"X-UA-Compatible\""); WriteLiteral(" content=\"IE=edge\""); -WriteLiteral(" />\r\n Disco - Technician Held Devices\r\n"); +WriteLiteral(" />\r\n Disco - Technician Held Devices for Users\r\n"); WriteLiteral(" "); @@ -80,7 +80,7 @@ WriteLiteral(">\r\n \r\n Technician Held Devices\r\n \r\n \r\n Technician Held Devices for Users\r\n \r\n \r\n $(function () {\r\n var models = {};\r\n " } else {\r\n insertTo(model, $inProcessContent);\r\n " + " window.setTimeout(updateScrollInProcess, 100);\r\n " + " }\r\n }\r\n }\r\n\r\n var removeModel = " + -"function (model) {\r\n if (model) {\r\n if (model." + -"updateAtToken) {\r\n window.clearTimeout(model.updateAtToke" + -"n);\r\n };\r\n model.htmlLi.slideUp(\'fast\', fu" + -"nction () {\r\n model.htmlLi.remove();\r\n " + -" });\r\n }\r\n };\r\n\r\n var scheduleModelUpdate =" + -" function (model) {\r\n if (model.updateAtToken) {\r\n " + -" window.clearTimeout(model.updateAtToken);\r\n };\r\n " + -" if (model.UpdateAt) {\r\n if (typeof model.UpdateAt == \'str" + -"ing\' && model.UpdateAt.indexOf(\'\\/Date(\') == 0) {\r\n model" + -".UpdateAt = new Date(parseInt(model.UpdateAt.substr(6)));\r\n }" + -"\r\n var nowMilliseconds = new Date().getTime();\r\n " + -" var updateAtMilliseconds = (model.UpdateAt - nowMilliseconds);\r\n " + -" if (updateAtMilliseconds > 0) {\r\n model.update" + -"AtToken = window.setTimeout(function () { updatedModel(model.UserId); }, updateA" + -"tMilliseconds);\r\n } else {\r\n model.Upd" + -"ateAt = null;\r\n }\r\n }\r\n };\r\n\r\n " + -" var processModel = function (id, model, init) {\r\n if (!cal" + -"culateFilter(model)) {\r\n removeModel(models[id]);\r\n " + -" delete models[id];\r\n sortModels();\r\n " + -" } else {\r\n var existing = models[id];\r\n m" + -"odels[id] = model;\r\n\r\n // Add\r\n model.html" + -"Content = $(\'
    \').text(model.UserId + \' - \' + model.UserDisplayName);\r\n " + -" if (!model.ReadyForReturn && model.EstimatedReturnTime) {\r\n " + -" model.htmlContent.append($(\'\').text(\' (Expe" + -"cted: \' + model.EstimatedReturnTime + \')\'));\r\n }\r\n " + -" if (model.WaitingForUserAction) {\r\n model.htmlCo" + -"ntent.append($(\'\').text(\' (Since \' + model.WaitingForUserAct" + -"ionSince + \')\'));\r\n } else {\r\n if (mod" + -"el.ReadyForReturn && model.ReadyForReturnSince) {\r\n m" + -"odel.htmlContent.append($(\'\').text(\' (Ready \' + model.ReadyF" + -"orReturnSince + \')\'));\r\n }\r\n }\r\n\r\n " + -" if (existing) {\r\n if (existing.ReadyForRe" + -"turn != model.ReadyForReturn || existing.WaitingForUserAction != model.WaitingFo" + -"rUserAction) {\r\n removeModel(existing);\r\n " + -" model.htmlLi = $(\'
  • \').html(model.htmlContent).data(\'ModelId\'," + -" id).hide();\r\n modelInsert(model);\r\n " + -" if (init) {\r\n model.htmlLi.fadeIn();\r\n" + -" } else {\r\n model.html" + -"Li.slideDown();\r\n }\r\n } else {" + -"\r\n if (existing.updateAtToken) {\r\n " + -" window.clearTimeout(existing.updateAtToken);\r\n " + -" };\r\n model.htmlLi = existing.htmlLi;\r\n " + -" model.htmlLi.slideUp(\'fast\', function () {\r\n " + -" model.htmlLi.html(model.htmlContent).slideDown();\r\n " + -" });\r\n }\r\n } else {\r\n " + -" model.htmlLi = $(\'
  • \').html(model.htmlContent).data(\'Mode" + -"lId\', id).hide();\r\n modelInsert(model);\r\n " + -" if (init) {\r\n model.htmlLi.fadeIn();\r\n " + -" } else {\r\n model.htmlLi.slideDown(\'s" + -"low\');\r\n }\r\n }\r\n if" + -" (model.htmlLi && model.IsAlert) {\r\n model.htmlLi.addClas" + -"s(\'alert\');\r\n }\r\n scheduleModelUpdate(mode" + -"l);\r\n }\r\n };\r\n\r\n var updatedModel = functio" + -"n (id) {\r\n var userId = id.toString();\r\n\r\n $.ajax(" + -"{\r\n dataType: \'json\',\r\n url: \'"); +"function (model) {\r\n if (model) {\r\n model.html" + +"Li.slideUp(\'fast\', function () {\r\n model.htmlLi.remove();" + +"\r\n });\r\n }\r\n };\r\n\r\n var " + +"processModel = function (id, model, init) {\r\n if (!calculateFilte" + +"r(model)) {\r\n removeModel(models[id]);\r\n d" + +"elete models[id];\r\n sortModels();\r\n } else {\r\n" + +" var existing = models[id];\r\n models[id] =" + +" model;\r\n\r\n // Add\r\n model.htmlContent = $" + +"(\'
    \').text(model.UserId + \' - \' + model.UserDisplayName);\r\n " + +" if (!model.ReadyForReturn && model.EstimatedReturnTime) {\r\n " + +" model.htmlContent.append($(\'\').text(\' (Expected: \' + m" + +"odel.EstimatedReturnTime + \')\'));\r\n }\r\n if" + +" (model.WaitingForUserAction) {\r\n model.htmlContent.appen" + +"d($(\'\').text(\' (Since \' + model.WaitingForUserActionSince + " + +"\')\'));\r\n } else {\r\n if (model.ReadyFor" + +"Return && model.ReadyForReturnSince) {\r\n model.htmlCo" + +"ntent.append($(\'\').text(\' (Ready \' + model.ReadyForReturnSin" + +"ce + \')\'));\r\n }\r\n }\r\n\r\n " + +" if (existing) {\r\n if (existing.ReadyForReturn != mod" + +"el.ReadyForReturn || existing.WaitingForUserAction != model.WaitingForUserAction" + +") {\r\n removeModel(existing);\r\n " + +" model.htmlLi = $(\'
  • \').html(model.htmlContent).data(\'ModelId\', id).hide()" + +";\r\n modelInsert(model);\r\n " + +"if (init) {\r\n model.htmlLi.fadeIn();\r\n " + +" } else {\r\n model.htmlLi.slideDow" + +"n();\r\n }\r\n } else {\r\n " + +" model.htmlLi = existing.htmlLi;\r\n " + +"model.htmlLi.slideUp(\'fast\', function () {\r\n mode" + +"l.htmlLi.html(model.htmlContent).slideDown();\r\n });\r\n" + +" }\r\n } else {\r\n " + +" model.htmlLi = $(\'
  • \').html(model.htmlContent).data(\'ModelId\', id).hide();\r\n " + +" modelInsert(model);\r\n if (init) {\r" + +"\n model.htmlLi.fadeIn();\r\n } e" + +"lse {\r\n model.htmlLi.slideDown(\'slow\');\r\n " + +" }\r\n }\r\n if (model.htmlLi && mo" + +"del.IsAlert) {\r\n model.htmlLi.addClass(\'alert\');\r\n " + +" }\r\n }\r\n };\r\n\r\n var updatedMode" + +"l = function (id) {\r\n var userId = id.toString();\r\n\r\n " + +" $.ajax({\r\n dataType: \'json\',\r\n url: \'"); - #line 460 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml" + #line 435 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml" Write(Url.Action(MVC.Public.UserHeldDevices.UserHeldDevice())); @@ -442,7 +426,7 @@ WriteLiteral(@"', window.location.href = '"); - #line 477 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml" + #line 452 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml" Write(Url.Action(MVC.Public.UserHeldDevices.Noticeboard())); @@ -453,7 +437,7 @@ WriteLiteral("\';\r\n }, 10000);\r\n }\r\n "rsistantConnection = $.connection(\'"); - #line 484 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml" + #line 459 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml" Write(Url.Content("~/Public/UserHeldDevices/Notifications")); @@ -464,7 +448,7 @@ WriteLiteral("\');\r\n persistantConnection.received(updatedModel "tion.start(function () {\r\n $.getJSON(\'"); - #line 488 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml" + #line 463 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml" Write(Url.Action(MVC.Public.UserHeldDevices.UserHeldDevices())); @@ -489,14 +473,14 @@ WriteLiteral(">\r\n (Links.ClientSource.Style.Images.Icon32_png + #line 475 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml" + , Tuple.Create(Tuple.Create("", 22648), Tuple.Create(Links.ClientSource.Style.Images.Icon32_png #line default #line hidden -, 23901), false) +, 22648), false) ); WriteLiteral(" alt=\"Disco Logo\""); diff --git a/Disco.Web/ClientSource/Style/Public/UserHeldDevices.css b/Disco.Web/ClientSource/Style/Public/HeldDevices.css similarity index 84% rename from Disco.Web/ClientSource/Style/Public/UserHeldDevices.css rename to Disco.Web/ClientSource/Style/Public/HeldDevices.css index 0d4b942c..f3e23e38 100644 --- a/Disco.Web/ClientSource/Style/Public/UserHeldDevices.css +++ b/Disco.Web/ClientSource/Style/Public/HeldDevices.css @@ -1,4 +1,4 @@ -div.page div.column1 { +div.page div.column1 { width: 44%; padding-right: 1%; float: left; @@ -22,9 +22,9 @@ div.page table tr:nth-child(odd) { div.page table td.Alert { background-color: #FFADAD; } -div.page table td.userId { - width: 100px; +div.page table td.id { + width: 120px; } div.page table td.timestamp { - width: 250px; + width: 200px; } diff --git a/Disco.Web/ClientSource/Style/Public/UserHeldDevices.less b/Disco.Web/ClientSource/Style/Public/HeldDevices.less similarity index 89% rename from Disco.Web/ClientSource/Style/Public/UserHeldDevices.less rename to Disco.Web/ClientSource/Style/Public/HeldDevices.less index 5a925c6a..56d5abae 100644 --- a/Disco.Web/ClientSource/Style/Public/UserHeldDevices.less +++ b/Disco.Web/ClientSource/Style/Public/HeldDevices.less @@ -23,11 +23,11 @@ div.page { td.Alert { background-color: #FFADAD; } - td.userId { - width: 100px; + td.id { + width: 120px; } td.timestamp { - width: 250px; + width: 200px; } } } \ No newline at end of file diff --git a/Disco.Web/ClientSource/Style/Public/HeldDevices.min.css b/Disco.Web/ClientSource/Style/Public/HeldDevices.min.css new file mode 100644 index 00000000..b32ffdfb --- /dev/null +++ b/Disco.Web/ClientSource/Style/Public/HeldDevices.min.css @@ -0,0 +1 @@ +div.page div.column1{width:44%;padding-right:1%;float:left}div.page div.column2{border-left:1px dashed #aaa;padding-left:1%;width:53%;float:left}div.page table{table-layout:fixed}div.page table tr{border-bottom:1px dashed #8db2d8;border-top:1px dashed #8db2d8}div.page table tr:nth-child(odd){background-color:#e8eef4}div.page table td.Alert{background-color:#ffadad}div.page table td.id{width:120px}div.page table td.timestamp{width:200px} \ No newline at end of file diff --git a/Disco.Web/ClientSource/Style/Public/UserHeldDevicesNoticeboard.css b/Disco.Web/ClientSource/Style/Public/HeldDevicesNoticeboard.css similarity index 85% rename from Disco.Web/ClientSource/Style/Public/UserHeldDevicesNoticeboard.css rename to Disco.Web/ClientSource/Style/Public/HeldDevicesNoticeboard.css index 2380602f..ee0cad96 100644 --- a/Disco.Web/ClientSource/Style/Public/UserHeldDevicesNoticeboard.css +++ b/Disco.Web/ClientSource/Style/Public/HeldDevicesNoticeboard.css @@ -25,7 +25,9 @@ div#page { padding: 0px; } header { - font-family: "Segoe UI Light", Arial, Verdana, Tahoma, sans-serif; + font-family: "Segoe UI", Arial, Verdana, Tahoma, sans-serif; + font-weight: lighter; + font-stretch: condensed; font-size: 2em; padding: 10px 20px; background-color: rgba(255, 255, 255, 0.7); @@ -48,8 +50,9 @@ div#mainFooter { } .list h3 { color: #000; - font-family: "Segoe UI Light", Arial, Verdana, Tahoma, sans-serif; - font-weight: normal; + font-family: "Segoe UI", Arial, Verdana, Tahoma, sans-serif; + font-weight: lighter; + font-stretch: condensed; margin-left: 10px; margin-bottom: 10px; font-size: 1.4em; diff --git a/Disco.Web/ClientSource/Style/Public/UserHeldDevicesNoticeboard.less b/Disco.Web/ClientSource/Style/Public/HeldDevicesNoticeboard.less similarity index 90% rename from Disco.Web/ClientSource/Style/Public/UserHeldDevicesNoticeboard.less rename to Disco.Web/ClientSource/Style/Public/HeldDevicesNoticeboard.less index 0f9f3bf3..dfc1ff54 100644 --- a/Disco.Web/ClientSource/Style/Public/UserHeldDevicesNoticeboard.less +++ b/Disco.Web/ClientSource/Style/Public/HeldDevicesNoticeboard.less @@ -29,6 +29,8 @@ div#page { header { font-family: @FontFamilyHeading; + font-weight: @FontWeightHeading; + font-stretch: @FontStretchHeading; font-size: 2em; padding: 10px 20px; background-color: rgba(255, 255, 255, 0.7); @@ -53,7 +55,8 @@ div#mainFooter { h3 { color: #000; font-family: @FontFamilyHeading; - font-weight: normal; + font-weight: @FontWeightHeading; + font-stretch: @FontStretchHeading; margin-left: 10px; margin-bottom: 10px; font-size: 1.4em; diff --git a/Disco.Web/ClientSource/Style/Public/HeldDevicesNoticeboard.min.css b/Disco.Web/ClientSource/Style/Public/HeldDevicesNoticeboard.min.css new file mode 100644 index 00000000..480817d7 --- /dev/null +++ b/Disco.Web/ClientSource/Style/Public/HeldDevicesNoticeboard.min.css @@ -0,0 +1 @@ +html,body{margin:0;padding:0;height:100%;width:100%;overflow:hidden}body{background-color:#84abcb;font-size:1em;font-family:"Segoe UI",Arial,Verdana,Tahoma,sans-serif;color:#333;cursor:auto}h1,h2,h3,h4{margin:0;padding:0}div#page{margin:0;padding:0}header{font-family:"Segoe UI",Arial,Verdana,Tahoma,sans-serif;font-weight:lighter;font-stretch:condensed;font-size:2em;padding:10px 20px;background-color:rgba(255,255,255,.7);border-bottom:10px solid rgba(255,255,255,.8);height:40px;box-shadow:0 5px 20px #555}div#mainFooter{clear:both;padding:10px 20px;background-color:rgba(255,255,255,.7);text-align:right;height:20px;color:#000;font-size:.8em}.list{float:left;margin:15px 5px 10px 5px}.list h3{color:#000;font-family:"Segoe UI",Arial,Verdana,Tahoma,sans-serif;font-weight:lighter;font-stretch:condensed;margin-left:10px;margin-bottom:10px;font-size:1.4em}.list div.content{border:2px solid rgba(255,255,255,0);background:rgba(255,255,255,.3);border-radius:2px;overflow:hidden}.list div.content ul{padding:0;margin:0;list-style:none}.list div.content ul li{font-size:1em;margin:3px;background-color:#fff;border:5px solid rgba(132,171,203,.2);border-radius:2px;padding:4px 5px}.list div.content ul li .small{font-size:.75em;font-style:italic}.list div.content ul li.alert{background-color:#ffadad} \ No newline at end of file diff --git a/Disco.Web/ClientSource/Style/Public/UserHeldDevices.min.css b/Disco.Web/ClientSource/Style/Public/UserHeldDevices.min.css deleted file mode 100644 index c6871f2a..00000000 --- a/Disco.Web/ClientSource/Style/Public/UserHeldDevices.min.css +++ /dev/null @@ -1 +0,0 @@ -div.page div.column1{width:44%;padding-right:1%;float:left}div.page div.column2{border-left:1px dashed #aaa;padding-left:1%;width:53%;float:left}div.page table{table-layout:fixed}div.page table tr{border-bottom:1px dashed #8db2d8;border-top:1px dashed #8db2d8}div.page table tr:nth-child(odd){background-color:#e8eef4}div.page table td.Alert{background-color:#ffadad}div.page table td.userId{width:100px}div.page table td.timestamp{width:250px} \ No newline at end of file diff --git a/Disco.Web/ClientSource/Style/Public/UserHeldDevicesNoticeboard.min.css b/Disco.Web/ClientSource/Style/Public/UserHeldDevicesNoticeboard.min.css deleted file mode 100644 index a7d44f8f..00000000 --- a/Disco.Web/ClientSource/Style/Public/UserHeldDevicesNoticeboard.min.css +++ /dev/null @@ -1 +0,0 @@ -html,body{margin:0;padding:0;height:100%;width:100%;overflow:hidden}body{background-color:#84abcb;font-size:1em;font-family:"Segoe UI",Arial,Verdana,Tahoma,sans-serif;color:#333;cursor:auto}h1,h2,h3,h4{margin:0;padding:0}div#page{margin:0;padding:0}header{font-family:"Segoe UI Light",Arial,Verdana,Tahoma,sans-serif;font-size:2em;padding:10px 20px;background-color:rgba(255,255,255,.7);border-bottom:10px solid rgba(255,255,255,.8);height:40px;box-shadow:0 5px 20px #555}div#mainFooter{clear:both;padding:10px 20px;background-color:rgba(255,255,255,.7);text-align:right;height:20px;color:#000;font-size:.8em}.list{float:left;margin:15px 5px 10px 5px}.list h3{color:#000;font-family:"Segoe UI Light",Arial,Verdana,Tahoma,sans-serif;font-weight:normal;margin-left:10px;margin-bottom:10px;font-size:1.4em}.list div.content{border:2px solid rgba(255,255,255,0);background:rgba(255,255,255,.3);border-radius:2px;overflow:hidden}.list div.content ul{padding:0;margin:0;list-style:none}.list div.content ul li{font-size:1em;margin:3px;background-color:#fff;border:5px solid rgba(132,171,203,.2);border-radius:2px;padding:4px 5px}.list div.content ul li .small{font-size:.75em;font-style:italic}.list div.content ul li.alert{background-color:#ffadad} \ No newline at end of file diff --git a/Disco.Web/Disco.Web.csproj b/Disco.Web/Disco.Web.csproj index 3818473c..49033df4 100644 --- a/Disco.Web/Disco.Web.csproj +++ b/Disco.Web/Disco.Web.csproj @@ -203,6 +203,19 @@ True Install.cshtml + + + + + Index.cshtml + True + True + + + Noticeboard.cshtml + True + True + @@ -811,6 +824,14 @@ RazorGenerator Install.generated.cs + + RazorGenerator + Index.generated.cs + + + RazorGenerator + Noticeboard.generated.cs + Core.js.bundle @@ -1167,18 +1188,18 @@ - - UserHeldDevices.less - - - UserHeldDevices.less + + HeldDevices.less - - UserHeldDevicesNoticeboard.less - - - UserHeldDevicesNoticeboard.less + + HeldDevices.less + + + HeldDevicesNoticeboard.less + + + HeldDevicesNoticeboard.less Designer @@ -1566,8 +1587,8 @@ - - + + RazorGenerator Index.generated.cs @@ -1890,7 +1911,7 @@ False - + diff --git a/Disco.Web/Properties/AssemblyInfo.cs b/Disco.Web/Properties/AssemblyInfo.cs index 7272cc23..aebedd03 100644 --- a/Disco.Web/Properties/AssemblyInfo.cs +++ b/Disco.Web/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.2.0625.1305")] -[assembly: AssemblyFileVersion("1.2.0625.1305")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0704.1521")] +[assembly: AssemblyFileVersion("1.2.0704.1521")] \ No newline at end of file diff --git a/Disco.Web/T4MVC.cs b/Disco.Web/T4MVC.cs index f49ee99f..f289629d 100644 --- a/Disco.Web/T4MVC.cs +++ b/Disco.Web/T4MVC.cs @@ -83,6 +83,7 @@ namespace T4MVC public class PublicClass { public readonly string Name = "Public"; + public Disco.Web.Areas.Public.Controllers.HeldDevicesController HeldDevices = new Disco.Web.Areas.Public.Controllers.T4MVC_HeldDevicesController(); public Disco.Web.Areas.Public.Controllers.PublicController Public = new Disco.Web.Areas.Public.Controllers.T4MVC_PublicController(); public Disco.Web.Areas.Public.Controllers.UserHeldDevicesController UserHeldDevices = new Disco.Web.Areas.Public.Controllers.T4MVC_UserHeldDevicesController(); public T4MVC.Public.SharedController Shared = new T4MVC.Public.SharedController(); @@ -899,14 +900,14 @@ namespace Links private const string URLPATH = "~/ClientSource/Style/Public"; public static string Url() { return T4MVCHelpers.ProcessVirtualPath(URLPATH); } public static string Url(string fileName) { return T4MVCHelpers.ProcessVirtualPath(URLPATH + "/" + fileName); } - public static readonly string UserHeldDevices_less = Url("UserHeldDevices.less"); - public static readonly string UserHeldDevices_css = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/UserHeldDevices.min.css") ? Url("UserHeldDevices.min.css") : Url("UserHeldDevices.css"); + public static readonly string HeldDevices_less = Url("HeldDevices.less"); + public static readonly string HeldDevices_css = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/HeldDevices.min.css") ? Url("HeldDevices.min.css") : Url("HeldDevices.css"); - public static readonly string UserHeldDevices_min_css = Url("UserHeldDevices.min.css"); - public static readonly string UserHeldDevicesNoticeboard_less = Url("UserHeldDevicesNoticeboard.less"); - public static readonly string UserHeldDevicesNoticeboard_css = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/UserHeldDevicesNoticeboard.min.css") ? Url("UserHeldDevicesNoticeboard.min.css") : Url("UserHeldDevicesNoticeboard.css"); + public static readonly string HeldDevices_min_css = Url("HeldDevices.min.css"); + public static readonly string HeldDevicesNoticeboard_less = Url("HeldDevicesNoticeboard.less"); + public static readonly string HeldDevicesNoticeboard_css = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/HeldDevicesNoticeboard.min.css") ? Url("HeldDevicesNoticeboard.min.css") : Url("HeldDevicesNoticeboard.css"); - public static readonly string UserHeldDevicesNoticeboard_min_css = Url("UserHeldDevicesNoticeboard.min.css"); + public static readonly string HeldDevicesNoticeboard_min_css = Url("HeldDevicesNoticeboard.min.css"); public static readonly string UserHeldDevicesXml_Sharepoint_xslt = Url("UserHeldDevicesXml_Sharepoint.xslt"); } @@ -9476,6 +9477,172 @@ namespace T4MVC.Config } +namespace Disco.Web.Areas.Public.Controllers +{ + public partial class HeldDevicesController + { + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public HeldDevicesController() { } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected HeldDevicesController(Dummy d) { } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected RedirectToRouteResult RedirectToAction(ActionResult result) + { + var callInfo = result.GetT4MVCResult(); + return RedirectToRoute(callInfo.RouteValueDictionary); + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected RedirectToRouteResult RedirectToActionPermanent(ActionResult result) + { + var callInfo = result.GetT4MVCResult(); + return RedirectToRoutePermanent(callInfo.RouteValueDictionary); + } + + [NonAction] + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public virtual System.Web.Mvc.ActionResult HeldDevice() + { + return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.HeldDevice); + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public HeldDevicesController Actions { get { return MVC.Public.HeldDevices; } } + [GeneratedCode("T4MVC", "2.0")] + public readonly string Area = "Public"; + [GeneratedCode("T4MVC", "2.0")] + public readonly string Name = "HeldDevices"; + [GeneratedCode("T4MVC", "2.0")] + public const string NameConst = "HeldDevices"; + + static readonly ActionNamesClass s_actions = new ActionNamesClass(); + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public ActionNamesClass ActionNames { get { return s_actions; } } + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public class ActionNamesClass + { + public readonly string Index = "Index"; + public readonly string ReadyForReturnXml = "ReadyForReturnXml"; + public readonly string WaitingForUserActionXml = "WaitingForUserActionXml"; + public readonly string HeldDevicesXml = "HeldDevicesXml"; + public readonly string Noticeboard = "Noticeboard"; + public readonly string HeldDevice = "HeldDevice"; + public readonly string HeldDevices = "HeldDevices"; + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public class ActionNameConstants + { + public const string Index = "Index"; + public const string ReadyForReturnXml = "ReadyForReturnXml"; + public const string WaitingForUserActionXml = "WaitingForUserActionXml"; + public const string HeldDevicesXml = "HeldDevicesXml"; + public const string Noticeboard = "Noticeboard"; + public const string HeldDevice = "HeldDevice"; + public const string HeldDevices = "HeldDevices"; + } + + + static readonly ActionParamsClass_HeldDevice s_params_HeldDevice = new ActionParamsClass_HeldDevice(); + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public ActionParamsClass_HeldDevice HeldDeviceParams { get { return s_params_HeldDevice; } } + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public class ActionParamsClass_HeldDevice + { + public readonly string id = "id"; + } + static readonly ViewsClass s_views = new ViewsClass(); + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public ViewsClass Views { get { return s_views; } } + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public class ViewsClass + { + static readonly _ViewNamesClass s_ViewNames = new _ViewNamesClass(); + public _ViewNamesClass ViewNames { get { return s_ViewNames; } } + public class _ViewNamesClass + { + public readonly string Index = "Index"; + public readonly string Noticeboard = "Noticeboard"; + } + public readonly string Index = "~/Areas/Public/Views/HeldDevices/Index.cshtml"; + public readonly string Noticeboard = "~/Areas/Public/Views/HeldDevices/Noticeboard.cshtml"; + } + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public partial class T4MVC_HeldDevicesController : Disco.Web.Areas.Public.Controllers.HeldDevicesController + { + public T4MVC_HeldDevicesController() : base(Dummy.Instance) { } + + partial void IndexOverride(T4MVC_System_Web_Mvc_ActionResult callInfo); + + public override System.Web.Mvc.ActionResult Index() + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Index); + IndexOverride(callInfo); + return callInfo; + } + + partial void ReadyForReturnXmlOverride(T4MVC_System_Web_Mvc_ActionResult callInfo); + + public override System.Web.Mvc.ActionResult ReadyForReturnXml() + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ReadyForReturnXml); + ReadyForReturnXmlOverride(callInfo); + return callInfo; + } + + partial void WaitingForUserActionXmlOverride(T4MVC_System_Web_Mvc_ActionResult callInfo); + + public override System.Web.Mvc.ActionResult WaitingForUserActionXml() + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.WaitingForUserActionXml); + WaitingForUserActionXmlOverride(callInfo); + return callInfo; + } + + partial void HeldDevicesXmlOverride(T4MVC_System_Web_Mvc_ActionResult callInfo); + + public override System.Web.Mvc.ActionResult HeldDevicesXml() + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.HeldDevicesXml); + HeldDevicesXmlOverride(callInfo); + return callInfo; + } + + partial void NoticeboardOverride(T4MVC_System_Web_Mvc_ActionResult callInfo); + + public override System.Web.Mvc.ActionResult Noticeboard() + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Noticeboard); + NoticeboardOverride(callInfo); + return callInfo; + } + + partial void HeldDeviceOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id); + + public override System.Web.Mvc.ActionResult HeldDevice(string id) + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.HeldDevice); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); + HeldDeviceOverride(callInfo, id); + return callInfo; + } + + partial void HeldDevicesOverride(T4MVC_System_Web_Mvc_ActionResult callInfo); + + public override System.Web.Mvc.ActionResult HeldDevices() + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.HeldDevices); + HeldDevicesOverride(callInfo); + return callInfo; + } + + } +} + namespace Disco.Web.Areas.Public.Controllers { public partial class PublicController