5510d34885
Performing page navigation (within an iFrame, or the top window) causes the foreverFrame transport in SignalR to abort which takes several seconds to reconnect. Popup windows are now used to navigate to Document Generation API when the foreverFrame transport is in use.
310 lines
19 KiB
Plaintext
310 lines
19 KiB
Plaintext
@model Disco.Web.Models.User.ShowModel
|
|
@{
|
|
Authorization.Require(Claims.User.Show);
|
|
|
|
var currentDeviceAssignments = Model.User.DeviceUserAssignments.Where(dua => !dua.UnassignedDate.HasValue).OrderByDescending(dua => dua.AssignedDate).ToList();
|
|
}
|
|
<table id="User_Show_Subjects">
|
|
<tbody>
|
|
<tr>
|
|
<td id="User_Show_Details">
|
|
<div>
|
|
<div id="User_Show_Details_Identity">
|
|
<table class="none verticalHeadings">
|
|
<tr>
|
|
<td><span>Username (Id):</span>
|
|
</td>
|
|
<td>
|
|
<h4 id="User_Show_Details_Identity_Id" title="Username">@Model.User.UserId</h4>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Display Name:</td>
|
|
<td><span id="User_Show_Details_Identity_DisplayName" title="Display Name">@Model.User.DisplayName</span></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Given Name:</td>
|
|
<td><span id="User_Show_Details_Identity_GivenName" title="Given Name">@Model.User.GivenName</span></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Surname:</td>
|
|
<td><span id="User_Show_Details_Identity_Surname" title="Surname">@Model.User.Surname</span></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
@if (Authorization.Has(Claims.User.ShowDetails))
|
|
{
|
|
<div id="User_Show_Details_Attributes" class="status">
|
|
<table class="none verticalHeadings">
|
|
<tr>
|
|
<td>Email:</td>
|
|
<td>
|
|
@if (!string.IsNullOrEmpty(Model.User.EmailAddress))
|
|
{
|
|
<span id="User_Show_Details_Attributes_Email" title="Email Address [Update in Active Directory]">@Model.User.EmailAddress</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="smallMessage">Unknown</span>
|
|
}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Phone:</td>
|
|
<td>
|
|
@if (!string.IsNullOrEmpty(Model.User.PhoneNumber))
|
|
{
|
|
<span id="User_Show_Details_Attributes_Phone" title="Phone Number [Update in Active Directory]">@Model.User.PhoneNumber</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="smallMessage">Unknown</span>
|
|
}
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
}
|
|
@if (Authorization.Has(Claims.User.Actions.GenerateDocuments))
|
|
{
|
|
<div id="User_Show_GenerateDocument_Container" class="status">
|
|
@Html.DropDownList("User_Show_GenerateDocument", Model.DocumentTemplatesSelectListItems)
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
var generatePdfUrl = '@Url.Action(MVC.API.User.GeneratePdf(Model.User.UserId, null))?DocumentTemplateId=';
|
|
var $documentTemplates = $('#User_Show_GenerateDocument');
|
|
var $generationHost;
|
|
|
|
$documentTemplates.change(function () {
|
|
var v = $documentTemplates.val();
|
|
if (v) {
|
|
var url = generatePdfUrl + v;
|
|
|
|
if ($.connection && $.connection.hub && $.connection.hub.transport &&
|
|
$.connection.hub.transport.name == 'foreverFrame') {
|
|
// SignalR active with foreverFrame transport - use popup window
|
|
window.open(url, '_blank', 'height=150,width=250,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
|
|
} else {
|
|
// use iFrame
|
|
if (!$generationHost) {
|
|
$generationHost = $('<iframe>')
|
|
.attr({ 'src': url, 'title': 'Document Generation Host' })
|
|
.addClass('hidden')
|
|
.appendTo('body')
|
|
.contents();
|
|
} else {
|
|
$generationHost[0].location.href = url;
|
|
}
|
|
}
|
|
|
|
$documentTemplates.val('').blur();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</div>
|
|
}
|
|
<div id="User_Show_Details_Actions">
|
|
@if (Model.User.CanCreateJob())
|
|
{
|
|
Html.BundleDeferred("~/ClientScripts/Modules/Disco-CreateJob");
|
|
@Html.ActionLinkSmallButton("Create Job", MVC.Job.Create(Model.PrimaryDeviceSerialNumber, Model.User.UserId), "User_Show_Details_Actions_CreateJob_Button")
|
|
if (currentDeviceAssignments.Count > 1)
|
|
{
|
|
<div id="User_Show_Details_Actions_CreateJob_Dialog" class="dialog" title="Create Job for Which Device?">
|
|
<div class="clearfix">
|
|
<i class="fa fa-info-circle information"></i> Multiple devices are assigned to this user.
|
|
<br />
|
|
<strong>Which device should be associated with this job?
|
|
</strong>
|
|
</div>
|
|
<div>
|
|
<ul id="CreateJob_Assignments" class="none">
|
|
@foreach (var assignment in currentDeviceAssignments)
|
|
{
|
|
<li class="CreateJob_Assignment clearfix" data-createjoburl="@Url.Action(MVC.Job.Create(assignment.DeviceSerialNumber, Model.User.UserId))">
|
|
<img class="CreateJob_Assignment_Image" alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(assignment.Device.DeviceModel.Id, assignment.Device.DeviceModel.ImageHash()))" />
|
|
<div class="CreateJob_Assignment_Details">
|
|
<table class="none">
|
|
<tbody>
|
|
<tr>
|
|
<td>Serial Number:
|
|
</td>
|
|
<td>
|
|
<span>@assignment.Device.SerialNumber</span> (<span>@assignment.Device.ComputerName</span>)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Model:
|
|
</td>
|
|
<td>
|
|
<span>@assignment.Device.DeviceModel.ToString()</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Asset:</td>
|
|
<td>
|
|
@if (!string.IsNullOrEmpty(assignment.Device.AssetNumber))
|
|
{
|
|
<span>@assignment.Device.AssetNumber</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="smallMessage">Unknown</span>
|
|
}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Assigned:</td>
|
|
<td>
|
|
<span>@CommonHelpers.FriendlyDate(assignment.AssignedDate)</span>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li>
|
|
}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$(function () {
|
|
var button = $('#User_Show_Details_Actions_CreateJob_Button');
|
|
var buttonDialog = null;
|
|
|
|
button.click(function () {
|
|
if (!buttonDialog) {
|
|
buttonDialog = $('#User_Show_Details_Actions_CreateJob_Dialog').dialog({
|
|
resizable: false,
|
|
width: 400,
|
|
modal: true,
|
|
autoOpen: false,
|
|
buttons: {
|
|
Cancel: function () {
|
|
$(this).dialog("close");
|
|
}
|
|
}
|
|
});
|
|
|
|
dialogItems = buttonDialog.find('li.CreateJob_Assignment');
|
|
|
|
dialogItems.click(function () {
|
|
var $this = $(this);
|
|
|
|
buttonDialog.dialog("close");
|
|
|
|
var createJobUrl = $this.attr('data-createjoburl');
|
|
document.DiscoFunctions.CreateOpenJobDialog(createJobUrl);
|
|
});
|
|
}
|
|
|
|
buttonDialog.dialog('open');
|
|
return false;
|
|
});
|
|
});
|
|
</script>
|
|
}
|
|
else
|
|
{
|
|
<script>
|
|
$(function () {
|
|
$('#User_Show_Details_Actions_CreateJob_Button').click(function () {
|
|
var $this = $(this);
|
|
var href = $this.attr('href');
|
|
|
|
document.DiscoFunctions.CreateOpenJobDialog(href);
|
|
|
|
return false;
|
|
});
|
|
});
|
|
</script>
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
</td>
|
|
@if (Authorization.Has(Claims.User.ShowAssignments))
|
|
{
|
|
<td id="User_Show_AssignedDevices">
|
|
<div>
|
|
<div id="User_Show_AssignedDevices_Active">
|
|
<h3>Current Device Assignments</h3>
|
|
@if (currentDeviceAssignments.Count > 0)
|
|
{
|
|
foreach (var assignment in currentDeviceAssignments)
|
|
{
|
|
<div class="User_Show_AssignedDevices_CurrentAssignment clearfix" data-deviceserialnumber="@assignment.DeviceSerialNumber">
|
|
@if (Authorization.Has(Claims.Device.Show))
|
|
{
|
|
<a href="@Url.Action(MVC.Device.Show(assignment.Device.SerialNumber))">
|
|
<img class="User_Show_AssignedDevices_CurrentAssignment_Image" alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(assignment.Device.DeviceModel.Id, assignment.Device.DeviceModel.ImageHash()))" />
|
|
</a>
|
|
}
|
|
else
|
|
{
|
|
<img class="User_Show_AssignedDevices_CurrentAssignment_Image" alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(assignment.Device.DeviceModel.Id, assignment.Device.DeviceModel.ImageHash()))" />
|
|
}
|
|
<div class="User_Show_AssignedDevices_CurrentAssignment_Details">
|
|
<table class="none">
|
|
<tbody>
|
|
<tr>
|
|
<td>Serial Number:
|
|
</td>
|
|
<td>
|
|
<span class="User_Show_AssignedDevices_CurrentAssignment_SerialNumber">
|
|
@if (Authorization.Has(Claims.Device.Show))
|
|
{
|
|
@Html.ActionLink(assignment.Device.SerialNumber, MVC.Device.Show(assignment.Device.SerialNumber))
|
|
}
|
|
else
|
|
{
|
|
@assignment.Device.SerialNumber
|
|
}
|
|
</span>(<span>@assignment.Device.ComputerName</span>)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Model:
|
|
</td>
|
|
<td>
|
|
<span class="User_Show_AssignedDevices_CurrentAssignment_Model">@assignment.Device.DeviceModel.ToString()</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Asset:</td>
|
|
<td>
|
|
@if (!string.IsNullOrEmpty(assignment.Device.AssetNumber))
|
|
{
|
|
<span class="User_Show_AssignedDevices_CurrentAssignment_Asset">@assignment.Device.AssetNumber</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="smallMessage">Unknown</span>
|
|
}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Assigned:</td>
|
|
<td>
|
|
<span class="User_Show_AssignedDevices_CurrentAssignment_Assigned">@CommonHelpers.FriendlyDate(assignment.AssignedDate)</span>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
<span class="smallMessage">No Current Device Assignments</span>
|
|
}
|
|
</div>
|
|
</div>
|
|
</td>
|
|
}
|
|
</tr>
|
|
</tbody>
|
|
</table>
|