From 0a215123293ef21ce4289fbcc290e0c404a6d23c Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 21 Dec 2021 16:41:34 +1100 Subject: [PATCH 1/6] Adds refresh and filtering for "company" table --- InvenTree/company/templates/company/index.html | 1 + InvenTree/templates/js/translated/company.js | 1 + .../templates/js/translated/table_filters.js | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/InvenTree/company/templates/company/index.html b/InvenTree/company/templates/company/index.html index 1654ab04b5..d7fbee1732 100644 --- a/InvenTree/company/templates/company/index.html +++ b/InvenTree/company/templates/company/index.html @@ -25,6 +25,7 @@
+ {% include "filter_list.html" with id='company' %}
diff --git a/InvenTree/templates/js/translated/company.js b/InvenTree/templates/js/translated/company.js index 4ab7a7fa3d..176f2f9f72 100644 --- a/InvenTree/templates/js/translated/company.js +++ b/InvenTree/templates/js/translated/company.js @@ -380,6 +380,7 @@ function loadCompanyTable(table, url, options={}) { url: url, method: 'get', queryParams: filters, + original: params, groupBy: false, sidePagination: 'server', formatNoMatches: function() { diff --git a/InvenTree/templates/js/translated/table_filters.js b/InvenTree/templates/js/translated/table_filters.js index 76c129abdc..d9f2014c14 100644 --- a/InvenTree/templates/js/translated/table_filters.js +++ b/InvenTree/templates/js/translated/table_filters.js @@ -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 { From 46aeafb5da6d52c6c157033446eee55d1c8987fb Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 21 Dec 2021 16:44:49 +1100 Subject: [PATCH 2/6] Adds filter for "assigned stock" view on customer page --- InvenTree/company/templates/company/detail.html | 5 +++-- InvenTree/templates/js/translated/stock.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/InvenTree/company/templates/company/detail.html b/InvenTree/company/templates/company/detail.html index 4181d81b6f..4464136535 100644 --- a/InvenTree/company/templates/company/detail.html +++ b/InvenTree/company/templates/company/detail.html @@ -169,10 +169,10 @@
- {% include "filter_list.html" with id="stock" %} + {% include "filter_list.html" with id="customerstock" %}
-
+
@@ -225,6 +225,7 @@ }, url: "{% url 'api-stock-list' %}", filterKey: "customerstock", + filterTarget: '#filter-list-customerstock', }); {% if company.is_customer %} diff --git a/InvenTree/templates/js/translated/stock.js b/InvenTree/templates/js/translated/stock.js index 77aed29c11..988b93cad9 100644 --- a/InvenTree/templates/js/translated/stock.js +++ b/InvenTree/templates/js/translated/stock.js @@ -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) { From 9884c0fadbb24ad7c6466b99da0b838679f0686c Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 21 Dec 2021 16:47:20 +1100 Subject: [PATCH 3/6] Adds filters for "manufacturer-parts" list --- InvenTree/company/templates/company/detail.html | 2 +- InvenTree/templates/js/translated/company.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/InvenTree/company/templates/company/detail.html b/InvenTree/company/templates/company/detail.html index 4464136535..b808a26f08 100644 --- a/InvenTree/company/templates/company/detail.html +++ b/InvenTree/company/templates/company/detail.html @@ -92,8 +92,8 @@ {% endif %} + {% include "filter_list.html" with id="manufacturer-part" %} - {% include "filter_list.html" with id="supplier-part" %} {% endif %} diff --git a/InvenTree/templates/js/translated/company.js b/InvenTree/templates/js/translated/company.js index 176f2f9f72..c92bb75d6f 100644 --- a/InvenTree/templates/js/translated/company.js +++ b/InvenTree/templates/js/translated/company.js @@ -464,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, From dbc385ac24c4f4444a5ddec71f2b528321bdd8c9 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 21 Dec 2021 16:48:34 +1100 Subject: [PATCH 4/6] Fix for "supplier-parts" view --- InvenTree/company/templates/company/detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/company/templates/company/detail.html b/InvenTree/company/templates/company/detail.html index b808a26f08..e63f217f4b 100644 --- a/InvenTree/company/templates/company/detail.html +++ b/InvenTree/company/templates/company/detail.html @@ -45,8 +45,8 @@ {% endif %} + {% include "filter_list.html" with id="supplier-part" %} - {% include "filter_list.html" with id="supplier-part" %} {% endif %} From 103f98b66542805077a3965c0b158139ef344b5d Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 21 Dec 2021 16:51:26 +1100 Subject: [PATCH 5/6] Adds "reload" button to attachment table(s) --- InvenTree/templates/attachment_table.html | 2 +- InvenTree/templates/js/translated/attachment.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/InvenTree/templates/attachment_table.html b/InvenTree/templates/attachment_table.html index cbd47dd3cf..cd73e864a1 100644 --- a/InvenTree/templates/attachment_table.html +++ b/InvenTree/templates/attachment_table.html @@ -2,7 +2,7 @@
- {% include "filter_list.html" with id="related" %} + {% include "filter_list.html" with id="attachments" %}
diff --git a/InvenTree/templates/js/translated/attachment.js b/InvenTree/templates/js/translated/attachment.js index 5c5af5682f..44061403fa 100644 --- a/InvenTree/templates/js/translated/attachment.js +++ b/InvenTree/templates/js/translated/attachment.js @@ -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({ From 0060bb074e499e5aaef9d05d709ae1e9b8278e8c Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 21 Dec 2021 16:56:47 +1100 Subject: [PATCH 6/6] Updates for various part views --- InvenTree/part/templates/part/detail.html | 7 ++++++- InvenTree/templates/js/translated/part.js | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index d16de22e1b..999a9cba63 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -181,6 +181,9 @@
+
+ {% include "filter_list.html" with id="parameters" %} +
@@ -217,7 +220,7 @@
-
@@ -371,6 +375,7 @@ + {% include "filter_list.html" with id="manufacturer-part" %} diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index 7d9ba454e8..a357a965ed 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -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,