document template on import user flag rules
This commit is contained in:
@@ -171,6 +171,10 @@
|
||||
<Compile Include="Migrations\202102110443550_DBv21.Designer.cs">
|
||||
<DependentUpon>202102110443550_DBv21.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202304150715559_DBv22.cs" />
|
||||
<Compile Include="Migrations\202304150715559_DBv22.Designer.cs">
|
||||
<DependentUpon>202304150715559_DBv22.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Migrations\DiscoDataMigrator.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@@ -249,6 +253,9 @@
|
||||
<EmbeddedResource Include="Migrations\202102110443550_DBv21.resx">
|
||||
<DependentUpon>202102110443550_DBv21.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202304150715559_DBv22.resx">
|
||||
<DependentUpon>202304150715559_DBv22.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv22 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv22));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202304150715559_DBv22"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv22 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.DocumentTemplates", "OnImportUserFlagRules", c => c.String());
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.DocumentTemplates", "OnImportUserFlagRules");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -69,6 +69,7 @@
|
||||
<Compile Include="Services\Devices\Importing\IDeviceImportColumn.cs" />
|
||||
<Compile Include="Services\Devices\Importing\IDeviceImportDataReader.cs" />
|
||||
<Compile Include="Services\Documents\DocumentTemplatePackage.cs" />
|
||||
<Compile Include="Services\Documents\OnImportUserFlagRule.cs" />
|
||||
<Compile Include="Services\Jobs\LocationModes.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\Certificate.cs" />
|
||||
<Compile Include="ClientServices\Register.cs" />
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Disco.Models.Repository
|
||||
public string OnGenerateExpression { get; set; }
|
||||
[DataType(DataType.MultilineText)]
|
||||
public string OnImportAttachmentExpression { get; set; }
|
||||
public string OnImportUserFlagRules { get; set; }
|
||||
|
||||
// Feature Request 2012-05-10 by G#: https://disco.uservoice.com/forums/159707-feedback/suggestions/2811092-document-template-option-flatten-form-on-generate
|
||||
public bool FlattenForm { get; set; }
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using Disco.Models.Repository;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Disco.Models.Services.Documents
|
||||
{
|
||||
public class OnImportUserFlagRule
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public int FlagId { get; set; }
|
||||
[StringLength(50)]
|
||||
public string UserId { get; set; }
|
||||
public bool AddFlag { get; set; }
|
||||
public string Comments { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public User User { get; set; }
|
||||
[JsonIgnore]
|
||||
public UserFlag UserFlag { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Disco.Models.Services.Documents;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Disco.Models.UI.Config.DocumentTemplate
|
||||
{
|
||||
@@ -11,6 +12,9 @@ namespace Disco.Models.UI.Config.DocumentTemplate
|
||||
string BulkGenerateDownloadId { get; }
|
||||
string BulkGenerateDownloadFilename { get; }
|
||||
|
||||
List<Repository.UserFlag> UserFlags { get; set; }
|
||||
List<OnImportUserFlagRule> OnImportUserFlagRules { get; }
|
||||
|
||||
List<Repository.JobType> JobTypes { get; set; }
|
||||
|
||||
List<string> Scopes { get; }
|
||||
|
||||
@@ -251,19 +251,33 @@ namespace Disco.Services.Documents.AttachmentImport
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Identifier.DocumentTemplate != null && !string.IsNullOrWhiteSpace(Identifier.DocumentTemplate.OnImportAttachmentExpression))
|
||||
if (Identifier.DocumentTemplate != null)
|
||||
{
|
||||
try
|
||||
if (!string.IsNullOrWhiteSpace(Identifier.DocumentTemplate.OnImportAttachmentExpression))
|
||||
{
|
||||
var expressionResult = Identifier.DocumentTemplate.EvaluateOnAttachmentImportExpression(attachment, Identifier.Target, Database, creatorUser, Identifier.TimeStamp, PageIdentifiers);
|
||||
DocumentsLog.LogImportAttachmentExpressionEvaluated(Identifier.DocumentTemplate, Identifier.Target, attachment, expressionResult);
|
||||
try
|
||||
{
|
||||
var expressionResult = Identifier.DocumentTemplate.EvaluateOnAttachmentImportExpression(attachment, Identifier.Target, Database, creatorUser, Identifier.TimeStamp, PageIdentifiers);
|
||||
DocumentsLog.LogImportAttachmentExpressionEvaluated(Identifier.DocumentTemplate, Identifier.Target, attachment, expressionResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemLog.LogException("Document Importer - OnImportAttachmentExpression", ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
if (Identifier.DocumentTemplate.OnImportUserFlagRules != null)
|
||||
{
|
||||
SystemLog.LogException("Document Importer - OnImportAttachmentExpression", ex);
|
||||
var rules = Identifier.DocumentTemplate.GetOnImportUserFlagRules();
|
||||
|
||||
foreach ( var rule in rules)
|
||||
{
|
||||
rule.Apply(Database, Identifier.Target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return attachment;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Models.Services.Documents;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Disco.Services.Users;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
@@ -168,5 +171,148 @@ namespace Disco.Services
|
||||
if (target == null)
|
||||
throw new ArgumentException("Target not found", nameof(targetId));
|
||||
}
|
||||
|
||||
public static IEnumerable<OnImportUserFlagRule> GetOnImportUserFlagRuleDetails(this DocumentTemplate template, DiscoDataContext database)
|
||||
{
|
||||
foreach (var rule in GetOnImportUserFlagRules(template))
|
||||
{
|
||||
var detail = rule.AddDetails(database);
|
||||
|
||||
if (detail == null)
|
||||
continue;
|
||||
|
||||
yield return detail;
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<OnImportUserFlagRule> GetOnImportUserFlagRules(this DocumentTemplate template)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(template.OnImportUserFlagRules))
|
||||
return Enumerable.Empty<OnImportUserFlagRule>();
|
||||
else
|
||||
return JsonConvert.DeserializeObject<List<OnImportUserFlagRule>>(template.OnImportUserFlagRules);
|
||||
}
|
||||
|
||||
public static OnImportUserFlagRule AddDetails(this OnImportUserFlagRule rule, DiscoDataContext database)
|
||||
{
|
||||
rule.User = database.Users.FirstOrDefault(u => u.UserId == rule.UserId);
|
||||
rule.UserFlag = database.UserFlags.FirstOrDefault(f => f.Id == rule.FlagId);
|
||||
|
||||
if (rule.User == null || rule.UserFlag == null)
|
||||
return null;
|
||||
else
|
||||
return rule;
|
||||
}
|
||||
|
||||
public static OnImportUserFlagRule AddOnImportUserFlagRule(this DocumentTemplate template, DiscoDataContext database, OnImportUserFlagRule rule)
|
||||
{
|
||||
List<OnImportUserFlagRule> rules;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(template.OnImportUserFlagRules))
|
||||
rules = new List<OnImportUserFlagRule>();
|
||||
else
|
||||
rules = JsonConvert.DeserializeObject<List<OnImportUserFlagRule>>(template.OnImportUserFlagRules);
|
||||
|
||||
// validate user id
|
||||
rule.User = database.Users.FirstOrDefault(u => u.UserId == rule.UserId);
|
||||
if (rule.User == null)
|
||||
throw new ArgumentException("Unknown rule user id", nameof(rule));
|
||||
|
||||
// validate user flag
|
||||
rule.UserFlag = database.UserFlags.FirstOrDefault(f => f.Id == rule.FlagId);
|
||||
if (rule.UserFlag == null)
|
||||
throw new ArgumentException("Unknown rule user flag", nameof(rule));
|
||||
|
||||
// validate no existing matching rule
|
||||
if (rules.Any(r => r.FlagId == rule.FlagId))
|
||||
throw new ArgumentException("This document template already has a rule for this user flag", nameof(rule));
|
||||
|
||||
rule.Id = Guid.NewGuid();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(rule.Comments))
|
||||
rule.Comments = null;
|
||||
|
||||
rules.Add(rule);
|
||||
template.OnImportUserFlagRules = JsonConvert.SerializeObject(rules);
|
||||
|
||||
database.SaveChanges();
|
||||
|
||||
return rule;
|
||||
}
|
||||
|
||||
public static bool RemoveOnImportUserFlagRule(this DocumentTemplate template, DiscoDataContext database, Guid id)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(template.OnImportUserFlagRules))
|
||||
return false;
|
||||
|
||||
var rules = JsonConvert.DeserializeObject<List<OnImportUserFlagRule>>(template.OnImportUserFlagRules);
|
||||
|
||||
if (rules.RemoveAll(r => r.Id == id) == 0)
|
||||
return false;
|
||||
|
||||
template.OnImportUserFlagRules = JsonConvert.SerializeObject(rules);
|
||||
database.SaveChanges();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void Apply(this OnImportUserFlagRule rule, DiscoDataContext database, IAttachmentTarget target)
|
||||
{
|
||||
string userId;
|
||||
if (target is User targetUser)
|
||||
userId = targetUser.UserId;
|
||||
else if (target is Device targetDevice && targetDevice.AssignedUserId != null)
|
||||
userId = targetDevice.AssignedUserId;
|
||||
else if (target is Job targetJob && targetJob.UserId != null)
|
||||
userId = targetJob.UserId;
|
||||
else
|
||||
return;
|
||||
|
||||
if (userId == null)
|
||||
return;
|
||||
|
||||
var user = database.Users.Include(u => u.UserFlagAssignments).FirstOrDefault(u => u.UserId == userId);
|
||||
|
||||
if (user == null)
|
||||
return;
|
||||
|
||||
var techUser = database.Users.FirstOrDefault(u => u.UserId == rule.UserId);
|
||||
if (techUser == null)
|
||||
return;
|
||||
|
||||
// remove flag
|
||||
if (!rule.AddFlag)
|
||||
{
|
||||
var flagAssignment = user.UserFlagAssignments.FirstOrDefault(a => a.RemovedDate == null && a.UserFlagId == rule.FlagId);
|
||||
if (flagAssignment != null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(rule.Comments))
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(flagAssignment.Comments))
|
||||
flagAssignment.Comments = string.Concat(flagAssignment.Comments, Environment.NewLine, rule.Comments);
|
||||
else
|
||||
flagAssignment.Comments = rule.Comments;
|
||||
}
|
||||
flagAssignment.OnRemoveUnsafe(database, techUser);
|
||||
}
|
||||
database.SaveChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
// already has flag?
|
||||
if (rule.AddFlag && user.UserFlagAssignments.Any(a => a.RemovedDate == null && a.UserFlagId == rule.FlagId))
|
||||
return;
|
||||
|
||||
// add flag
|
||||
var userFlag = database.UserFlags.FirstOrDefault(f => f.Id == rule.FlagId);
|
||||
if (userFlag == null)
|
||||
return;
|
||||
|
||||
user.OnAddUserFlagUnsafe(database, userFlag, techUser, rule.Comments);
|
||||
|
||||
database.SaveChanges();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,10 +14,11 @@ using Disco.Services.Web;
|
||||
using Disco.Web.Areas.API.Models.DocumentTemplate;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Data.Entity;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.UI.WebControls;
|
||||
@@ -1209,6 +1210,68 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.UserFlag.Configure)]
|
||||
public virtual ActionResult RemoveOnImportUserFlagRule([Required] string id, Guid? ruleId = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var template = Database.DocumentTemplates.FirstOrDefault(t => t.Id == id);
|
||||
|
||||
if (template == null)
|
||||
throw new ArgumentException("Unknown document template", nameof(id));
|
||||
|
||||
template.RemoveOnImportUserFlagRule(Database, ruleId.Value);
|
||||
|
||||
return new HttpStatusCodeResult(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult AddOnImportUserFlagRule([Required] string id, bool? addFlag = null, int? userFlagId = null, string comments = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var template = Database.DocumentTemplates.FirstOrDefault(t => t.Id == id);
|
||||
|
||||
if (template == null)
|
||||
throw new ArgumentException("Unknown document template", nameof(id));
|
||||
|
||||
var rule = new OnImportUserFlagRule()
|
||||
{
|
||||
AddFlag = addFlag.Value,
|
||||
FlagId = userFlagId.Value,
|
||||
UserId = Authorization.User.UserId,
|
||||
Comments = comments,
|
||||
};
|
||||
|
||||
rule = template.AddOnImportUserFlagRule(Database, rule);
|
||||
|
||||
var model = new AddOnImportUserFlagRuleModel()
|
||||
{
|
||||
Id = rule.Id,
|
||||
FlagId = rule.FlagId,
|
||||
UserId = rule.UserId,
|
||||
AddFlag = rule.AddFlag,
|
||||
Comments = rule.Comments,
|
||||
UserDisplayName = rule.User.DisplayName,
|
||||
UserIdFriendly = rule.User.FriendlyId(),
|
||||
UserFlagName = rule.UserFlag.Name,
|
||||
UserFlagIcon = rule.UserFlag.Icon,
|
||||
UserFlagColour = rule.UserFlag.IconColour,
|
||||
};
|
||||
|
||||
return Json(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handlers
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
|
||||
namespace Disco.Web.Areas.API.Models.DocumentTemplate
|
||||
{
|
||||
public class AddOnImportUserFlagRuleModel
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public int FlagId { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public bool AddFlag { get; set; }
|
||||
public string Comments { get; set; }
|
||||
|
||||
public string UserDisplayName { get; set; }
|
||||
public string UserIdFriendly { get; set; }
|
||||
|
||||
public string UserFlagIcon { get; set; }
|
||||
public string UserFlagColour { get; set; }
|
||||
public string UserFlagName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Models.Services.Documents;
|
||||
using Disco.Models.UI.Config.DocumentTemplate;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Documents.ManagedGroups;
|
||||
using Disco.Services.Expressions;
|
||||
using System.Collections.Generic;
|
||||
@@ -18,6 +20,9 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
|
||||
public List<Expression> TemplateExpressions { get; set; }
|
||||
public int TemplatePageCount { get { return TemplatePagesHaveAttachmentId?.Count() ?? 0; } }
|
||||
|
||||
public List<Disco.Models.Repository.UserFlag> UserFlags { get; set; }
|
||||
public List<OnImportUserFlagRule> OnImportUserFlagRules { get; set; }
|
||||
|
||||
public List<JobType> JobTypes { get; set; }
|
||||
|
||||
public List<string> Scopes
|
||||
@@ -53,6 +58,9 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
|
||||
|
||||
if (this.JobTypes == null)
|
||||
JobTypes = Database.JobTypes.Include("JobSubTypes").ToList();
|
||||
|
||||
UserFlags = Database.UserFlags.ToList();
|
||||
OnImportUserFlagRules = DocumentTemplate.GetOnImportUserFlagRuleDetails(Database).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,8 @@
|
||||
Model.DocumentTemplate.FilterExpression == null &&
|
||||
Model.DocumentTemplate.OnGenerateExpression == null &&
|
||||
Model.DocumentTemplate.OnImportAttachmentExpression == null &&
|
||||
Model.TemplateExpressions.All(e => e.All(p => !p.ParseError));
|
||||
Model.TemplateExpressions.All(e => e.All(p => !p.ParseError) &&
|
||||
!Model.OnImportUserFlagRules.Any());
|
||||
|
||||
#region Can Bulk Generate
|
||||
var canBulkGenerate = Authorization.Has(Claims.Config.DocumentTemplate.BulkGenerate);
|
||||
@@ -679,209 +680,514 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Linked Groups:
|
||||
On Import <br /> User Flag Rules:
|
||||
</th>
|
||||
<td>
|
||||
<div>
|
||||
@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)
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="Config_HideAdvanced_Item">
|
||||
<h2>Template Expressions</h2>
|
||||
@Html.Partial(MVC.Config.DocumentTemplate.Views._ExpressionsTable, Model.TemplateExpressions)
|
||||
</div>
|
||||
</div>
|
||||
<div id="dialogConfirmDelete" title="Delete this Document Template?">
|
||||
<p>
|
||||
<i class="fa fa-exclamation-triangle fa-lg warning"></i>This item will be permanently deleted and cannot be recovered.<br />
|
||||
<em>
|
||||
This <strong>will not delete attachments</strong> which have already been imported,
|
||||
but any generated documents will no longer be automatically imported.
|
||||
</em><br />
|
||||
Are you sure?
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var button = $('#buttonDelete');
|
||||
var buttonDialog = $("#dialogConfirmDelete");
|
||||
var buttonLink = button.attr('href');
|
||||
button.attr('href', '#');
|
||||
button.click(function () {
|
||||
buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
buttonDialog.dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Delete": function () {
|
||||
$this = $(this);
|
||||
$this.dialog('disable');
|
||||
$this.dialog("option", "buttons", null);
|
||||
window.location.href = buttonLink;
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<div class="actionBar">
|
||||
@if (hideAdvanced)
|
||||
{
|
||||
<button id="Config_HideAdvanced_Show" class="button">Show Advanced Options</button>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#Config_HideAdvanced_Show').click(function () {
|
||||
$('#Config_DocumentTemplates_Show').removeClass('Config_HideAdvanced');
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
@if (Authorization.Has(Claims.Config.Show))
|
||||
{
|
||||
@Html.ActionLinkButton("Expression Browser", MVC.Config.DocumentTemplate.ExpressionBrowser())
|
||||
}
|
||||
@if (canBulkGenerate)
|
||||
{
|
||||
if (Model.DocumentTemplate.Scope == DocumentTemplate.DocumentTemplateScopes.User)
|
||||
{
|
||||
@Html.ActionLinkButton("Bulk Generate", MVC.Config.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id))
|
||||
}
|
||||
else
|
||||
{
|
||||
<a id="buttonBulkGenerate" href="#" class="button">Bulk Generate</a>
|
||||
<div id="dialogBulkGenerate" class="hiddenDialog dialog-bulk-generate" title="Bulk Generate: @(Model.DocumentTemplate.Id)">
|
||||
<div class="brief">
|
||||
@switch (Model.DocumentTemplate.Scope)
|
||||
{
|
||||
case "Device":
|
||||
<div>
|
||||
Enter multiple <span class="scopeDescBulkGenerate">Device Serial Numbers</span> separated by <code><new line></code>, commas (<code>,</code>) or semicolons (<code>;</code>).
|
||||
</div>
|
||||
<div class="examples clearfix">
|
||||
<h4>Examples:</h4>
|
||||
<div class="example1 code">
|
||||
01234567<br />
|
||||
ABCD9876<br />
|
||||
8VQ6G2R
|
||||
</div>
|
||||
<div class="example2 code">01234567,ABCD9876,8VQ6G2R</div>
|
||||
<div class="example3 code">01234567;ABCD9876;8VQ6G2R</div>
|
||||
</div>
|
||||
break;
|
||||
case "Job":
|
||||
<div>
|
||||
Enter multiple <span class="scopeDescBulkGenerate">Job Ids</span> separated by <code><new line></code>, commas (<code>,</code>) or semicolons (<code>;</code>).
|
||||
</div>
|
||||
<div class="examples clearfix">
|
||||
<h4>Examples:</h4>
|
||||
<div class="example1 code">
|
||||
86<br />
|
||||
99<br />
|
||||
44
|
||||
</div>
|
||||
<div class="example2 code">86,99,44</div>
|
||||
<div class="example3 code">86;99;44</div>
|
||||
</div>
|
||||
break;
|
||||
}
|
||||
</div>
|
||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id), FormMethod.Post))
|
||||
{
|
||||
<div class="field-validation-valid" data-valmsg-replace="true" data-valmsg-for="DataIds"></div>
|
||||
<textarea id="inputBulkGenerateDataIds" name="DataIds" data-val="true" data-val-required="Identifiers are required"></textarea>
|
||||
if (Model.TemplatePageCount > 1 && Model.TemplatePageCount % 2 != 0)
|
||||
{
|
||||
<div style="margin-top: 6px;">
|
||||
<input id="inputBulkGenerateInsertBlankPage" type="checkbox" name="InsertBlankPage" value="True" /><label for="inputBulkGenerateInsertBlankPage">Insert Blank Pages for Double-Sided Printing</label>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
var dialog;
|
||||
|
||||
$('#buttonBulkGenerate').click(function () {
|
||||
if (!dialog) {
|
||||
dialog = $('#dialogBulkGenerate').dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 460,
|
||||
buttons: {
|
||||
"Bulk Generate": function () {
|
||||
dialog.find('form').submit();
|
||||
dialog.dialog("disable");
|
||||
},
|
||||
Close: function () {
|
||||
$(this).dialog("close");
|
||||
@if (canConfig && Authorization.Has(Claims.Config.UserFlag.Configure))
|
||||
{
|
||||
<table id="DocumentTemplate_OnImportUserFlagRules" class="tableData">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Action</td>
|
||||
<td>User Flag</td>
|
||||
<td>Created By</td>
|
||||
<td>Comments</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="@(Model.OnImportUserFlagRules.Any() ? "hidden" : null)">
|
||||
<td colspan="5"><span class="smallMessage"><None Specified></span></td>
|
||||
</tr>
|
||||
@foreach (var rule in Model.OnImportUserFlagRules)
|
||||
{
|
||||
<tr data-id="@rule.Id">
|
||||
<td>@(rule.AddFlag ? "Assign" : "Remove")</td>
|
||||
<td>
|
||||
<i class="fa fa-@(rule.UserFlag.Icon) fa-lg d-@(rule.UserFlag.IconColour)"></i>
|
||||
@if (Authorization.Has(Claims.Config.UserFlag.Configure))
|
||||
{
|
||||
<span>@Html.ActionLink(rule.UserFlag.Name, MVC.Config.UserFlag.Index(rule.UserFlag.Id))</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>@rule.UserFlag.Name</span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (Authorization.Has(Claims.User.Show))
|
||||
{
|
||||
<span>@Html.ActionLink(string.Format("{0} ({1})", rule.User.DisplayName, rule.User.FriendlyId()), MVC.User.Show(rule.User.UserId))</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>@string.Format("{0} ({1})", rule.User.DisplayName, rule.User.FriendlyId())</span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (string.IsNullOrWhiteSpace(rule.Comments))
|
||||
{
|
||||
<span> </span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="whitespace-pre-wrap">@rule.Comments</span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<i class="fa fa-times-circle fa-lg ajaxRemove" title="Remove"></i>
|
||||
<i class="ajaxLoading" title="Loading..."></i>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
using (Html.BeginForm(MVC.API.DocumentTemplate.RemoveOnImportUserFlagRule(Model.DocumentTemplate.Id), FormMethod.Post, new { id = "DocumentTemplate_OnImportUserFlagRules_Remove" }))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
@Html.Hidden("ruleId", "")
|
||||
}
|
||||
<a id="DocumentTemplate_OnImportUserFlagRules_AddButton" href="#" class="button small">Add User Flag Rule</a>
|
||||
<div id="DocumentTemplate_OnImportUserFlagRules_AddDialog" class="hiddenDialog" title="On Import User Flag Rule: @(Model.DocumentTemplate.Id)">
|
||||
<div class="brief">
|
||||
@switch (Model.DocumentTemplate.Scope)
|
||||
{
|
||||
case "Device":
|
||||
<div>
|
||||
The user flag will be created/removed against the devices assigned user.
|
||||
</div>
|
||||
break;
|
||||
case "Job":
|
||||
<div>
|
||||
The user flag will be created/removed against the jobs associated user.
|
||||
</div>
|
||||
break;
|
||||
case "User":
|
||||
<div>
|
||||
The user flag will be created/removed against the user.
|
||||
</div>
|
||||
break;
|
||||
}
|
||||
</div>
|
||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.AddOnImportUserFlagRule(Model.DocumentTemplate.Id), FormMethod.Post))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
<div class="distribute-evenly">
|
||||
<span>
|
||||
<input id="DocumentTemplate_OnImportUserFlagRules_Add_Create" type="radio" name="addFlag" value="true" checked /><label for="DocumentTemplate_OnImportUserFlagRules_Add_Create">Assign User Flag</label>
|
||||
</span>
|
||||
<span>
|
||||
<input id="DocumentTemplate_OnImportUserFlagRules_Add_Remove" type="radio" name="addFlag" value="false" /><label for="DocumentTemplate_OnImportUserFlagRules_Add_Remove">Remove User Flag</label>
|
||||
</span>
|
||||
</div>
|
||||
<div class="dialog-item-picker">
|
||||
@foreach (var flag in Model.UserFlags)
|
||||
{
|
||||
<div class="item">
|
||||
<input id="DocumentTemplate_OnImportUserFlagRules_Add_Flag_@flag.Id" type="radio" name="userFlagId" value="@flag.Id" required />
|
||||
<label for="DocumentTemplate_OnImportUserFlagRules_Add_Flag_@flag.Id"><i class="fa fa-@(flag.Icon) fa-fw fa-lg d-@(flag.IconColour)"></i>@flag.Name</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div>
|
||||
<div class="mt-1">
|
||||
<label for="DocumentTemplate_OnImportUserFlagRules_Add_Comments">Comments</label> <small>(added to the assignment; optional)</small>
|
||||
</div>
|
||||
<textarea id="DocumentTemplate_OnImportUserFlagRules_Add_Comments" name="comments"></textarea>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<script id="DocumentTemplate_OnImportUserFlagRules_AddTemplate" type="text/template">
|
||||
<tr>
|
||||
<td class="rule-action"></td>
|
||||
<td>
|
||||
<i class="rule-flag fa fa-lg"></i>
|
||||
<span class="rule-flag"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="rule-user"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="rule-comments whitespace-pre-wrap"></span>
|
||||
</td>
|
||||
<td>
|
||||
<i class="fa fa-times-circle fa-lg ajaxRemove" title="Remove"></i>
|
||||
<i class="ajaxLoading" title="Loading..." style="display: none;"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
const rulesTable = $('#DocumentTemplate_OnImportUserFlagRules');
|
||||
|
||||
rulesTable.on('click', '.ajaxRemove', e => {
|
||||
const $remove = $(e.currentTarget);
|
||||
const $target = $remove.closest('tr');
|
||||
const id = $target.attr('data-id');
|
||||
|
||||
const $loader = $remove.next('.ajaxLoading');
|
||||
$loader.show();
|
||||
$remove.hide();
|
||||
|
||||
const $form = $('#DocumentTemplate_OnImportUserFlagRules_Remove');
|
||||
$form.find('[name="ruleId"]').val(id);
|
||||
const body = new FormData($form[0]);
|
||||
fetch($form[0].action, {
|
||||
body: body,
|
||||
method: 'POST'
|
||||
}).then(r => {
|
||||
if (r.status === 200) {
|
||||
$target.remove();
|
||||
|
||||
const rows = rulesTable.find('tbody').find('tr');
|
||||
if (rows.length === 1) {
|
||||
rows.first().removeClass('hidden');
|
||||
} else {
|
||||
rows.first().addClass('hidden');
|
||||
}
|
||||
} else {
|
||||
alert(r.statusText);
|
||||
$loader.hide();
|
||||
$remove.show();
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
alert(e);
|
||||
$loader.hide();
|
||||
$remove.show();
|
||||
});
|
||||
});
|
||||
|
||||
$.validator.unobtrusive.reparse('#inputBulkGenerateDataIds');
|
||||
}
|
||||
let dialog = null;
|
||||
$('#DocumentTemplate_OnImportUserFlagRules_AddButton').click(e => {
|
||||
e.preventDefault();
|
||||
|
||||
dialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
if (!dialog) {
|
||||
dialog = $('#DocumentTemplate_OnImportUserFlagRules_AddDialog').dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 460,
|
||||
buttons: {
|
||||
"Add Rule": function () {
|
||||
dialog.dialog("disable");
|
||||
|
||||
const form = dialog.find('form')[0];
|
||||
if (form.reportValidity()) {
|
||||
const body = new FormData(form);
|
||||
|
||||
fetch(form.action, {
|
||||
method: 'POST',
|
||||
body: body
|
||||
})
|
||||
.then(r => r.json())
|
||||
.then(r => {
|
||||
const row = $($('#DocumentTemplate_OnImportUserFlagRules_AddTemplate').html());
|
||||
row.attr('data-id', r.Id);
|
||||
row.find('.rule-action').text(r.AddFlag ? 'Assign' : 'Remove');
|
||||
row.find('i.rule-flag').addClass('fa-' + r.UserFlagIcon + ' d-' + r.UserFlagColour);
|
||||
row.find('span.rule-flag').text(r.UserFlagName);
|
||||
row.find('.rule-user').text(r.UserDisplayName + ' (' + r.UserIdFriendly + ')');
|
||||
row.find('.rule-comments').text(r.Comments);
|
||||
rulesTable.find('tbody').append(row);
|
||||
|
||||
rulesTable.find('tbody').find('tr').first().addClass('hidden');
|
||||
|
||||
dialog.dialog("close");
|
||||
})
|
||||
.catch(e => {
|
||||
alert(e);
|
||||
})
|
||||
}
|
||||
},
|
||||
Close: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Model.OnImportUserFlagRules.Any())
|
||||
{
|
||||
<span class="smallMessage"><None Specified></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="tableData">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Action</td>
|
||||
<td>User Flag</td>
|
||||
<td>Created By</td>
|
||||
<td>Comments</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var rule in Model.OnImportUserFlagRules)
|
||||
{
|
||||
<tr>
|
||||
<td>@(rule.AddFlag ? "Assign" : "Remove")</td>
|
||||
<td>
|
||||
<i class="fa fa-@(rule.UserFlag.Icon) fa-lg d-@(rule.UserFlag.IconColour)"></i>
|
||||
@if (Authorization.Has(Claims.Config.UserFlag.Configure))
|
||||
{
|
||||
<span>@Html.ActionLink(rule.UserFlag.Name, MVC.Config.UserFlag.Index(rule.UserFlag.Id))</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>@rule.UserFlag.Name</span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (Authorization.Has(Claims.User.Show))
|
||||
{
|
||||
<span>@Html.ActionLink(string.Format("{0} ({1})", rule.User.DisplayName, rule.User.FriendlyId()), MVC.User.Show(rule.User.UserId))</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>@string.Format("{0} ({1})", rule.User.DisplayName, rule.User.FriendlyId())</span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (string.IsNullOrWhiteSpace(rule.Comments))
|
||||
{
|
||||
<span> </span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="whitespace-pre-wrap">@rule.Comments</span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
}
|
||||
<div class="info-box">
|
||||
<p class="fa-p">
|
||||
<i class="fa fa-fw fa-info-circle"></i>
|
||||
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.
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Linked Groups:
|
||||
</th>
|
||||
<td>
|
||||
<div>
|
||||
@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)
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="Config_HideAdvanced_Item">
|
||||
<h2>Template Expressions</h2>
|
||||
@Html.Partial(MVC.Config.DocumentTemplate.Views._ExpressionsTable, Model.TemplateExpressions)
|
||||
</div>
|
||||
</div>
|
||||
<div id="dialogConfirmDelete" title="Delete this Document Template?">
|
||||
<p>
|
||||
<i class="fa fa-exclamation-triangle fa-lg warning"></i>This item will be permanently deleted and cannot be recovered.<br />
|
||||
<em>
|
||||
This <strong>will not delete attachments</strong> which have already been imported,
|
||||
but any generated documents will no longer be automatically imported.
|
||||
</em><br />
|
||||
Are you sure?
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var button = $('#buttonDelete');
|
||||
var buttonDialog = $("#dialogConfirmDelete");
|
||||
var buttonLink = button.attr('href');
|
||||
button.attr('href', '#');
|
||||
button.click(function () {
|
||||
buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
}
|
||||
}
|
||||
@if (Authorization.Has(Claims.Config.DocumentTemplate.Delete))
|
||||
{
|
||||
@Html.ActionLinkButton("Delete", MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true), "buttonDelete")
|
||||
}
|
||||
</div>
|
||||
@if (!string.IsNullOrWhiteSpace(Model.BulkGenerateDownloadId))
|
||||
{
|
||||
<div id="Config_DocumentTemplates_Show_DownloadBulk_Dialog" class="dialog" title="Download Bulk Documents">
|
||||
<a href="@Url.Action(MVC.API.DocumentTemplate.BulkGenerateDownload(Model.BulkGenerateDownloadId, Model.BulkGenerateDownloadFilename))" class="button"><i class="fa fa-download fa-lg"></i>Download Bulk Documents</a>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#Config_DocumentTemplates_Show_DownloadBulk_Dialog')
|
||||
.dialog({
|
||||
width: 400,
|
||||
height: 100,
|
||||
buttonDialog.dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: true
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Delete": function () {
|
||||
$this = $(this);
|
||||
$this.dialog('disable');
|
||||
$this.dialog("option", "buttons", null);
|
||||
window.location.href = buttonLink;
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
<div class="actionBar">
|
||||
@if (hideAdvanced)
|
||||
{
|
||||
<button id="Config_HideAdvanced_Show" class="button">Show Advanced Options</button>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#Config_HideAdvanced_Show').click(function () {
|
||||
$('#Config_DocumentTemplates_Show').removeClass('Config_HideAdvanced');
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
@if (Authorization.Has(Claims.Config.Show))
|
||||
{
|
||||
@Html.ActionLinkButton("Expression Browser", MVC.Config.DocumentTemplate.ExpressionBrowser())
|
||||
}
|
||||
@if (canBulkGenerate)
|
||||
{
|
||||
if (Model.DocumentTemplate.Scope == DocumentTemplate.DocumentTemplateScopes.User)
|
||||
{
|
||||
@Html.ActionLinkButton("Bulk Generate", MVC.Config.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id))
|
||||
}
|
||||
else
|
||||
{
|
||||
<a id="buttonBulkGenerate" href="#" class="button">Bulk Generate</a>
|
||||
<div id="dialogBulkGenerate" class="hiddenDialog dialog-bulk-generate" title="Bulk Generate: @(Model.DocumentTemplate.Id)">
|
||||
<div class="brief">
|
||||
@switch (Model.DocumentTemplate.Scope)
|
||||
{
|
||||
case "Device":
|
||||
<div>
|
||||
Enter multiple <span class="scopeDescBulkGenerate">Device Serial Numbers</span> separated by <code><new line></code>, commas (<code>,</code>) or semicolons (<code>;</code>).
|
||||
</div>
|
||||
<div class="examples clearfix">
|
||||
<h4>Examples:</h4>
|
||||
<div class="example1 code">
|
||||
01234567<br />
|
||||
ABCD9876<br />
|
||||
8VQ6G2R
|
||||
</div>
|
||||
<div class="example2 code">01234567,ABCD9876,8VQ6G2R</div>
|
||||
<div class="example3 code">01234567;ABCD9876;8VQ6G2R</div>
|
||||
</div>
|
||||
break;
|
||||
case "Job":
|
||||
<div>
|
||||
Enter multiple <span class="scopeDescBulkGenerate">Job Ids</span> separated by <code><new line></code>, commas (<code>,</code>) or semicolons (<code>;</code>).
|
||||
</div>
|
||||
<div class="examples clearfix">
|
||||
<h4>Examples:</h4>
|
||||
<div class="example1 code">
|
||||
86<br />
|
||||
99<br />
|
||||
44
|
||||
</div>
|
||||
<div class="example2 code">86,99,44</div>
|
||||
<div class="example3 code">86;99;44</div>
|
||||
</div>
|
||||
break;
|
||||
}
|
||||
</div>
|
||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id), FormMethod.Post))
|
||||
{
|
||||
<div class="field-validation-valid" data-valmsg-replace="true" data-valmsg-for="DataIds"></div>
|
||||
<textarea id="inputBulkGenerateDataIds" name="DataIds" data-val="true" data-val-required="Identifiers are required"></textarea>
|
||||
if (Model.TemplatePageCount > 1 && Model.TemplatePageCount % 2 != 0)
|
||||
{
|
||||
<div style="margin-top: 6px;">
|
||||
<input id="inputBulkGenerateInsertBlankPage" type="checkbox" name="InsertBlankPage" value="True" /><label for="inputBulkGenerateInsertBlankPage">Insert Blank Pages for Double-Sided Printing</label>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
var dialog;
|
||||
|
||||
$('#buttonBulkGenerate').click(function () {
|
||||
if (!dialog) {
|
||||
dialog = $('#dialogBulkGenerate').dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 460,
|
||||
buttons: {
|
||||
"Bulk Generate": function () {
|
||||
dialog.find('form').submit();
|
||||
dialog.dialog("disable");
|
||||
},
|
||||
Close: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.validator.unobtrusive.reparse('#inputBulkGenerateDataIds');
|
||||
}
|
||||
|
||||
dialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
}
|
||||
@if (Authorization.Has(Claims.Config.DocumentTemplate.Delete))
|
||||
{
|
||||
@Html.ActionLinkButton("Delete", MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true), "buttonDelete")
|
||||
}
|
||||
</div>
|
||||
@if (!string.IsNullOrWhiteSpace(Model.BulkGenerateDownloadId))
|
||||
{
|
||||
<div id="Config_DocumentTemplates_Show_DownloadBulk_Dialog" class="dialog" title="Download Bulk Documents">
|
||||
<a href="@Url.Action(MVC.API.DocumentTemplate.BulkGenerateDownload(Model.BulkGenerateDownloadId, Model.BulkGenerateDownloadFilename))" class="button"><i class="fa fa-download fa-lg"></i>Download Bulk Documents</a>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#Config_DocumentTemplates_Show_DownloadBulk_Dialog')
|
||||
.dialog({
|
||||
width: 400,
|
||||
height: 100,
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5342,4 +5342,7 @@ ul.list-group li.selected:hover {
|
||||
}
|
||||
ul.list-group li:not(:first-child) {
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
.whitespace-pre-wrap {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -670,6 +670,17 @@ div.logEventsViewport table.logEventsViewport > tbody > tr > td.message {
|
||||
#Config_DocumentTemplates_JobSubTypes_Update_Dialog .checkboxBulkSelectContainer {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
#DocumentTemplate_OnImportUserFlagRules_AddDialog .distribute-evenly {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
margin: 1em 0;
|
||||
}
|
||||
#DocumentTemplate_OnImportUserFlagRules_AddDialog textarea {
|
||||
width: 99%;
|
||||
}
|
||||
#DocumentTemplate_OnImportUserFlagRules_AddDialog .mt-1 {
|
||||
margin-top: 1em;
|
||||
}
|
||||
.dialog-bulk-generate .brief {
|
||||
margin: 0 0 8px 0;
|
||||
}
|
||||
|
||||
@@ -733,6 +733,22 @@ div.logEventsViewport {
|
||||
}
|
||||
}
|
||||
|
||||
#DocumentTemplate_OnImportUserFlagRules_AddDialog {
|
||||
.distribute-evenly {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 99%;
|
||||
}
|
||||
|
||||
.mt-1 {
|
||||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-bulk-generate {
|
||||
.brief {
|
||||
margin: 0 0 8px 0;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -1575,4 +1575,7 @@ ul.list-group li.selected:hover {
|
||||
}
|
||||
ul.list-group li:not(:first-child) {
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
.whitespace-pre-wrap {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
@@ -1676,3 +1676,7 @@ ul.list-group {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.whitespace-pre-wrap {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -214,6 +214,7 @@
|
||||
<Compile Include="Areas\API\Controllers\JobQueueJobController.cs" />
|
||||
<Compile Include="Areas\API\Controllers\PluginController.cs" />
|
||||
<Compile Include="Areas\API\Controllers\SearchController.cs" />
|
||||
<Compile Include="Areas\API\Models\DocumentTemplate\AddOnImportUserFlagRuleModel.cs" />
|
||||
<Compile Include="Areas\API\Models\DocumentTemplate\BulkGenerateUserModel.cs" />
|
||||
<Compile Include="Areas\API\Models\DocumentTemplate\DocumentHandlersModel.cs" />
|
||||
<Compile Include="Areas\API\Models\Job\DeviceHeldLocationModel.cs" />
|
||||
|
||||
@@ -241,6 +241,18 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
}
|
||||
[NonAction]
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public virtual System.Web.Mvc.ActionResult RemoveOnImportUserFlagRule()
|
||||
{
|
||||
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.RemoveOnImportUserFlagRule);
|
||||
}
|
||||
[NonAction]
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public virtual System.Web.Mvc.ActionResult AddOnImportUserFlagRule()
|
||||
{
|
||||
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AddOnImportUserFlagRule);
|
||||
}
|
||||
[NonAction]
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public virtual System.Web.Mvc.ActionResult GenerateDocumentHandlerUi()
|
||||
{
|
||||
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.GenerateDocumentHandlerUi);
|
||||
@@ -298,6 +310,8 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
public readonly string BulkGenerateAddUserDetail = "BulkGenerateAddUserDetail";
|
||||
public readonly string Generate = "Generate";
|
||||
public readonly string Delete = "Delete";
|
||||
public readonly string RemoveOnImportUserFlagRule = "RemoveOnImportUserFlagRule";
|
||||
public readonly string AddOnImportUserFlagRule = "AddOnImportUserFlagRule";
|
||||
public readonly string GenerateDocumentHandlerUi = "GenerateDocumentHandlerUi";
|
||||
public readonly string DocumentHandlers = "DocumentHandlers";
|
||||
}
|
||||
@@ -336,6 +350,8 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
public const string BulkGenerateAddUserDetail = "BulkGenerateAddUserDetail";
|
||||
public const string Generate = "Generate";
|
||||
public const string Delete = "Delete";
|
||||
public const string RemoveOnImportUserFlagRule = "RemoveOnImportUserFlagRule";
|
||||
public const string AddOnImportUserFlagRule = "AddOnImportUserFlagRule";
|
||||
public const string GenerateDocumentHandlerUi = "GenerateDocumentHandlerUi";
|
||||
public const string DocumentHandlers = "DocumentHandlers";
|
||||
}
|
||||
@@ -622,6 +638,26 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
public readonly string id = "id";
|
||||
public readonly string redirect = "redirect";
|
||||
}
|
||||
static readonly ActionParamsClass_RemoveOnImportUserFlagRule s_params_RemoveOnImportUserFlagRule = new ActionParamsClass_RemoveOnImportUserFlagRule();
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public ActionParamsClass_RemoveOnImportUserFlagRule RemoveOnImportUserFlagRuleParams { get { return s_params_RemoveOnImportUserFlagRule; } }
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public class ActionParamsClass_RemoveOnImportUserFlagRule
|
||||
{
|
||||
public readonly string id = "id";
|
||||
public readonly string ruleId = "ruleId";
|
||||
}
|
||||
static readonly ActionParamsClass_AddOnImportUserFlagRule s_params_AddOnImportUserFlagRule = new ActionParamsClass_AddOnImportUserFlagRule();
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public ActionParamsClass_AddOnImportUserFlagRule AddOnImportUserFlagRuleParams { get { return s_params_AddOnImportUserFlagRule; } }
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public class ActionParamsClass_AddOnImportUserFlagRule
|
||||
{
|
||||
public readonly string id = "id";
|
||||
public readonly string addFlag = "addFlag";
|
||||
public readonly string userFlagId = "userFlagId";
|
||||
public readonly string comments = "comments";
|
||||
}
|
||||
static readonly ActionParamsClass_GenerateDocumentHandlerUi s_params_GenerateDocumentHandlerUi = new ActionParamsClass_GenerateDocumentHandlerUi();
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public ActionParamsClass_GenerateDocumentHandlerUi GenerateDocumentHandlerUiParams { get { return s_params_GenerateDocumentHandlerUi; } }
|
||||
@@ -1084,6 +1120,34 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
return callInfo;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
partial void RemoveOnImportUserFlagRuleOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id, System.Guid? ruleId);
|
||||
|
||||
[NonAction]
|
||||
public override System.Web.Mvc.ActionResult RemoveOnImportUserFlagRule(string id, System.Guid? ruleId)
|
||||
{
|
||||
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.RemoveOnImportUserFlagRule);
|
||||
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
|
||||
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "ruleId", ruleId);
|
||||
RemoveOnImportUserFlagRuleOverride(callInfo, id, ruleId);
|
||||
return callInfo;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
partial void AddOnImportUserFlagRuleOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id, bool? addFlag, int? userFlagId, string comments);
|
||||
|
||||
[NonAction]
|
||||
public override System.Web.Mvc.ActionResult AddOnImportUserFlagRule(string id, bool? addFlag, int? userFlagId, string comments)
|
||||
{
|
||||
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AddOnImportUserFlagRule);
|
||||
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
|
||||
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "addFlag", addFlag);
|
||||
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "userFlagId", userFlagId);
|
||||
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "comments", comments);
|
||||
AddOnImportUserFlagRuleOverride(callInfo, id, addFlag, userFlagId, comments);
|
||||
return callInfo;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
partial void GenerateDocumentHandlerUiOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string templateId, string targetId, string handlerId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user