partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit a6e56f216a40204fe2c9d8c6df4ab934fc0cc873
parent ab96843f90113d0583b7bf92705a51ccf063421f
Author: Timo A. Hummel <felicitus@felicitus.org>
Date:   Thu, 11 Feb 2016 23:42:20 +0100

Merge pull request #597 from partkeepr/PartKeepr-587

Use category filter only when the part manager is passed. Category fi…
Diffstat:
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartFilterPanel.js | 62+++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 33 insertions(+), 29 deletions(-)

diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartFilterPanel.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartFilterPanel.js @@ -228,24 +228,26 @@ Ext.define('PartKeepr.PartFilterPanel', { fieldLabel: i18n("Storage Location") }); - // Create the category scope field - this.categoryFilter = Ext.create("Ext.form.RadioGroup", { - fieldLabel: i18n("Category Scope"), - columns: 1, - items: [ - { - boxLabel: i18n("All Subcategories"), - name: 'category', - inputValue: "all", - checked: true - }, - { - boxLabel: i18n("Selected Category"), - name: 'category', - inputValue: "selected" - } - ] - }); + if (this.partManager !== null) { + // Create the category scope field + this.categoryFilter = Ext.create("Ext.form.RadioGroup", { + fieldLabel: i18n("Category Scope"), + columns: 1, + items: [ + { + boxLabel: i18n("All Subcategories"), + name: 'category', + inputValue: "all", + checked: true + }, + { + boxLabel: i18n("Selected Category"), + name: 'category', + inputValue: "selected" + } + ] + }); + } // Create the stock level filter field this.stockFilter = Ext.create("Ext.form.RadioGroup", { @@ -457,22 +459,24 @@ Ext.define('PartKeepr.PartFilterPanel', { })); } - if (this.categoryFilter.getValue().category === "all") { - if (this.partManager.getSelectedCategory() !== null) { + if (this.partManager !== null) { + if (this.categoryFilter.getValue().category === "all") { + if (this.partManager.getSelectedCategory() !== null) { + filters.push(Ext.create("Ext.util.Filter", { + id: 'categoryFilter', + property: 'category', + operator: 'IN', + value: this.partManager.getChildrenIds(this.partManager.getSelectedCategory()) + })); + } + } else { filters.push(Ext.create("Ext.util.Filter", { id: 'categoryFilter', property: 'category', - operator: 'IN', - value: this.partManager.getChildrenIds(this.partManager.getSelectedCategory()) + operator: '=', + value: this.partManager.getSelectedCategory() })); } - } else { - filters.push(Ext.create("Ext.util.Filter", { - id: 'categoryFilter', - property: 'category', - operator: '=', - value: this.partManager.getSelectedCategory() - })); } if (this.partsWithoutPrice.getValue() === true) {