@model Disco.Web.Areas.Config.Models.DocumentTemplate.ShowModel @using Disco.Services.Documents.ManagedGroups; @using Disco.Services.Interop.ActiveDirectory; @using Disco.Web.Areas.Config.Models.Shared; @{ Authorization.Require(Claims.Config.DocumentTemplate.Show); var canConfig = Authorization.Has(Claims.Config.DocumentTemplate.Configure); var hideAdvanced = Model.DocumentTemplate.UsersLinkedGroup == null && Model.DocumentTemplate.DevicesLinkedGroup == null && Model.DocumentTemplate.FilterExpression == null && Model.DocumentTemplate.OnGenerateExpression == null && Model.DocumentTemplate.OnImportAttachmentExpression == null && Model.TemplateExpressions.All(e => e.All(p => !p.ParseError) && !Model.OnImportUserFlagRules.Any()); var canBulkGenerate = false; var canBulkDownload = false; switch (Model.DocumentTemplate.Scope) { case DocumentTemplate.DocumentTemplateScopes.Device: canBulkGenerate = Authorization.Has(Claims.Config.DocumentTemplate.BulkGenerate) && Authorization.Has(Claims.Device.Actions.GenerateDocuments); canBulkDownload = Authorization.Has(Claims.Device.ShowAttachments) && Model.StoredInstanceCount > 0; break; case DocumentTemplate.DocumentTemplateScopes.Job: canBulkGenerate = Authorization.Has(Claims.Config.DocumentTemplate.BulkGenerate) && Authorization.Has(Claims.Job.Actions.GenerateDocuments); canBulkDownload = Authorization.Has(Claims.Job.ShowAttachments) && Model.StoredInstanceCount > 0; break; case DocumentTemplate.DocumentTemplateScopes.User: canBulkGenerate = Authorization.Has(Claims.Config.DocumentTemplate.BulkGenerate) && Authorization.Has(Claims.User.Actions.GenerateDocuments); canBulkDownload = Authorization.Has(Claims.User.ShowAttachments) && Model.StoredInstanceCount > 0; break; default: throw new InvalidOperationException("Invalid DocumentType Scope"); } ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), Model.DocumentTemplate.Description); if (canConfig) { Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers"); } }
| Id: |
@Html.DisplayFor(model => model.DocumentTemplate.Id)
|
|---|---|
| Statistics: | @Model.StoredInstanceCount.ToString("n0") Stored Instance@(Model.StoredInstanceCount == 1 ? null : "s") |
| Description: | @if (canConfig) { @Html.TextBoxFor(model => model.DocumentTemplate.Description) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader() } else { if (string.IsNullOrEmpty(Model.DocumentTemplate.Description)) { <None Specified> } else { @Model.DocumentTemplate.Description } } |
|
@if (canConfig)
{
@AjaxHelpers.AjaxLoader()
}
else
{
}
If selected the template will not appear in the list of documents to generate. |
|
| Scope: |
@Model.DocumentTemplate.Scope ScopeThis template is generated from @(Model.DocumentTemplate.Scope)s. Any expressions within the Template PDF will be evaluated within the @(Model.DocumentTemplate.Scope) Scope.
@using (Html.BeginForm(MVC.API.DocumentTemplate.UpdateScope(Model.DocumentTemplate.Id, redirect: true)))
{
@Html.AntiForgeryToken()
}
@if (Model.DocumentTemplate.Scope == DocumentTemplate.DocumentTemplateScopes.Job)
{
Expressions within the Template PDF may need to be updated to reflect any changes to the Document Template Scope. Warning: This Document Template contains Linked Groups, these will be automatically updated to reflect the new Document Template Scope which may result in undesired behaviour. Job Type Filters:
@if (Model.DocumentTemplate.JobSubTypes.Count > 0)
{
@if (canConfig)
{
Update
@using (Html.BeginForm(MVC.API.DocumentTemplate.UpdateJobSubTypes(Model.DocumentTemplate.Id, null, true)))
{
@Html.AntiForgeryToken()
var selectedTypes = Model.DocumentTemplate.JobSubTypes.Select(jst => jst.JobType).Distinct().ToList();
foreach (var jt in Model.JobTypes)
{
}
@CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id), "div")
@CommonHelpers.CheckBoxList("JobSubTypes", jt.JobSubTypes.OrderBy(jst => jst.Description).ToSelectListItems(Model.DocumentTemplate.JobSubTypes), 2)
|
|
@if (canConfig)
{
@AjaxHelpers.AjaxLoader()
}
else
{
}
When a document is generated all form elements will be removed and their content written in place if this option is selected. |
|
|
|
@if (Model.TemplatePagesHaveAttachmentId.Any(i => !i))
{
@for (int i = 0; i < Model.TemplatePagesHaveAttachmentId.Count; i++)
{
if (!Model.TemplatePagesHaveAttachmentId[i])
{
}
Note: Page @(i + 1) does not have a
The
@Html.ActionLinkSmallButton("Download Template", MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id))
@if (canConfig && Authorization.Has(Claims.Config.DocumentTemplate.Upload))
{
Select a PDF Template to upload:
@using (Html.BeginForm(MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
}
|
| Filter Expression: |
@if (canConfig && Authorization.Has(Claims.Config.DocumentTemplate.ConfigureFilterExpression))
{
@Html.EditorFor(model => model.DocumentTemplate.FilterExpression)
@AjaxHelpers.AjaxRemove()
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
}
else
{
if (string.IsNullOrWhiteSpace(Model.DocumentTemplate.FilterExpression))
{
<None Specified>
}
else
{
@Model.DocumentTemplate.FilterExpression
}
}
This expression will be evaluated to determine if this template is shown in the Generate Document drop-down list. If the template is hidden (see above) this expression is ignored. |
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| On Generated Expression: |
@if (canConfig && Authorization.Has(Claims.Config.DocumentTemplate.ConfigureFilterExpression))
{
@Html.EditorFor(model => model.DocumentTemplate.OnGenerateExpression)
@AjaxHelpers.AjaxRemove()
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
}
else
{
if (string.IsNullOrWhiteSpace(Model.DocumentTemplate.OnGenerateExpression))
{
<None Specified>
}
else
{
@Model.DocumentTemplate.OnGenerateExpression
}
}
This expression will be evaluated each time a document is generated from this template. |
||||||||||||||||||
| On Import Expression: |
@if (canConfig && Authorization.Has(Claims.Config.DocumentTemplate.ConfigureFilterExpression))
{
@Html.EditorFor(model => model.DocumentTemplate.OnImportAttachmentExpression)
@AjaxHelpers.AjaxRemove()
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
}
else
{
if (string.IsNullOrWhiteSpace(Model.DocumentTemplate.OnImportAttachmentExpression))
{
<None Specified>
}
else
{
@Model.DocumentTemplate.OnImportAttachmentExpression
}
}
This expression will be evaluated each time a document is imported (as an attachment) where it is determined the document was based on this template. |
||||||||||||||||||
|
On Import User Flag Rules: |
@if (canConfig && Authorization.Has(Claims.Config.UserFlag.Configure))
{
@switch (Model.DocumentTemplate.Scope)
{
case "Device":
@using (Html.BeginForm(MVC.API.DocumentTemplate.AddOnImportUserFlagRule(Model.DocumentTemplate.Id)))
{
@Html.AntiForgeryToken()
The user flag will be created/removed against the devices assigned user.
break;
case "Job":
The user flag will be created/removed against the jobs associated user.
break;
case "User":
The user flag will be created/removed against the user.
break;
}
@foreach (var flag in Model.UserFlags)
{
(added to the assignment; optional)
These rules will be applied each time a document is imported (as an attachment) where it is determined the document was based on this template. When creating a user flag assignment, if an assignment already exists the rule will be skipped. When removing user flag assignments, if no assignment is present the rule will be skipped. |
||||||||||||||||||
| Linked Groups: |
@Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel()
{
CanConfigure = canConfig,
CategoryDescription = DocumentTemplateUsersManagedGroup.GetCategoryDescription(Model.DocumentTemplate),
Description = DocumentTemplateUsersManagedGroup.GetDescription(Model.DocumentTemplate),
ManagedGroup = Model.UsersLinkedGroup,
IncludeFilterBeginDate = true,
UpdateUrl = Url.Action(MVC.API.DocumentTemplate.UpdateUsersLinkedGroup(Model.DocumentTemplate.Id, redirect: true))
})
@Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel()
{
CanConfigure = canConfig,
CategoryDescription = DocumentTemplateDevicesManagedGroup.GetCategoryDescription(Model.DocumentTemplate),
Description = DocumentTemplateDevicesManagedGroup.GetDescription(Model.DocumentTemplate),
ManagedGroup = Model.DevicesLinkedGroup,
IncludeFilterBeginDate = true,
UpdateUrl = Url.Action(MVC.API.DocumentTemplate.UpdateDevicesLinkedGroup(Model.DocumentTemplate.Id, redirect: true))
})
@if (canConfig)
{
@Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared)
}
|
||||||||||||||||||
This item will be permanently deleted and cannot be recovered.
This will not delete attachments which have already been imported,
but any generated documents will no longer be automatically imported.
Are you sure?
<new line>, commas (,) or semicolons (;).
<new line>, commas (,) or semicolons (;).