From 8daa3ae89c9bfae99edb257ee31a2f7eee2efe4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Tue, 8 Sep 2020 10:11:22 +0200 Subject: [PATCH] html changes --- .../front/catalog-search-panel/index.html | 63 ++++++++++++++++++- .../order/front/catalog-search-panel/index.js | 43 ++++++++++++- modules/order/front/catalog/index.html | 4 +- modules/order/front/catalog/index.js | 5 +- 4 files changed, 108 insertions(+), 7 deletions(-) diff --git a/modules/order/front/catalog-search-panel/index.html b/modules/order/front/catalog-search-panel/index.html index d32ecaafac..4cca58ade1 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 99f3e1c122..9f77e0dee9 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 ddfe69cc96..8b83f131a4 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(); */ } /**