2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 21:45:39 +00:00

Add optional display of part stock quantity in forms

This commit is contained in:
Oliver
2021-10-06 22:12:59 +11:00
parent 54d770927a
commit 166af3592d
3 changed files with 25 additions and 2 deletions

View File

@ -159,7 +159,24 @@ function renderPart(name, data, parameters, options) {
html += ` - <i>${data.description}</i>`;
}
html += `<span class='float-right'><small>{% trans "Part ID" %}: ${data.pk}</small></span>`;
var stock = '';
// Display available part quantity
if (global_settings.PART_SHOW_QUANTITY_IN_FORMS) {
if (data.in_stock == 0) {
stock = `<span class='label-form label-red'>{% trans "No Stock" %}</span>`;
} else {
stock = `<span class='label-form label-green'>{% trans "In Stock" %}: ${data.in_stock}</span>`;
}
}
html += `
<span class='float-right'>
<small>
${stock}
{% trans "Part ID" %}: ${data.pk}
</small>
</span>`;
return html;
}