mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 12:35:46 +00:00
Adds ability to export sales order line table to a file (#4392)
* Adds ability to export sales order line table to a file * Fix expand / collapse buttons * Fix other expand / collapse buttons * Add export functionality for "extra" line items
This commit is contained in:
@ -1,5 +0,0 @@
|
||||
{% 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>
|
@ -1,5 +0,0 @@
|
||||
{% 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>
|
@ -2231,7 +2231,14 @@ function loadPurchaseOrderLineItemTable(table, options={}) {
|
||||
|
||||
var target = options.filter_target || '#filter-list-purchase-order-lines';
|
||||
|
||||
setupFilterList('purchaseorderlineitem', $(table), target, {download: true});
|
||||
setupFilterList(
|
||||
'purchaseorderlineitem',
|
||||
$(table),
|
||||
target,
|
||||
{
|
||||
download: true
|
||||
}
|
||||
);
|
||||
|
||||
function setupCallbacks() {
|
||||
if (options.allow_edit) {
|
||||
@ -2596,7 +2603,7 @@ function loadPurchaseOrderExtraLineTable(table, options={}) {
|
||||
|
||||
var filter_target = options.filter_target || '#filter-list-purchase-order-extra-lines';
|
||||
|
||||
setupFilterList('purchaseorderextraline', $(table), filter_target);
|
||||
setupFilterList('purchaseorderextraline', $(table), filter_target, {download: true});
|
||||
|
||||
// Table columns to display
|
||||
var columns = [
|
||||
@ -3072,6 +3079,7 @@ function loadSalesOrderShipmentTable(table, options={}) {
|
||||
showColumns: true,
|
||||
detailView: true,
|
||||
detailViewByClick: false,
|
||||
buttons: constructExpandCollapseButtons(table),
|
||||
detailFilter: function(index, row) {
|
||||
return row.allocations.length > 0;
|
||||
},
|
||||
@ -3871,7 +3879,14 @@ function loadSalesOrderLineItemTable(table, options={}) {
|
||||
|
||||
var filter_target = options.filter_target || '#filter-list-sales-order-lines';
|
||||
|
||||
setupFilterList('salesorderlineitem', $(table), filter_target);
|
||||
setupFilterList(
|
||||
'salesorderlineitem',
|
||||
$(table),
|
||||
filter_target,
|
||||
{
|
||||
download: true,
|
||||
}
|
||||
);
|
||||
|
||||
// Is the order pending?
|
||||
var pending = options.pending;
|
||||
@ -4333,6 +4348,7 @@ function loadSalesOrderLineItemTable(table, options={}) {
|
||||
uniqueId: 'pk',
|
||||
detailView: show_detail,
|
||||
detailViewByClick: false,
|
||||
buttons: constructExpandCollapseButtons(table),
|
||||
detailFilter: function(index, row) {
|
||||
if (pending) {
|
||||
// Order is pending
|
||||
@ -4395,7 +4411,7 @@ function loadSalesOrderExtraLineTable(table, options={}) {
|
||||
|
||||
var filter_target = options.filter_target || '#filter-list-sales-order-extra-lines';
|
||||
|
||||
setupFilterList('salesorderextraline', $(table), filter_target);
|
||||
setupFilterList('salesorderextraline', $(table), filter_target, {download: true});
|
||||
|
||||
// Table columns to display
|
||||
var columns = [
|
||||
|
@ -12,6 +12,7 @@
|
||||
reloadtable,
|
||||
renderLink,
|
||||
reloadTableFilters,
|
||||
constructExpandCollapseButtons,
|
||||
constructOrderTableButtons,
|
||||
*/
|
||||
|
||||
@ -98,6 +99,28 @@ function constructOrderTableButtons(options={}) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Construct buttons to expand / collapse all rows in a table
|
||||
*/
|
||||
function constructExpandCollapseButtons(table, idx=0) {
|
||||
|
||||
return [
|
||||
{
|
||||
html: `<button type='button' name='${idx++}' class='btn btn-outline-secondary' title='{% trans "Expand all rows" %}'><span class='fas fa-expand'></span></button>`,
|
||||
event: function() {
|
||||
$(table).bootstrapTable('expandAllRows');
|
||||
}
|
||||
},
|
||||
{
|
||||
html: `<button type='button' name='${idx++}' class='btn btn-outline-secondary' title='{% trans "Collapse all rows" %}'><span class='fas fa-compress'></span></button>`,
|
||||
event: function() {
|
||||
$(table).bootstrapTable('collapseAllRows');
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/* Return the 'selected' data rows from a bootstrap table.
|
||||
* If allowEmpty = false, and the returned dataset is empty,
|
||||
* then instead try to return *all* the data
|
||||
|
Reference in New Issue
Block a user