1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00
invoiceninja/resources/views/invoices/pdf.blade.php

153 lines
6.4 KiB
PHP
Raw Normal View History

2015-03-16 22:45:25 +01:00
<iframe id="theFrame" style="display:none" frameborder="1" width="100%" height="{{ isset($pdfHeight) ? $pdfHeight : 1180 }}px"></iframe>
<canvas id="theCanvas" style="display:none;width:100%;border:solid 1px #CCCCCC;"></canvas>
2015-07-07 22:08:16 +02:00
@if (!Utils::isNinja() || !Utils::isPro())
2015-03-16 22:45:25 +01:00
<div class="modal fade" id="moreDesignsModal" tabindex="-1" role="dialog" aria-labelledby="moreDesignsModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">{{ trans('texts.more_designs_title') }}</h4>
</div>
<div class="container">
@if (Utils::isNinja())
<h3>{{ trans('texts.more_designs_cloud_header') }}</h3>
<p>{{ trans('texts.more_designs_cloud_text') }}</p>
@else
<h3>{{ trans('texts.more_designs_self_host_header') }}</h3>
<p>{{ trans('texts.more_designs_self_host_text') }}</p>
@endif
</div>
<center id="designThumbs">
<p>&nbsp;</p>
2016-02-25 11:16:27 +01:00
<a href="{{ asset('/images/designs/business.png') }}" data-lightbox="more-designs" data-title="Business">
<img src="{{ BLANK_IMAGE }}" data-src="{{ asset('/images/designs/business_thumb.png') }}"/>
</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="{{ asset('/images/designs/creative.png') }}" data-lightbox="more-designs" data-title="Creative">
<img src="{{ BLANK_IMAGE }}" data-src="{{ asset('/images/designs/creative_thumb.png') }}"/>
</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="{{ asset('/images/designs/elegant.png') }}" data-lightbox="more-designs" data-title="Elegant">
<img src="{{ BLANK_IMAGE }}" data-src="{{ asset('/images/designs/elegant_thumb.png') }}"/>
</a>
2015-03-16 22:45:25 +01:00
<p>&nbsp;</p>
2016-02-25 11:16:27 +01:00
<a href="{{ asset('/images/designs/hipster.png') }}" data-lightbox="more-designs" data-title="Hipster">
<img src="{{ BLANK_IMAGE }}" data-src="{{ asset('/images/designs/hipster_thumb.png') }}"/>
</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="{{ asset('/images/designs/playful.png') }}" data-lightbox="more-designs" data-title="Playful">
<img src="{{ BLANK_IMAGE }}" data-src="{{ asset('/images/designs/playful_thumb.png') }}"/>
</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="{{ asset('/images/designs/photo.png') }}" data-lightbox="more-designs" data-title="Photo">
<img src="{{ BLANK_IMAGE }}" data-src="{{ asset('/images/designs/photo_thumb.png') }}"/>
</a>
2015-03-16 22:45:25 +01:00
<p>&nbsp;</p>
</center>
<div class="modal-footer" id="signUpFooter">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button>
@if (Utils::isNinjaProd())
2015-06-10 22:55:23 +02:00
<button type="button" class="btn btn-primary" onclick="showProPlan('invoice_designs')">{{ trans('texts.go_pro') }}</button>
2015-03-16 22:45:25 +01:00
@else
<button type="button" class="btn btn-primary" onclick="buyProduct('{{ INVOICE_DESIGNS_AFFILIATE_KEY }}', '{{ PRODUCT_INVOICE_DESIGNS }}')">{{ trans('texts.buy') }}</button>
@endif
</div>
</div>
</div>
</div>
2015-07-07 22:08:16 +02:00
@endif
2015-03-16 22:45:25 +01:00
<script type="text/javascript">
window.logoImages = {};
logoImages.imageLogo1 = "{{ HTML::image_data('images/report_logo1.jpg') }}";
logoImages.imageLogoWidth1 =120;
logoImages.imageLogoHeight1 = 40
logoImages.imageLogo2 = "{{ HTML::image_data('images/report_logo2.jpg') }}";
logoImages.imageLogoWidth2 =325/2;
logoImages.imageLogoHeight2 = 81/2;
logoImages.imageLogo3 = "{{ HTML::image_data('images/report_logo3.jpg') }}";
logoImages.imageLogoWidth3 =325/2;
logoImages.imageLogoHeight3 = 81/2;
2016-01-18 15:09:06 +01:00
@if ($account->hasLogo())
2015-07-21 20:51:56 +02:00
window.accountLogo = "{{ HTML::image_data($account->getLogoPath()) }}";
2015-03-16 22:45:25 +01:00
if (window.invoice) {
2015-07-21 20:51:56 +02:00
invoice.image = window.accountLogo;
2015-03-16 22:45:25 +01:00
invoice.imageWidth = {{ $account->getLogoWidth() }};
invoice.imageHeight = {{ $account->getLogoHeight() }};
}
@endif
var NINJA = NINJA || {};
2015-11-21 22:10:26 +01:00
@if ($account->isPro())
2015-10-13 09:11:44 +02:00
NINJA.primaryColor = "{{ $account->primary_color }}";
NINJA.secondaryColor = "{{ $account->secondary_color }}";
NINJA.fontSize = {{ $account->font_size }};
NINJA.headerFont = {!! json_encode($account->getHeaderFontName()) !!};
NINJA.bodyFont = {!! json_encode($account->getBodyFontName()) !!};
2015-10-13 09:11:44 +02:00
@endif
2015-03-30 21:45:10 +02:00
var invoiceLabels = {!! json_encode($account->getInvoiceLabels()) !!};
2015-03-16 22:45:25 +01:00
2015-06-10 10:34:20 +02:00
if (window.invoice) {
2015-12-13 21:12:54 +01:00
//invoiceLabels.item = invoice.has_tasks ? invoiceLabels.date : invoiceLabels.item_orig;
2015-06-10 10:34:20 +02:00
invoiceLabels.quantity = invoice.has_tasks ? invoiceLabels.hours : invoiceLabels.quantity_orig;
2015-09-07 11:07:55 +02:00
invoiceLabels.unit_cost = invoice.has_tasks ? invoiceLabels.rate : invoiceLabels.unit_cost_orig;
2015-06-10 10:34:20 +02:00
}
2015-03-16 22:45:25 +01:00
var isRefreshing = false;
var needsRefresh = false;
2015-07-21 20:51:56 +02:00
function refreshPDF(force) {
2015-12-29 08:52:02 +01:00
//console.log('refresh PDF - force: ' + force + ' ' + (new Date()).getTime())
2015-09-17 21:01:06 +02:00
return getPDFString(refreshPDFCB, force);
2015-04-13 08:02:33 +02:00
}
function refreshPDFCB(string) {
if (!string) return;
2015-03-16 22:45:25 +01:00
PDFJS.workerSrc = '{{ asset('js/pdf_viewer.worker.js') }}';
var forceJS = {{ Auth::check() && Auth::user()->force_pdfjs ? 'false' : 'true' }};
// Temporarily workaround for: https://code.google.com/p/chromium/issues/detail?id=574648
if (forceJS && (isFirefox || (isChrome && (!isChrome48 || {{ isset($viewPDF) && $viewPDF ? 'true' : 'false' }})))) {
2015-12-29 08:52:02 +01:00
$('#theFrame').attr('src', string).show();
2015-03-16 22:45:25 +01:00
} else {
if (isRefreshing) {
2015-07-24 16:13:17 +02:00
//needsRefresh = true;
2015-03-16 22:45:25 +01:00
return;
}
isRefreshing = true;
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('theCanvas');
var context = canvas.getContext('2d');
canvas.height = viewport.height;
canvas.width = viewport.width;
page.render({canvasContext: context, viewport: viewport});
$('#theCanvas').show();
isRefreshing = false;
if (needsRefresh) {
needsRefresh = false;
refreshPDF();
}
});
});
}
}
function showMoreDesigns() {
2016-02-25 11:16:27 +01:00
loadImages('#designThumbs');
2015-06-01 15:06:18 +02:00
trackEvent('/account', '/view_more_designs');
2015-03-16 22:45:25 +01:00
$('#moreDesignsModal').modal('show');
}
</script>