mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
bug fixes
This commit is contained in:
parent
ccd7a9f3a7
commit
352cf9182a
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
/app/config/staging
|
||||
/public/logo
|
||||
/bootstrap/compiled.php
|
||||
/vendor
|
||||
composer.phar
|
||||
|
@ -56,3 +56,4 @@ Configure config/database.php and then initialize the database
|
||||
* [webpatser/laravel-countries](https://github.com/webpatser/laravel-countries) - Almost ISO 3166_2, 3166_3, currency, Capital and more for all countries
|
||||
* [briannesbitt/Carbon](https://github.com/briannesbitt/Carbon) - A simple API extension for DateTime with PHP 5.3+
|
||||
* [thomaspark/bootswatch](https://github.com/thomaspark/bootswatch) - Themes for Bootstrap
|
||||
* [mozilla/pdf.js)](https://github.com/mozilla/pdf.js) - PDF Reader in JavaScript
|
@ -20,7 +20,7 @@
|
||||
)
|
||||
)
|
||||
, array('id'=>'actionDropDown'))->split(); }}
|
||||
{{ Button::primary_link(URL::to('invoices/create/' . $client->id), 'Create Invoice') }}
|
||||
{{ Button::primary_link(URL::to('invoices/create/' . $client->public_id), 'Create Invoice') }}
|
||||
{{ Former::close() }}
|
||||
|
||||
</div>
|
||||
|
@ -153,7 +153,7 @@
|
||||
<!-- <textarea rows="20" cols="120" id="pdfText" onkeyup="runCode()"></textarea> -->
|
||||
<!-- <iframe frameborder="1" width="100%" height="600" style="display:block;margin: 0 auto"></iframe> -->
|
||||
<!-- <iframe frameborder="1" width="100%" height="500"></iframe> -->
|
||||
<canvas id="the-canvas" style="width:100%"></canvas>
|
||||
<canvas id="the-canvas" style="width:100%;border:solid 1px #CCCCCC;"></canvas>
|
||||
|
||||
|
||||
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
@ -262,7 +262,7 @@
|
||||
//enableHoverClick($('.combobox-container input.form-control'), $('.combobox-container input[name=client]'), '{{ URL::to('clients') }}');
|
||||
|
||||
@if ($client)
|
||||
$('input#invoice_number').focus();
|
||||
$('#invoice_number').focus();
|
||||
@else
|
||||
//$('[name="client_combobox"]').focus();
|
||||
@endif
|
||||
@ -386,21 +386,6 @@
|
||||
}
|
||||
|
||||
|
||||
var BASE64_MARKER = ';base64,';
|
||||
function convertDataURIToBinary(dataURI) {
|
||||
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
|
||||
var base64 = dataURI.substring(base64Index);
|
||||
var raw = window.atob(base64);
|
||||
var rawLength = raw.length;
|
||||
var array = new Uint8Array(new ArrayBuffer(rawLength));
|
||||
|
||||
for(i = 0; i < rawLength; i++) {
|
||||
array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
function _refreshPDF() {
|
||||
var invoice = createInvoiceModel();
|
||||
var doc = generatePDF(invoice);
|
||||
@ -423,14 +408,13 @@
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//$('iframe').attr('src', string);
|
||||
}
|
||||
|
||||
function onDownloadClick() {
|
||||
var invoice = createInvoiceModel();
|
||||
var doc = generatePDF(invoice);
|
||||
doc.save('Invoice-' + $('#number').val() + '.pdf');
|
||||
doc.save('Invoice-' + $('#invoice_number').val() + '.pdf');
|
||||
}
|
||||
|
||||
function onEmailClick() {
|
||||
@ -460,13 +444,12 @@
|
||||
$('select#client').combobox('setSelected');
|
||||
$('input[name=client]').val('-1');
|
||||
$('.client_select input.form-control').val(name);
|
||||
$('.client_select').addClass('combobox-selected');
|
||||
$('.client_select .combobox-container').addClass('combobox-selected');
|
||||
|
||||
$('#nameError').css( "display", "none" );
|
||||
$('#modalLink').text('Edit client details');
|
||||
$('#myModal').modal('hide');
|
||||
$('.client_select input.form-control').focus();
|
||||
//$('[name="client_combobox"]').focus();
|
||||
|
||||
refreshPDF();
|
||||
}
|
||||
|
@ -1,18 +1,29 @@
|
||||
@extends('header')
|
||||
|
||||
@section('head')
|
||||
@parent
|
||||
|
||||
<script type="text/javascript" src="{{ asset('js/pdf_viewer.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ asset('js/compatibility.js') }}"></script>
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="pull-right">
|
||||
{{ Button::normal('Download PDF', array('onclick' => 'onDownloadClick()', 'class' => 'btn-lg')) }}
|
||||
@if ($invoice->client->account->isGatewayConfigured())
|
||||
{{ Button::primary_link(URL::to('payment/' . $invitation->invitation_key), 'Pay Now', array('class' => 'btn-lg pull-right')) }}
|
||||
<div class="clearfix"></div><p> </p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="clearfix"></div><p> </p>
|
||||
|
||||
<iframe frameborder="1" width="100%" height="650" style="display:block;margin: 0 auto"></iframe>
|
||||
<!-- <iframe frameborder="1" width="100%" height="650" style="display:block;margin: 0 auto"></iframe> -->
|
||||
<canvas id="the-canvas" style="width:100%;border:solid 1px #CCCCCC;"></canvas>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
var invoice = {{ $invoice->toJson() }};
|
||||
window.invoice = {{ $invoice->toJson() }};
|
||||
@if (file_exists($invoice->client->account->getLogoPath()))
|
||||
invoice.image = "{{ HTML::image_data($invoice->client->account->getLogoPath()) }}";
|
||||
invoice.imageWidth = {{ $invoice->client->account->getLogoWidth() }};
|
||||
@ -20,8 +31,31 @@
|
||||
@endif
|
||||
var doc = generatePDF(invoice);
|
||||
var string = doc.output('datauristring');
|
||||
$('iframe').attr('src', string);
|
||||
//$('iframe').attr('src', string);
|
||||
|
||||
//console.log(string);
|
||||
var pdfAsArray = convertDataURIToBinary(string);
|
||||
PDFJS.getDocument(pdfAsArray).then(function getPdfHelloWorld(pdf) {
|
||||
|
||||
pdf.getPage(1).then(function getPageHelloWorld(page) {
|
||||
var scale = 1.5;
|
||||
var viewport = page.getViewport(scale);
|
||||
|
||||
var canvas = document.getElementById('the-canvas');
|
||||
var context = canvas.getContext('2d');
|
||||
canvas.height = viewport.height;
|
||||
canvas.width = viewport.width;
|
||||
|
||||
page.render({canvasContext: context, viewport: viewport});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function onDownloadClick() {
|
||||
var doc = generatePDF(invoice);
|
||||
doc.save('Invoice-' + invoice.invoice_number + '.pdf');
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
4
public/js/bootstrap-combobox.js
vendored
4
public/js/bootstrap-combobox.js
vendored
@ -233,6 +233,10 @@
|
||||
this.lookup();
|
||||
}
|
||||
}
|
||||
|
||||
this.$element.trigger('change');
|
||||
this.$target.trigger('change');
|
||||
this.$source.trigger('change');
|
||||
}
|
||||
|
||||
, clearElement: function () {
|
||||
|
@ -187,7 +187,7 @@ var log = (function() {
|
||||
// disabled, which is important to devs but not end users.
|
||||
function info(msg) {
|
||||
if (verbosity >= INFOS) {
|
||||
log('Info: ' + msg);
|
||||
//log('Info: ' + msg);
|
||||
PDFJS.LogManager.notify('info', msg);
|
||||
}
|
||||
}
|
||||
@ -195,7 +195,7 @@ function info(msg) {
|
||||
// Non-fatal warnings that should trigger the fallback UI.
|
||||
function warn(msg) {
|
||||
if (verbosity >= WARNINGS) {
|
||||
log('Warning: ' + msg);
|
||||
//log('Warning: ' + msg);
|
||||
PDFJS.LogManager.notify('warn', msg);
|
||||
}
|
||||
}
|
||||
@ -34845,8 +34845,8 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
||||
// Pre compile the pdf page and fetch the fonts/images.
|
||||
page.getOperatorList(handler).then(function(operatorList) {
|
||||
|
||||
log('page=%d - getOperatorList: time=%dms, len=%d', pageNum,
|
||||
Date.now() - start, operatorList.fnArray.length);
|
||||
//log('page=%d - getOperatorList: time=%dms, len=%d', pageNum,
|
||||
// Date.now() - start, operatorList.fnArray.length);
|
||||
|
||||
}, function(e) {
|
||||
|
||||
|
@ -439,3 +439,18 @@ function setComboboxValue($combobox, id, name) {
|
||||
$combobox.find('.combobox-container').removeClass('combobox-selected');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var BASE64_MARKER = ';base64,';
|
||||
function convertDataURIToBinary(dataURI) {
|
||||
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
|
||||
var base64 = dataURI.substring(base64Index);
|
||||
var raw = window.atob(base64);
|
||||
var rawLength = raw.length;
|
||||
var array = new Uint8Array(new ArrayBuffer(rawLength));
|
||||
|
||||
for(i = 0; i < rawLength; i++) {
|
||||
array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
return array;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user