mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Sales order tables (#3225)
* Add buttons to expand / collapse shipment tables (cherry picked from commit 0af9fc473ee005b7544d204107cfb58ba78c5e30) * Updates for sales order lines table (cherry picked from commit d99ec062adf0c1c8e6c5cae5db921e54e167be8c)
This commit is contained in:
parent
eb255e84d8
commit
652e6fb83e
@ -275,13 +275,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if build.has_tracked_bom_items %}
|
{% if build.has_tracked_bom_items %}
|
||||||
<button id='outputs-expand' class='btn btn-outline-secondary' type='button' title='{% trans "Expand all build output rows" %}'>
|
{% include "expand_rows.html" with label="outputs" %}
|
||||||
<span class='fas fa-expand'></span>
|
{% include "collapse_rows.html" with label="outputs" %}
|
||||||
</button>
|
|
||||||
|
|
||||||
<button id='outputs-collapse' class='btn btn-outline-secondary' type='button' title='{% trans "Collapse all build output rows" %}'>
|
|
||||||
<span class='fas fa-compress'></span>
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% include "filter_list.html" with id='incompletebuilditems' %}
|
{% include "filter_list.html" with id='incompletebuilditems' %}
|
||||||
|
@ -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>
|
||||||
@ -86,6 +88,8 @@
|
|||||||
{% if roles.sales_order.change %}
|
{% if roles.sales_order.change %}
|
||||||
<div id='pending-shipment-toolbar' class='btn-group' style='float: right;'>
|
<div id='pending-shipment-toolbar' class='btn-group' style='float: right;'>
|
||||||
<div class='btn-group' role='group'>
|
<div class='btn-group' role='group'>
|
||||||
|
{% include "expand_rows.html" with label="pending-shipments" %}
|
||||||
|
{% include "collapse_rows.html" with label="pending-shipments" %}
|
||||||
{% include "filter_list.html" with id="pending-shipments" %}
|
{% include "filter_list.html" with id="pending-shipments" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -102,6 +106,8 @@
|
|||||||
<div class='panel-content'>
|
<div class='panel-content'>
|
||||||
<div id='completed-shipment-toolbar' class='btn-group' style='float: right;'>
|
<div id='completed-shipment-toolbar' class='btn-group' style='float: right;'>
|
||||||
<div class='btn-group' role='group'>
|
<div class='btn-group' role='group'>
|
||||||
|
{% include "expand_rows.html" with label="completed-shipments" %}
|
||||||
|
{% include "collapse_rows.html" with label="completed-shipments" %}
|
||||||
{% include "filter_list.html" with id="completed-shipments" %}
|
{% include "filter_list.html" with id="completed-shipments" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
5
InvenTree/templates/collapse_rows.html
Normal file
5
InvenTree/templates/collapse_rows.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
<button id='{{ label }}-collapse' class='btn btn-outline-secondary' type='button' title='{% trans "Collapse all rows" %}'>
|
||||||
|
<span class='fas fa-compress'></span>
|
||||||
|
</button>
|
5
InvenTree/templates/expand_rows.html
Normal file
5
InvenTree/templates/expand_rows.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
<button id='{{ label }}-expand' class='btn btn-outline-secondary' type='button' title='{% trans "Expand all rows" %}'>
|
||||||
|
<span class='fas fa-expand'></span>
|
||||||
|
</button>
|
@ -2540,6 +2540,17 @@ function loadSalesOrderShipmentTable(table, options={}) {
|
|||||||
|
|
||||||
setupFilterList('salesordershipment', $(table), options.filter_target);
|
setupFilterList('salesordershipment', $(table), options.filter_target);
|
||||||
|
|
||||||
|
// Add callbacks for expand / collapse buttons
|
||||||
|
var prefix = options.shipped ? 'completed' : 'pending';
|
||||||
|
|
||||||
|
$(`#${prefix}-shipments-expand`).click(function() {
|
||||||
|
$(table).bootstrapTable('expandAllRows');
|
||||||
|
});
|
||||||
|
|
||||||
|
$(`#${prefix}-shipments-collapse`).click(function() {
|
||||||
|
$(table).bootstrapTable('collapseAllRows');
|
||||||
|
});
|
||||||
|
|
||||||
function makeShipmentActions(row) {
|
function makeShipmentActions(row) {
|
||||||
// Construct "actions" for the given shipment row
|
// Construct "actions" for the given shipment row
|
||||||
var pk = row.pk;
|
var pk = row.pk;
|
||||||
@ -3416,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 = [
|
||||||
/*
|
/*
|
||||||
@ -3543,29 +3563,26 @@ 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 (available >= required) {
|
if (required > 0) {
|
||||||
html += `<span class='fas fa-check-circle icon-green float-right' title='{% trans "Sufficient stock available" %}'></span>`;
|
if (available >= required) {
|
||||||
} else {
|
html += `<span class='fas fa-check-circle icon-green float-right' title='{% trans "Sufficient stock available" %}'></span>`;
|
||||||
html += `<span class='fas fa-times-circle icon-red float-right' title='{% trans "Insufficient stock available" %}'></span>`;
|
} else {
|
||||||
|
html += `<span class='fas fa-times-circle icon-red float-right' title='{% trans "Insufficient stock available" %}'></span>`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user