From 2ef8464a83471e923da555f0e199b4135c7baa62 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 28 Sep 2020 20:27:13 +1000 Subject: [PATCH] Add buttons to remove installed items from a stock item --- .../stock/templates/stock/item_installed.html | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/InvenTree/stock/templates/stock/item_installed.html b/InvenTree/stock/templates/stock/item_installed.html index c9c429c87b..72451f11e9 100644 --- a/InvenTree/stock/templates/stock/item_installed.html +++ b/InvenTree/stock/templates/stock/item_installed.html @@ -113,8 +113,28 @@ $('#installed-table').inventreeTable({ field: 'actions', switchable: false, title: '', + formatter: function(value, row) { + var pk = row.pk; + + var html = `
`; + + html += makeIconButton('fa-trash-alt icon-red', 'button-uninstall', pk, '{% trans "Uninstall item" %}'); + + html += `
`; + + return html; + } } - ] + ], + onLoadSuccess: function() { + + var table = $('#installed-table'); + + // Find buttons and associate actions + table.find('.button-uninstall').click(function() { + var pk = $(this).attr('pk'); + }); + } }); {% endblock %} \ No newline at end of file