mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2475 from SchrodingersGat/table-filternig
Table filtering
This commit is contained in:
commit
f0c41b3b70
@ -45,10 +45,10 @@
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% include "filter_list.html" with id="supplier-part" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<table class='table table-striped table-condensed' id='supplier-part-table' data-toolbar='#supplier-part-button-toolbar'>
|
||||
@ -92,8 +92,8 @@
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% include "filter_list.html" with id="manufacturer-part" %}
|
||||
</div>
|
||||
{% include "filter_list.html" with id="supplier-part" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
@ -169,10 +169,10 @@
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
<div id='assigned-stock-button-toolbar'>
|
||||
{% include "filter_list.html" with id="stock" %}
|
||||
{% include "filter_list.html" with id="customerstock" %}
|
||||
</div>
|
||||
|
||||
<table class='table table-striped table-condensed' id='assigned-stock-table' data-toolbar='#bassigned-stock-utton-toolbar'></table>
|
||||
<table class='table table-striped table-condensed' id='assigned-stock-table' data-toolbar='#assigned-stock-button-toolbar'></table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -225,6 +225,7 @@
|
||||
},
|
||||
url: "{% url 'api-stock-list' %}",
|
||||
filterKey: "customerstock",
|
||||
filterTarget: '#filter-list-customerstock',
|
||||
});
|
||||
|
||||
{% if company.is_customer %}
|
||||
|
@ -25,6 +25,7 @@
|
||||
<div class='panel-content'>
|
||||
|
||||
<div id='button-toolbar'>
|
||||
{% include "filter_list.html" with id='company' %}
|
||||
</div>
|
||||
|
||||
<table class='table table-striped table-condensed' id='company-table' data-toolbar='#button-toolbar'>
|
||||
|
@ -181,6 +181,9 @@
|
||||
<div class='panel-content'>
|
||||
<div id='param-button-toolbar'>
|
||||
<div class='button-toolbar container-fluid' style='float: right;'>
|
||||
<div class='btn-group' role='group'>
|
||||
{% include "filter_list.html" with id="parameters" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id='parameter-table' class='table table-condensed table-striped' data-toolbar="#param-button-toolbar"></table>
|
||||
@ -217,7 +220,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
<div id='related-button-bar'>
|
||||
<div id='related-button-toolbar'>
|
||||
<div class='btn-group' role='group'>
|
||||
{% include "filter_list.html" with id="related" %}
|
||||
</div>
|
||||
@ -344,6 +347,7 @@
|
||||
<li><a class='dropdown-item' href='#' id='supplier-part-delete' title='{% trans "Delete supplier parts" %}'>{% trans "Delete" %}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{% include "filter_list.html" with id="supplier-part" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -371,6 +375,7 @@
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class='dropdown-item' href='#' id='manufacturer-part-delete' title='{% trans "Delete manufacturer parts" %}'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete" %}</a></li>
|
||||
</ul>
|
||||
{% include "filter_list.html" with id="manufacturer-part" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div id='attachment-buttons'>
|
||||
<div class='btn-group' role='group'>
|
||||
{% include "filter_list.html" with id="related" %}
|
||||
{% include "filter_list.html" with id="attachments" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -67,6 +67,8 @@ function loadAttachmentTable(url, options) {
|
||||
|
||||
var table = options.table || '#attachment-table';
|
||||
|
||||
setupFilterList('attachments', $(table), '#filter-list-attachments');
|
||||
|
||||
addAttachmentButtonCallbacks(url, options.fields || {});
|
||||
|
||||
$(table).inventreeTable({
|
||||
|
@ -380,6 +380,7 @@ function loadCompanyTable(table, url, options={}) {
|
||||
url: url,
|
||||
method: 'get',
|
||||
queryParams: filters,
|
||||
original: params,
|
||||
groupBy: false,
|
||||
sidePagination: 'server',
|
||||
formatNoMatches: function() {
|
||||
@ -463,7 +464,9 @@ function loadManufacturerPartTable(table, url, options) {
|
||||
filters[key] = params[key];
|
||||
}
|
||||
|
||||
setupFilterList('manufacturer-part', $(table));
|
||||
var filterTarget = options.filterTarget || '#filter-list-manufacturer-part';
|
||||
|
||||
setupFilterList('manufacturer-part', $(table), filterTarget);
|
||||
|
||||
$(table).inventreeTable({
|
||||
url: url,
|
||||
|
@ -621,7 +621,9 @@ function loadPartParameterTable(table, url, options) {
|
||||
filters[key] = params[key];
|
||||
}
|
||||
|
||||
// setupFilterList("#part-parameters", $(table));
|
||||
var filterTarget = options.filterTarget || '#filter-list-parameters';
|
||||
|
||||
setupFilterList('part-parameters', $(table), filterTarget);
|
||||
|
||||
$(table).inventreeTable({
|
||||
url: url,
|
||||
|
@ -1468,7 +1468,7 @@ function loadStockTable(table, options) {
|
||||
|
||||
var params = options.params || {};
|
||||
|
||||
var filterListElement = options.filterList || '#filter-list-stock';
|
||||
var filterTarget = options.filterTarget || '#filter-list-stock';
|
||||
|
||||
var filters = {};
|
||||
|
||||
@ -1484,7 +1484,7 @@ function loadStockTable(table, options) {
|
||||
original[k] = params[k];
|
||||
}
|
||||
|
||||
setupFilterList(filterKey, table, filterListElement);
|
||||
setupFilterList(filterKey, table, filterTarget);
|
||||
|
||||
// Override the default values, or add new ones
|
||||
for (var key in params) {
|
||||
|
@ -381,6 +381,24 @@ function getAvailableTableFilters(tableKey) {
|
||||
};
|
||||
}
|
||||
|
||||
// Filters for "company" table
|
||||
if (tableKey == 'company') {
|
||||
return {
|
||||
is_manufacturer: {
|
||||
type: 'bool',
|
||||
title: '{% trans "Manufacturer" %}',
|
||||
},
|
||||
is_supplier: {
|
||||
type: 'bool',
|
||||
title: '{% trans "Supplier" %}',
|
||||
},
|
||||
is_customer: {
|
||||
type: 'bool',
|
||||
title: '{% trans "Customer" %}',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// Filters for the "Parts" table
|
||||
if (tableKey == 'parts') {
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user