diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 2b9f2e5f4aec..481de829b614 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -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; diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index 5099ded5206b..c27057b2b284 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -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){