mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:57:33 -05:00 
			
		
		
		
	Merge remote-tracking branch 'upstream/develop' into wepay-integration
This commit is contained in:
		
						commit
						6ddbbbc64d
					
				@ -41,10 +41,10 @@ class AddDocuments extends Migration {
 | 
			
		||||
 | 
			
		||||
            $t->timestamps();
 | 
			
		||||
 | 
			
		||||
            $t->foreign('account_id')->references('id')->on('accounts');
 | 
			
		||||
			$t->foreign('user_id')->references('id')->on('users');
 | 
			
		||||
			$t->foreign('invoice_id')->references('id')->on('invoices');
 | 
			
		||||
			$t->foreign('expense_id')->references('id')->on('expenses');
 | 
			
		||||
            $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
 | 
			
		||||
			$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
 | 
			
		||||
			$t->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
 | 
			
		||||
			$t->foreign('expense_id')->references('id')->on('expenses')->onDelete('cascade');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            $t->unique( array('account_id','public_id') );
 | 
			
		||||
 | 
			
		||||
@ -1311,6 +1311,7 @@ $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.',
 | 
			
		||||
 | 
			
		||||
    'view_dashboard' => 'View Dashboard',
 | 
			
		||||
    'client_session_expired' => 'Session Expired',
 | 
			
		||||
 | 
			
		||||
@ -249,7 +249,7 @@
 | 
			
		||||
                        public_id:document.public_id(),
 | 
			
		||||
                        status:Dropzone.SUCCESS,
 | 
			
		||||
                        accepted:true,
 | 
			
		||||
                        url:document.preview_url()||document.url(),
 | 
			
		||||
                        url:document.url(),
 | 
			
		||||
                        mock:true,
 | 
			
		||||
                        index:i
 | 
			
		||||
                    };
 | 
			
		||||
 | 
			
		||||
@ -998,7 +998,18 @@
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        // Initialize document upload
 | 
			
		||||
        dropzone = new Dropzone('#document-upload .dropzone', {
 | 
			
		||||
        window.dropzone = false;
 | 
			
		||||
        $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
 | 
			
		||||
            if (window.dropzone) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var target = $(e.target).attr('href') // activated tab
 | 
			
		||||
            if (target != '#attached-documents') {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            window.dropzone = new Dropzone('#document-upload .dropzone', {
 | 
			
		||||
                url:{!! json_encode(url('document')) !!},
 | 
			
		||||
                params:{
 | 
			
		||||
                    _token:"{{ Session::getToken() }}"
 | 
			
		||||
@ -1023,7 +1034,7 @@
 | 
			
		||||
                        public_id:document.public_id(),
 | 
			
		||||
                        status:Dropzone.SUCCESS,
 | 
			
		||||
                        accepted:true,
 | 
			
		||||
                    url:document.preview_url()||document.url(),
 | 
			
		||||
                        url:document.url(),
 | 
			
		||||
                        mock:true,
 | 
			
		||||
                        index:i
 | 
			
		||||
                    };
 | 
			
		||||
@ -1031,7 +1042,7 @@
 | 
			
		||||
                    dropzone.emit('addedfile', mockFile);
 | 
			
		||||
                    dropzone.emit('complete', mockFile);
 | 
			
		||||
                    if(document.preview_url()){
 | 
			
		||||
                    dropzone.emit('thumbnail', mockFile, document.preview_url()||document.url());
 | 
			
		||||
                        dropzone.emit('thumbnail', mockFile, document.preview_url());
 | 
			
		||||
                    }
 | 
			
		||||
                    else if(document.type()=='jpeg' || document.type()=='png' || document.type()=='svg'){
 | 
			
		||||
                        dropzone.emit('thumbnail', mockFile, document.url());
 | 
			
		||||
@ -1039,6 +1050,7 @@
 | 
			
		||||
                    dropzone.files.push(mockFile);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        @endif
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
@ -1222,7 +1234,7 @@
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        preparePdfData('');
 | 
			
		||||
        submitAction('');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function getSendToEmails() {
 | 
			
		||||
@ -1257,6 +1269,11 @@
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    function onFormSubmit(event) {
 | 
			
		||||
        if (window.countUploadingDocuments > 0) {
 | 
			
		||||
            alert("{!! trans('texts.wait_for_upload') !!}");
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!isSaveValid()) {
 | 
			
		||||
            model.showClientForm();
 | 
			
		||||
            return false;
 | 
			
		||||
@ -1431,6 +1448,7 @@
 | 
			
		||||
        model.invoice().invoice_number(number);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    window.countUploadingDocuments = 0;
 | 
			
		||||
    @if ($account->hasFeature(FEATURE_DOCUMENTS))
 | 
			
		||||
    function handleDocumentAdded(file){
 | 
			
		||||
        // open document when clicked
 | 
			
		||||
@ -1442,6 +1460,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){
 | 
			
		||||
@ -1452,6 +1471,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){
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user