More cleanup

- Allow user filtering for purchase-order table in part view
- Remove some debug strings
This commit is contained in:
Oliver Walters 2020-04-13 20:01:19 +10:00
parent eb3b5308ab
commit ea466c3588
5 changed files with 7 additions and 16 deletions

View File

@ -73,8 +73,6 @@ function saveTableFilters(tableKey, filters) {
var filterstring = strings.join('&'); var filterstring = strings.join('&');
console.log(`Saving filters for table '${tableKey}' - ${filterstring}`);
inventreeSave(lookup, filterstring); inventreeSave(lookup, filterstring);
} }
@ -256,12 +254,8 @@ function setupFilterList(tableKey, table, target) {
var clear = `filter-clear-${tableKey}`; var clear = `filter-clear-${tableKey}`;
var make = `filter-make-${tableKey}`; var make = `filter-make-${tableKey}`;
console.log(`Generating filter list: ${tableKey}`);
var filters = loadTableFilters(tableKey); var filters = loadTableFilters(tableKey);
console.log("Filters: " + filters.count);
var element = $(target); var element = $(target);
// One blank slate, please // One blank slate, please

View File

@ -114,7 +114,7 @@ function loadPurchaseOrderTable(table, options) {
setupFilterList("order", table); setupFilterList("order", table);
table.inventreeTable({ $(table).inventreeTable({
url: options.url, url: options.url,
queryParams: filters, queryParams: filters,
groupBy: false, groupBy: false,

View File

@ -25,7 +25,7 @@
{% block js_ready %} {% block js_ready %}
{{ block.super }} {{ block.super }}
loadPurchaseOrderTable($("#purchase-order-table"), { loadPurchaseOrderTable("#purchase-order-table", {
url: "{% url 'api-po-list' %}?supplier={{ company.id }}", url: "{% url 'api-po-list' %}?supplier={{ company.id }}",
}); });
@ -48,7 +48,4 @@
newOrder(); newOrder();
}); });
$(".po-table").inventreeTable({
});
{% endblock %} {% endblock %}

View File

@ -37,10 +37,7 @@ $("#po-create").click(function() {
); );
}); });
$("#po-table").inventreeTable({ loadPurchaseOrderTable("#purchase-order-table", {
});
loadPurchaseOrderTable($("#purchase-order-table"), {
url: "{% url 'api-po-list' %}", url: "{% url 'api-po-list' %}",
}); });

View File

@ -9,8 +9,11 @@
<hr> <hr>
<div id='button-bar'> <div id='button-bar'>
<div class='btn-group'> <div class='button-toolbar container-fluid' style='float: right;'>
<button class='btn btn-primary' type='button' id='part-order2' title='Order part'>Order Part</button> <button class='btn btn-primary' type='button' id='part-order2' title='Order part'>Order Part</button>
<div class='filter-list' id='filter-list-order'>
<!-- An empty div in which the filter list will be constructed -->
</div>
</div> </div>
</div> </div>