Display sub-location information

This commit is contained in:
Oliver Walters 2019-05-28 18:08:50 +10:00
parent 7120b940f0
commit 4011d66b6f
4 changed files with 32 additions and 4 deletions

View File

@ -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;
}

View File

@ -153,7 +153,7 @@
var cell = '<td>';
if (typeof that.options.groupByFormatter == 'function') {
cell += that.options.groupByFormatter(col.title, item.id, item.data);
cell += '<i>' + that.options.groupByFormatter(col.title, item.id, item.data) + "</i>";
}
cell += "</td>";
@ -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('')));
}

View File

@ -404,9 +404,25 @@ function loadStockTable(table, options) {
stock += item.quantity;
});
return stock;
}
return stock + ' <i>(' + data.length + ' items)</i>';
} 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 '';
}

View File

@ -30,6 +30,7 @@
<!-- CSS -->
<link rel="stylesheet" href="{% static 'css/bootstrap_3.3.7_css_bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'css/bootstrap-table.css' %}">
<link rel="stylesheet" href="{% static 'css/bootstrap-table-group-by.css' %}">
<link rel="stylesheet" href="{% static 'css/select2.css' %}">
<link rel="stylesheet" href="{% static 'css/select2-bootstrap.css' %}">
<link rel="stylesheet" href="{% static 'css/inventree.css' %}">