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
@@ -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