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

Updates for sales order lines table

This commit is contained in:
Oliver Walters
2022-06-18 21:48:58 +10:00
parent 0af9fc473e
commit d99ec062ad
2 changed files with 18 additions and 10 deletions

View File

@ -28,6 +28,8 @@
<div class='panel-content'> <div class='panel-content'>
<div id='order-toolbar-buttons' class='btn-group' style='float: right;'> <div id='order-toolbar-buttons' class='btn-group' style='float: right;'>
<div class='btn-group'> <div class='btn-group'>
{% include "expand_rows.html" with label="sales-lines" %}
{% include "collapse_rows.html" with label="sales-lines" %}
{% include "filter_list.html" with id="sales-order-lines" %} {% include "filter_list.html" with id="sales-order-lines" %}
</div> </div>
</div> </div>

View File

@ -3427,6 +3427,15 @@ function loadSalesOrderLineItemTable(table, options={}) {
// Show detail view if the PurchaseOrder is PENDING or SHIPPED // Show detail view if the PurchaseOrder is PENDING or SHIPPED
var show_detail = pending || shipped; var show_detail = pending || shipped;
// Add callbacks for expand / collapse buttons
$('#sales-lines-expand').click(function() {
$(table).bootstrapTable('expandAllRows');
});
$('#sales-lines-collapse').click(function() {
$(table).bootstrapTable('collapseAllRows');
});
// Table columns to display // Table columns to display
var columns = [ var columns = [
/* /*
@ -3554,30 +3563,27 @@ function loadSalesOrderLineItemTable(table, options={}) {
title: '{% trans "Available Stock" %}', title: '{% trans "Available Stock" %}',
formatter: function(value, row) { formatter: function(value, row) {
var available = row.available_stock; var available = row.available_stock;
var total = row.part_detail.stock;
var required = Math.max(row.quantity - row.allocated - row.shipped, 0); var required = Math.max(row.quantity - row.allocated - row.shipped, 0);
var html = ''; var html = '';
if (total > 0) { if (available > 0) {
var url = `/part/${row.part}/?display=part-stock`; var url = `/part/${row.part}/?display=part-stock`;
var text = available; var text = available;
if (total != available) {
text += ` / ${total}`;
}
html = renderLink(text, url); html = renderLink(text, url);
} else { } else {
html += `<span class='badge rounded-pill bg-danger'>{% trans "No Stock Available" %}</span>`; html += `<span class='badge rounded-pill bg-danger'>{% trans "No Stock Available" %}</span>`;
} }
if (required > 0) {
if (available >= required) { if (available >= required) {
html += `<span class='fas fa-check-circle icon-green float-right' title='{% trans "Sufficient stock available" %}'></span>`; html += `<span class='fas fa-check-circle icon-green float-right' title='{% trans "Sufficient stock available" %}'></span>`;
} else { } else {
html += `<span class='fas fa-times-circle icon-red float-right' title='{% trans "Insufficient stock available" %}'></span>`; html += `<span class='fas fa-times-circle icon-red float-right' title='{% trans "Insufficient stock available" %}'></span>`;
} }
}
return html; return html;
}, },