Merge pull request #575 from SchrodingersGat/stock-table-notes-fix

Properly display 'notes' field in grouped rows for stock table
This commit is contained in:
Oliver 2019-11-05 11:13:17 +11:00 committed by GitHub
commit b92b7dc825
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,6 +125,28 @@ function loadStockTable(table, options) {
// A single location!
return renderLink(row.location__path, '/stock/location/' + row.location + '/')
}
} else if (field == 'notes') {
var notes = [];
data.forEach(function(item) {
var note = item.notes;
if (!note || note == '') {
note = '-';
}
if (!notes.includes(note)) {
notes.push(note);
}
});
if (notes.length > 1) {
return '...';
} else if (notes.length == 1) {
return notes[0] || '-';
} else {
return '-';
}
}
else {
return '';