2015-03-16 22:45:25 +01:00
|
|
|
@extends('header')
|
|
|
|
|
|
|
|
@section('head')
|
|
|
|
@parent
|
|
|
|
|
2015-12-30 19:45:52 +01:00
|
|
|
@include('money_script')
|
2016-01-07 08:08:30 +01:00
|
|
|
@foreach (Auth::user()->account->getFontFolders() as $font)
|
|
|
|
<script src="{{ asset('js/vfs_fonts/'.$font.'.js') }}" type="text/javascript"></script>
|
|
|
|
@endforeach
|
2016-06-05 21:55:23 +02:00
|
|
|
<script src="{{ asset('pdf.built.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
<script>
|
|
|
|
|
2015-04-16 19:12:56 +02:00
|
|
|
var invoiceDesigns = {!! $invoiceDesigns !!};
|
2016-01-07 08:08:30 +01:00
|
|
|
var invoiceFonts = {!! $invoiceFonts !!};
|
2017-05-08 21:10:39 +02:00
|
|
|
var currentInvoice = {!! $invoice !!};
|
2017-04-30 13:35:17 +02:00
|
|
|
var versionsJson = {!! strip_tags($versionsJson) !!};
|
2016-06-05 21:55:23 +02:00
|
|
|
|
2015-04-14 13:07:50 +02:00
|
|
|
function getPDFString(cb) {
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
var version = $('#version').val();
|
|
|
|
var invoice;
|
|
|
|
|
2017-01-09 09:17:22 +01:00
|
|
|
@if ($paymentId)
|
|
|
|
invoice = versionsJson[0];
|
|
|
|
@else
|
|
|
|
if (parseInt(version)) {
|
|
|
|
invoice = versionsJson[version];
|
|
|
|
} else {
|
|
|
|
invoice = currentInvoice;
|
|
|
|
}
|
|
|
|
@endif
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
invoice.image = window.accountLogo;
|
|
|
|
|
|
|
|
var invoiceDesignId = parseInt(invoice.invoice_design_id);
|
|
|
|
var invoiceDesign = _.findWhere(invoiceDesigns, {id: invoiceDesignId});
|
|
|
|
if (!invoiceDesign) {
|
|
|
|
invoiceDesign = invoiceDesigns[0];
|
|
|
|
}
|
2016-06-05 21:55:23 +02:00
|
|
|
|
|
|
|
generatePDF(invoice, invoiceDesign.javascript, true, cb);
|
2015-03-16 22:45:25 +01:00
|
|
|
}
|
|
|
|
|
2016-06-05 21:55:23 +02:00
|
|
|
$(function() {
|
2015-03-16 22:45:25 +01:00
|
|
|
refreshPDF();
|
|
|
|
});
|
|
|
|
|
2016-06-05 21:55:23 +02:00
|
|
|
</script>
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
@stop
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
|
2015-04-16 19:12:56 +02:00
|
|
|
{!! Former::open()->addClass('form-inline')->onchange('refreshPDF()') !!}
|
2016-10-26 09:28:38 +02:00
|
|
|
|
2017-01-09 09:17:22 +01:00
|
|
|
@if (count($versionsSelect) > 1)
|
2017-01-08 22:34:44 +01:00
|
|
|
{!! Former::select('version')
|
|
|
|
->options($versionsSelect)
|
|
|
|
->label(trans('select_version'))
|
|
|
|
->style('background-color: white !important') !!}
|
2016-10-26 09:28:38 +02:00
|
|
|
@endif
|
|
|
|
|
2016-06-05 21:55:23 +02:00
|
|
|
{!! Button::primary(trans('texts.edit_' . $invoice->getEntityType()))->asLinkTo(URL::to('/' . $invoice->getEntityType() . 's/' . $invoice->public_id . '/edit'))->withAttributes(array('class' => 'pull-right')) !!}
|
2015-04-16 19:12:56 +02:00
|
|
|
{!! Former::close() !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
<br/> <br/>
|
|
|
|
|
2017-01-09 09:17:22 +01:00
|
|
|
@if (count($versionsSelect) <= 1)
|
2016-10-26 09:28:38 +02:00
|
|
|
<br/> <br/>
|
|
|
|
@endif
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
@include('invoices.pdf', ['account' => Auth::user()->account, 'pdfHeight' => 800])
|
2016-06-05 21:55:23 +02:00
|
|
|
|
2016-04-19 04:35:18 +02:00
|
|
|
@if (Utils::hasFeature(FEATURE_DOCUMENTS) && $invoice->account->invoice_embed_documents)
|
2016-03-23 23:40:42 +01:00
|
|
|
@foreach ($invoice->documents as $document)
|
2016-03-24 16:33:28 +01:00
|
|
|
@if($document->isPDFEmbeddable())
|
|
|
|
<script src="{{ $document->getVFSJSUrl() }}" type="text/javascript" async></script>
|
|
|
|
@endif
|
2016-03-23 23:40:42 +01:00
|
|
|
@endforeach
|
2016-03-24 23:15:52 +01:00
|
|
|
@foreach ($invoice->expenses as $expense)
|
|
|
|
@foreach ($expense->documents as $document)
|
|
|
|
@if($document->isPDFEmbeddable())
|
|
|
|
<script src="{{ $document->getVFSJSUrl() }}" type="text/javascript" async></script>
|
|
|
|
@endif
|
|
|
|
@endforeach
|
|
|
|
@endforeach
|
2016-03-23 23:40:42 +01:00
|
|
|
@endif
|
2016-06-05 21:55:23 +02:00
|
|
|
@stop
|