Prevent clicking save while document is still uploading

This commit is contained in:
Hillel Coren 2016-05-25 14:42:20 +03:00
parent 1531727188
commit ba561c7d0d
2 changed files with 10 additions and 0 deletions

View File

@ -1311,6 +1311,8 @@ $LANG = array(
'new_start_date' => 'New start date',
'security' => 'Security',
'see_whats_new' => 'See what\'s new in v:version',
'wait_for_upload' => 'Please wait for the document upload to complete.'
);
return $LANG;

View File

@ -1265,6 +1265,11 @@
}
function onFormSubmit(event) {
if (window.countUploadingDocuments > 0) {
alert("{!! trans('texts.wait_for_upload') !!}");
return false;
}
if (!isSaveValid()) {
model.showClientForm();
return false;
@ -1435,6 +1440,7 @@
model.invoice().invoice_number(number);
}
window.countUploadingDocuments = 0;
@if ($account->hasFeature(FEATURE_DOCUMENTS))
function handleDocumentAdded(file){
// open document when clicked
@ -1446,6 +1452,7 @@
if(file.mock)return;
file.index = model.invoice().documents().length;
model.invoice().addDocument({name:file.name, size:file.size, type:file.type});
window.countUploadingDocuments++;
}
function handleDocumentRemoved(file){
@ -1456,6 +1463,7 @@
function handleDocumentUploaded(file, response){
file.public_id = response.document.public_id
model.invoice().documents()[file.index].update(response.document);
window.countUploadingDocuments--;
refreshPDF(true);
if(response.document.preview_url){