mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on product fields
This commit is contained in:
parent
044aa6ccaa
commit
bd98591ca7
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -488,9 +488,9 @@ NINJA.productFields = function(invoice, isTasks) {
|
|||||||
var allFields = JSON.parse(account.invoice_fields);
|
var allFields = JSON.parse(account.invoice_fields);
|
||||||
|
|
||||||
if (allFields) {
|
if (allFields) {
|
||||||
if (isTasks && allFields.task_fields) {
|
if (isTasks && allFields.task_fields && allFields.task_fields.length) {
|
||||||
return allFields.task_fields;
|
return allFields.task_fields;
|
||||||
} else if (! isTasks && allFields.product_fields) {
|
} else if (! isTasks && allFields.product_fields && allFields.product_fields.length) {
|
||||||
return allFields.product_fields;
|
return allFields.product_fields;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -506,6 +506,11 @@ NINJA.productFields = function(invoice, isTasks) {
|
|||||||
'product.line_total',
|
'product.line_total',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// add backwards compatibility for 'hide qty' setting
|
||||||
|
if (invoice.account.hide_quantity == '1' && ! isTasks) {
|
||||||
|
fields.splice(5, 1);
|
||||||
|
}
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,11 +532,20 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
|
|||||||
for (var i=0; i<fields.length; i++) {
|
for (var i=0; i<fields.length; i++) {
|
||||||
var field = fields[i].split('.')[1]; // split to remove 'product.'
|
var field = fields[i].split('.')[1]; // split to remove 'product.'
|
||||||
var headerStyles = styles.concat([snakeToCamel(field), snakeToCamel(field) + 'TableHeader']);
|
var headerStyles = styles.concat([snakeToCamel(field), snakeToCamel(field) + 'TableHeader']);
|
||||||
|
var value = invoiceLabels[field];
|
||||||
|
|
||||||
if (field == 'custom_value1' && ! invoice.has_custom_item_value1) {
|
if (field == 'custom_value1') {
|
||||||
continue;
|
if (invoice.has_custom_item_value1) {
|
||||||
} else if (field == 'custom_value2' && ! invoice.has_custom_item_value1) {
|
value = account.custom_invoice_item_label1;
|
||||||
continue;
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else if (field == 'custom_value2') {
|
||||||
|
if (invoice.has_custom_item_value2) {
|
||||||
|
value = account.custom_invoice_item_label2;
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
} else if (field == 'tax' && ! invoice.has_item_taxes) {
|
} else if (field == 'tax' && ! invoice.has_item_taxes) {
|
||||||
continue;
|
continue;
|
||||||
} else if (field == 'product_key' && ! invoice.has_product_key) {
|
} else if (field == 'product_key' && ! invoice.has_product_key) {
|
||||||
@ -540,7 +554,7 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
|
|||||||
headerStyles.push('cost');
|
headerStyles.push('cost');
|
||||||
}
|
}
|
||||||
|
|
||||||
grid[0].push({text: invoiceLabels[field], style: headerStyles});
|
grid[0].push({text: value, style: headerStyles});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i=0; i<invoice.invoice_items.length; i++) {
|
for (var i=0; i<invoice.invoice_items.length; i++) {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
"text": "$entityTypeUC",
|
"text": "$entityTypeUC",
|
||||||
"margin": [8, 30, 8, 5],
|
"margin": [8, 30, 8, 5],
|
||||||
"style": "entityTypeLabel"
|
"style": "entityTypeLabel"
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"table": {
|
"table": {
|
||||||
@ -27,12 +27,12 @@
|
|||||||
"body": [
|
"body": [
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"table": {
|
"table": {
|
||||||
"body": "$invoiceDetails"
|
"body": "$invoiceDetails"
|
||||||
},
|
},
|
||||||
"margin": [0, 0, 12, 0],
|
"margin": [0, 0, 12, 0],
|
||||||
"layout": "noBorders"
|
"layout": "noBorders"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"stack": "$clientDetails"
|
"stack": "$clientDetails"
|
||||||
},
|
},
|
||||||
@ -46,9 +46,9 @@
|
|||||||
"hLineWidth": "$firstAndLast:.5",
|
"hLineWidth": "$firstAndLast:.5",
|
||||||
"vLineWidth": "$none",
|
"vLineWidth": "$none",
|
||||||
"hLineColor": "#D8D8D8",
|
"hLineColor": "#D8D8D8",
|
||||||
"paddingLeft": "$amount:8",
|
"paddingLeft": "$amount:8",
|
||||||
"paddingRight": "$amount:8",
|
"paddingRight": "$amount:8",
|
||||||
"paddingTop": "$amount:6",
|
"paddingTop": "$amount:6",
|
||||||
"paddingBottom": "$amount:6"
|
"paddingBottom": "$amount:6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -63,14 +63,14 @@
|
|||||||
"hLineWidth": "$notFirst:.5",
|
"hLineWidth": "$notFirst:.5",
|
||||||
"vLineWidth": "$none",
|
"vLineWidth": "$none",
|
||||||
"hLineColor": "#D8D8D8",
|
"hLineColor": "#D8D8D8",
|
||||||
"paddingLeft": "$amount:8",
|
"paddingLeft": "$amount:8",
|
||||||
"paddingRight": "$amount:8",
|
"paddingRight": "$amount:8",
|
||||||
"paddingTop": "$amount:14",
|
"paddingTop": "$amount:14",
|
||||||
"paddingBottom": "$amount:14"
|
"paddingBottom": "$amount:14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"columns": [
|
"columns": [
|
||||||
"$notesAndTerms",
|
"$notesAndTerms",
|
||||||
{
|
{
|
||||||
"table": {
|
"table": {
|
||||||
@ -80,10 +80,10 @@
|
|||||||
"layout": {
|
"layout": {
|
||||||
"hLineWidth": "$none",
|
"hLineWidth": "$none",
|
||||||
"vLineWidth": "$none",
|
"vLineWidth": "$none",
|
||||||
"paddingLeft": "$amount:34",
|
"paddingLeft": "$amount:34",
|
||||||
"paddingRight": "$amount:8",
|
"paddingRight": "$amount:8",
|
||||||
"paddingTop": "$amount:4",
|
"paddingTop": "$amount:4",
|
||||||
"paddingBottom": "$amount:4"
|
"paddingBottom": "$amount:4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -124,7 +124,7 @@
|
|||||||
},
|
},
|
||||||
"invoiceDetails": {
|
"invoiceDetails": {
|
||||||
"margin": [0, 0, 8, 0]
|
"margin": [0, 0, 8, 0]
|
||||||
},
|
},
|
||||||
"accountDetails": {
|
"accountDetails": {
|
||||||
"margin": [0, 2, 0, 2]
|
"margin": [0, 2, 0, 2]
|
||||||
},
|
},
|
||||||
@ -150,7 +150,7 @@
|
|||||||
"subtotalsBalanceDue": {
|
"subtotalsBalanceDue": {
|
||||||
"fontSize": "$fontSizeLarger",
|
"fontSize": "$fontSizeLarger",
|
||||||
"color": "$primaryColor:#37a3c6"
|
"color": "$primaryColor:#37a3c6"
|
||||||
},
|
},
|
||||||
"invoiceNumber": {
|
"invoiceNumber": {
|
||||||
"bold": true
|
"bold": true
|
||||||
},
|
},
|
||||||
@ -169,7 +169,7 @@
|
|||||||
},
|
},
|
||||||
"lineTotalTableHeader": {
|
"lineTotalTableHeader": {
|
||||||
"alignment": "right"
|
"alignment": "right"
|
||||||
},
|
},
|
||||||
"invoiceLineItemsTable": {
|
"invoiceLineItemsTable": {
|
||||||
"margin": [0, 16, 0, 16]
|
"margin": [0, 16, 0, 16]
|
||||||
},
|
},
|
||||||
@ -190,7 +190,7 @@
|
|||||||
},
|
},
|
||||||
"subtotals": {
|
"subtotals": {
|
||||||
"alignment": "right"
|
"alignment": "right"
|
||||||
},
|
},
|
||||||
"termsLabel": {
|
"termsLabel": {
|
||||||
"bold": true
|
"bold": true
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user