initial source commit
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
@model IEnumerable<Disco.Web.Areas.Public.Models.UserHeldDevices.UserHeldDeviceModel>
|
||||
@{
|
||||
ViewBag.Title = Html.ToBreadcrumb("Public Reports", MVC.Public.Public.Index(), "Technician Held Devices", null);
|
||||
Html.BundleDeferred("~/Style/Public/UserHeldDevices");
|
||||
}
|
||||
<div class="clearfix page">
|
||||
<div class="column1">
|
||||
@{
|
||||
var DevicesInProcess = Model.Where(i => !i.ReadyForReturn && !i.WaitingForUserAction).ToArray();
|
||||
}
|
||||
<h2>
|
||||
In Process (@DevicesInProcess.Length)</h2>
|
||||
<table class="dataTable">
|
||||
@foreach (var item in DevicesInProcess)
|
||||
{
|
||||
<tr>
|
||||
<td class="userId">
|
||||
@item.UserId
|
||||
</td>
|
||||
<td class="userDisplayName">
|
||||
@item.UserDisplayName@{
|
||||
if (!string.IsNullOrEmpty(item.EstimatedReturnTime))
|
||||
{
|
||||
<span class="smallMessage">(Expected: @item.EstimatedReturnTime)</span>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
<div class="column2">
|
||||
@{
|
||||
var WaitingForUserActionJobs = Model.Where(i => i.WaitingForUserAction).ToArray();
|
||||
}
|
||||
<h2>
|
||||
Waiting for User Action (@WaitingForUserActionJobs.Length)</h2>
|
||||
<table class="dataTable">
|
||||
@foreach (var item in WaitingForUserActionJobs)
|
||||
{
|
||||
<tr>
|
||||
<td class="userId">
|
||||
@item.UserId
|
||||
</td>
|
||||
<td class="userDisplayName">
|
||||
@item.UserDisplayName
|
||||
</td>
|
||||
<td class="timestamp@(item.IsAlert ? " Alert" : string.Empty)">
|
||||
Since @item.WaitingForUserActionSince
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
<hr />
|
||||
@{
|
||||
var DevicesReadyForReturn = Model.Where(i => i.ReadyForReturn && !i.WaitingForUserAction).ToArray();
|
||||
}
|
||||
<h2>
|
||||
Ready for Return (@DevicesReadyForReturn.Length)</h2>
|
||||
<table class="dataTable">
|
||||
@foreach (var item in DevicesReadyForReturn)
|
||||
{
|
||||
<tr>
|
||||
<td class="userId">
|
||||
@item.UserId
|
||||
</td>
|
||||
<td class="userDisplayName">
|
||||
@item.UserDisplayName
|
||||
</td>
|
||||
<td class="timestamp@(item.IsAlert ? " Alert" : string.Empty)">
|
||||
Ready @item.ReadyForReturnSince
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,396 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.Public.Views.UserHeldDevices
|
||||
{
|
||||
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", "1.5.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Public/Views/UserHeldDevices/Index.cshtml")]
|
||||
public class Index : System.Web.Mvc.WebViewPage<IEnumerable<Disco.Web.Areas.Public.Models.UserHeldDevices.UserHeldDeviceModel>>
|
||||
{
|
||||
public Index()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#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");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<div");
|
||||
|
||||
WriteLiteral(" class=\"clearfix page\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"column1\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 8 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 8 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
|
||||
var DevicesInProcess = Model.Where(i => !i.ReadyForReturn && !i.WaitingForUserAction).ToArray();
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <h2>\r\n In Process (");
|
||||
|
||||
|
||||
#line 12 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
Write(DevicesInProcess.Length);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(")</h2>\r\n <table");
|
||||
|
||||
WriteLiteral(" class=\"dataTable\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 14 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 14 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
foreach (var item in DevicesInProcess)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"userId\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 18 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
Write(item.UserId);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"userDisplayName\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 21 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
Write(item.UserDisplayName);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 21 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
|
||||
if (!string.IsNullOrEmpty(item.EstimatedReturnTime))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <span");
|
||||
|
||||
WriteLiteral(" class=\"smallMessage\"");
|
||||
|
||||
WriteLiteral(">(Expected: ");
|
||||
|
||||
|
||||
#line 24 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
Write(item.EstimatedReturnTime);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(")</span>\r\n");
|
||||
|
||||
|
||||
#line 25 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 29 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </table>\r\n </div>\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"column2\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 33 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 33 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
|
||||
var WaitingForUserActionJobs = Model.Where(i => i.WaitingForUserAction).ToArray();
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <h2>\r\n Waiting for User Action (");
|
||||
|
||||
|
||||
#line 37 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
Write(WaitingForUserActionJobs.Length);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(")</h2>\r\n <table");
|
||||
|
||||
WriteLiteral(" class=\"dataTable\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 39 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 39 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
foreach (var item in WaitingForUserActionJobs)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"userId\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 43 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
Write(item.UserId);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"userDisplayName\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 46 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
Write(item.UserDisplayName);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 1816), Tuple.Create("\"", 1874)
|
||||
, Tuple.Create(Tuple.Create("", 1824), Tuple.Create("timestamp", 1824), true)
|
||||
|
||||
#line 48 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1833), Tuple.Create<System.Object, System.Int32>(item.IsAlert ? " Alert" : string.Empty
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1833), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n Since ");
|
||||
|
||||
|
||||
#line 49 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
Write(item.WaitingForUserActionSince);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 52 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </table>\r\n <hr />\r\n");
|
||||
|
||||
|
||||
#line 55 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 55 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
|
||||
var DevicesReadyForReturn = Model.Where(i => i.ReadyForReturn && !i.WaitingForUserAction).ToArray();
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <h2>\r\n Ready for Return (");
|
||||
|
||||
|
||||
#line 59 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
Write(DevicesReadyForReturn.Length);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(")</h2>\r\n <table");
|
||||
|
||||
WriteLiteral(" class=\"dataTable\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 61 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 61 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
foreach (var item in DevicesReadyForReturn)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"userId\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 65 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
Write(item.UserId);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"userDisplayName\"");
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 68 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
Write(item.UserDisplayName);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 2641), Tuple.Create("\"", 2699)
|
||||
, Tuple.Create(Tuple.Create("", 2649), Tuple.Create("timestamp", 2649), true)
|
||||
|
||||
#line 70 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 2658), Tuple.Create<System.Object, System.Int32>(item.IsAlert ? " Alert" : string.Empty
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 2658), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n Ready ");
|
||||
|
||||
|
||||
#line 71 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
Write(item.ReadyForReturnSince);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 74 "..\..\Areas\Public\Views\UserHeldDevices\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </table>\r\n </div>\r\n</div>\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
@@ -0,0 +1,494 @@
|
||||
@{
|
||||
Layout = null;
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
Html.BundleDeferred("~/ClientScripts/Core");
|
||||
Html.BundleDeferred("~/Style/Public/UserHeldDevicesNoticeboard");
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>Disco - Technician Held Devices</title>
|
||||
@Html.BundleRenderDeferred()
|
||||
</head>
|
||||
<body>
|
||||
<div id="page">
|
||||
<header id="mainHeader">
|
||||
Technician Held Devices
|
||||
</header>
|
||||
<section id="mainSection">
|
||||
<div id="inProcess" class="list">
|
||||
<h3>
|
||||
In Process <span id="inProcessCount"></span>
|
||||
</h3>
|
||||
<div class="content">
|
||||
<ul>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="readyForReturn" class="list">
|
||||
<h3>
|
||||
Ready for Return <span id="readyForReturnCount"></span>
|
||||
</h3>
|
||||
<div class="content">
|
||||
<ul>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="waitingForUserAction" class="list">
|
||||
<h3>
|
||||
Waiting for User Action <span id="waitingForUserActionCount"></span>
|
||||
</h3>
|
||||
<div class="content">
|
||||
<ul>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<footer>
|
||||
</footer>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
// Resizing
|
||||
$(function () {
|
||||
var $inProcess = $('#inProcess');
|
||||
var $inProcessContent = $inProcess.find('.content');
|
||||
var $inProcessHeader = $inProcess.find('.h3');
|
||||
var $readyForReturn = $('#readyForReturn');
|
||||
var $readyForReturnContent = $readyForReturn.find('.content');
|
||||
var $readyForReturnHeader = $readyForReturn.find('.h3');
|
||||
var $waitingForUserAction = $('#waitingForUserAction');
|
||||
var $waitingForUserActionContent = $waitingForUserAction.find('.content');
|
||||
var $waitingForUserActionHeader = $waitingForUserAction.find('.h3');
|
||||
var $mainSection = $('#mainSection');
|
||||
var $mainHeader = $('#mainHeader');
|
||||
var $mainFooter = $('#mainFooter');
|
||||
|
||||
var onResize = function () {
|
||||
var width = $mainSection.width();
|
||||
var height = $(window).height() - $mainHeader.outerHeight() - $mainFooter.outerHeight() - 25;
|
||||
|
||||
$inProcess.height(height);
|
||||
$inProcess.width((width * .28) - 11);
|
||||
$inProcessContent.height(height - $inProcessHeader.outerHeight() - 56);
|
||||
|
||||
$readyForReturn.height(height);
|
||||
$readyForReturn.width((width * .36) - 11);
|
||||
$readyForReturnContent.height(height - $readyForReturnHeader.outerHeight() - 56);
|
||||
|
||||
$waitingForUserAction.height(height);
|
||||
$waitingForUserAction.width((width * .36) - 11);
|
||||
$waitingForUserActionContent.height(height - $waitingForUserActionHeader.outerHeight() - 56);
|
||||
};
|
||||
|
||||
$(window).resize(onResize);
|
||||
onResize();
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
// 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);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var models = {};
|
||||
var modelsInProcessSorted = [];
|
||||
var modelsInProcessCount = 0;
|
||||
var modelsReadyForReturnSorted = [];
|
||||
var modelsReadyForReturnCount = 0;
|
||||
var modelsWaitingForUserActionSorted = [];
|
||||
var modelsWaitingForUserActionCount = 0;
|
||||
var $inProcess = $('#inProcess');
|
||||
var $inProcessContent = $inProcess.find('.content ul');
|
||||
var $readyForReturn = $('#readyForReturn');
|
||||
var $readyForReturnContent = $readyForReturn.find('.content ul');
|
||||
var $waitingForUserAction = $('#waitingForUserAction');
|
||||
var $waitingForUserActionContent = $waitingForUserAction.find('.content ul');
|
||||
var modelsInProcessIndexOffset = 0;
|
||||
var scrollInProcessToken = null;
|
||||
var modelsReadyForReturnIndexOffset = 0;
|
||||
var scrollReadyForReturnToken = null;
|
||||
var modelsWaitingForUserActionIndexOffset = 0;
|
||||
var scrollWaitingForUserActionToken = null;
|
||||
var scrollSpeed = 3000;
|
||||
var persistantConnection = null;
|
||||
var filterDeviceAddressInclude;
|
||||
var filterDeviceAddressExclude;
|
||||
var filterDeviceProfileInclude;
|
||||
var filterDeviceProfileExclude;
|
||||
|
||||
var getParameterByName = function (name) {
|
||||
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
||||
var regexS = "[\\?&]" + name + "=([^&#]*)";
|
||||
var regex = new RegExp(regexS);
|
||||
var results = regex.exec(window.location.search);
|
||||
if (results == null)
|
||||
return "";
|
||||
else
|
||||
return decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||
}
|
||||
|
||||
var buildFilters = function () {
|
||||
var deviceAddressInclude = getParameterByName('deviceAddressInclude');
|
||||
if (deviceAddressInclude) {
|
||||
filterDeviceAddressInclude = {};
|
||||
var split = deviceAddressInclude.split(",");
|
||||
for (var i = 0; i < split.length; i++) {
|
||||
filterDeviceAddressInclude[split[i].toLowerCase()] = true;
|
||||
}
|
||||
} else {
|
||||
var deviceAddressExclude = getParameterByName('deviceAddressExclude');
|
||||
if (deviceAddressExclude) {
|
||||
filterDeviceAddressExclude = {};
|
||||
var split = deviceAddressExclude.split(",");
|
||||
for (var i = 0; i < split.length; i++) {
|
||||
filterDeviceAddressExclude[split[i].toLowerCase()] = true;
|
||||
}
|
||||
} else {
|
||||
var deviceProfileInclude = getParameterByName('deviceProfileInclude');
|
||||
if (deviceProfileInclude) {
|
||||
filterDeviceProfileInclude = {};
|
||||
var deviceProfileIncludeSplit = deviceProfileInclude.split(",");
|
||||
for (var i = 0; i < deviceProfileIncludeSplit.length; i++) {
|
||||
filterDeviceProfileInclude[parseInt(deviceProfileIncludeSplit[i])] = true;
|
||||
}
|
||||
} else {
|
||||
var deviceProfileExclude = getParameterByName('deviceProfileExclude');
|
||||
if (deviceProfileExclude) {
|
||||
filterDeviceProfileExclude = {};
|
||||
var deviceProfileExcludeSplit = deviceProfileExclude.split(",");
|
||||
for (var i = 0; i < deviceProfileExcludeSplit.length; i++) {
|
||||
filterDeviceProfileExclude[parseInt(deviceProfileExcludeSplit[i])] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var calculateFilter = function (model) {
|
||||
if (model) {
|
||||
if (filterDeviceAddressInclude) {
|
||||
return (filterDeviceAddressInclude[model.DeviceAddress.toLowerCase()] == true)
|
||||
}
|
||||
if (filterDeviceAddressExclude) {
|
||||
return (!filterDeviceAddressExclude[model.DeviceAddress.toLowerCase()])
|
||||
}
|
||||
if (filterDeviceProfileInclude) {
|
||||
return (filterDeviceProfileInclude[model.DeviceProfileId] == true)
|
||||
}
|
||||
if (filterDeviceProfileExclude) {
|
||||
return (!filterDeviceProfileExclude[model.DeviceProfileId])
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
var sortModels = function () {
|
||||
modelsInProcessSorted = [];
|
||||
modelsReadyForReturnSorted = [];
|
||||
modelsWaitingForUserActionSorted = [];
|
||||
var modelSortFunc = function (a, b) {
|
||||
if (a.UserId.toUpperCase() == b.UserId.toUpperCase()) {
|
||||
return 0;
|
||||
} else {
|
||||
if (a.UserId.toUpperCase() < b.UserId.toUpperCase()) {
|
||||
return -1
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
};
|
||||
for (var key in models) {
|
||||
var model = models[key];
|
||||
if (model) {
|
||||
if (model.WaitingForUserAction) {
|
||||
modelsWaitingForUserActionSorted.push(model);
|
||||
} else {
|
||||
if (model.ReadyForReturn) {
|
||||
modelsReadyForReturnSorted.push(model);
|
||||
} else {
|
||||
modelsInProcessSorted.push(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
modelsReadyForReturnSorted = modelsReadyForReturnSorted.sort(modelSortFunc);
|
||||
modelsInProcessSorted = modelsInProcessSorted.sort(modelSortFunc);
|
||||
modelsWaitingForUserActionSorted = modelsWaitingForUserActionSorted.sort(modelSortFunc);
|
||||
|
||||
if (modelsInProcessSorted.length != modelsInProcessCount) {
|
||||
modelsInProcessCount = modelsInProcessSorted.length;
|
||||
$('#inProcessCount').text('(' + modelsInProcessCount + ')');
|
||||
}
|
||||
if (modelsReadyForReturnSorted.length != modelsReadyForReturnCount) {
|
||||
modelsReadyForReturnCount = modelsReadyForReturnSorted.length;
|
||||
$('#readyForReturnCount').text('(' + modelsReadyForReturnCount + ')');
|
||||
}
|
||||
if (modelsWaitingForUserActionSorted.length != modelsWaitingForUserActionCount) {
|
||||
modelsWaitingForUserActionCount = modelsWaitingForUserActionSorted.length;
|
||||
$('#waitingForUserActionCount').text('(' + modelsWaitingForUserActionCount + ')');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var scrollReadyForReturn = function () {
|
||||
$readyForReturnContent.find('li').last().detach().prependTo($readyForReturnContent).hide().slideDown('slow');
|
||||
modelsReadyForReturnIndexOffset++;
|
||||
if (modelsReadyForReturnIndexOffset >= modelsReadyForReturnSorted.length) {
|
||||
modelsReadyForReturnIndexOffset = 0;
|
||||
}
|
||||
scrollReadyForReturnToken = window.setTimeout(scrollReadyForReturn, scrollSpeed);
|
||||
};
|
||||
var updateScrollReadyForReturn = function () {
|
||||
var containerHeight = $readyForReturn.find('.content').height();
|
||||
var contentHeight = $readyForReturnContent.height();
|
||||
if (containerHeight >= contentHeight && scrollReadyForReturnToken) {
|
||||
window.clearTimeout(scrollReadyForReturnToken);
|
||||
return;
|
||||
}
|
||||
if (containerHeight < contentHeight && scrollReadyForReturnToken == null) {
|
||||
scrollReadyForReturnToken = window.setTimeout(scrollReadyForReturn, scrollSpeed);
|
||||
}
|
||||
};
|
||||
var scrollInProcess = function () {
|
||||
$inProcessContent.find('li').last().detach().prependTo($inProcessContent).hide().slideDown('slow');
|
||||
modelsInProcessIndexOffset++;
|
||||
if (modelsInProcessIndexOffset >= modelsInProcessSorted.length) {
|
||||
modelsInProcessIndexOffset = 0;
|
||||
}
|
||||
scrollInProcessToken = window.setTimeout(scrollInProcess, scrollSpeed);
|
||||
};
|
||||
var updateScrollInProcess = function () {
|
||||
var containerHeight = $inProcess.find('.content').height();
|
||||
var contentHeight = $inProcessContent.height();
|
||||
if (containerHeight >= contentHeight && scrollInProcessToken) {
|
||||
window.clearTimeout(scrollInProcessToken);
|
||||
return;
|
||||
}
|
||||
if (containerHeight < contentHeight && scrollInProcessToken == null) {
|
||||
scrollInProcessToken = window.setTimeout(scrollInProcess, scrollSpeed);
|
||||
}
|
||||
};
|
||||
var scrollWaitingForUserAction = function () {
|
||||
$waitingForUserActionContent.find('li').last().detach().prependTo($waitingForUserActionContent).hide().slideDown('slow');
|
||||
modelsInProcessIndexOffset++;
|
||||
if (modelsWaitingForUserActionIndexOffset >= modelsWaitingForUserActionSorted.length) {
|
||||
modelsWaitingForUserActionIndexOffset = 0;
|
||||
}
|
||||
scrollWaitingForUserActionToken = window.setTimeout(scrollWaitingForUserAction, scrollSpeed);
|
||||
};
|
||||
var updateScrollWaitingForUserAction = function () {
|
||||
var containerHeight = $waitingForUserAction.find('.content').height();
|
||||
var contentHeight = $waitingForUserActionContent.height();
|
||||
if (containerHeight >= contentHeight && scrollWaitingForUserActionToken) {
|
||||
window.clearTimeout(scrollWaitingForUserActionToken);
|
||||
return;
|
||||
}
|
||||
if (containerHeight < contentHeight && scrollWaitingForUserActionToken == null) {
|
||||
scrollWaitingForUserActionToken = window.setTimeout(scrollWaitingForUserAction, scrollSpeed);
|
||||
}
|
||||
};
|
||||
|
||||
var modelInsertIndex = function (model) {
|
||||
sortModels();
|
||||
var findIndex = function (model, array, offset) {
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
if (model.UserId == array[i].UserId) {
|
||||
var index = i + offset;
|
||||
if (index > (array.length - 1)) {
|
||||
index = index - (array.length - 1);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
};
|
||||
};
|
||||
if (model.WaitingForUserAction) {
|
||||
return findIndex(model, modelsWaitingForUserActionSorted, modelsWaitingForUserActionIndexOffset);
|
||||
} else {
|
||||
if (model.ReadyForReturn) {
|
||||
return findIndex(model, modelsReadyForReturnSorted, modelsReadyForReturnIndexOffset);
|
||||
} else {
|
||||
return findIndex(model, modelsInProcessSorted, modelsInProcessIndexOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
var modelInsert = function (model) {
|
||||
var index = modelInsertIndex(model);
|
||||
var insertTo = function (model, host) {
|
||||
var hostLi = host.children('li');
|
||||
if (hostLi.length == 0 || hostLi.length < index) {
|
||||
host.append(model.htmlLi);
|
||||
} else {
|
||||
if (index == 0) {
|
||||
host.prepend(model.htmlLi);
|
||||
} else {
|
||||
$(hostLi.get(index - 1)).after(model.htmlLi);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (model.WaitingForUserAction) {
|
||||
insertTo(model, $waitingForUserActionContent);
|
||||
window.setTimeout(updateScrollWaitingForUserAction, 100);
|
||||
} else {
|
||||
if (model.ReadyForReturn) {
|
||||
insertTo(model, $readyForReturnContent);
|
||||
window.setTimeout(updateScrollReadyForReturn, 100);
|
||||
} else {
|
||||
insertTo(model, $inProcessContent);
|
||||
window.setTimeout(updateScrollInProcess, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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]);
|
||||
delete models[id];
|
||||
sortModels();
|
||||
} else {
|
||||
var existing = models[id];
|
||||
models[id] = model;
|
||||
|
||||
// Add
|
||||
model.htmlContent = $('<div>').text(model.UserId + ' - ' + model.UserDisplayName);
|
||||
if (!model.ReadyForReturn && model.EstimatedReturnTime) {
|
||||
model.htmlContent.append($('<span class="small">').text(' (Expected: ' + model.EstimatedReturnTime + ')'));
|
||||
}
|
||||
if (model.WaitingForUserAction) {
|
||||
model.htmlContent.append($('<span class="small">').text(' (Since ' + model.WaitingForUserActionSince + ')'));
|
||||
} else {
|
||||
if (model.ReadyForReturn && model.ReadyForReturnSince) {
|
||||
model.htmlContent.append($('<span class="small">').text(' (Ready ' + model.ReadyForReturnSince + ')'));
|
||||
}
|
||||
}
|
||||
|
||||
if (existing) {
|
||||
if (existing.ReadyForReturn != model.ReadyForReturn || existing.WaitingForUserAction != model.WaitingForUserAction) {
|
||||
removeModel(existing);
|
||||
model.htmlLi = $('<li>').html(model.htmlContent).data('ModelId', id).hide();
|
||||
modelInsert(model);
|
||||
if (init) {
|
||||
model.htmlLi.fadeIn();
|
||||
} else {
|
||||
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();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
model.htmlLi = $('<li>').html(model.htmlContent).data('ModelId', id).hide();
|
||||
modelInsert(model);
|
||||
if (init) {
|
||||
model.htmlLi.fadeIn();
|
||||
} else {
|
||||
model.htmlLi.slideDown('slow');
|
||||
}
|
||||
}
|
||||
if (model.htmlLi && model.IsAlert) {
|
||||
model.htmlLi.addClass('alert');
|
||||
}
|
||||
scheduleModelUpdate(model);
|
||||
}
|
||||
};
|
||||
|
||||
var updatedModel = function (id) {
|
||||
var UserId = id.toString();
|
||||
$.getJSON('@(Url.Action(MVC.Public.UserHeldDevices.UserHeldDevice()))', { id: UserId }, function (data) {
|
||||
processModel(UserId, data, false);
|
||||
});
|
||||
};
|
||||
|
||||
var connectionError = function () {
|
||||
if (persistantConnection) {
|
||||
persistantConnection.stop();
|
||||
persistantConnection = null;
|
||||
window.setTimeout(function () {
|
||||
window.location.href = '@(Url.Action(MVC.Public.UserHeldDevices.Noticeboard()))';
|
||||
}, 10000);
|
||||
}
|
||||
}
|
||||
|
||||
var init = function () {
|
||||
buildFilters();
|
||||
persistantConnection = $.connection('@(Url.Content("~/Public/UserHeldDevices/Notifications"))');
|
||||
persistantConnection.received(updatedModel);
|
||||
persistantConnection.error(connectionError);
|
||||
persistantConnection.start(function () {
|
||||
$.getJSON('@(Url.Action(MVC.Public.UserHeldDevices.UserHeldDevices()))', null, function (data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
processModel(data[i].UserId, data[i], true);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
init();
|
||||
|
||||
});
|
||||
</script>
|
||||
<div id="mainFooter">
|
||||
<img style="width: 32px; height: 32px; margin-top: -5px; margin-bottom: -15px;" src="@Links.ClientSource.Style.Images.Icon32_png" alt="Disco Logo" />
|
||||
powered by Disco
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,502 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.Public.Views.UserHeldDevices
|
||||
{
|
||||
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", "1.5.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Public/Views/UserHeldDevices/Noticeboard.cshtml")]
|
||||
public class Noticeboard : System.Web.Mvc.WebViewPage<dynamic>
|
||||
{
|
||||
public Noticeboard()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 1 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml"
|
||||
|
||||
Layout = null;
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
Html.BundleDeferred("~/ClientScripts/Core");
|
||||
Html.BundleDeferred("~/Style/Public/UserHeldDevicesNoticeboard");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<!DOCTYPE html>\r\n<html>\r\n<head>\r\n <meta");
|
||||
|
||||
WriteLiteral(" charset=\"utf-8\"");
|
||||
|
||||
WriteLiteral(" />\r\n <meta");
|
||||
|
||||
WriteLiteral(" http-equiv=\"X-UA-Compatible\"");
|
||||
|
||||
WriteLiteral(" content=\"IE=edge\"");
|
||||
|
||||
WriteLiteral(" />\r\n <title>Disco - Technician Held Devices</title>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 13 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml"
|
||||
Write(Html.BundleRenderDeferred());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n</head>\r\n<body>\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"page\"");
|
||||
|
||||
WriteLiteral(">\r\n <header");
|
||||
|
||||
WriteLiteral(" id=\"mainHeader\"");
|
||||
|
||||
WriteLiteral(">\r\n Technician Held Devices\r\n </header>\r\n <section");
|
||||
|
||||
WriteLiteral(" id=\"mainSection\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"inProcess\"");
|
||||
|
||||
WriteLiteral(" class=\"list\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>\r\n In Process <span");
|
||||
|
||||
WriteLiteral(" id=\"inProcessCount\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </h3>\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"content\"");
|
||||
|
||||
WriteLiteral(">\r\n <ul>\r\n </ul>\r\n </div>\r\n " +
|
||||
" </div>\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"readyForReturn\"");
|
||||
|
||||
WriteLiteral(" class=\"list\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>\r\n Ready for Return <span");
|
||||
|
||||
WriteLiteral(" id=\"readyForReturnCount\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </h3>\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"content\"");
|
||||
|
||||
WriteLiteral(">\r\n <ul>\r\n </ul>\r\n </div>\r\n " +
|
||||
" </div>\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"waitingForUserAction\"");
|
||||
|
||||
WriteLiteral(" class=\"list\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>\r\n Waiting for User Action <span");
|
||||
|
||||
WriteLiteral(" id=\"waitingForUserActionCount\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </h3>\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"content\"");
|
||||
|
||||
WriteLiteral(">\r\n <ul>\r\n </ul>\r\n </div>\r\n " +
|
||||
" </div>\r\n </section>\r\n <footer>\r\n </footer>\r\n " +
|
||||
"</div>\r\n <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\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 </scrip" +
|
||||
"t>\r\n <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
// 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);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\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 " +
|
||||
" var getParameterByName = function (name) {\r\n name = na" +
|
||||
"me.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 (results == 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 deviceAddressInclude = getParameterByName(\'deviceAddressInclude\');\r\n " +
|
||||
" if (deviceAddressInclude) {\r\n filterDeviceAddressInc" +
|
||||
"lude = {};\r\n var split = deviceAddressInclude.split(\",\");\r\n " +
|
||||
" for (var i = 0; i < split.length; i++) {\r\n " +
|
||||
" filterDeviceAddressInclude[split[i].toLowerCase()] = true;\r\n " +
|
||||
" }\r\n } else {\r\n var deviceAddressExclude = " +
|
||||
"getParameterByName(\'deviceAddressExclude\');\r\n if (deviceAddre" +
|
||||
"ssExclude) {\r\n filterDeviceAddressExclude = {};\r\n " +
|
||||
" var split = deviceAddressExclude.split(\",\");\r\n " +
|
||||
" for (var i = 0; i < split.length; i++) {\r\n filt" +
|
||||
"erDeviceAddressExclude[split[i].toLowerCase()] = true;\r\n " +
|
||||
"}\r\n } else {\r\n var deviceProfileInclud" +
|
||||
"e = getParameterByName(\'deviceProfileInclude\');\r\n if (dev" +
|
||||
"iceProfileInclude) {\r\n filterDeviceProfileInclude = {" +
|
||||
"};\r\n var deviceProfileIncludeSplit = deviceProfileInc" +
|
||||
"lude.split(\",\");\r\n for (var i = 0; i < deviceProfileI" +
|
||||
"ncludeSplit.length; i++) {\r\n filterDeviceProfileI" +
|
||||
"nclude[parseInt(deviceProfileIncludeSplit[i])] = true;\r\n " +
|
||||
" }\r\n } else {\r\n var deviceP" +
|
||||
"rofileExclude = getParameterByName(\'deviceProfileExclude\');\r\n " +
|
||||
" if (deviceProfileExclude) {\r\n filterDevi" +
|
||||
"ceProfileExclude = {};\r\n var deviceProfileExclude" +
|
||||
"Split = deviceProfileExclude.split(\",\");\r\n for (v" +
|
||||
"ar 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 " +
|
||||
" var calculateFilter = function (model) {\r\n if (model) {" +
|
||||
"\r\n if (filterDeviceAddressInclude) {\r\n " +
|
||||
" return (filterDeviceAddressInclude[model.DeviceAddress.toLowerCase()] == true)\r" +
|
||||
"\n }\r\n if (filterDeviceAddressExclude) {\r\n " +
|
||||
" return (!filterDeviceAddressExclude[model.DeviceAddress.t" +
|
||||
"oLowerCase()])\r\n }\r\n if (filterDeviceProfi" +
|
||||
"leInclude) {\r\n return (filterDeviceProfileInclude[model.D" +
|
||||
"eviceProfileId] == true)\r\n }\r\n if (filterD" +
|
||||
"eviceProfileExclude) {\r\n return (!filterDeviceProfileExcl" +
|
||||
"ude[model.DeviceProfileId])\r\n }\r\n return t" +
|
||||
"rue;\r\n }\r\n return false;\r\n }\r\n\r\n " +
|
||||
" var sortModels = function () {\r\n modelsInProcessSorted = [];" +
|
||||
"\r\n modelsReadyForReturnSorted = [];\r\n modelsWaitin" +
|
||||
"gForUserActionSorted = [];\r\n var modelSortFunc = function (a, b) " +
|
||||
"{\r\n if (a.UserId.toUpperCase() == b.UserId.toUpperCase()) {\r\n" +
|
||||
" return 0;\r\n } else {\r\n " +
|
||||
" if (a.UserId.toUpperCase() < b.UserId.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 (mod" +
|
||||
"el.WaitingForUserAction) {\r\n modelsWaitingForUserActi" +
|
||||
"onSorted.push(model);\r\n } else {\r\n " +
|
||||
" if (model.ReadyForReturn) {\r\n modelsReadyFor" +
|
||||
"ReturnSorted.push(model);\r\n } else {\r\n " +
|
||||
" modelsInProcessSorted.push(model);\r\n " +
|
||||
" }\r\n }\r\n }\r\n }\r\n " +
|
||||
" modelsReadyForReturnSorted = modelsReadyForReturnSorted.sort(modelSortF" +
|
||||
"unc);\r\n modelsInProcessSorted = modelsInProcessSorted.sort(modelS" +
|
||||
"ortFunc);\r\n modelsWaitingForUserActionSorted = modelsWaitingForUs" +
|
||||
"erActionSorted.sort(modelSortFunc);\r\n\r\n if (modelsInProcessSorted" +
|
||||
".length != modelsInProcessCount) {\r\n modelsInProcessCount = m" +
|
||||
"odelsInProcessSorted.length;\r\n $(\'#inProcessCount\').text(\'(\' " +
|
||||
"+ modelsInProcessCount + \')\');\r\n }\r\n if (modelsRea" +
|
||||
"dyForReturnSorted.length != modelsReadyForReturnCount) {\r\n mo" +
|
||||
"delsReadyForReturnCount = modelsReadyForReturnSorted.length;\r\n " +
|
||||
" $(\'#readyForReturnCount\').text(\'(\' + modelsReadyForReturnCount + \')\');\r\n " +
|
||||
" }\r\n if (modelsWaitingForUserActionSorted.length != mode" +
|
||||
"lsWaitingForUserActionCount) {\r\n modelsWaitingForUserActionCo" +
|
||||
"unt = modelsWaitingForUserActionSorted.length;\r\n $(\'#waitingF" +
|
||||
"orUserActionCount\').text(\'(\' + modelsWaitingForUserActionCount + \')\');\r\n " +
|
||||
" }\r\n\r\n };\r\n\r\n var scrollReadyForReturn = function (" +
|
||||
") {\r\n $readyForReturnContent.find(\'li\').last().detach().prependTo" +
|
||||
"($readyForReturnContent).hide().slideDown(\'slow\');\r\n modelsReadyF" +
|
||||
"orReturnIndexOffset++;\r\n if (modelsReadyForReturnIndexOffset >= m" +
|
||||
"odelsReadyForReturnSorted.length) {\r\n modelsReadyForReturnInd" +
|
||||
"exOffset = 0;\r\n }\r\n scrollReadyForReturnToken = wi" +
|
||||
"ndow.setTimeout(scrollReadyForReturn, scrollSpeed);\r\n };\r\n " +
|
||||
" var updateScrollReadyForReturn = function () {\r\n var containerHe" +
|
||||
"ight = $readyForReturn.find(\'.content\').height();\r\n var contentHe" +
|
||||
"ight = $readyForReturnContent.height();\r\n if (containerHeight >= " +
|
||||
"contentHeight && scrollReadyForReturnToken) {\r\n window.clearT" +
|
||||
"imeout(scrollReadyForReturnToken);\r\n return;\r\n " +
|
||||
" }\r\n if (containerHeight < contentHeight && scrollReadyForReturnT" +
|
||||
"oken == null) {\r\n scrollReadyForReturnToken = window.setTimeo" +
|
||||
"ut(scrollReadyForReturn, scrollSpeed);\r\n }\r\n };\r\n " +
|
||||
" var scrollInProcess = function () {\r\n $inProcessContent.fi" +
|
||||
"nd(\'li\').last().detach().prependTo($inProcessContent).hide().slideDown(\'slow\');\r" +
|
||||
"\n modelsInProcessIndexOffset++;\r\n if (modelsInProc" +
|
||||
"essIndexOffset >= modelsInProcessSorted.length) {\r\n modelsInP" +
|
||||
"rocessIndexOffset = 0;\r\n }\r\n scrollInProcessToken " +
|
||||
"= window.setTimeout(scrollInProcess, scrollSpeed);\r\n };\r\n " +
|
||||
"var updateScrollInProcess = function () {\r\n var containerHeight =" +
|
||||
" $inProcess.find(\'.content\').height();\r\n var contentHeight = $inP" +
|
||||
"rocessContent.height();\r\n if (containerHeight >= contentHeight &&" +
|
||||
" scrollInProcessToken) {\r\n window.clearTimeout(scrollInProces" +
|
||||
"sToken);\r\n return;\r\n }\r\n if (co" +
|
||||
"ntainerHeight < contentHeight && scrollInProcessToken == null) {\r\n " +
|
||||
" scrollInProcessToken = window.setTimeout(scrollInProcess, scrollSpeed);\r\n " +
|
||||
" }\r\n };\r\n var scrollWaitingForUserAction = f" +
|
||||
"unction () {\r\n $waitingForUserActionContent.find(\'li\').last().det" +
|
||||
"ach().prependTo($waitingForUserActionContent).hide().slideDown(\'slow\');\r\n " +
|
||||
" modelsInProcessIndexOffset++;\r\n if (modelsWaitingForUser" +
|
||||
"ActionIndexOffset >= modelsWaitingForUserActionSorted.length) {\r\n " +
|
||||
" modelsWaitingForUserActionIndexOffset = 0;\r\n }\r\n " +
|
||||
" scrollWaitingForUserActionToken = window.setTimeout(scrollWaitingForUserActi" +
|
||||
"on, scrollSpeed);\r\n };\r\n var updateScrollWaitingForUserAct" +
|
||||
"ion = function () {\r\n var containerHeight = $waitingForUserAction" +
|
||||
".find(\'.content\').height();\r\n var contentHeight = $waitingForUser" +
|
||||
"ActionContent.height();\r\n if (containerHeight >= contentHeight &&" +
|
||||
" scrollWaitingForUserActionToken) {\r\n window.clearTimeout(scr" +
|
||||
"ollWaitingForUserActionToken);\r\n return;\r\n }\r\n" +
|
||||
" if (containerHeight < contentHeight && scrollWaitingForUserActio" +
|
||||
"nToken == null) {\r\n scrollWaitingForUserActionToken = window." +
|
||||
"setTimeout(scrollWaitingForUserAction, scrollSpeed);\r\n }\r\n " +
|
||||
" };\r\n\r\n var modelInsertIndex = function (model) {\r\n " +
|
||||
" sortModels();\r\n var findIndex = function (model, array, offset)" +
|
||||
" {\r\n for (var i = 0; i < array.length; i++) {\r\n " +
|
||||
" if (model.UserId == array[i].UserId) {\r\n va" +
|
||||
"r 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.WaitingForUserAction) {\r\n return findIndex(model, model" +
|
||||
"sWaitingForUserActionSorted, modelsWaitingForUserActionIndexOffset);\r\n " +
|
||||
" } else {\r\n if (model.ReadyForReturn) {\r\n " +
|
||||
" return findIndex(model, modelsReadyForReturnSorted, modelsReadyForRetur" +
|
||||
"nIndexOffset);\r\n } else {\r\n return fin" +
|
||||
"dIndex(model, modelsInProcessSorted, modelsInProcessIndexOffset);\r\n " +
|
||||
" }\r\n }\r\n }\r\n var modelInsert = functi" +
|
||||
"on (model) {\r\n var index = modelInsertIndex(model);\r\n " +
|
||||
" var insertTo = function (model, host) {\r\n var hostLi = ho" +
|
||||
"st.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(model.htmlLi);\r\n } else {\r\n " +
|
||||
" $(hostLi.get(index - 1)).after(model.htmlLi);\r\n " +
|
||||
" }\r\n }\r\n }\r\n if (model.Wa" +
|
||||
"itingForUserAction) {\r\n insertTo(model, $waitingForUserAction" +
|
||||
"Content);\r\n window.setTimeout(updateScrollWaitingForUserActio" +
|
||||
"n, 100);\r\n } else {\r\n if (model.ReadyForReturn" +
|
||||
") {\r\n insertTo(model, $readyForReturnContent);\r\n " +
|
||||
" window.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 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 = $(\'<div>\').text(model.UserId + \' - \' + model.UserDisplayName);\r\n " +
|
||||
" if (!model.ReadyForReturn && model.EstimatedReturnTime) {\r\n " +
|
||||
" model.htmlContent.append($(\'<span class=\"small\">\').text(\' (Expe" +
|
||||
"cted: \' + model.EstimatedReturnTime + \')\'));\r\n }\r\n " +
|
||||
" if (model.WaitingForUserAction) {\r\n model.htmlCo" +
|
||||
"ntent.append($(\'<span class=\"small\">\').text(\' (Since \' + model.WaitingForUserAct" +
|
||||
"ionSince + \')\'));\r\n } else {\r\n if (mod" +
|
||||
"el.ReadyForReturn && model.ReadyForReturnSince) {\r\n m" +
|
||||
"odel.htmlContent.append($(\'<span class=\"small\">\').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 = $(\'<li>\').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 = $(\'<li>\').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 $.getJSON" +
|
||||
"(\'");
|
||||
|
||||
|
||||
#line 457 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Action(MVC.Public.UserHeldDevices.UserHeldDevice()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"', { id: UserId }, function (data) {
|
||||
processModel(UserId, data, false);
|
||||
});
|
||||
};
|
||||
|
||||
var connectionError = function () {
|
||||
if (persistantConnection) {
|
||||
persistantConnection.stop();
|
||||
persistantConnection = null;
|
||||
window.setTimeout(function () {
|
||||
window.location.href = '");
|
||||
|
||||
|
||||
#line 467 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Action(MVC.Public.UserHeldDevices.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 pe" +
|
||||
"rsistantConnection = $.connection(\'");
|
||||
|
||||
|
||||
#line 474 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Content("~/Public/UserHeldDevices/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 478 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Action(MVC.Public.UserHeldDevices.UserHeldDevices()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"', null, function (data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
processModel(data[i].UserId, data[i], true);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
init();
|
||||
|
||||
});
|
||||
</script>
|
||||
<div");
|
||||
|
||||
WriteLiteral(" id=\"mainFooter\"");
|
||||
|
||||
WriteLiteral(">\r\n <img");
|
||||
|
||||
WriteLiteral(" style=\"width: 32px; height: 32px; margin-top: -5px; margin-bottom: -15px;\"");
|
||||
|
||||
WriteAttribute("src", Tuple.Create(" src=\"", 23515), Tuple.Create("\"", 23564)
|
||||
|
||||
#line 490 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 23521), Tuple.Create<System.Object, System.Int32>(Links.ClientSource.Style.Images.Icon32_png
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 23521), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" alt=\"Disco Logo\"");
|
||||
|
||||
WriteLiteral(" />\r\n powered by Disco\r\n </div>\r\n</body>\r\n</html>\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
Reference in New Issue
Block a user