Skip to content

Commit

Permalink
[MediaGallery] fix: progress bar fades out after uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
Théo David committed Jun 27, 2022
1 parent 458e0be commit 1f3db26
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions js/digiriskdolibarr.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -1359,24 +1359,29 @@
let token = $('.id-container.page-ut-gp-list').find('input[name="token"]').val();
$('#myProgress').attr('style', 'display:block')
$.each(files, function(index, file) {
let formdata = new FormData();
formdata.append("userfile[]", file);
$.ajax({
url: document.URL + "&action=uploadPhoto&token=" + token,
type: "POST",
data: formdata,
processData: false,
contentType: false,
}).done(function() {
progress += (1 / totalCount) * 100
$('#myBar').animate({
width: progress + '%'
}, 300 );
if (index + 1 === totalCount) {
elementParent.load( document.URL + '&uploadMediasSuccess=1' + ' .ecm-photo-list');
actionContainerSuccess.removeClass('hidden');
}
})
let formdata = new FormData();
formdata.append("userfile[]", file);
$.ajax({
url: document.URL + "&action=uploadPhoto&uploadMediasSuccess=1&token=" + token,
type: "POST",
data: formdata,
processData: false,
contentType: false,
success: function (resp) {
progress += (1 / totalCount) * 100
$('#myBar').animate({
width: progress + '%'
}, 300);
if (index + 1 === totalCount) {
elementParent.load( document.URL + '&uploadMediasSuccess=1' + ' .ecm-photo-list', () => {
setTimeout(() => {
$('#myProgress').fadeOut(800)
}, 800)
});
actionContainerSuccess.removeClass('hidden');
}
}
});
})
};

Expand Down

0 comments on commit 1f3db26

Please sign in to comment.