diff --git a/resources/views/expenses/edit.blade.php b/resources/views/expenses/edit.blade.php index 49e3b9e379d3..920162e67dd2 100644 --- a/resources/views/expenses/edit.blade.php +++ b/resources/views/expenses/edit.blade.php @@ -14,7 +14,7 @@ @stop @section('content') - + {!! Former::open($url)->addClass('warn-on-exit main-form')->method($method) !!}
{!! Former::text('action') !!} @@ -216,13 +216,13 @@ @else $('#amount').focus(); @endif - + @if (Auth::user()->account->isPro()) $('.main-form').submit(function(){ if($('#document-upload .fallback input').val())$(this).attr('enctype', 'multipart/form-data') else $(this).removeAttr('enctype') }) - + // Initialize document upload dropzone = new Dropzone('#document-upload', { url:{!! json_encode(url('document')) !!}, @@ -286,7 +286,7 @@ } } } - + if (data) { ko.mapping.fromJS(data, self.mapping, this); } @@ -327,11 +327,11 @@ } var expenseCurrencyId = self.expense_currency_id() || self.account_currency_id(); var invoiceCurrencyId = self.invoice_currency_id() || self.account_currency_id(); - return expenseCurrencyId != invoiceCurrencyId + return expenseCurrencyId != invoiceCurrencyId || invoiceCurrencyId != self.account_currency_id() || expenseCurrencyId != self.account_currency_id(); }) - + self.addDocument = function() { var documentModel = new DocumentModel(); self.documents.push(documentModel); @@ -359,11 +359,17 @@ if (data) { self.update(data); - } + } } - + @if (Auth::user()->account->hasFeature(FEATURE_DOCUMENTS)) function handleDocumentAdded(file){ + // open document when clicked + if (file.url) { + file.previewElement.addEventListener("click", function() { + window.open(file.url, '_blank'); + }); + } if(file.mock)return; file.index = model.documents().length; model.addDocument({name:file.name, size:file.size, type:file.type}); @@ -384,4 +390,4 @@ @endif -@stop \ No newline at end of file +@stop diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index 09be1ed4134e..4f1d96f20ad6 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -17,7 +17,7 @@ label.control-label[for=invoice_number] { font-weight: normal !important; } - + select.tax-select { width: 50%; float: left; @@ -79,7 +79,7 @@   
{{ trans('texts.deleted') }}
@endif - + @can('view', $invoice->client) @can('edit', $invoice->client) {{ trans('texts.edit_client') }} | @@ -90,7 +90,7 @@
@endif - + {!! Former::select('client')->addOption('', '')->data_bind("dropdown: client")->addClass('client-input')->addGroupClass('client_select closer-row') !!}
@@ -419,7 +419,7 @@ ->options($taxRateOptions) ->addClass('tax-select') ->data_bind('value: tax1') - ->raw() !!} + ->raw() !!} {!! Former::select('') @@ -427,7 +427,7 @@ ->options($taxRateOptions) ->addClass('tax-select') ->data_bind('value: tax2') - ->raw() !!} + ->raw() !!} @@ -569,7 +569,7 @@ {!! Former::text('client[work_phone]') ->label('work_phone') ->data_bind("value: work_phone, valueUpdate: 'afterkeydown'") !!} - + @if (Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS)) @@ -756,7 +756,7 @@ var $clientSelect = $('select#client'); var invoiceDesigns = {!! $invoiceDesigns !!}; var invoiceFonts = {!! $invoiceFonts !!}; - + $(function() { // create client dictionary for (var i=0; iaccount->hasFeature(FEATURE_DOCUMENTS)) $('.main-form').submit(function(){ if($('#document-upload .dropzone .fallback input').val())$(this).attr('enctype', 'multipart/form-data') else $(this).removeAttr('enctype') }) - + // Initialize document upload dropzone = new Dropzone('#document-upload .dropzone', { url:{!! json_encode(url('document')) !!}, @@ -1224,7 +1224,7 @@ } onPartialChange(true); - + return true; } @@ -1379,24 +1379,30 @@ number = number.replace('{$custom2}', client.custom_value2 ? client.custom_value1 : ''); model.invoice().invoice_number(number); } - + @if ($account->hasFeature(FEATURE_DOCUMENTS)) function handleDocumentAdded(file){ + // open document when clicked + if (file.url) { + file.previewElement.addEventListener("click", function() { + window.open(file.url, '_blank'); + }); + } if(file.mock)return; file.index = model.invoice().documents().length; model.invoice().addDocument({name:file.name, size:file.size, type:file.type}); } - + function handleDocumentRemoved(file){ model.invoice().removeDocument(file.public_id); refreshPDF(true); } - + function handleDocumentUploaded(file, response){ file.public_id = response.document.public_id model.invoice().documents()[file.index].update(response.document); refreshPDF(true); - + if(response.document.preview_url){ dropzone.emit('thumbnail', file, response.document.preview_url); }