diff --git a/InvenTree/templates/js/translated/bom.js b/InvenTree/templates/js/translated/bom.js
index 4f3ae912d5..a5e1153bad 100644
--- a/InvenTree/templates/js/translated/bom.js
+++ b/InvenTree/templates/js/translated/bom.js
@@ -162,7 +162,7 @@ function bomSubstitutesDialog(bom_item_id, substitutes, options={}) {
// Render a single row
var html = `
-
+
${thumb} ${substitute.part_detail.full_name} |
${substitute.part_detail.description} |
${buttons} |
@@ -218,9 +218,30 @@ function bomSubstitutesDialog(bom_item_id, substitutes, options={}) {
},
},
preFormContent: html,
+ submitText: '{% trans "Add Substitute" %}',
title: '{% trans "Edit BOM Item Substitutes" %}',
afterRender: function(fields, opts) {
- // TODO
+
+ // Add a callback to remove individual rows
+ $(opts.modal).find('.button-row-remove').click(function() {
+ var pk = $(this).attr('pk');
+
+ var pre = `
+
+ {% trans "Are you sure you wish to remove this substitute part link?" %}
+
+ `;
+
+ constructForm(`/api/bom/substitute/${pk}/`, {
+ method: 'DELETE',
+ title: '{% trans "Remove Substitute Part" %}',
+ preFormContent: pre,
+ confirm: true,
+ onSuccess: function() {
+ $(opts.modal).find(`#substitute-row-${pk}`).remove();
+ }
+ });
+ });
},
onSubmit: function(fields, opts) {
// TODO