mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 15:34:39 -04:00
Working on invoice customizer
This commit is contained in:
parent
912fe5b7a3
commit
76a53ed5dc
@ -244,7 +244,7 @@ class AccountController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($subSection == ACCOUNT_CUSTOMIZE_DESIGN) {
|
if ($subSection == ACCOUNT_CUSTOMIZE_DESIGN) {
|
||||||
$data['customDesign'] = $account->custom_design && !$design ? $account->custom_design : $design;
|
$data['customDesign'] = ($account->custom_design && !$design) ? $account->custom_design : $design;
|
||||||
}
|
}
|
||||||
} else if ($subSection == ACCOUNT_EMAIL_TEMPLATES) {
|
} else if ($subSection == ACCOUNT_EMAIL_TEMPLATES) {
|
||||||
$data['invoiceEmail'] = $account->getEmailTemplate(ENTITY_INVOICE);
|
$data['invoiceEmail'] = $account->getEmailTemplate(ENTITY_INVOICE);
|
||||||
@ -698,25 +698,21 @@ class AccountController extends BaseController
|
|||||||
if ($file = Input::file('logo')) {
|
if ($file = Input::file('logo')) {
|
||||||
$path = Input::file('logo')->getRealPath();
|
$path = Input::file('logo')->getRealPath();
|
||||||
File::delete('logo/'.$account->account_key.'.jpg');
|
File::delete('logo/'.$account->account_key.'.jpg');
|
||||||
|
File::delete('logo/'.$account->account_key.'.png');
|
||||||
|
|
||||||
$image = Image::make($path);
|
$image = Image::make($path);
|
||||||
$mimeType = $file->getMimeType();
|
$mimeType = $file->getMimeType();
|
||||||
|
|
||||||
if ($mimeType == 'image/jpeg') {
|
if ($mimeType == 'image/jpeg' && $account->utf8_invoices) {
|
||||||
$file->move('logo/', $account->account_key . '.jpg');
|
$file->move('logo/', $account->account_key . '.jpg');
|
||||||
} else if ($mimeType == 'image/png') {
|
} else if ($mimeType == 'image/png' && $account->utf8_invoices) {
|
||||||
$file->move('logo/', $account->account_key . '.png');
|
$file->move('logo/', $account->account_key . '.png');
|
||||||
|
|
||||||
if (!$account->utf8_invoices) {
|
|
||||||
$account->utf8_invoices = true;
|
|
||||||
$account->save();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$image->resize(200, 120, function ($constraint) {
|
$image->resize(200, 120, function ($constraint) {
|
||||||
$constraint->aspectRatio();
|
$constraint->aspectRatio();
|
||||||
});
|
});
|
||||||
Image::canvas($image->width(), $image->height(), '#FFFFFF')
|
Image::canvas($image->width(), $image->height(), '#FFFFFF')
|
||||||
->insert($image)->save('logo/'.$this->account_key.'.jpg');
|
->insert($image)->save('logo/'.$account->account_key.'.jpg');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -730,6 +726,7 @@ class AccountController extends BaseController
|
|||||||
public function removeLogo()
|
public function removeLogo()
|
||||||
{
|
{
|
||||||
File::delete('logo/'.Auth::user()->account->account_key.'.jpg');
|
File::delete('logo/'.Auth::user()->account->account_key.'.jpg');
|
||||||
|
File::delete('logo/'.Auth::user()->account->account_key.'.png');
|
||||||
|
|
||||||
Session::flash('message', trans('texts.removed_logo'));
|
Session::flash('message', trans('texts.removed_logo'));
|
||||||
|
|
||||||
|
@ -33260,30 +33260,25 @@ function GetPdfMake(invoice, javascript, callback) {
|
|||||||
javascript = NINJA.decodeJavascript(invoice, javascript);
|
javascript = NINJA.decodeJavascript(invoice, javascript);
|
||||||
|
|
||||||
function jsonCallBack(key, val) {
|
function jsonCallBack(key, val) {
|
||||||
if ((val+'').indexOf('$borderTopAndBottom') === 0) {
|
if ((val+'').indexOf('$firstAndLast') === 0) {
|
||||||
var parts = val.split(':');
|
var parts = val.split(':');
|
||||||
return function (i, node) {
|
return function (i, node) {
|
||||||
return (i === 0 || i === node.table.body.length) ? parseFloat(parts[1]) : 0;
|
return (i === 0 || i === node.table.body.length) ? parseFloat(parts[1]) : 0;
|
||||||
};
|
};
|
||||||
} else if ((val+'').indexOf('$borderNone') === 0) {
|
} else if ((val+'').indexOf('$none') === 0) {
|
||||||
return function (i, node) {
|
return function (i, node) {
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
} else if ((val+'').indexOf('$borderNotTop') === 0) {
|
} else if ((val+'').indexOf('$notFirst') === 0) {
|
||||||
var parts = val.split(':');
|
var parts = val.split(':');
|
||||||
return function (i, node) {
|
return function (i, node) {
|
||||||
return i === 0 ? 0 : parseFloat(parts[1]);
|
return i === 0 ? 0 : parseFloat(parts[1]);
|
||||||
};
|
};
|
||||||
} else if ((val+'').indexOf('$border') === 0) {
|
} else if ((val+'').indexOf('$amount') === 0) {
|
||||||
var parts = val.split(':');
|
var parts = val.split(':');
|
||||||
return function (i, node) {
|
return function (i, node) {
|
||||||
return parseFloat(parts[1]);
|
return parseFloat(parts[1]);
|
||||||
};
|
};
|
||||||
} else if ((val+'').indexOf('$padding') === 0) {
|
|
||||||
var parts = val.split(':');
|
|
||||||
return function (i, node) {
|
|
||||||
return parseInt(parts[1], 10);
|
|
||||||
};
|
|
||||||
} else if ((val+'').indexOf('$primaryColor') === 0) {
|
} else if ((val+'').indexOf('$primaryColor') === 0) {
|
||||||
var parts = val.split(':');
|
var parts = val.split(':');
|
||||||
return NINJA.primaryColor || parts[1];
|
return NINJA.primaryColor || parts[1];
|
||||||
@ -33344,18 +33339,10 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
'subtotalsHeight': NINJA.subtotals(invoice).length * 22,
|
'subtotalsHeight': NINJA.subtotals(invoice).length * 22,
|
||||||
'subtotalsWithoutBalance': NINJA.subtotals(invoice, true),
|
'subtotalsWithoutBalance': NINJA.subtotals(invoice, true),
|
||||||
'balanceDue': formatMoney(invoice.balance_amount, invoice.client.currency_id),
|
'balanceDue': formatMoney(invoice.balance_amount, invoice.client.currency_id),
|
||||||
'balanceDueLabel': invoiceLabels.balance_due,
|
|
||||||
'invoiceFooter': account.invoice_footer || ' ',
|
'invoiceFooter': account.invoice_footer || ' ',
|
||||||
'invoiceNumber': invoice.invoice_number || ' ',
|
'invoiceNumber': invoice.invoice_number || ' ',
|
||||||
'entityType': invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice,
|
'entityType': invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice,
|
||||||
'entityTypeUpper': (invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice).toUpperCase(),
|
'entityTypeUC': (invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice).toUpperCase(),
|
||||||
'yourInvoice': invoiceLabels.your_invoice,
|
|
||||||
'yourInvoiceUpper': invoiceLabels.your_invoice.toUpperCase(),
|
|
||||||
'invoiceIssuedTo': invoiceLabels.invoice_issued_to + ':',
|
|
||||||
'invoiceTo': invoiceLabels.invoice_to + ':',
|
|
||||||
'details': invoiceLabels.details + ':',
|
|
||||||
'fromUpper': invoiceLabels.from.toUpperCase() + ':',
|
|
||||||
'toUpper': invoiceLabels.to.toUpperCase() + ':',
|
|
||||||
'fontSize': NINJA.fontSize,
|
'fontSize': NINJA.fontSize,
|
||||||
'fontSizeLarger': NINJA.fontSize + 1,
|
'fontSizeLarger': NINJA.fontSize + 1,
|
||||||
'fontSizeLargest': NINJA.fontSize + 2,
|
'fontSizeLargest': NINJA.fontSize + 2,
|
||||||
@ -33368,7 +33355,7 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// search/replace labels
|
// search/replace labels
|
||||||
var regExp = new RegExp('"\\$\\\w*?Label(UC)?"', 'g');
|
var regExp = new RegExp('"\\$\\\w*?Label(UC)?(:)?(\\\?)?"', 'g');
|
||||||
var matches = javascript.match(regExp);
|
var matches = javascript.match(regExp);
|
||||||
|
|
||||||
if (matches) {
|
if (matches) {
|
||||||
@ -33376,11 +33363,19 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
var match = matches[i];
|
var match = matches[i];
|
||||||
field = match.substring(2, match.indexOf('Label'));
|
field = match.substring(2, match.indexOf('Label'));
|
||||||
field = toSnakeCase(field);
|
field = toSnakeCase(field);
|
||||||
|
var value = getDescendantProp(invoice, field);
|
||||||
|
if (match.indexOf('?') < 0) {
|
||||||
var label = invoiceLabels[field];
|
var label = invoiceLabels[field];
|
||||||
if (match.indexOf('UC') >= 0) {
|
if (match.indexOf('UC') >= 0) {
|
||||||
if (!label) console.log('match: ' + field);
|
if (!label) console.log('match: ' + field);
|
||||||
label = label.toUpperCase();
|
label = label.toUpperCase();
|
||||||
}
|
}
|
||||||
|
if (match.indexOf(':') >= 0) {
|
||||||
|
label = label + ':';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
label = ' ';
|
||||||
|
}
|
||||||
javascript = javascript.replace(match, '"'+label+'"');
|
javascript = javascript.replace(match, '"'+label+'"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33395,7 +33390,7 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
field = match.substring(2, match.indexOf('Value'));
|
field = match.substring(2, match.indexOf('Value'));
|
||||||
field = toSnakeCase(field);
|
field = toSnakeCase(field);
|
||||||
var value = getDescendantProp(invoice, field) || ' ';
|
var value = getDescendantProp(invoice, field) || ' ';
|
||||||
if (field.indexOf('date') >= 0) {
|
if (field.toLowerCase().indexOf('date') >= 0 && value != ' ') {
|
||||||
value = moment(value, 'YYYY-MM-DD').format('MMM D YYYY');
|
value = moment(value, 'YYYY-MM-DD').format('MMM D YYYY');
|
||||||
}
|
}
|
||||||
javascript = javascript.replace(match, '"'+value+'"');
|
javascript = javascript.replace(match, '"'+value+'"');
|
||||||
@ -33594,11 +33589,11 @@ NINJA.invoiceDetails = function(invoice) {
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
{text: invoiceLabels.invoice_date},
|
{text: invoiceLabels.invoice_date},
|
||||||
{text: invoice.invoice_date}
|
{text: moment(invoice.invoice_date, 'YYYY-MM-DD').format('MMM D YYYY')}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{text: invoiceLabels.due_date},
|
{text: invoiceLabels.due_date},
|
||||||
{text: invoice.due_date}
|
{text: invoice.due_date ? moment(invoice.due_date, 'YYYY-MM-DD').format('MMM D YYYY') : false}
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -18,30 +18,25 @@ function GetPdfMake(invoice, javascript, callback) {
|
|||||||
javascript = NINJA.decodeJavascript(invoice, javascript);
|
javascript = NINJA.decodeJavascript(invoice, javascript);
|
||||||
|
|
||||||
function jsonCallBack(key, val) {
|
function jsonCallBack(key, val) {
|
||||||
if ((val+'').indexOf('$borderTopAndBottom') === 0) {
|
if ((val+'').indexOf('$firstAndLast') === 0) {
|
||||||
var parts = val.split(':');
|
var parts = val.split(':');
|
||||||
return function (i, node) {
|
return function (i, node) {
|
||||||
return (i === 0 || i === node.table.body.length) ? parseFloat(parts[1]) : 0;
|
return (i === 0 || i === node.table.body.length) ? parseFloat(parts[1]) : 0;
|
||||||
};
|
};
|
||||||
} else if ((val+'').indexOf('$borderNone') === 0) {
|
} else if ((val+'').indexOf('$none') === 0) {
|
||||||
return function (i, node) {
|
return function (i, node) {
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
} else if ((val+'').indexOf('$borderNotTop') === 0) {
|
} else if ((val+'').indexOf('$notFirst') === 0) {
|
||||||
var parts = val.split(':');
|
var parts = val.split(':');
|
||||||
return function (i, node) {
|
return function (i, node) {
|
||||||
return i === 0 ? 0 : parseFloat(parts[1]);
|
return i === 0 ? 0 : parseFloat(parts[1]);
|
||||||
};
|
};
|
||||||
} else if ((val+'').indexOf('$border') === 0) {
|
} else if ((val+'').indexOf('$amount') === 0) {
|
||||||
var parts = val.split(':');
|
var parts = val.split(':');
|
||||||
return function (i, node) {
|
return function (i, node) {
|
||||||
return parseFloat(parts[1]);
|
return parseFloat(parts[1]);
|
||||||
};
|
};
|
||||||
} else if ((val+'').indexOf('$padding') === 0) {
|
|
||||||
var parts = val.split(':');
|
|
||||||
return function (i, node) {
|
|
||||||
return parseInt(parts[1], 10);
|
|
||||||
};
|
|
||||||
} else if ((val+'').indexOf('$primaryColor') === 0) {
|
} else if ((val+'').indexOf('$primaryColor') === 0) {
|
||||||
var parts = val.split(':');
|
var parts = val.split(':');
|
||||||
return NINJA.primaryColor || parts[1];
|
return NINJA.primaryColor || parts[1];
|
||||||
@ -102,18 +97,10 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
'subtotalsHeight': NINJA.subtotals(invoice).length * 22,
|
'subtotalsHeight': NINJA.subtotals(invoice).length * 22,
|
||||||
'subtotalsWithoutBalance': NINJA.subtotals(invoice, true),
|
'subtotalsWithoutBalance': NINJA.subtotals(invoice, true),
|
||||||
'balanceDue': formatMoney(invoice.balance_amount, invoice.client.currency_id),
|
'balanceDue': formatMoney(invoice.balance_amount, invoice.client.currency_id),
|
||||||
'balanceDueLabel': invoiceLabels.balance_due,
|
|
||||||
'invoiceFooter': account.invoice_footer || ' ',
|
'invoiceFooter': account.invoice_footer || ' ',
|
||||||
'invoiceNumber': invoice.invoice_number || ' ',
|
'invoiceNumber': invoice.invoice_number || ' ',
|
||||||
'entityType': invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice,
|
'entityType': invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice,
|
||||||
'entityTypeUpper': (invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice).toUpperCase(),
|
'entityTypeUC': (invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice).toUpperCase(),
|
||||||
'yourInvoice': invoiceLabels.your_invoice,
|
|
||||||
'yourInvoiceUpper': invoiceLabels.your_invoice.toUpperCase(),
|
|
||||||
'invoiceIssuedTo': invoiceLabels.invoice_issued_to + ':',
|
|
||||||
'invoiceTo': invoiceLabels.invoice_to + ':',
|
|
||||||
'details': invoiceLabels.details + ':',
|
|
||||||
'fromUpper': invoiceLabels.from.toUpperCase() + ':',
|
|
||||||
'toUpper': invoiceLabels.to.toUpperCase() + ':',
|
|
||||||
'fontSize': NINJA.fontSize,
|
'fontSize': NINJA.fontSize,
|
||||||
'fontSizeLarger': NINJA.fontSize + 1,
|
'fontSizeLarger': NINJA.fontSize + 1,
|
||||||
'fontSizeLargest': NINJA.fontSize + 2,
|
'fontSizeLargest': NINJA.fontSize + 2,
|
||||||
@ -126,7 +113,7 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// search/replace labels
|
// search/replace labels
|
||||||
var regExp = new RegExp('"\\$\\\w*?Label(UC)?"', 'g');
|
var regExp = new RegExp('"\\$\\\w*?Label(UC)?(:)?(\\\?)?"', 'g');
|
||||||
var matches = javascript.match(regExp);
|
var matches = javascript.match(regExp);
|
||||||
|
|
||||||
if (matches) {
|
if (matches) {
|
||||||
@ -134,11 +121,19 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
var match = matches[i];
|
var match = matches[i];
|
||||||
field = match.substring(2, match.indexOf('Label'));
|
field = match.substring(2, match.indexOf('Label'));
|
||||||
field = toSnakeCase(field);
|
field = toSnakeCase(field);
|
||||||
|
var value = getDescendantProp(invoice, field);
|
||||||
|
if (match.indexOf('?') < 0) {
|
||||||
var label = invoiceLabels[field];
|
var label = invoiceLabels[field];
|
||||||
if (match.indexOf('UC') >= 0) {
|
if (match.indexOf('UC') >= 0) {
|
||||||
if (!label) console.log('match: ' + field);
|
if (!label) console.log('match: ' + field);
|
||||||
label = label.toUpperCase();
|
label = label.toUpperCase();
|
||||||
}
|
}
|
||||||
|
if (match.indexOf(':') >= 0) {
|
||||||
|
label = label + ':';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
label = ' ';
|
||||||
|
}
|
||||||
javascript = javascript.replace(match, '"'+label+'"');
|
javascript = javascript.replace(match, '"'+label+'"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +148,7 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
field = match.substring(2, match.indexOf('Value'));
|
field = match.substring(2, match.indexOf('Value'));
|
||||||
field = toSnakeCase(field);
|
field = toSnakeCase(field);
|
||||||
var value = getDescendantProp(invoice, field) || ' ';
|
var value = getDescendantProp(invoice, field) || ' ';
|
||||||
if (field.indexOf('date') >= 0) {
|
if (field.toLowerCase().indexOf('date') >= 0 && value != ' ') {
|
||||||
value = moment(value, 'YYYY-MM-DD').format('MMM D YYYY');
|
value = moment(value, 'YYYY-MM-DD').format('MMM D YYYY');
|
||||||
}
|
}
|
||||||
javascript = javascript.replace(match, '"'+value+'"');
|
javascript = javascript.replace(match, '"'+value+'"');
|
||||||
@ -352,11 +347,11 @@ NINJA.invoiceDetails = function(invoice) {
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
{text: invoiceLabels.invoice_date},
|
{text: invoiceLabels.invoice_date},
|
||||||
{text: invoice.invoice_date}
|
{text: moment(invoice.invoice_date, 'YYYY-MM-DD').format('MMM D YYYY')}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{text: invoiceLabels.due_date},
|
{text: invoiceLabels.due_date},
|
||||||
{text: invoice.due_date}
|
{text: invoice.due_date ? moment(invoice.due_date, 'YYYY-MM-DD').format('MMM D YYYY') : false}
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
{
|
{
|
||||||
"width": 300,
|
"width": 300,
|
||||||
"stack": [
|
"stack": [
|
||||||
{"text":"$yourInvoiceUpper", "style": "yourInvoice"},
|
{"text":"$yourInvoiceLabelUC", "style": "yourInvoice"},
|
||||||
"$clientDetails"
|
"$clientDetails"
|
||||||
],
|
],
|
||||||
"margin": [-32, 120, 0, 0]
|
"margin": [-32, 120, 0, 0]
|
||||||
@ -48,12 +48,12 @@
|
|||||||
"body": "$invoiceLineItems"
|
"body": "$invoiceLineItems"
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
"hLineWidth": "$borderNone",
|
"hLineWidth": "$none",
|
||||||
"vLineWidth": "$borderNone",
|
"vLineWidth": "$none",
|
||||||
"paddingLeft": "$padding:8",
|
"paddingLeft": "$amount:8",
|
||||||
"paddingRight": "$padding:8",
|
"paddingRight": "$amount:8",
|
||||||
"paddingTop": "$padding:14",
|
"paddingTop": "$amount:14",
|
||||||
"paddingBottom": "$padding:14"
|
"paddingBottom": "$amount:14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -69,12 +69,12 @@
|
|||||||
"body": "$subtotals"
|
"body": "$subtotals"
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
"hLineWidth": "$borderNone",
|
"hLineWidth": "$none",
|
||||||
"vLineWidth": "$borderNone",
|
"vLineWidth": "$none",
|
||||||
"paddingLeft": "$padding:8",
|
"paddingLeft": "$amount:8",
|
||||||
"paddingRight": "$padding:8",
|
"paddingRight": "$amount:8",
|
||||||
"paddingTop": "$padding:4",
|
"paddingTop": "$amount:4",
|
||||||
"paddingBottom": "$padding:4"
|
"paddingBottom": "$amount:4"
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
"image": "$accountLogo",
|
"image": "$accountLogo",
|
||||||
"width": 100
|
"width": 140
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"stack": "$accountDetails",
|
"stack": "$accountDetails",
|
||||||
"margin": [80, 0, 0, 0]
|
"margin": [40, 0, 0, 0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"stack": "$accountAddress"
|
"stack": "$accountAddress"
|
||||||
@ -15,7 +15,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "$entityTypeUpper",
|
"text": "$entityTypeUC",
|
||||||
"margin": [8, 50, 8, 5],
|
"margin": [8, 50, 8, 5],
|
||||||
"style": "entityTypeLabel"
|
"style": "entityTypeLabel"
|
||||||
|
|
||||||
@ -43,13 +43,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
"hLineWidth": "$borderTopAndBottom:.5",
|
"hLineWidth": "$firstAndLast:.5",
|
||||||
"vLineWidth": "$borderNone",
|
"vLineWidth": "$none",
|
||||||
"hLineColor": "#D8D8D8",
|
"hLineColor": "#D8D8D8",
|
||||||
"paddingLeft": "$padding:8",
|
"paddingLeft": "$amount:8",
|
||||||
"paddingRight": "$padding:8",
|
"paddingRight": "$amount:8",
|
||||||
"paddingTop": "$padding:4",
|
"paddingTop": "$amount:4",
|
||||||
"paddingBottom": "$padding:4"
|
"paddingBottom": "$amount:4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -60,13 +60,13 @@
|
|||||||
"body": "$invoiceLineItems"
|
"body": "$invoiceLineItems"
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
"hLineWidth": "$borderNotTop:.5",
|
"hLineWidth": "$notFirst:.5",
|
||||||
"vLineWidth": "$borderNone",
|
"vLineWidth": "$none",
|
||||||
"hLineColor": "#D8D8D8",
|
"hLineColor": "#D8D8D8",
|
||||||
"paddingLeft": "$padding:8",
|
"paddingLeft": "$amount:8",
|
||||||
"paddingRight": "$padding:8",
|
"paddingRight": "$amount:8",
|
||||||
"paddingTop": "$padding:14",
|
"paddingTop": "$amount:14",
|
||||||
"paddingBottom": "$padding:14"
|
"paddingBottom": "$amount:14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -78,12 +78,12 @@
|
|||||||
"body": "$subtotals"
|
"body": "$subtotals"
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
"hLineWidth": "$borderNone",
|
"hLineWidth": "$none",
|
||||||
"vLineWidth": "$borderNone",
|
"vLineWidth": "$none",
|
||||||
"paddingLeft": "$padding:8",
|
"paddingLeft": "$amount:8",
|
||||||
"paddingRight": "$padding:8",
|
"paddingRight": "$amount:8",
|
||||||
"paddingTop": "$padding:4",
|
"paddingTop": "$amount:4",
|
||||||
"paddingBottom": "$padding:4"
|
"paddingBottom": "$amount:4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
"body": "$invoiceLineItems"
|
"body": "$invoiceLineItems"
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
"hLineWidth": "$borderNotTop:.5",
|
"hLineWidth": "$notFirst:.5",
|
||||||
"vLineWidth": "$borderNone",
|
"vLineWidth": "$none",
|
||||||
"hLineColor": "#888888",
|
"hLineColor": "#888888",
|
||||||
"paddingLeft": "$padding:8",
|
"paddingLeft": "$amount:8",
|
||||||
"paddingRight": "$padding:8",
|
"paddingRight": "$amount:8",
|
||||||
"paddingTop": "$padding:8",
|
"paddingTop": "$amount:8",
|
||||||
"paddingBottom": "$padding:8"
|
"paddingBottom": "$amount:8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -41,12 +41,12 @@
|
|||||||
"body": "$subtotalsWithoutBalance"
|
"body": "$subtotalsWithoutBalance"
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
"hLineWidth": "$borderNone",
|
"hLineWidth": "$none",
|
||||||
"vLineWidth": "$borderNone",
|
"vLineWidth": "$none",
|
||||||
"paddingLeft": "$padding:8",
|
"paddingLeft": "$amount:8",
|
||||||
"paddingRight": "$padding:8",
|
"paddingRight": "$amount:8",
|
||||||
"paddingTop": "$padding:4",
|
"paddingTop": "$amount:4",
|
||||||
"paddingBottom": "$padding:4"
|
"paddingBottom": "$amount:4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -48,13 +48,13 @@
|
|||||||
"body": "$invoiceLineItems"
|
"body": "$invoiceLineItems"
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
"hLineWidth": "$borderNotTop:1",
|
"hLineWidth": "$notFirst:1",
|
||||||
"vLineWidth": "$borderNone",
|
"vLineWidth": "$none",
|
||||||
"hLineColor": "#e6e6e6",
|
"hLineColor": "#e6e6e6",
|
||||||
"paddingLeft": "$padding:8",
|
"paddingLeft": "$amount:8",
|
||||||
"paddingRight": "$padding:8",
|
"paddingRight": "$amount:8",
|
||||||
"paddingTop": "$padding:8",
|
"paddingTop": "$amount:8",
|
||||||
"paddingBottom": "$padding:8"
|
"paddingBottom": "$amount:8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -70,12 +70,12 @@
|
|||||||
"body": "$subtotals"
|
"body": "$subtotals"
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
"hLineWidth": "$borderNone",
|
"hLineWidth": "$none",
|
||||||
"vLineWidth": "$borderNone",
|
"vLineWidth": "$none",
|
||||||
"paddingLeft": "$padding:8",
|
"paddingLeft": "$amount:8",
|
||||||
"paddingRight": "$padding:8",
|
"paddingRight": "$amount:8",
|
||||||
"paddingTop": "$padding:4",
|
"paddingTop": "$amount:4",
|
||||||
"paddingBottom": "$padding:4"
|
"paddingBottom": "$amount:4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
var invoiceDesigns = {!! $invoiceDesigns !!};
|
var invoiceDesigns = {!! $invoiceDesigns !!};
|
||||||
var invoice = {!! json_encode($invoice) !!};
|
var invoice = {!! json_encode($invoice) !!};
|
||||||
var sections = ['content', 'styles', 'defaultStyle', 'pageMargins', 'header', 'footer'];
|
var sections = ['content', 'styles', 'defaultStyle', 'pageMargins', 'header', 'footer'];
|
||||||
var customDesign = origCustomDesign = {!! $customDesign !!};
|
var customDesign = origCustomDesign = {!! $customDesign ?: 'JSON.parse(invoiceDesigns[0].javascript);' !!};
|
||||||
|
|
||||||
function getPDFString(cb, force) {
|
function getPDFString(cb, force) {
|
||||||
invoice.is_pro = {!! Auth::user()->isPro() ? 'true' : 'false' !!};
|
invoice.is_pro = {!! Auth::user()->isPro() ? 'true' : 'false' !!};
|
||||||
@ -57,8 +57,10 @@
|
|||||||
showMoreDesigns();
|
showMoreDesigns();
|
||||||
$('#invoice_design_id').val(1);
|
$('#invoice_design_id').val(1);
|
||||||
return invoiceDesigns[0].javascript;
|
return invoiceDesigns[0].javascript;
|
||||||
} else {
|
} else if (customDesign) {
|
||||||
return JSON.stringify(customDesign);
|
return JSON.stringify(customDesign);
|
||||||
|
} else {
|
||||||
|
return invoiceDesigns[0].javascript;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +152,9 @@
|
|||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
{!! Button::normal(trans('texts.documentation'))->asLinkTo(PDFMAKE_DOCS)->withAttributes(['target' => '_blank'])->appendIcon(Icon::create('info-sign')) !!}
|
{!! Button::normal(trans('texts.documentation'))->asLinkTo(PDFMAKE_DOCS)->withAttributes(['target' => '_blank'])->appendIcon(Icon::create('info-sign')) !!}
|
||||||
{!! Button::normal(trans('texts.cancel'))->asLinkTo(URL::to('/company/advanced_settings/invoice_design'))->appendIcon(Icon::create('remove-circle')) !!}
|
{!! Button::normal(trans('texts.cancel'))->asLinkTo(URL::to('/company/advanced_settings/invoice_design'))->appendIcon(Icon::create('remove-circle')) !!}
|
||||||
|
@if (Auth::user()->isPro())
|
||||||
{!! Button::success(trans('texts.save'))->withAttributes(['onclick' => 'submitForm()'])->appendIcon(Icon::create('floppy-disk')) !!}
|
{!! Button::success(trans('texts.save'))->withAttributes(['onclick' => 'submitForm()'])->appendIcon(Icon::create('floppy-disk')) !!}
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user