Add a custom "id" to the progress bar

This commit is contained in:
Oliver Walters 2020-04-21 21:43:04 +10:00
parent 4979c690d9
commit 15166c7797
2 changed files with 6 additions and 2 deletions

View File

@ -97,8 +97,10 @@ function makeProgressBar(value, maximum, opts) {
percent = 100; percent = 100;
} }
var id = opts.id || 'progress-bar';
return ` return `
<div class='progress'> <div id='${id}' class='progress'>
<div class='progress-bar' role='progressbar' aria-valuenow='${percent}' aria-valuemin='0' aria-valuemax='100' style='width:${percent}%'></div> <div class='progress-bar' role='progressbar' aria-valuenow='${percent}' aria-valuemin='0' aria-valuemax='100' style='width:${percent}%'></div>
<div class='progress-value'>${value} / ${maximum}</div> <div class='progress-value'>${value} / ${maximum}</div>
</div> </div>

View File

@ -133,7 +133,9 @@ $("#so-lines-table").inventreeTable({
field: 'quantity', field: 'quantity',
title: 'Quantity', title: 'Quantity',
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
return makeProgressBar(row.allocated, row.quantity); return makeProgressBar(row.allocated, row.quantity, {
id: `order-line-progress-${row.pk}`,
});
}, },
sorter: function(valA, valB, rowA, rowB) { sorter: function(valA, valB, rowA, rowB) {