2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 04:26:44 +00:00

refactor for better readabilty

This commit is contained in:
Matthias 2021-06-25 07:40:01 +02:00
parent b99af16bfd
commit 4921cd47f9
2 changed files with 25 additions and 13 deletions

View File

@ -340,7 +340,7 @@
borderWidth: 1
}]
}
var StockPriceChart = loadStockPricingChart(document.getElementById('StockPriceChart'), pricedata)
var StockPriceChart = loadStockPricingChart($('#StockPriceChart'), pricedata)
var bom_colors = randomColor({hue: 'green', count: {{ bom_parts|length }} })
var bomdata = {
labels: [{% for line in bom_parts %}'{{ line.name }}',{% endfor %}],
@ -369,12 +369,14 @@
{% if show_internal_price and roles.sales_order.view %}
initPriceBreakSet(
$('#internal-price-break-table'),
{{part.id}},
'internal price break',
'internal-price',
"{% url 'api-part-internal-price-list' %}",
$('#new-internal-price-break'),
'{% url 'internal-price-break-create' %}'
{
part_id: {{part.id}},
pb_human_name: 'internal price break',
pb_url_slug: 'internal-price',
pb_url: '{% url 'api-part-internal-price-list' %}',
pb_new_btn: $('#new-internal-price-break'),
pb_new_url: '{% url 'internal-price-break-create' %}',
},
);
{% endif %}
@ -393,12 +395,14 @@
{% if part.salable and roles.sales_order.view %}
initPriceBreakSet(
$('#price-break-table'),
{{part.id}},
'sale price break',
'sale-price',
"{% url 'api-part-sale-price-list' %}",
$('#new-price-break'),
'{% url 'sale-price-break-create' %}'
{
part_id: {{part.id}},
pb_human_name: 'sale price break',
pb_url_slug: 'sale-price',
pb_url: "{% url 'api-part-sale-price-list' %}",
pb_new_btn: $('#new-price-break'),
pb_new_url: '{% url 'sale-price-break-create' %}',
},
);
{% endif %}

View File

@ -817,6 +817,14 @@ function loadPriceBreakTable(table, options) {
});
}
function initPriceBreakSet(table, options) {
var part_id = options.part_id;
var pb_human_name = options.pb_human_name;
var pb_url_slug = options.pb_url_slug;
var pb_url = options.pb_url;
var pb_new_btn = options.pb_new_btn;
var pb_new_url = options.pb_new_url;
function initPriceBreakSet(table, part_id, pb_human_name, pb_url_slug, pb_url, pb_new_btn, pb_new_url) {