diff --git a/InvenTree/InvenTree/static/script/inventree/inventree.js b/InvenTree/InvenTree/static/script/inventree/inventree.js index c3e64d80de..e2626e3c0a 100644 --- a/InvenTree/InvenTree/static/script/inventree/inventree.js +++ b/InvenTree/InvenTree/static/script/inventree/inventree.js @@ -78,6 +78,22 @@ function getImageUrlFromTransfer(transfer) { return url; } +function makeIconButton(icon, id, opts) { + // Construct an 'icon button' using the fontawesome set + + var options = opts || {}; + + var title = options.title || ''; + + var html = ''; + + html += ``; + + return html; +} + function makeProgressBar(value, maximum, opts) { /* * Render a progessbar! diff --git a/InvenTree/order/templates/order/sales_order_detail.html b/InvenTree/order/templates/order/sales_order_detail.html index 88b7fa8976..ed7293f126 100644 --- a/InvenTree/order/templates/order/sales_order_detail.html +++ b/InvenTree/order/templates/order/sales_order_detail.html @@ -156,7 +156,30 @@ $("#so-lines-table").inventreeTable({ { field: 'buttons', formatter: function(value, row, index, field) { - return '-'; + + var html = ''; + + var pk = row.pk; + + if (row.part) { + var part = row.part_detail; + + html = `
`; + + html += makeIconButton('fa-plus', `button-add-${pk}`); + + if (part.purchaseable) { + html += makeIconButton('fa-shopping-cart', `button-buy-${pk}`); + } + + if (part.assembly) { + html += makeIconButton('fa-tools', `button-build-${pk}`); + } + + html += `
`; + } + + return html; } }, ], diff --git a/InvenTree/part/serializers.py b/InvenTree/part/serializers.py index 4da079d4cc..1ee58062fe 100644 --- a/InvenTree/part/serializers.py +++ b/InvenTree/part/serializers.py @@ -65,6 +65,8 @@ class PartBriefSerializer(InvenTreeModelSerializer): 'thumbnail', 'active', 'assembly', + 'purchaseable', + 'salable', 'virtual', ]