partkeepr

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

commit ed99f5541d28cbba4ecc46264bc260f0cade468e
parent ad01683d505ec58b0b79697c9733b7ee1cede2fc
Author: Felicitus <felicitus@felicitus.org>
Date:   Wed, 28 Nov 2012 03:15:46 +0100

Added footprint filter to the part filter panel, fixes #264

Diffstat:
Msrc/backend/PartKeepr/Part/PartService.php | 6++++++
Msrc/frontend/js/Components/Part/PartFilterPanel.js | 43++++++++++++++++++++++++++++++++++++++++---
2 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/src/backend/PartKeepr/Part/PartService.php b/src/backend/PartKeepr/Part/PartService.php @@ -67,6 +67,12 @@ class PartService extends Service implements RestfulService { $queryBuilder->andWhere("mam.id = :manufacturer"); $queryBuilder->setParameter("manufacturer", $this->getParameter("manufacturer")); } + + if ($this->getParameter("footprint") !== null) { + $queryBuilder->andWhere("f.id = :footprintId"); + $queryBuilder->setParameter("footprintId", $this->getParameter("footprint")); + } + /** * Filter by the category id and set the category mode * diff --git a/src/frontend/js/Components/Part/PartFilterPanel.js b/src/frontend/js/Components/Part/PartFilterPanel.js @@ -63,7 +63,8 @@ Ext.define('PartKeepr.PartFilterPanel', { this.stockFilter, this.distributorOrderNumberFilter, this.distributorFilter, - this.manufacturerFilter + this.manufacturerFilter, + this.footprintFilter ] }; @@ -132,8 +133,12 @@ Ext.define('PartKeepr.PartFilterPanel', { this.distributorFilterCombo.setValue(""); this.distributorFilterCheckbox.setValue(false); + this.manufacturerFilterCombo.setValue(""); this.manufacturerFilterCheckbox.setValue(false); + + this.footprintFilterCombo.setValue(""); + this.footprintFilterCheckbox.setValue(false); this.onApply(); }, @@ -322,8 +327,34 @@ Ext.define('PartKeepr.PartFilterPanel', { items: [ this.distributorFilterCheckbox, this.distributorFilterCombo ], fieldLabel: i18n("Distributor") }); - - + + this.footprintFilterCheckbox = Ext.create("Ext.form.field.Checkbox", { + style: 'margin-right: 5px', + listeners: { + change: function (obj, value) { + if (!value) { + this.footprintFilterCombo.setValue(""); + } + }, + scope: this + } + }); + + this.footprintFilterCombo = Ext.create("PartKeepr.FootprintComboBox", { + flex: 1, + listeners: { + select: function () { + this.footprintFilterCheckbox.setValue(true); + }, + scope: this + } + }); + + this.footprintFilter = Ext.create("Ext.form.FieldContainer", { + layout: 'hbox', + items: [ this.footprintFilterCheckbox, this.footprintFilterCombo ], + fieldLabel: i18n("Footprint") + }); }, /** @@ -356,6 +387,12 @@ Ext.define('PartKeepr.PartFilterPanel', { } else { delete extraParams.distributor; } + + if (this.footprintFilterCombo.getRawValue() !== "") { + extraParams.footprint = this.footprintFilterCombo.getValue(); + } else { + delete extraParams.footprint; + } extraParams.createDateRestriction = this.createDateFilterSelect.getValue(); var createDate = Ext.util.Format.date(this.createDateField.getValue(), "Y-m-d H:i:s");