diff --git a/InvenTree/static/css/bootstrap-table-group-by.css b/InvenTree/static/css/bootstrap-table-group-by.css new file mode 100644 index 0000000000..449bc73aa4 --- /dev/null +++ b/InvenTree/static/css/bootstrap-table-group-by.css @@ -0,0 +1,11 @@ +.bootstrap-table .table > tbody > tr.groupBy { + cursor: pointer; +} + +.bootstrap-table .table > tbody > tr.groupBy.expanded { + +} + +.bootstrap-table .table > tbody > tr.hidden + tr.detail-view { + display: none; +} diff --git a/InvenTree/static/script/bootstrap/bootstrap-table-group-by.js b/InvenTree/static/script/bootstrap/bootstrap-table-group-by.js index e056ba392f..586e69e186 100644 --- a/InvenTree/static/script/bootstrap/bootstrap-table-group-by.js +++ b/InvenTree/static/script/bootstrap/bootstrap-table-group-by.js @@ -153,7 +153,7 @@ var cell = ''; if (typeof that.options.groupByFormatter == 'function') { - cell += that.options.groupByFormatter(col.title, item.id, item.data); + cell += '' + that.options.groupByFormatter(col.title, item.id, item.data) + ""; } cell += ""; @@ -177,7 +177,7 @@ if(item.data.length > 1) { - that.$body.find('tr[data-parent-index=' + item.id + ']').addClass('hidden'); + that.$body.find('tr[data-parent-index=' + item.id + ']').addClass('hidden stock-sub-group'); that.$body.find('tr[data-parent-index=' + item.id + ']:first').before($(html.join(''))); } diff --git a/InvenTree/static/script/inventree/stock.js b/InvenTree/static/script/inventree/stock.js index 66c1fcc1de..28c0550bed 100644 --- a/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/static/script/inventree/stock.js @@ -404,9 +404,25 @@ function loadStockTable(table, options) { stock += item.quantity; }); - return stock; - } + return stock + ' (' + data.length + ' items)'; + } else if (field == 'Location') { + /* Determine how many locations */ + var locations = []; + data.forEach(function(item) { + var loc = item.location; + + if (!locations.includes(loc)) { + locations.push(loc); + } + }); + + if (locations.length > 1) { + return "In " + locations.length + " locations"; + } else { + return renderLink(data[0].location_detail.pathstring, data[0].location_detail.url); + } + } else { return ''; } diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index 69e72248d2..dff19e0a36 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -30,6 +30,7 @@ +