diff --git a/client/core/src/autocomplete/autocomplete.js b/client/core/src/autocomplete/autocomplete.js index 81e3206764..8b4d65c1e7 100644 --- a/client/core/src/autocomplete/autocomplete.js +++ b/client/core/src/autocomplete/autocomplete.js @@ -81,7 +81,7 @@ export default class Autocomplete extends Component { && !this.moreData && textFilter.substr(0, lastRequest.length) === lastRequest; - if (requestWillSame) + if (requestWillSame || !this.url) this.localFilter(textFilter); else if (this.url) this.requestData(textFilter, false); diff --git a/client/core/src/directives/validation.js b/client/core/src/directives/validation.js index 0b0939318a..8159017b69 100644 --- a/client/core/src/directives/validation.js +++ b/client/core/src/directives/validation.js @@ -6,7 +6,7 @@ directive.$inject = ['$interpolate', '$compile', '$window']; export function directive(interpolate, compile, $window) { return { restrict: 'A', - require: ['ngModel', '^^form'], + require: ['ngModel', '?^^form'], link: link }; diff --git a/client/core/src/icon-button/icon-button.html b/client/core/src/icon-button/icon-button.html index 9c5f9c5fe3..4bd12c6204 100644 --- a/client/core/src/icon-button/icon-button.html +++ b/client/core/src/icon-button/icon-button.html @@ -1,3 +1,3 @@ - \ No newline at end of file diff --git a/client/core/src/icon-button/icon-button.js b/client/core/src/icon-button/icon-button.js index 55d4b10704..4201a37a89 100644 --- a/client/core/src/icon-button/icon-button.js +++ b/client/core/src/icon-button/icon-button.js @@ -4,7 +4,7 @@ _module.component('vnIconButton', { template: require('./icon-button.html'), bindings: { icon: '@', - className: ' - - + + \ No newline at end of file diff --git a/client/core/src/icon-menu/icon-menu.js b/client/core/src/icon-menu/icon-menu.js index 23d84b041d..766b412478 100644 --- a/client/core/src/icon-menu/icon-menu.js +++ b/client/core/src/icon-menu/icon-menu.js @@ -50,10 +50,9 @@ module.component('vnIconMenu', { template: require('./icon-menu.html'), bindings: { url: '@?', - items: '=?', + items: '{{i.icon}}', + template: '{{::$ctrl.icon}}', bindings: { icon: '@' - }, - controllerAs: 'i' + } }); diff --git a/client/core/src/popover/popover.js b/client/core/src/popover/popover.js index 46e772681c..7abe382e3e 100644 --- a/client/core/src/popover/popover.js +++ b/client/core/src/popover/popover.js @@ -16,9 +16,11 @@ export function directive(vnPopover) { module.directive('vnPopover', directive); export class Popover { - constructor($document, $compile) { + constructor($document, $compile, $timeout) { this.document = $document[0]; this.$compile = $compile; + this.$timeout = $timeout; + this.removeScope = false; } show(childElement, parent) { this.childElement = childElement; @@ -80,7 +82,8 @@ export class Popover { } showComponent(childComponent, $scope, parent) { let childElement = this.document.createElement(childComponent); - this.$compile(childElement)($scope); + this.removeScope = true; + this.$compile(childElement)($scope.$new()); this.show(childElement, parent); return childElement; } @@ -93,7 +96,10 @@ export class Popover { this.lastEvent = null; this.docMouseDownHandler = null; this.docKeyDownHandler = null; - angular.element(this.childElement).remove(); + if (this.removeScope) { + angular.element(this.childElement).scope().$destroy(); + angular.element(this.childElement).remove(); + } } onDocMouseDown(event) { if (event != this.lastEvent) @@ -107,5 +113,5 @@ export class Popover { this.lastEvent = event; } } -Popover.$inject = ['$document', '$compile']; +Popover.$inject = ['$document', '$compile', '$timeout']; module.service('vnPopover', Popover); diff --git a/client/production/src/filter-panel/filter-panel.js b/client/production/src/filter-panel/filter-panel.js deleted file mode 100644 index 907df7f145..0000000000 --- a/client/production/src/filter-panel/filter-panel.js +++ /dev/null @@ -1,29 +0,0 @@ -import ngModule from '../module'; -import './style.scss'; - -export default class Controller { - constructor($window) { - this.$window = $window; - } - /* $onDestroy() { - console.log('panel destruido'); - }*/ - onSearch() { - this.setStorageValue(); - this.onSubmit(this.filter); - } - $onChanges() { - var value = JSON.parse(this.$window.sessionStorage.getItem('filter')); - if (value !== undefined) - this.filter = value; - } - setStorageValue() { - this.$window.sessionStorage.setItem('filter', JSON.stringify(this.filter)); - } -} -Controller.$inject = ['$window']; - -ngModule.component('vnProductionFilterPanel', { - template: require('./filter-panel.html'), - controller: Controller -}); diff --git a/client/production/src/filter-panel/style.scss b/client/production/src/filter-panel/style.scss deleted file mode 100644 index f943570873..0000000000 --- a/client/production/src/filter-panel/style.scss +++ /dev/null @@ -1,6 +0,0 @@ -vn-production-filter-panel { - button { - color: #ffa410 !important; - background-color: white !important; - } -} \ No newline at end of file diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index 8eed566b28..7dd6b4dc4c 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -2,113 +2,102 @@ - - - Localizador - - - - - - - - - - - - - - - - - + + + Localizador + + + + + + + + + + + - - - - + + + + - - - - + + + + - + - + - + - + - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - + + - - {{::ticket.ticket}} - {{::ticket.agency}} - {{::ticket.salePerson | ucwords}} - {{::ticket.hour}} - {{ticket.state}} - {{::ticket.lines}} - {{::ticket.m3}} - {{::ticket.boxes}} - - - - - - - - - : + + {{::ticket.ticket}} + {{::ticket.agency}} + {{::ticket.salePerson | ucwords}} + {{::ticket.hour}} + {{ticket.state}} + {{::ticket.lines}} + {{::ticket.m3}} + {{::ticket.boxes}} + + + + + + + + + : {{$ctrl.tickets.length}} - - - {{$ctrl.lines}} - {{$ctrl.meters}} - - - - + + + {{$ctrl.lines}} + {{$ctrl.meters}} + + + + \ No newline at end of file diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js index 68929bdd19..cdd4f63c35 100644 --- a/client/production/src/index/index.js +++ b/client/production/src/index/index.js @@ -2,10 +2,11 @@ import ngModule from '../module'; import './style.scss'; export default class ProductionIndex { - constructor($element, $scope, $http) { + constructor($element, $scope, $http, vnPopover) { this.$element = $element; this.$ = $scope; this.$http = $http; + this.vnPopover = vnPopover; this.filter = {}; this._checkAll = false; this.tickets = []; @@ -99,8 +100,16 @@ export default class ProductionIndex { this.hourItems.push({id: i, name: hour}); } } + moreFilters(event) { + var child = this.vnPopover.showComponent('vn-production-filter-panel', this.$, this.$element[0].querySelector('.filterPanel')); + var childCtrl = angular.element(child).isolateScope().$ctrl; + childCtrl.filter = Object.assign({}, this.index.filter); + childCtrl.onSubmit = filter => this.onChildSubmit(filter); + + event.preventDefault(); + } } -ProductionIndex.$inject = ['$element', '$scope', '$http']; +ProductionIndex.$inject = ['$element', '$scope', '$http', 'vnPopover']; ngModule.component('vnProductionIndex', { template: require('./index.html'), diff --git a/client/production/src/filter-panel/filter-panel.html b/client/production/src/production-filters/production-filters.html similarity index 95% rename from client/production/src/filter-panel/filter-panel.html rename to client/production/src/production-filters/production-filters.html index 5ef3ecddaa..bbd638e048 100644 --- a/client/production/src/filter-panel/filter-panel.html +++ b/client/production/src/production-filters/production-filters.html @@ -1,5 +1,5 @@ -
+ diff --git a/client/production/src/production-filters/production-filters.js b/client/production/src/production-filters/production-filters.js new file mode 100644 index 0000000000..b74136113f --- /dev/null +++ b/client/production/src/production-filters/production-filters.js @@ -0,0 +1,13 @@ +import ngModule from '../module'; + +export default class Controller { + constructor($window) { + this.$window = $window; + } +} +Controller.$inject = ['$window']; + +ngModule.component('vnProductionFilterPanel', { + template: require('./production-filters.html'), + controller: Controller +}); diff --git a/client/production/src/production.js b/client/production/src/production.js index f36e961565..e7a2703053 100644 --- a/client/production/src/production.js +++ b/client/production/src/production.js @@ -3,4 +3,4 @@ export * from './module'; // import components import './index/index'; -import './filter-panel/filter-panel'; +import './production-filters/production-filters'; diff --git a/client/salix/src/components/searchbar/searchbar.html b/client/salix/src/components/searchbar/searchbar.html index 0ca47a768b..26df711088 100644 --- a/client/salix/src/components/searchbar/searchbar.html +++ b/client/salix/src/components/searchbar/searchbar.html @@ -2,6 +2,7 @@