From 547c0256b0cae2533bbd1b0346069a9056271b7d Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Wed, 12 Dec 2018 19:42:18 +0100 Subject: [PATCH] Testing if upload trigger works --- Site/Controls/v5/Base/FileUpload.ascx | 4 ++ Site/Pages/v5/Ledgers/EndOfMonth.aspx | 50 ++++++++++++------- Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs | 8 ++- .../v5/Ledgers/EndOfMonth.aspx.designer.cs | 9 ++++ 4 files changed, 53 insertions(+), 18 deletions(-) diff --git a/Site/Controls/v5/Base/FileUpload.ascx b/Site/Controls/v5/Base/FileUpload.ascx index 337dfc54..1e1b630f 100644 --- a/Site/Controls/v5/Base/FileUpload.ascx +++ b/Site/Controls/v5/Base/FileUpload.ascx @@ -102,6 +102,10 @@ } + function <%=this.ClientID%>_triggerUpload() { + $('#<%=this.ClientID %>_ButtonUploadHidden').click(); + } + function <%=this.ClientID%>_clear() { // Note that this only clears the UI -- the uploaded docs must be disassociated elsewhere $('#<%=this.ClientID%>_DivUploadCount').empty(); diff --git a/Site/Pages/v5/Ledgers/EndOfMonth.aspx b/Site/Pages/v5/Ledgers/EndOfMonth.aspx index 6c88694b..2f635191 100644 --- a/Site/Pages/v5/Ledgers/EndOfMonth.aspx +++ b/Site/Pages/v5/Ledgers/EndOfMonth.aspx @@ -134,25 +134,34 @@ $('img.action-icon[data-item="' + itemId + '"]').hide(); $('img.status-icon-pleasewait[data-item="' + itemId + '"]').show(); - SwarmopsJS.ajaxCall( - "/Pages/v5/Ledgers/EndOfMonth.aspx/" + callbackFunction, - {}, - $.proxy(function() { - var groupId = $(this).attr('data-group'); - var itemId = $(this).attr('data-item'); + if ($(this).hasClass('is-upload')) { + // Trigger upload, then trigger ajax call on complete - $('span.action-list-item[data-item="' + itemId + '"]').addClass('action-list-item-completed'); - $('img.status-icon-pleasewait[data-item="' + itemId + '"]').hide(); - $('img.status-icon-completed[data-item="' + itemId + '"]').fadeIn(); + <%=this.UploadControl.ClientID%>_triggerUpload(); - var selector = ".action-list-item:not(.action-list-item-completed):not(.action-list-item-disabled)[data-group='" + groupId + "']"; - if ($(selector).length == 0) // no further actions in this group enabled - { - // mark the group as completed - $(".group-status-icon[data-group='" + groupId + "']").fadeIn(); - } - }, this) - ); + } else { + // Ajax call right away + + SwarmopsJS.ajaxCall( + "/Pages/v5/Ledgers/EndOfMonth.aspx/" + callbackFunction, + {}, + $.proxy(function() { + var groupId = $(this).attr('data-group'); + var itemId = $(this).attr('data-item'); + + $('span.action-list-item[data-item="' + itemId + '"]').addClass('action-list-item-completed'); + $('img.status-icon-pleasewait[data-item="' + itemId + '"]').hide(); + $('img.status-icon-completed[data-item="' + itemId + '"]').fadeIn(); + + var selector = ".action-list-item:not(.action-list-item-completed):not(.action-list-item-disabled)[data-group='" + groupId + "']"; + if ($(selector).length == 0) // no further actions in this group enabled + { + // mark the group as completed + $(".group-status-icon[data-group='" + groupId + "']").fadeIn(); + } + }, this) + ); + } }); @@ -170,6 +179,12 @@ }); + function clientPostUpload(callbackFunction, cookie) { + + } + + var uploadGuid = '<%=this.UploadControl.GuidString%>'; + // Function: Match all mismatched transactions // Function: Upload bank statement PDF for accountId x @@ -255,6 +270,7 @@

+
0) { @@ -194,10 +195,15 @@ namespace Swarmops.Frontend.Pages.Ledgers Server.HtmlEncode(Resources.Global.Global_SkipThis) + ")"; } + if (item.Icon == "upload") + { + iconIsUploadClass = " is-upload"; + } + builder.Append(@" $('#TableEomItems').datagrid('appendRow', { itemName: """ + itemName + @""", - action: """" + action: """" }); "); } diff --git a/Site/Pages/v5/Ledgers/EndOfMonth.aspx.designer.cs b/Site/Pages/v5/Ledgers/EndOfMonth.aspx.designer.cs index a7497d52..dfc5ac42 100644 --- a/Site/Pages/v5/Ledgers/EndOfMonth.aspx.designer.cs +++ b/Site/Pages/v5/Ledgers/EndOfMonth.aspx.designer.cs @@ -20,5 +20,14 @@ namespace Swarmops.Frontend.Pages.Ledgers { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label LabelHeader; + + /// + /// UploadControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Swarmops.Controls.Base.FileUpload UploadControl; } }