Feature: Document Template Packages

Document Templates can be grouped into a package and generated on-demand
in the same was as individual document templates. Packages can be
generated in bulk.
This commit is contained in:
Gary Sharp
2016-11-14 01:21:23 +11:00
parent ef8df08e29
commit aca037ecf8
75 changed files with 8008 additions and 2078 deletions
@@ -3,8 +3,9 @@
Authorization.Require(Claims.Config.DocumentTemplate.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates");
var showTags = Model.DocumentTemplates.Keys.Any(i => i.DevicesLinkedGroup != null || i.UsersLinkedGroup != null ||
i.FilterExpression != null || i.OnGenerateExpression != null || i.OnImportAttachmentExpression != null);
var showTags = Model.DocumentTemplates.Keys.Any(i => i.IsHidden || i.DevicesLinkedGroup != null || i.UsersLinkedGroup != null ||
i.FilterExpression != null || i.OnGenerateExpression != null || i.OnImportAttachmentExpression != null) ||
Model.Packages.Any(i => i.IsHidden || i.FilterExpression != null || i.OnGenerateExpression != null);
}
@if (Model.DocumentTemplates.Count == 0)
{
@@ -14,18 +15,19 @@
}
else
{
if (Model.DocumentTemplates.Keys.Any(dt => dt.IsHidden))
if (Model.DocumentTemplates.Keys.Any(dt => dt.IsHidden) || Model.Packages.Any(p => p.IsHidden))
{
<a id="Config_DocumentTemplates_ShowHidden" href="#" class="button small">Show Hidden (@(Model.DocumentTemplates.Keys.Count(dt => dt.IsHidden)))</a>
<script>
$(function () {
$('#Config_DocumentTemplates_ShowHidden').click(function () {
$(this).remove();
$('#Config_DocumentTemplates_List').find('tr.hidden').show();
return false;
}).detach().appendTo('#layout_PageHeading');
})
</script>
<a id="Config_DocumentTemplates_ShowHidden" href="#" class="button small">Show Hidden (@(Model.DocumentTemplates.Keys.Count(dt => dt.IsHidden) + Model.Packages.Count(p => p.IsHidden)))</a>
<script>
$(function () {
$('#Config_DocumentTemplates_ShowHidden').click(function () {
$(this).remove();
$('#Config_DocumentTemplates_List').find('tr.hidden').show();
$('#Config_DocumentTemplatePackages_List').find('tr.hidden').show();
return false;
}).detach().appendTo('#layout_PageHeading');
})
</script>
}
<table id="Config_DocumentTemplates_List" class="tableData">
<tr>
@@ -67,6 +69,43 @@ else
</tr>
}
</table>
if (Model.Packages.Count > 0)
{
<h1 class="Config_DocumentTemplates">Document Template Packages</h1>
<table id="Config_DocumentTemplatePackages_List" class="tableData">
<tr>
<th>Id</th>
<th>Description</th>
<th>Scope</th>
<th>Document Templates</th>
@if (showTags)
{
<th>&nbsp;</th>
}
</tr>
@foreach (var package in Model.Packages.OrderBy(p => p.Id))
{
<tr class="@(package.IsHidden ? "hidden" : null)">
<td>@Html.ActionLink(package.Id.ToString(), MVC.Config.DocumentTemplate.ShowPackage(package.Id))</td>
<td>@Html.DisplayFor(modelItem => package.Description)</td>
<td>@Html.DisplayFor(modelItem => package.Scope)</td>
@if (showTags)
{
<td>
@if (package.FilterExpression != null || package.OnGenerateExpression != null)
{
<i class="fa fa-bolt fa-lg alert" title="Has Expressions"></i>
}
@if (package.IsHidden)
{
<i class="fa fa-minus-square fa-lg error" title="Is Hidden"></i>
}
</td>
}
</tr>
}
</table>
}
}
<div class="actionBar">
@if (Authorization.Has(Claims.Config.DocumentTemplate.UndetectedPages))
@@ -81,6 +120,10 @@ else
{
@Html.ActionLinkButton("Expression Browser", MVC.Config.DocumentTemplate.ExpressionBrowser())
}
@if (Model.DocumentTemplates.Count > 2 && Authorization.HasAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure))
{
@Html.ActionLinkButton("Create Package", MVC.Config.DocumentTemplate.CreatePackage())
}
@if (Authorization.HasAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure))
{
@Html.ActionLinkButton("Create Document Template", MVC.Config.DocumentTemplate.Create())