diff --git a/modules/order/front/catalog-search-panel/index.html b/modules/order/front/catalog-search-panel/index.html index d32ecaafa..4cca58ade 100644 --- a/modules/order/front/catalog-search-panel/index.html +++ b/modules/order/front/catalog-search-panel/index.html @@ -1,6 +1,7 @@ +
- + + + + + + Tags + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/order/front/catalog-search-panel/index.js b/modules/order/front/catalog-search-panel/index.js index 99f3e1c12..9f77e0dee 100644 --- a/modules/order/front/catalog-search-panel/index.js +++ b/modules/order/front/catalog-search-panel/index.js @@ -1,10 +1,49 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; +class Controller extends SearchPanel { + constructor($element, $) { + super($element, $); + + this.filter = {}; + } + + get filter() { + return this.$.filter; + } + + set filter(value) { + if (!value) + value = {}; + if (!value.tags) + value.tags = [{}]; + + this.$.filter = value; + } + + getSourceTable(selection) { + if (!selection || selection.isFree === true) + return null; + + if (selection.sourceTable) { + return '' + + selection.sourceTable.charAt(0).toUpperCase() + + selection.sourceTable.substring(1) + 's'; + } else if (selection.sourceTable == null) + return `ItemTags/filterItemTags/${selection.id}`; + } + + addTag() { + this.filter.tags.push({}); + this.popover.relocate(); + } +} + ngModule.vnComponent('vnOrderCatalogSearchPanel', { template: require('./index.html'), - controller: SearchPanel, + controller: Controller, bindings: { - onSubmit: '&?' + onSubmit: '&?', + popover: ' + on-submit="$ctrl.onPanelSubmit($filter)" + popover="popover">
diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index ddfe69cc9..8b83f131a 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -243,10 +243,11 @@ class Controller extends Section { } onPanelSubmit(filter) { - this.$.popover.hide(); + console.log(filter); + /* this.$.popover.hide(); this.tags.push(filter); this.updateStateParams(); - this.applyFilters(); + this.applyFilters(); */ } /**