javascript linting

This commit is contained in:
Oliver 2021-09-08 13:02:03 +10:00
parent 1a21576f28
commit a32a30de52

View File

@ -20,6 +20,7 @@
/* exported /* exported
createSalesOrder, createSalesOrder,
editPurchaseOrderLineItem, editPurchaseOrderLineItem,
loadPurchaseOrderLineItemTable,
loadPurchaseOrderTable, loadPurchaseOrderTable,
loadSalesOrderAllocationTable, loadSalesOrderAllocationTable,
loadSalesOrderTable, loadSalesOrderTable,
@ -435,7 +436,7 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
field: 'location', field: 'location',
label: '{% trans "New Location" %}', label: '{% trans "New Location" %}',
title: '{% trans "Create new stock location" %}', title: '{% trans "Create new stock location" %}',
url: "{% url 'stock-location-create' %}", url: '{% url "stock-location-create" %}',
}, },
] ]
}); });
@ -454,7 +455,7 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
order: options.order, order: options.order,
part_detail: true part_detail: true
}, },
url: "{% url 'api-po-line-list' %}", url: '{% url "api-po-line-list" %}',
showFooter: true, showFooter: true,
columns: [ columns: [
{ {
@ -477,7 +478,7 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
} }
}, },
footerFormatter: function() { footerFormatter: function() {
return '{% trans "Total" %}' return '{% trans "Total" %}';
} }
}, },
{ {
@ -506,7 +507,7 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
if (row.supplier_part_detail && row.supplier_part_detail.manufacturer_part) { if (row.supplier_part_detail && row.supplier_part_detail.manufacturer_part) {
return renderLink(value, `/manufacturer-part/${row.supplier_part_detail.manufacturer_part}/`); return renderLink(value, `/manufacturer-part/${row.supplier_part_detail.manufacturer_part}/`);
} else { } else {
return "-"; return '-';
} }
}, },
}, },
@ -521,10 +522,10 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
title: '{% trans "Quantity" %}', title: '{% trans "Quantity" %}',
footerFormatter: function(data) { footerFormatter: function(data) {
return data.map(function(row) { return data.map(function(row) {
return +row['quantity'] return +row['quantity'];
}).reduce(function(sum, i) { }).reduce(function(sum, i) {
return sum + i return sum + i
}, 0) }, 0);
} }
}, },
{ {
@ -543,17 +544,26 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
formatter: function(value, row) { formatter: function(value, row) {
var total = row.purchase_price * row.quantity; var total = row.purchase_price * row.quantity;
var formatter = new Intl.NumberFormat('en-US', {style: 'currency', currency: row.purchase_price_currency}); var formatter = new Intl.NumberFormat('en-US', {style: 'currency', currency: row.purchase_price_currency});
return formatter.format(total) return formatter.format(total);
}, },
footerFormatter: function(data) { footerFormatter: function(data) {
var total = data.map(function(row) { var total = data.map(function(row) {
return +row['purchase_price']*row['quantity'] return +row['purchase_price']*row['quantity'];
}).reduce(function(sum, i) { }).reduce(function(sum, i) {
return sum + i return sum + i;
}, 0) }, 0);
var currency = (data.slice(-1)[0] && data.slice(-1)[0].purchase_price_currency) || 'USD'; var currency = (data.slice(-1)[0] && data.slice(-1)[0].purchase_price_currency) || 'USD';
var formatter = new Intl.NumberFormat('en-US', {style: 'currency', currency: currency});
return formatter.format(total) var formatter = new Intl.NumberFormat(
'en-US',
{
style: 'currency',
currency: currency
}
);
return formatter.format(total);
} }
}, },
{ {