From c959e8f62c7e5266c9d55c8b6eead1e5ddbfe6ce Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 2 Jul 2019 19:45:26 +1000 Subject: [PATCH] Add ability to remove individual rows from BOM uploader --- .../part/bom_upload/select_fields.html | 10 ++++-- InvenTree/static/script/inventree/bom.js | 31 +++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/InvenTree/part/templates/part/bom_upload/select_fields.html b/InvenTree/part/templates/part/bom_upload/select_fields.html index c423d7b0c1..366cce80a3 100644 --- a/InvenTree/part/templates/part/bom_upload/select_fields.html +++ b/InvenTree/part/templates/part/bom_upload/select_fields.html @@ -32,13 +32,14 @@ + {% for col in bom_columns %} {% for row in bom_rows %} - + + {% for item in row.data %}
Row
{{ col.name }} -
@@ -65,7 +66,12 @@
{% add forloop.counter 1 %} + + {{ forloop.counter }} diff --git a/InvenTree/static/script/inventree/bom.js b/InvenTree/static/script/inventree/bom.js index 581fb8d4a3..8b6e802f72 100644 --- a/InvenTree/static/script/inventree/bom.js +++ b/InvenTree/static/script/inventree/bom.js @@ -12,6 +12,37 @@ function reloadBomTable(table, options) { } +function removeRowFromBomWizard(e) { + /* Remove a row from BOM upload wizard + */ + + e = e || window.event; + + var src = e.target || e.srcElement; + + var table = $(src).closest('table'); + + // Which column was clicked? + var row = $(src).closest('tr'); + + row.remove(); + + var rowNum = 1; + var colNum = 0; + + table.find('tr').each(function() { + + colNum++; + + if (colNum >= 3) { + var cell = $(this).find('td:eq(1)'); + cell.text(rowNum++); + console.log("Row: " + rowNum); + } + }); +} + + function removeColFromBomWizard(e) { /* Remove a column from BOM upload wizard */