More work on EOM

This commit is contained in:
Rick Falkvinge
2018-12-14 10:41:26 +01:00
parent 547c0256b0
commit c0cbdf5410
3 changed files with 62 additions and 5 deletions
+14
View File
@@ -75,8 +75,22 @@
<%= this.ClientUploadStartedCallback %>("<%= GuidString%>", "<%= Cookie%>");
<% } %>
},
send: function(e, data) {
// call when upload actually begins -- for notify
},
fail: function(e, data) {
// called on upload fail or upload abort -- for notify
<% if (!String.IsNullOrEmpty(this.ClientUploadFailedCallback))
{ %>
<%= this.ClientUploadFailedCallback %>("<%= GuidString%>", "<%= Cookie%>");
<% } %>
}
});
+1
View File
@@ -36,6 +36,7 @@ namespace Swarmops.Controls.Base
public bool HideTrigger { get; set; }
public string ClientUploadCompleteCallback { get; set; }
public string ClientUploadStartedCallback { get; set; }
public string ClientUploadFailedCallback { get; set; }
public string Cookie { get; set; }
public string GuidToken
+47 -5
View File
@@ -131,17 +131,27 @@
var itemId = $(this).attr('data-item');
var callbackFunction = $(this).attr('data-callback');
$('img.action-icon[data-item="' + itemId + '"]').hide();
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').show();
if ($(this).hasClass('is-upload')) {
// Trigger upload, then trigger ajax call on complete
if (triggeredUpload != null) {
// upload is already in progress; don't allow two concurrent uploads since we're using one control
// todo: error message or some UX to explain this?
return;
}
triggeredUpload = this;
<%=this.UploadControl.ClientID%>_triggerUpload();
} else {
// Ajax call right away
$('img.action-icon[data-item="' + itemId + '"]').hide();
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').show();
SwarmopsJS.ajaxCall(
"/Pages/v5/Ledgers/EndOfMonth.aspx/" + callbackFunction,
{},
@@ -179,12 +189,44 @@
});
function clientPostUpload(callbackFunction, cookie) {
function clientStartUpload() {
if (triggeredUpload == null) {
// invalid state
return;
}
var itemId = $(triggeredUpload).attr('data-item');
$('img.action-icon[data-item="' + itemId + '"]').hide();
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').show();
}
function clientFailUpload() {
if (triggeredUpload == null) {
// invalid state
return;
}
var itemId = $(triggeredUpload).attr('data-item');
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').hide();
$('img.action-icon[data-item="' + itemId + '"]').show();
triggeredUpload = null;
}
function clientFinishUpload() {
if (triggeredUpload == null) {
// invalid state
return;
}
triggeredUpload = null;
}
var uploadGuid = '<%=this.UploadControl.GuidString%>';
var triggeredUpload = null;
// Function: Match all mismatched transactions
// Function: Upload bank statement PDF for accountId x