feature: bulk generate documents for device batches, models and profiles

This commit is contained in:
Gary Sharp
2023-05-04 15:30:04 +10:00
parent 473b02f718
commit 0a4a2816a0
29 changed files with 1285 additions and 530 deletions
+1
View File
@@ -189,6 +189,7 @@
<Compile Include="UI\Config\JobQueue\ConfigJobQueueIndexModel.cs" />
<Compile Include="UI\Config\JobQueue\ConfigJobQueueShowModel.cs" />
<Compile Include="UI\Config\Logging\ConfigLoggingIndexModel.cs" />
<Compile Include="UI\Config\Shared\ConfigSharedDeviceGroupDocumentTemplateBulkGenerate.cs" />
<Compile Include="UI\Config\Shared\ConfigSharedTaskStatusModel.cs" />
<Compile Include="UI\Config\Organisation\ConfigOrganisationIndexModel.cs" />
<Compile Include="UI\Config\UserFlag\ConfigUserFlagCreateModel.cs" />
@@ -1,18 +1,15 @@
using System;
using Disco.Models.UI.Config.Shared;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Models.UI.Config.DeviceBatch
{
public interface ConfigDeviceBatchShowModel : BaseUIModel
public interface ConfigDeviceBatchShowModel : BaseUIModel, ConfigSharedDeviceGroupDocumentTemplateBulkGenerate
{
Disco.Models.Repository.DeviceBatch DeviceBatch { get; set; }
Repository.DeviceBatch DeviceBatch { get; set; }
Disco.Models.Repository.DeviceModel DefaultDeviceModel { get; set; }
Repository.DeviceModel DefaultDeviceModel { get; set; }
List<Disco.Models.Repository.DeviceModel> DeviceModels { get; set; }
List<Repository.DeviceModel> DeviceModels { get; set; }
List<ConfigDeviceBatchShowModelMembership> DeviceModelMembers { get; set; }
@@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Disco.Models.UI.Config.Shared;
namespace Disco.Models.UI.Config.DeviceModel
{
public interface ConfigDeviceModelShowModel : BaseUIModel
public interface ConfigDeviceModelShowModel : BaseUIModel, ConfigSharedDeviceGroupDocumentTemplateBulkGenerate
{
Disco.Models.Repository.DeviceModel DeviceModel { get; set; }
@@ -1,9 +1,10 @@
using Disco.Models.BI.Config;
using Disco.Models.UI.Config.Shared;
using System.Collections.Generic;
namespace Disco.Models.UI.Config.DeviceProfile
{
public interface ConfigDeviceProfileShowModel : BaseUIModel
public interface ConfigDeviceProfileShowModel : BaseUIModel, ConfigSharedDeviceGroupDocumentTemplateBulkGenerate
{
Repository.DeviceProfile DeviceProfile { get; set; }
OrganisationAddress DefaultOrganisationAddress { get; set; }
@@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace Disco.Models.UI.Config.Shared
{
public interface ConfigSharedDeviceGroupDocumentTemplateBulkGenerate : BaseUIModel
{
List<Repository.DocumentTemplate> BulkGenerateDocumentTemplates { get; set; }
int DeviceGroupId { get; }
}
}
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Models.UI.Config.Shared
namespace Disco.Models.UI.Config.Shared
{
public interface ConfigSharedTaskStatusModel : BaseUIModel
{
@@ -666,6 +666,105 @@ namespace Disco.Web.Areas.API.Controllers
}
}
[DiscoAuthorizeAll(Claims.Config.DeviceModel.Show, Claims.Config.DocumentTemplate.BulkGenerate)]
public virtual ActionResult BulkGenerateDeviceModel(string id, int deviceGroupId)
{
var template = Database.DocumentTemplates.FirstOrDefault(t => t.Id == id);
if (template == null)
return HttpNotFound("Document Template not found");
var deviceModel = Database.DeviceModels.FirstOrDefault(m => m.Id == deviceGroupId);
if (deviceModel is null)
return HttpNotFound("Device Model not found");
List<string> dataIds;
switch (template.AttachmentType)
{
case AttachmentTypes.Device:
dataIds = Database.Devices.Where(d => d.DeviceModelId == deviceModel.Id && d.DecommissionedDate == null).Select(d => d.SerialNumber).ToList();
break;
case AttachmentTypes.Job:
dataIds = Database.Jobs.Where(j => j.ClosedDate == null && j.Device.DeviceModelId == deviceModel.Id).Select(j => j.Id).AsEnumerable().Select(j => j.ToString()).ToList();
break;
case AttachmentTypes.User:
dataIds = Database.Users.Where(u => u.DeviceUserAssignments.Any(a => a.UnassignedDate == null && a.Device.DeviceModelId == deviceModel.Id)).Select(u => u.UserId).ToList();
break;
default:
throw new NotSupportedException("The template type is not supported");
}
if (!dataIds.Any())
return HttpNotFound($"No {template.AttachmentType} targets in scope");
return BulkGenerate(template.Id, string.Join(Environment.NewLine, dataIds));
}
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Show, Claims.Config.DocumentTemplate.BulkGenerate)]
public virtual ActionResult BulkGenerateDeviceProfile(string id, int deviceGroupId)
{
var template = Database.DocumentTemplates.FirstOrDefault(t => t.Id == id);
if (template == null)
return HttpNotFound("Document Template not found");
var deviceProfile = Database.DeviceProfiles.FirstOrDefault(m => m.Id == deviceGroupId);
if (deviceProfile is null)
return HttpNotFound("Device Profile not found");
List<string> dataIds;
switch (template.AttachmentType)
{
case AttachmentTypes.Device:
dataIds = Database.Devices.Where(d => d.DeviceProfileId == deviceProfile.Id && d.DecommissionedDate == null).Select(d => d.SerialNumber).ToList();
break;
case AttachmentTypes.Job:
dataIds = Database.Jobs.Where(j => j.ClosedDate == null && j.Device.DeviceProfileId == deviceProfile.Id).Select(j => j.Id).AsEnumerable().Select(j => j.ToString()).ToList();
break;
case AttachmentTypes.User:
dataIds = Database.Users.Where(u => u.DeviceUserAssignments.Any(a => a.UnassignedDate == null && a.Device.DeviceProfileId == deviceProfile.Id)).Select(u => u.UserId).ToList();
break;
default:
throw new NotSupportedException("The template type is not supported");
}
if (!dataIds.Any())
return HttpNotFound($"No {template.AttachmentType} targets in scope");
return BulkGenerate(template.Id, string.Join(Environment.NewLine, dataIds));
}
[DiscoAuthorizeAll(Claims.Config.DeviceBatch.Show, Claims.Config.DocumentTemplate.BulkGenerate)]
public virtual ActionResult BulkGenerateDeviceBatch(string id, int deviceGroupId)
{
var template = Database.DocumentTemplates.FirstOrDefault(t => t.Id == id);
if (template == null)
return HttpNotFound("Document Template not found");
var deviceBatch = Database.DeviceBatches.FirstOrDefault(m => m.Id == deviceGroupId);
if (deviceBatch is null)
return HttpNotFound("Device Batch not found");
List<string> dataIds;
switch (template.AttachmentType)
{
case AttachmentTypes.Device:
dataIds = Database.Devices.Where(d => d.DeviceBatchId == deviceBatch.Id && d.DecommissionedDate == null).Select(d => d.SerialNumber).ToList();
break;
case AttachmentTypes.Job:
dataIds = Database.Jobs.Where(j => j.ClosedDate == null && j.Device.DeviceBatchId == deviceBatch.Id).Select(j => j.Id).AsEnumerable().Select(j => j.ToString()).ToList();
break;
case AttachmentTypes.User:
dataIds = Database.Users.Where(u => u.DeviceUserAssignments.Any(a => a.UnassignedDate == null && a.Device.DeviceBatchId == deviceBatch.Id)).Select(u => u.UserId).ToList();
break;
default:
throw new NotSupportedException("The template type is not supported");
}
if (!dataIds.Any())
return HttpNotFound($"No {template.AttachmentType} targets in scope");
return BulkGenerate(template.Id, string.Join(Environment.NewLine, dataIds));
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.BulkGenerate)]
public virtual ActionResult BulkGenerate(string id, string DataIds = null, bool InsertBlankPage = false)
{
@@ -61,6 +61,9 @@ namespace Disco.Web.Areas.Config.Controllers
m.DefaultDeviceModel = m.DeviceBatch.DefaultDeviceModelId.HasValue ? Database.DeviceModels.Find(m.DeviceBatch.DefaultDeviceModelId.Value) : null;
}
if (m.DeviceModelMembers.Any(g => g.DeviceCount - g.DeviceDecommissionedCount > 0))
m.BulkGenerateDocumentTemplates = Database.DocumentTemplates.Where(t => !t.IsHidden).ToList();
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceBatchShowModel>(this.ControllerContext, m);
@@ -41,6 +41,9 @@ namespace Disco.Web.Areas.Config.Controllers
m.CanDelete = m.DeviceModel.CanDelete(Database);
if (m.DeviceCount - m.DeviceDecommissionedCount > 0)
m.BulkGenerateDocumentTemplates = Database.DocumentTemplates.Where(t => !t.IsHidden).ToList();
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceModelShowModel>(this.ControllerContext, m);
@@ -63,6 +63,9 @@ namespace Disco.Web.Areas.Config.Controllers
}
m.CanDelete = m.DeviceProfile.CanDelete(Database);
if (m.DeviceCount - m.DeviceDecommissionedCount > 0)
m.BulkGenerateDocumentTemplates = Database.DocumentTemplates.Where(t => !t.IsHidden).ToList();
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceProfileShowModel>(this.ControllerContext, m);
@@ -1,10 +1,11 @@
using Disco.Models.UI.Config.DeviceBatch;
using Disco.Services.Devices.ManagedGroups;
using Disco.Web.Areas.Config.Models.Shared;
using System.Collections.Generic;
namespace Disco.Web.Areas.Config.Models.DeviceBatch
{
public class ShowModel : ConfigDeviceBatchShowModel
public class ShowModel : DeviceGroupDocumentTemplateBulkGenerateModel, ConfigDeviceBatchShowModel
{
public Disco.Models.Repository.DeviceBatch DeviceBatch { get; set; }
@@ -19,5 +20,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceBatch
public int DeviceCount { get; set; }
public int DeviceDecommissionedCount { get; set; }
public bool CanDelete { get; set; }
public override int DeviceGroupId => DeviceBatch.Id;
}
}
@@ -1,13 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Models.UI.Config.DeviceModel;
using Disco.Services.Plugins;
using Disco.Models.UI.Config.DeviceModel;
using Disco.Web.Areas.Config.Models.Shared;
using System.Collections.Generic;
namespace Disco.Web.Areas.Config.Models.DeviceModel
{
public class ShowModel : ConfigDeviceModelShowModel
public class ShowModel : DeviceGroupDocumentTemplateBulkGenerateModel, ConfigDeviceModelShowModel
{
public Disco.Models.Repository.DeviceModel DeviceModel { get; set; }
@@ -20,5 +18,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceModel
public int DeviceDecommissionedCount { get; set; }
public bool CanDelete { get; set; }
public override int DeviceGroupId => DeviceModel.Id;
}
}
@@ -2,12 +2,13 @@
using Disco.Services.Devices.ManagedGroups;
using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Plugins;
using Disco.Web.Areas.Config.Models.Shared;
using System.Collections.Generic;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
public class ShowModel : ConfigDeviceProfileShowModel
public class ShowModel : DeviceGroupDocumentTemplateBulkGenerateModel, ConfigDeviceProfileShowModel
{
public Disco.Models.Repository.DeviceProfile DeviceProfile { get; set; }
public List<SelectListItem> DeviceProfileDistributionTypes { get; set; }
@@ -42,5 +43,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceProfile
public int DeviceDecommissionedCount { get; set; }
public bool CanDelete { get; set; }
public override int DeviceGroupId => DeviceProfile.Id;
}
}
@@ -0,0 +1,12 @@
using Disco.Models.UI.Config.Shared;
using System.Collections.Generic;
namespace Disco.Web.Areas.Config.Models.Shared
{
public abstract class DeviceGroupDocumentTemplateBulkGenerateModel : ConfigSharedDeviceGroupDocumentTemplateBulkGenerate
{
public List<Disco.Models.Repository.DocumentTemplate> BulkGenerateDocumentTemplates { get; set; }
public abstract int DeviceGroupId { get; }
}
}
@@ -1007,6 +1007,7 @@
</tr>
</table>
</div>
@Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model);
<div class="actionBar">
@if (Model.CanDelete)
{
@@ -2720,21 +2720,29 @@ WriteLiteral("\r\n");
#line default
#line hidden
WriteLiteral(" </div>\r\n </td>\r\n </tr>\r\n </table>\r\n</div>\r\n<" +
"div");
WriteLiteral(" </div>\r\n </td>\r\n </tr>\r\n </table>\r\n</div>\r\n");
#line 1010 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
Write(Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model));
#line default
#line hidden
WriteLiteral(";\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
#line 1011 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
#line 1012 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
#line default
#line hidden
#line 1011 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
#line 1012 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
if (Model.CanDelete)
{
@@ -2742,14 +2750,14 @@ WriteLiteral(">\r\n");
#line default
#line hidden
#line 1013 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
#line 1014 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
Write(Html.ActionLinkButton("Delete", MVC.API.DeviceBatch.Delete(Model.DeviceBatch.Id, true), "buttonDelete"));
#line default
#line hidden
#line 1013 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
#line 1014 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
}
@@ -2759,7 +2767,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 1015 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
#line 1016 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
if (Model.DeviceCount > 0)
{
if (Authorization.Has(Claims.Device.Actions.Export))
@@ -2769,14 +2777,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 1019 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
#line 1020 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.Exporting.DeviceExportTypes.Batch, Model.DeviceBatch.Id)));
#line default
#line hidden
#line 1019 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
#line 1020 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
}
if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
@@ -2786,14 +2794,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 1023 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
#line 1024 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
Write(Html.ActionLinkButton(string.Format("View {0} Device{1}", Model.DeviceCount, (Model.DeviceCount != 1 ? "s" : null)), MVC.Search.Query(Model.DeviceBatch.Id.ToString(), "DeviceBatch")));
#line default
#line hidden
#line 1023 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
#line 1024 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
}
}
@@ -44,7 +44,14 @@
@Html.DisplayFor(modelItem => item.ModelType)
</td>
<td>
@item.DeviceCount.ToString("n0")
@if (item.DeviceCount > 0 && Authorization.Has(Claims.Device.Search))
{
<span>@Html.ActionLink(string.Format("View {0}", item.DeviceCount), MVC.Search.Query(item.Id.ToString(), "DeviceModel"))</span>
}
else
{
<span>@item.DeviceCount.ToString("n0")</span>
}
@if (item.DeviceDecommissionedCount > 0)
{
<span class="smallMessage" title="@(item.DeviceDecommissionedCount.ToString("n0")) Decommissioned">
@@ -185,25 +185,62 @@ WriteLiteral(" ");
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 47 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
WriteLiteral("\r\n");
#line 48 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line default
#line hidden
#line 48 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 47 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
if (item.DeviceCount > 0 && Authorization.Has(Claims.Device.Search))
{
#line default
#line hidden
WriteLiteral(" <span>");
#line 49 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.ActionLink(string.Format("View {0}", item.DeviceCount), MVC.Search.Query(item.Id.ToString(), "DeviceModel")));
#line default
#line hidden
WriteLiteral("</span>\r\n");
#line 50 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <span>");
#line 53 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
WriteLiteral("</span>\r\n");
#line 54 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 55 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
if (item.DeviceDecommissionedCount > 0)
{
@@ -214,21 +251,21 @@ WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2020), Tuple.Create("\"", 2091)
WriteAttribute("title", Tuple.Create(" title=\"", 2371), Tuple.Create("\"", 2442)
#line 50 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
, Tuple.Create(Tuple.Create("", 2028), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0")
#line 57 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
, Tuple.Create(Tuple.Create("", 2379), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0")
#line default
#line hidden
, 2028), false)
, Tuple.Create(Tuple.Create(" ", 2076), Tuple.Create("Decommissioned", 2077), true)
, 2379), false)
, Tuple.Create(Tuple.Create(" ", 2427), Tuple.Create("Decommissioned", 2428), true)
);
WriteLiteral(">\r\n (");
#line 51 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 58 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(item.DeviceDecommissionedCount.ToString("n0"));
@@ -237,7 +274,7 @@ WriteLiteral(">\r\n (");
WriteLiteral(")\r\n </span>\r\n");
#line 53 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 60 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
}
@@ -246,7 +283,7 @@ WriteLiteral(")\r\n </span>\r\n");
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 56 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 63 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
}
@@ -261,7 +298,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 59 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 66 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.ActionLinkButton("Generic Components", MVC.Config.DeviceModel.GenericComponents()));
@@ -15,21 +15,24 @@
<div class="form" style="width: 530px">
<table>
<tr>
<th style="width: 150px">Id:
<th style="width: 150px">
Id:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Id)
</td>
</tr>
<tr>
<th>Description:
<th>
Description:
</th>
<td>@if (canConfig)
<td>
@if (canConfig)
{
@Html.EditorFor(model => model.DeviceModel.Description)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script>
@Html.EditorFor(model => model.DeviceModel.Description)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script>
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#DeviceModel_Description'),
@@ -38,43 +41,47 @@
'Description'
);
});
</script>
</script>
}
else
{
@Html.DisplayFor(model => model.DeviceModel.Description)
@Html.DisplayFor(model => model.DeviceModel.Description)
}
</td>
</tr>
<tr>
<th>Manufacturer:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Manufacturer)
</td>
</tr>
<tr>
<th>Model:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Model)
</td>
</tr>
<tr>
<th>Statistics</th>
<td>
<div><strong>@Model.DeviceCount.ToString("n0")</strong> @(Model.DeviceCount == 1 ? "devices is" : "devices are") of this model type.</div>
@if (Model.DeviceDecommissionedCount > 0)
{
<div class="smallMessage">@Model.DeviceDecommissionedCount.ToString("n0") @(Model.DeviceDecommissionedCount == 1 ? "device is" : "devices are") decommissioned.</div>
}
</td>
</tr>
<tr>
<th>Default Purchase Date:
</th>
<td>@if (canConfig)
{
</td>
</tr>
<tr>
<th>
Manufacturer:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Manufacturer)
</td>
</tr>
<tr>
<th>
Model:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Model)
</td>
</tr>
<tr>
<th>Statistics</th>
<td>
<div><strong>@Model.DeviceCount.ToString("n0")</strong> @(Model.DeviceCount == 1 ? "devices is" : "devices are") of this model type.</div>
@if (Model.DeviceDecommissionedCount > 0)
{
<div class="smallMessage">@Model.DeviceDecommissionedCount.ToString("n0") @(Model.DeviceDecommissionedCount == 1 ? "device is" : "devices are") decommissioned.</div>
}
</td>
</tr>
<tr>
<th>
Default Purchase Date:
</th>
<td>
@if (canConfig)
{
@Html.EditorFor(model => model.DeviceModel.DefaultPurchaseDate)
@AjaxHelpers.AjaxLoader()
<script>
@@ -90,20 +97,22 @@
);
});
</script>
}
else
{
}
else
{
@CommonHelpers.FriendlyDate(Model.DeviceModel.DefaultPurchaseDate, "Unknown")
}
</td>
</tr>
<tr>
<th>Default Warranty Provider:
</th>
<td>@if (canConfig)
{
if (Model.WarrantyProviders.Count > 0)
{
}
</td>
</tr>
<tr>
<th>
Default Warranty Provider:
</th>
<td>
@if (canConfig)
{
if (Model.WarrantyProviders.Count > 0)
{
@Html.DropDownListFor(model => model.DeviceModel.DefaultWarrantyProvider, Model.WarrantyProviders.ToSelectListItems(Model.DeviceModel.DefaultWarrantyProvider, true, "None"))
@AjaxHelpers.AjaxLoader()
<script>
@@ -116,48 +125,50 @@
);
});
</script>
}
else
{
}
else
{
<span class="smallMessage">No warranty provider plugins installed</span>
}
if (canViewPlugins)
{
}
if (canViewPlugins)
{
<div class="info-box">
<p class="fa-p">
<i class="fa fa-info-circle"></i>View the <a href="@(Url.Action(MVC.Config.Plugins.Install()))">Plugin Catalogue</a> to discover and install warranty provider plugins.
</p>
</div>
}
}
}
else
{
if (Model.DeviceModel.DefaultWarrantyProvider == null)
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
var provider = Model.WarrantyProviders.FirstOrDefault(wp => wp.Id == Model.DeviceModel.DefaultWarrantyProvider);
if (provider == null)
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
if (Model.DeviceModel.DefaultWarrantyProvider == null)
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
var provider = Model.WarrantyProviders.FirstOrDefault(wp => wp.Id == Model.DeviceModel.DefaultWarrantyProvider);
if (provider == null)
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
@provider.Name
}
}
@provider.Name
}
</td>
</tr>
<tr>
<th>Default Repair Provider:
</th>
<td>@if (canConfig)
{
if (Model.RepairProviders.Count > 0)
{
}
}
</td>
</tr>
<tr>
<th>
Default Repair Provider:
</th>
<td>
@if (canConfig)
{
if (Model.RepairProviders.Count > 0)
{
@Html.DropDownListFor(model => model.DeviceModel.DefaultRepairProvider, Model.RepairProviders.ToSelectListItems(Model.DeviceModel.DefaultRepairProvider, true, "None"))
@AjaxHelpers.AjaxLoader()
<script>
@@ -170,82 +181,85 @@
);
});
</script>
}
else
{
}
else
{
<div>No repair provider plugins installed</div>
}
if (canViewPlugins)
{
}
if (canViewPlugins)
{
<div class="info-box">
<p class="fa-p">
<i class="fa fa-info-circle"></i>View the <a href="@(Url.Action(MVC.Config.Plugins.Install()))">Plugin Catalogue</a> to discover and install repair provider plugins.
</p>
</div>
}
}
}
else
{
if (Model.DeviceModel.DefaultRepairProvider == null)
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
var provider = Model.RepairProviders.FirstOrDefault(wp => wp.Id == Model.DeviceModel.DefaultRepairProvider);
if (provider == null)
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
if (Model.DeviceModel.DefaultRepairProvider == null)
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
var provider = Model.RepairProviders.FirstOrDefault(wp => wp.Id == Model.DeviceModel.DefaultRepairProvider);
if (provider == null)
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
@provider.Name
}
}
@provider.Name
}
</td>
</tr>
<tr>
<th>Type:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.ModelType)
</td>
</tr>
<tr>
<th>Image:
</th>
<td>
<img alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))" />
@if (canConfig)
{
<hr />
using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="Image" id="Image" style="width: 220px;" />
<input class="button small" type="submit" value="Upload Image" />
}
}
</td>
</tr>
</table>
}
}
</td>
</tr>
<tr>
<th>
Type:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.ModelType)
</td>
</tr>
<tr>
<th>
Image:
</th>
<td>
<img alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))" />
@if (canConfig)
{
<hr />
using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="Image" id="Image" style="width: 220px;" />
<input class="button small" type="submit" value="Upload Image" />
}
}
</td>
</tr>
</table>
</div>
<h2>Components</h2>
@Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel)
@Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model);
<div class="actionBar">
@if (Model.CanDelete)
{
{
@Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete")
}
@if (Model.DeviceCount > 0)
{
if (Authorization.Has(Claims.Device.Actions.Export))
{
@Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.Exporting.DeviceExportTypes.Model, Model.DeviceModel.Id))
@Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.Exporting.DeviceExportTypes.Model, Model.DeviceModel.Id))
}
if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
{
@Html.ActionLinkButton(string.Format("View {0} Device{1}", Model.DeviceCount, (Model.DeviceCount != 1 ? "s" : null)), MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel"))
@Html.ActionLinkButton(string.Format("View {0} Device{1}", Model.DeviceCount, (Model.DeviceCount != 1 ? "s" : null)), MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel"))
}
}
</div>
File diff suppressed because it is too large Load Diff
@@ -38,7 +38,7 @@
</th>
<td>
@if (canConfig)
{
{
@Html.TextBoxFor(model => model.DeviceProfile.Name)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
@@ -512,7 +512,7 @@
<div style="margin-top: 8px;">
@if (canConfig)
{
<input id="DeviceProfile_EnforceOrganisationalUnit" type="checkbox" @(Model.DeviceProfile.EnforceOrganisationalUnit ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty)) />
<input id="DeviceProfile_EnforceOrganisationalUnit" type="checkbox" @(Model.DeviceProfile.EnforceOrganisationalUnit ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty)) />
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
@@ -617,7 +617,7 @@
{
<ul>
@foreach (var certificateProvider in certificateProviders)
{
{
<li>@certificateProvider.Name</li>
}
</ul>
@@ -640,14 +640,14 @@
{
<ul>
@foreach (var certificateProvider in certificateProviders)
{
{
<li>@certificateProvider.Name</li>
}
</ul>
}
}
@if (canViewPlugins)
{
{
<div class="info-box">
<p class="fa-p">
<i class="fa fa-info-circle"></i>View the <a href="@(Url.Action(MVC.Config.Plugins.Install()))">Plugin Catalogue</a> to discover and install certificate provider plugins.
@@ -703,7 +703,7 @@
{
<ul>
@foreach (var wirelessProfileProvider in wirelessProfileProviders)
{
{
<li>@wirelessProfileProvider.Name</li>
}
</ul>
@@ -804,6 +804,7 @@
});
</script>
}
@Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model);
<div class="actionBar">
@if (canDelete)
{
@@ -125,7 +125,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n
#line 40 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (canConfig)
{
{
#line default
@@ -724,14 +724,14 @@ WriteLiteral(" class=\"fa fa-info-circle\"");
WriteLiteral("></i>The profile address is used to separate jobs for <a");
WriteAttribute("href", Tuple.Create(" href=\"", 8092), Tuple.Create("\"", 8143)
WriteAttribute("href", Tuple.Create(" href=\"", 8096), Tuple.Create("\"", 8147)
#line 192 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
, Tuple.Create(Tuple.Create("", 8099), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Organisation.Index())
, Tuple.Create(Tuple.Create("", 8103), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Organisation.Index())
#line default
#line hidden
, 8099), false)
, 8103), false)
);
WriteLiteral(@">multi-site mode</a>.
@@ -1186,14 +1186,14 @@ WriteLiteral(" <a");
WriteLiteral(" id=\"expressionBrowserAnchor\"");
WriteAttribute("href", Tuple.Create(" href=\"", 14667), Tuple.Create("\"", 14736)
WriteAttribute("href", Tuple.Create(" href=\"", 14671), Tuple.Create("\"", 14740)
#line 303 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
, Tuple.Create(Tuple.Create("", 14674), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.DocumentTemplate.ExpressionBrowser())
, Tuple.Create(Tuple.Create("", 14678), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.DocumentTemplate.ExpressionBrowser())
#line default
#line hidden
, 14674), false)
, 14678), false)
);
WriteLiteral(">&nbsp;</a>\r\n");
@@ -1714,7 +1714,7 @@ WriteLiteral(" ");
#line default
#line hidden
WriteLiteral(" />\r\n");
WriteLiteral(" />\r\n");
WriteLiteral(" <script");
@@ -2018,7 +2018,7 @@ WriteLiteral(" <ul>\r\n");
#line 619 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
foreach (var certificateProvider in certificateProviders)
{
{
#line default
@@ -2118,7 +2118,7 @@ WriteLiteral(" <ul>\r\n");
#line 642 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
foreach (var certificateProvider in certificateProviders)
{
{
#line default
@@ -2156,7 +2156,7 @@ WriteLiteral(" ");
#line 649 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (canViewPlugins)
{
{
#line default
@@ -2175,14 +2175,14 @@ WriteLiteral(" class=\"fa fa-info-circle\"");
WriteLiteral("></i>View the <a");
WriteAttribute("href", Tuple.Create(" href=\"", 34296), Tuple.Create("\"", 34346)
WriteAttribute("href", Tuple.Create(" href=\"", 34318), Tuple.Create("\"", 34368)
#line 653 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
, Tuple.Create(Tuple.Create("", 34303), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Plugins.Install())
, Tuple.Create(Tuple.Create("", 34325), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Plugins.Install())
#line default
#line hidden
, 34303), false)
, 34325), false)
);
WriteLiteral(">Plugin Catalogue</a> to discover and install certificate provider plugins.\r\n " +
@@ -2340,7 +2340,7 @@ WriteLiteral(" <ul>\r\n");
#line 705 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
foreach (var wirelessProfileProvider in wirelessProfileProviders)
{
{
#line default
@@ -2397,14 +2397,14 @@ WriteLiteral(" class=\"fa fa-info-circle\"");
WriteLiteral("></i>View the <a");
WriteAttribute("href", Tuple.Create(" href=\"", 37542), Tuple.Create("\"", 37592)
WriteAttribute("href", Tuple.Create(" href=\"", 37572), Tuple.Create("\"", 37622)
#line 716 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
, Tuple.Create(Tuple.Create("", 37549), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Plugins.Install())
, Tuple.Create(Tuple.Create("", 37579), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Plugins.Install())
#line default
#line hidden
, 37549), false)
, 37579), false)
);
WriteLiteral(">Plugin Catalogue</a> to discover and install wireless profile provider plugins.\r" +
@@ -2602,20 +2602,27 @@ WriteLiteral(@">
#line default
#line hidden
WriteLiteral("<div");
#line 807 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model));
#line default
#line hidden
WriteLiteral(";\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
#line 808 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 809 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 808 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 809 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (canDelete)
{
@@ -2623,14 +2630,14 @@ WriteLiteral(">\r\n");
#line default
#line hidden
#line 810 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 811 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Html.ActionLinkButton("Delete", MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true), "buttonDelete"));
#line default
#line hidden
#line 810 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 811 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -2640,7 +2647,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 812 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 813 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (Authorization.Has(Claims.Device.Actions.Export))
{
@@ -2648,14 +2655,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 814 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 815 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.Exporting.DeviceExportTypes.Profile, Model.DeviceProfile.Id)));
#line default
#line hidden
#line 814 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 815 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -2665,7 +2672,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 816 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 817 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
{
@@ -2673,14 +2680,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 818 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 819 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Html.ActionLinkButton(string.Format("View {0} Device{1}", Model.DeviceCount, (Model.DeviceCount != 1 ? "s" : null)), MVC.Search.Query(Model.DeviceProfile.Id.ToString(), "DeviceProfile")));
#line default
#line hidden
#line 818 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 819 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -35,7 +35,14 @@
@Html.DisplayFor(modelItem => item.DistributionType)
</td>
<td>
@item.DeviceCount.ToString("n0")
@if (item.DeviceCount > 0 && Authorization.Has(Claims.Device.Search))
{
<span>@Html.ActionLink(string.Format("View {0}", item.DeviceCount), MVC.Search.Query(item.Id.ToString(), "DeviceProfile"))</span>
}
else
{
<span>@item.DeviceCount.ToString("n0")</span>
}
@if (item.DeviceDecommissionedCount > 0)
{
<span class="smallMessage" title="@(item.DeviceDecommissionedCount.ToString("n0")) Decommissioned">
@@ -148,25 +148,62 @@ WriteLiteral(" ");
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 38 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
WriteLiteral("\r\n");
#line 39 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line default
#line hidden
#line 39 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 38 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
if (item.DeviceCount > 0 && Authorization.Has(Claims.Device.Search))
{
#line default
#line hidden
WriteLiteral(" <span>");
#line 40 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(Html.ActionLink(string.Format("View {0}", item.DeviceCount), MVC.Search.Query(item.Id.ToString(), "DeviceProfile")));
#line default
#line hidden
WriteLiteral("</span>\r\n");
#line 41 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <span>");
#line 44 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
WriteLiteral("</span>\r\n");
#line 45 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 46 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
if (item.DeviceDecommissionedCount > 0)
{
@@ -177,21 +214,21 @@ WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1187), Tuple.Create("\"", 1258)
WriteAttribute("title", Tuple.Create(" title=\"", 1540), Tuple.Create("\"", 1611)
#line 41 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
, Tuple.Create(Tuple.Create("", 1195), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0")
#line 48 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
, Tuple.Create(Tuple.Create("", 1548), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0")
#line default
#line hidden
, 1195), false)
, Tuple.Create(Tuple.Create(" ", 1243), Tuple.Create("Decommissioned", 1244), true)
, 1548), false)
, Tuple.Create(Tuple.Create(" ", 1596), Tuple.Create("Decommissioned", 1597), true)
);
WriteLiteral(">\r\n (");
#line 42 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 49 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(item.DeviceDecommissionedCount.ToString("n0"));
@@ -200,7 +237,7 @@ WriteLiteral(">\r\n (");
WriteLiteral(")\r\n </span>\r\n");
#line 44 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 51 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
@@ -209,13 +246,13 @@ WriteLiteral(")\r\n </span>\r\n");
WriteLiteral(" </td>\r\n");
#line 46 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 53 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line default
#line hidden
#line 46 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 53 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
if (showTags)
{
@@ -225,13 +262,13 @@ WriteLiteral(" </td>\r\n");
WriteLiteral(" <td>\r\n");
#line 49 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 56 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line default
#line hidden
#line 49 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 56 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
if (item.IsLinked)
{
@@ -247,7 +284,7 @@ WriteLiteral(" title=\"Is Linked\"");
WriteLiteral("></i>\r\n");
#line 52 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 59 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
else
{
@@ -262,7 +299,7 @@ WriteLiteral("&nbsp;");
WriteLiteral("\r\n");
#line 56 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 63 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
@@ -271,7 +308,7 @@ WriteLiteral("\r\n");
WriteLiteral(" </td>\r\n");
#line 58 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 65 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
@@ -280,7 +317,7 @@ WriteLiteral(" </td>\r\n");
WriteLiteral(" </tr>\r\n");
#line 60 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 67 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
@@ -0,0 +1,90 @@
@model Disco.Web.Areas.Config.Models.Shared.DeviceGroupDocumentTemplateBulkGenerateModel
@if (Model.BulkGenerateDocumentTemplates != null && Model.BulkGenerateDocumentTemplates.Any())
{
List<AttachmentTypes> allowedTargets = new List<AttachmentTypes>();
if (Authorization.HasAll(Claims.Device.Actions.GenerateDocuments, Claims.Config.DocumentTemplate.BulkGenerate))
{
allowedTargets.Add(AttachmentTypes.Device);
}
if (Authorization.HasAll(Claims.Job.Actions.GenerateDocuments, Claims.Config.DocumentTemplate.BulkGenerate))
{
allowedTargets.Add(AttachmentTypes.Job);
}
if (Authorization.HasAll(Claims.User.Actions.GenerateDocuments, Claims.Config.DocumentTemplate.BulkGenerate))
{
allowedTargets.Add(AttachmentTypes.User);
}
var allowedTemplates = Model.BulkGenerateDocumentTemplates.Where(m => allowedTargets.Contains(m.AttachmentType)).ToList();
if (allowedTemplates.Any())
{
string targetDescription;
int targetId = Model.DeviceGroupId;
Func<ActionResult> urlDelegate;
if (Model is Disco.Web.Areas.Config.Models.DeviceBatch.ShowModel)
{
targetDescription = "Batch";
urlDelegate = MVC.API.DocumentTemplate.BulkGenerateDeviceBatch;
}
else if (Model is Disco.Web.Areas.Config.Models.DeviceModel.ShowModel)
{
urlDelegate = MVC.API.DocumentTemplate.BulkGenerateDeviceModel;
targetDescription = "Model";
}
else if (Model is Disco.Web.Areas.Config.Models.DeviceProfile.ShowModel)
{
urlDelegate = MVC.API.DocumentTemplate.BulkGenerateDeviceProfile;
targetDescription = "Profile";
}
else
{
throw new NotSupportedException("Unsupported Device Group Model");
}
<div class="dialog" id="Config_Shared_DeviceGroupDocumentTemplateBulkGenerate_Dialog" title="Document Template Bulk Generate for Device @targetDescription">
<p>
Bulk generate documents for devices, users or jobs (based on document template scope) associated with this Device @(targetDescription).
</p>
@using (Html.BeginForm(urlDelegate(), FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.Hidden("deviceGroupId", targetId)
<select name="id" required>
<option value="">-- Choose Document Template --</option>
@foreach (var template in allowedTemplates)
{
<option value="@template.Id">@template.Description (@(template.AttachmentType)s)</option>
}
</select>
}
</div>
<script type="text/javascript">
$(function () {
const button = $('<button class="button">Document Bulk Generate</button>').prependTo('.actionBar');
let dialog = null;
button.click(e => {
if (!dialog) {
dialog = $('#Config_Shared_DeviceGroupDocumentTemplateBulkGenerate_Dialog')
.dialog({
resizable: false,
width: 450,
modal: true,
autoOpen: false,
buttons: {
Close: function () {
$(this).dialog("close");
},
'Bulk Generate': function () {
const form = dialog.find('form')[0];
if (form.reportValidity()) {
form.submit();
$(this).dialog("close");
}
}
}
});
}
dialog.dialog('open');
});
});
</script>
}
}
@@ -0,0 +1,288 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.Shared
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Shared/_DeviceGroupDocumentBulkGenerate.cshtml")]
public partial class _DeviceGroupDocumentBulkGenerate : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.Shared.DeviceGroupDocumentTemplateBulkGenerateModel>
{
public _DeviceGroupDocumentBulkGenerate()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
if (Model.BulkGenerateDocumentTemplates != null && Model.BulkGenerateDocumentTemplates.Any())
{
List<AttachmentTypes> allowedTargets = new List<AttachmentTypes>();
if (Authorization.HasAll(Claims.Device.Actions.GenerateDocuments, Claims.Config.DocumentTemplate.BulkGenerate))
{
allowedTargets.Add(AttachmentTypes.Device);
}
if (Authorization.HasAll(Claims.Job.Actions.GenerateDocuments, Claims.Config.DocumentTemplate.BulkGenerate))
{
allowedTargets.Add(AttachmentTypes.Job);
}
if (Authorization.HasAll(Claims.User.Actions.GenerateDocuments, Claims.Config.DocumentTemplate.BulkGenerate))
{
allowedTargets.Add(AttachmentTypes.User);
}
var allowedTemplates = Model.BulkGenerateDocumentTemplates.Where(m => allowedTargets.Contains(m.AttachmentType)).ToList();
if (allowedTemplates.Any())
{
string targetDescription;
int targetId = Model.DeviceGroupId;
Func<ActionResult> urlDelegate;
if (Model is Disco.Web.Areas.Config.Models.DeviceBatch.ShowModel)
{
targetDescription = "Batch";
urlDelegate = MVC.API.DocumentTemplate.BulkGenerateDeviceBatch;
}
else if (Model is Disco.Web.Areas.Config.Models.DeviceModel.ShowModel)
{
urlDelegate = MVC.API.DocumentTemplate.BulkGenerateDeviceModel;
targetDescription = "Model";
}
else if (Model is Disco.Web.Areas.Config.Models.DeviceProfile.ShowModel)
{
urlDelegate = MVC.API.DocumentTemplate.BulkGenerateDeviceProfile;
targetDescription = "Profile";
}
else
{
throw new NotSupportedException("Unsupported Device Group Model");
}
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" id=\"Config_Shared_DeviceGroupDocumentTemplateBulkGenerate_Dialog\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1966), Tuple.Create("\"", 2035)
, Tuple.Create(Tuple.Create("", 1974), Tuple.Create("Document", 1974), true)
, Tuple.Create(Tuple.Create(" ", 1982), Tuple.Create("Template", 1983), true)
, Tuple.Create(Tuple.Create(" ", 1991), Tuple.Create("Bulk", 1992), true)
, Tuple.Create(Tuple.Create(" ", 1996), Tuple.Create("Generate", 1997), true)
, Tuple.Create(Tuple.Create(" ", 2005), Tuple.Create("for", 2006), true)
, Tuple.Create(Tuple.Create(" ", 2009), Tuple.Create("Device", 2010), true)
#line 42 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
, Tuple.Create(Tuple.Create(" ", 2016), Tuple.Create<System.Object, System.Int32>(targetDescription
#line default
#line hidden
, 2017), false)
);
WriteLiteral(">\r\n <p>\r\n Bulk generate documents for devices, users or" +
" jobs (based on document template scope) associated with this Device ");
#line 44 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
Write(targetDescription);
#line default
#line hidden
WriteLiteral(".\r\n </p>\r\n");
#line 46 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
#line default
#line hidden
#line 46 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
using (Html.BeginForm(urlDelegate(), FormMethod.Post))
{
#line default
#line hidden
#line 48 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
#line 48 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
#line default
#line hidden
#line 49 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
Write(Html.Hidden("deviceGroupId", targetId));
#line default
#line hidden
#line 49 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
#line default
#line hidden
WriteLiteral(" <select");
WriteLiteral(" name=\"id\"");
WriteLiteral(" required>\r\n <option");
WriteLiteral(" value=\"\"");
WriteLiteral(">-- Choose Document Template --</option>\r\n");
#line 52 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
#line default
#line hidden
#line 52 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
foreach (var template in allowedTemplates)
{
#line default
#line hidden
WriteLiteral(" <option");
WriteAttribute("value", Tuple.Create(" value=\"", 2652), Tuple.Create("\"", 2672)
#line 54 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
, Tuple.Create(Tuple.Create("", 2660), Tuple.Create<System.Object, System.Int32>(template.Id
#line default
#line hidden
, 2660), false)
);
WriteLiteral(">");
#line 54 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
Write(template.Description);
#line default
#line hidden
WriteLiteral(" (");
#line 54 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
Write(template.AttachmentType);
#line default
#line hidden
WriteLiteral("s)</option>\r\n");
#line 55 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
}
#line default
#line hidden
WriteLiteral(" </select>\r\n");
#line 57 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
const button = $('<button class=""button"">Document Bulk Generate</button>').prependTo('.actionBar');
let dialog = null;
button.click(e => {
if (!dialog) {
dialog = $('#Config_Shared_DeviceGroupDocumentTemplateBulkGenerate_Dialog')
.dialog({
resizable: false,
width: 450,
modal: true,
autoOpen: false,
buttons: {
Close: function () {
$(this).dialog(""close"");
},
'Bulk Generate': function () {
const form = dialog.find('form')[0];
if (form.reportValidity()) {
form.submit();
$(this).dialog(""close"");
}
}
}
});
}
dialog.dialog('open');
});
});
</script>
");
#line 89 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml"
}
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
+10
View File
@@ -231,6 +231,7 @@
<Compile Include="Areas\Config\Models\DocumentTemplate\BulkGenerateModel.cs" />
<Compile Include="Areas\Config\Models\DocumentTemplate\CreatePackageModel.cs" />
<Compile Include="Areas\Config\Models\DocumentTemplate\ShowPackageModel.cs" />
<Compile Include="Areas\Config\Models\Shared\DeviceGroupDocumentTemplateBulkGenerateModel.cs" />
<Compile Include="Areas\Config\Models\Shared\LinkedGroupModel.cs" />
<Compile Include="Areas\Config\Models\UserFlag\CreateModel.cs" />
<Compile Include="Areas\Config\Models\UserFlag\IndexModel.cs" />
@@ -336,6 +337,11 @@
<DesignTime>True</DesignTime>
<DependentUpon>TaskStatus.cshtml</DependentUpon>
</Compile>
<Compile Include="Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>_DeviceGroupDocumentBulkGenerate.cshtml</DependentUpon>
</Compile>
<Compile Include="Areas\Config\Views\UserFlag\Create.generated.cs">
<DependentUpon>Create.cshtml</DependentUpon>
<AutoGen>True</AutoGen>
@@ -1281,6 +1287,10 @@
<Generator>RazorGenerator</Generator>
<LastGenOutput>TaskStatus.generated.cs</LastGenOutput>
</None>
<None Include="Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>_DeviceGroupDocumentBulkGenerate.generated.cs</LastGenOutput>
</None>
<None Include="Areas\Config\Views\UserFlag\Create.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>Create.generated.cs</LastGenOutput>
@@ -169,6 +169,24 @@ namespace Disco.Web.Areas.API.Controllers
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult BulkGenerateDeviceModel()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.BulkGenerateDeviceModel);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult BulkGenerateDeviceProfile()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.BulkGenerateDeviceProfile);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult BulkGenerateDeviceBatch()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.BulkGenerateDeviceBatch);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult BulkGenerate()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.BulkGenerate);
@@ -298,6 +316,9 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string ImporterUndetectedFile = "ImporterUndetectedFile";
public readonly string ImporterUndetectedAssign = "ImporterUndetectedAssign";
public readonly string ImporterUndetectedDelete = "ImporterUndetectedDelete";
public readonly string BulkGenerateDeviceModel = "BulkGenerateDeviceModel";
public readonly string BulkGenerateDeviceProfile = "BulkGenerateDeviceProfile";
public readonly string BulkGenerateDeviceBatch = "BulkGenerateDeviceBatch";
public readonly string BulkGenerate = "BulkGenerate";
public readonly string BulkGenerateDownload = "BulkGenerateDownload";
public readonly string BulkGenerateAddUsers = "BulkGenerateAddUsers";
@@ -338,6 +359,9 @@ namespace Disco.Web.Areas.API.Controllers
public const string ImporterUndetectedFile = "ImporterUndetectedFile";
public const string ImporterUndetectedAssign = "ImporterUndetectedAssign";
public const string ImporterUndetectedDelete = "ImporterUndetectedDelete";
public const string BulkGenerateDeviceModel = "BulkGenerateDeviceModel";
public const string BulkGenerateDeviceProfile = "BulkGenerateDeviceProfile";
public const string BulkGenerateDeviceBatch = "BulkGenerateDeviceBatch";
public const string BulkGenerate = "BulkGenerate";
public const string BulkGenerateDownload = "BulkGenerateDownload";
public const string BulkGenerateAddUsers = "BulkGenerateAddUsers";
@@ -535,6 +559,33 @@ namespace Disco.Web.Areas.API.Controllers
{
public readonly string id = "id";
}
static readonly ActionParamsClass_BulkGenerateDeviceModel s_params_BulkGenerateDeviceModel = new ActionParamsClass_BulkGenerateDeviceModel();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_BulkGenerateDeviceModel BulkGenerateDeviceModelParams { get { return s_params_BulkGenerateDeviceModel; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_BulkGenerateDeviceModel
{
public readonly string id = "id";
public readonly string deviceGroupId = "deviceGroupId";
}
static readonly ActionParamsClass_BulkGenerateDeviceProfile s_params_BulkGenerateDeviceProfile = new ActionParamsClass_BulkGenerateDeviceProfile();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_BulkGenerateDeviceProfile BulkGenerateDeviceProfileParams { get { return s_params_BulkGenerateDeviceProfile; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_BulkGenerateDeviceProfile
{
public readonly string id = "id";
public readonly string deviceGroupId = "deviceGroupId";
}
static readonly ActionParamsClass_BulkGenerateDeviceBatch s_params_BulkGenerateDeviceBatch = new ActionParamsClass_BulkGenerateDeviceBatch();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_BulkGenerateDeviceBatch BulkGenerateDeviceBatchParams { get { return s_params_BulkGenerateDeviceBatch; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_BulkGenerateDeviceBatch
{
public readonly string id = "id";
public readonly string deviceGroupId = "deviceGroupId";
}
static readonly ActionParamsClass_BulkGenerate s_params_BulkGenerate = new ActionParamsClass_BulkGenerate();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_BulkGenerate BulkGenerateParams { get { return s_params_BulkGenerate; } }
@@ -969,6 +1020,45 @@ namespace Disco.Web.Areas.API.Controllers
return callInfo;
}
[NonAction]
partial void BulkGenerateDeviceModelOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id, int deviceGroupId);
[NonAction]
public override System.Web.Mvc.ActionResult BulkGenerateDeviceModel(string id, int deviceGroupId)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.BulkGenerateDeviceModel);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "deviceGroupId", deviceGroupId);
BulkGenerateDeviceModelOverride(callInfo, id, deviceGroupId);
return callInfo;
}
[NonAction]
partial void BulkGenerateDeviceProfileOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id, int deviceGroupId);
[NonAction]
public override System.Web.Mvc.ActionResult BulkGenerateDeviceProfile(string id, int deviceGroupId)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.BulkGenerateDeviceProfile);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "deviceGroupId", deviceGroupId);
BulkGenerateDeviceProfileOverride(callInfo, id, deviceGroupId);
return callInfo;
}
[NonAction]
partial void BulkGenerateDeviceBatchOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id, int deviceGroupId);
[NonAction]
public override System.Web.Mvc.ActionResult BulkGenerateDeviceBatch(string id, int deviceGroupId)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.BulkGenerateDeviceBatch);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "deviceGroupId", deviceGroupId);
BulkGenerateDeviceBatchOverride(callInfo, id, deviceGroupId);
return callInfo;
}
[NonAction]
partial void BulkGenerateOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id, string DataIds, bool InsertBlankPage);
@@ -38,11 +38,13 @@ namespace T4MVC.Config
public _ViewNamesClass ViewNames { get { return s_ViewNames; } }
public class _ViewNamesClass
{
public readonly string _DeviceGroupDocumentBulkGenerate = "_DeviceGroupDocumentBulkGenerate";
public readonly string LinkedGroupInstance = "LinkedGroupInstance";
public readonly string LinkedGroupShared = "LinkedGroupShared";
public readonly string LogEvents = "LogEvents";
public readonly string TaskStatus = "TaskStatus";
}
public readonly string _DeviceGroupDocumentBulkGenerate = "~/Areas/Config/Views/Shared/_DeviceGroupDocumentBulkGenerate.cshtml";
public readonly string LinkedGroupInstance = "~/Areas/Config/Views/Shared/LinkedGroupInstance.cshtml";
public readonly string LinkedGroupShared = "~/Areas/Config/Views/Shared/LinkedGroupShared.cshtml";
public readonly string LogEvents = "~/Areas/Config/Views/Shared/LogEvents.cshtml";