feature: #158 adds job preference option to include all attachments on lodgment

This commit is contained in:
Gary Sharp
2024-12-11 17:01:42 +11:00
parent 25e3a8e1f1
commit 90c709c4c1
17 changed files with 352 additions and 7 deletions
@@ -12,6 +12,7 @@
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
}
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.General);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Lodgment);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Reports);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Locations);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Expressions);
@@ -58,6 +58,7 @@ namespace Disco.Web.Areas.Config.Views.JobPreferences
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
}
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.General);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Lodgment);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Reports);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Locations);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Expressions);
@@ -0,0 +1,45 @@
@model Disco.Web.Areas.Config.Models.JobPreferences.IndexModel
@{
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
}
<div id="Config_Lodgment" class="form" style="width: 530px;">
<h2>Job Lodgment</h2>
<table>
<tr>
<th style="width: 200px">
&nbsp;
</th>
<td>
@if (canConfig)
{
@Html.CheckBoxFor(model => model.LodgmentIncludeAllAttachmentsByDefault)
<label for="LodgmentIncludeAllAttachmentsByDefault">Include All Attachments by Default</label>
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<div class="info-box">
<p class="fa-p">
<i class="fa fa-info-circle"></i>If enabled, all attachments will be selected by default when lodging a job.
</p>
</div>
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#LodgmentIncludeAllAttachmentsByDefault'),
null,
'@(Url.Action(MVC.API.JobPreferences.UpdateLodgmentIncludeAllAttachmentsByDefault()))',
'includeAllAttachmentsByDefault');
});
</script>
}
else
{
<span>
@(Model.LodgmentIncludeAllAttachmentsByDefault ? "Yes" : "No")
</span>
}
</td>
</tr>
</table>
</div>
@@ -0,0 +1,206 @@
#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.JobPreferences.Parts
{
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/JobPreferences/Parts/Lodgment.cshtml")]
public partial class Lodgment : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.JobPreferences.IndexModel>
{
public Lodgment()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"Config_Lodgment\"");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 530px;\"");
WriteLiteral(">\r\n <h2>Job Lodgment</h2>\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px\"");
WriteLiteral(">\r\n &nbsp;\r\n </th>\r\n <td>\r\n");
#line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
Write(Html.CheckBoxFor(model => model.LodgmentIncludeAllAttachmentsByDefault));
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
#line default
#line hidden
WriteLiteral(" <label");
WriteLiteral(" for=\"LodgmentIncludeAllAttachmentsByDefault\"");
WriteLiteral(">Include All Attachments by Default</label>\r\n");
#line 19 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
#line default
#line hidden
#line 19 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 19 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
#line default
#line hidden
#line 20 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 20 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"info-box\"");
WriteLiteral(">\r\n <p");
WriteLiteral(" class=\"fa-p\"");
WriteLiteral(">\r\n <i");
WriteLiteral(" class=\"fa fa-info-circle\"");
WriteLiteral("></i>If enabled, all attachments will be selected by default when lodging a job.\r" +
"\n </p>\r\n </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#LodgmentIncludeAll" +
"AttachmentsByDefault\'),\r\n null,\r\n " +
" \'");
#line 31 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
Write(Url.Action(MVC.API.JobPreferences.UpdateLodgmentIncludeAllAttachmentsByDefault()));
#line default
#line hidden
WriteLiteral("\',\r\n \'includeAllAttachmentsByDefault\');\r\n " +
" });\r\n </script>\r\n");
#line 35 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <span>\r\n");
WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
Write(Model.LodgmentIncludeAllAttachmentsByDefault ? "Yes" : "No");
#line default
#line hidden
WriteLiteral("\r\n </span>\r\n");
#line 41 "..\..\Areas\Config\Views\JobPreferences\Parts\Lodgment.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591