mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Added a 'Live Preview' option when using a large font
This commit is contained in:
parent
c6ff456d4d
commit
08fd14a4c1
@ -20,7 +20,6 @@ class Account extends Eloquent
|
|||||||
protected $presenter = 'App\Ninja\Presenters\AccountPresenter';
|
protected $presenter = 'App\Ninja\Presenters\AccountPresenter';
|
||||||
protected $dates = ['deleted_at'];
|
protected $dates = ['deleted_at'];
|
||||||
protected $hidden = ['ip'];
|
protected $hidden = ['ip'];
|
||||||
public $fonts_obj = null;
|
|
||||||
|
|
||||||
public static $basicSettings = [
|
public static $basicSettings = [
|
||||||
ACCOUNT_COMPANY_DETAILS,
|
ACCOUNT_COMPANY_DETAILS,
|
||||||
@ -897,6 +896,11 @@ class Account extends Eloquent
|
|||||||
return $css;
|
return $css;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasLargeFont()
|
||||||
|
{
|
||||||
|
return stripos($this->getBodyFontName(), 'chinese') || stripos($this->getHeaderFontName(), 'chinese');
|
||||||
|
}
|
||||||
|
|
||||||
public function getFontsUrl($protocol = ''){
|
public function getFontsUrl($protocol = ''){
|
||||||
if ($this->isPro()){
|
if ($this->isPro()){
|
||||||
$bodyFont = $this->body_font_id;
|
$bodyFont = $this->body_font_id;
|
||||||
|
@ -1031,4 +1031,5 @@ return array(
|
|||||||
'body_font_id' => 'Body Font',
|
'body_font_id' => 'Body Font',
|
||||||
'color_font_help' => 'Note: the primary color and fonts are also used in the client portal and custom email designs.',
|
'color_font_help' => 'Note: the primary color and fonts are also used in the client portal and custom email designs.',
|
||||||
|
|
||||||
|
'live_preview' => 'Live Preview',
|
||||||
);
|
);
|
@ -393,6 +393,11 @@
|
|||||||
{!! Former::text('pdfupload') !!}
|
{!! Former::text('pdfupload') !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if ($account->hasLargeFont())
|
||||||
|
<label for="livePreview" class="control-label" style="padding-right:10px">
|
||||||
|
<input id="livePreview" type="checkbox"/> {{ trans('texts.live_preview') }}
|
||||||
|
</label>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if (!Utils::isPro() || \App\Models\InvoiceDesign::count() == COUNT_FREE_DESIGNS_SELF_HOST)
|
@if (!Utils::isPro() || \App\Models\InvoiceDesign::count() == COUNT_FREE_DESIGNS_SELF_HOST)
|
||||||
{!! Former::select('invoice_design_id')->style('display:inline;width:150px;background-color:white !important')->raw()->fromQuery($invoiceDesigns, 'name', 'id')->data_bind("value: invoice_design_id")->addOption(trans('texts.more_designs') . '...', '-1') !!}
|
{!! Former::select('invoice_design_id')->style('display:inline;width:150px;background-color:white !important')->raw()->fromQuery($invoiceDesigns, 'name', 'id')->data_bind("value: invoice_design_id")->addOption(trans('texts.more_designs') . '...', '-1') !!}
|
||||||
@ -942,11 +947,20 @@
|
|||||||
return invoice;
|
return invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.generatedPDF = false;
|
||||||
function getPDFString(cb, force) {
|
function getPDFString(cb, force) {
|
||||||
|
@if ($account->hasLargeFont())
|
||||||
|
console.log('checked: %s', $('#livePreview').is(':checked'));
|
||||||
|
if (!$('#livePreview').is(':checked') && window.generatedPDF) {
|
||||||
|
console.log('returning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@endif
|
||||||
var invoice = createInvoiceModel();
|
var invoice = createInvoiceModel();
|
||||||
var design = getDesignJavascript();
|
var design = getDesignJavascript();
|
||||||
if (!design) return;
|
if (!design) return;
|
||||||
generatePDF(invoice, design, force, cb);
|
generatePDF(invoice, design, force, cb);
|
||||||
|
window.generatedPDF = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDesignJavascript() {
|
function getDesignJavascript() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user