diff --git a/client/core/src/colum-header/colum-header.html b/client/core/src/colum-header/colum-header.html index 286a6774a..8472abe53 100644 --- a/client/core/src/colum-header/colum-header.html +++ b/client/core/src/colum-header/colum-header.html @@ -1,11 +1,11 @@ -
+
{{::$ctrl.text}} - - + + diff --git a/client/core/src/colum-header/colum-header.js b/client/core/src/colum-header/colum-header.js index d30631db7..ad9c57aad 100644 --- a/client/core/src/colum-header/colum-header.js +++ b/client/core/src/colum-header/colum-header.js @@ -3,6 +3,7 @@ import {module} from '../module'; export default class ColumHeader { constructor() { this.order = undefined; + this.mouseIsOver = false; } onClick() { if (this.order === 'ASC') { @@ -12,6 +13,14 @@ export default class ColumHeader { } this.gridHeader.selectColum(this); } + showArrow(type) { + let showArrow = (this.gridHeader && this.gridHeader.currentColumn && this.gridHeader.currentColumn.field === this.field && this.order === type); + let showOther = (this.gridHeader && this.gridHeader.currentColumn && this.gridHeader.currentColumn.field === this.field && this.order !== type); + if (type === 'DESC' && this.mouseIsOver && !showOther) { + showArrow = true; + } + return showArrow; + } } ColumHeader.$inject = []; diff --git a/client/core/src/drop-down/drop-down.html b/client/core/src/drop-down/drop-down.html index ef9b218c8..dad08a84f 100644 --- a/client/core/src/drop-down/drop-down.html +++ b/client/core/src/drop-down/drop-down.html @@ -1,13 +1,18 @@ - +
+ +
+
+ +
diff --git a/client/core/src/drop-down/drop-down.js b/client/core/src/drop-down/drop-down.js index 2ab79c06c..ddde9e9d5 100644 --- a/client/core/src/drop-down/drop-down.js +++ b/client/core/src/drop-down/drop-down.js @@ -2,34 +2,43 @@ import {module} from '../module'; import './style.scss'; export default class DropDown { - constructor($element, $scope) { + constructor($element, $filter) { this.$element = $element; - this.$ = $scope; - this._showLoadMore = false; + this.$filter = $filter; + this.search = ''; + this.itemsFiltered = []; + } - get showLoadMore() { - return this._showLoadMore; + + filterItems() { + this.itemsFiltered = this.search ? this.$filter('filter')(this.items, this.search) : this.items; } - set showLoadMore(value) { - this._showLoadMore = value; + + onFilterRest() { + this.showLoadMore = false; + if (this.filterAction) { + this.filterAction({search: this.search}); + } } $onChanges(changesObj) { if (changesObj.show && changesObj.top && changesObj.top.currentValue) { this.$element.css('top', changesObj.top.currentValue + 'px'); } - if (this.loadMore) { - this.showLoadMore = true; + if (changesObj.items) { + this.filterItems(); } } + clearSearch() { - this.$.search = ''; - } - $onInit() { - this.clearSearch(); + this.search = ''; + this.showLoadMore = this.loadMore != null; + if (this.filterAction) { + this.filterAction(); + } } } -DropDown.$inject = ['$element', '$scope']; +DropDown.$inject = ['$element', '$filter']; module.component('vnDropDown', { template: require('./drop-down.html'), @@ -40,6 +49,8 @@ module.component('vnDropDown', { filter: '@?', selected: '=', loadMore: '&?', + filterAction: '&?', + showLoadMore: ' - +
+ +
+
+ +
\ 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 bfb4f2660..a276923fe 100644 --- a/client/core/src/icon-menu/icon-menu.js +++ b/client/core/src/icon-menu/icon-menu.js @@ -14,15 +14,53 @@ export default class IconMenu { set showDropDown(value) { this._showDropDown = value; } + findItems(search) { + if (!this.url) + return this.items ? this.items : []; + + if (search) { + let filter = {where: {name: {regexp: search}}}; + let json = JSON.stringify(filter); + + this.$http.get(`${this.url}?filter=${json}`).then( + json => { + this.items = json.data; + } + ); + } else { + this.items = []; + this.getItems(); + } + } getItems() { - this.$http.get(this.url).then( + let filter = {}; + + if (this.maxRow) { + if (this.items) { + filter.skip = this.items.length; + } + filter.limit = this.maxRow; + filter.order = 'name ASC'; + } + + let json = JSON.stringify(filter); + + this.$http.get(`${this.url}?filter=${json}`).then( json => { - this.items = json.data; + if (json.data.length) + json.data.forEach( + el => { + this.items.push(el); + } + ); + else + this.maxRow = false; } ); } $onInit() { if (!this.items && this.url) { + this.items = []; this.getItems(); } @@ -51,6 +89,7 @@ module.component('vnIconMenu', { url: '@?', items: ' - diff --git a/client/production/src/production-table/production-table.html b/client/production/src/production-table/production-table.html index 29af2918a..dbc230452 100644 --- a/client/production/src/production-table/production-table.html +++ b/client/production/src/production-table/production-table.html @@ -43,8 +43,8 @@ {{$ctrl.footer.total}} - {{$ctrl.footer.lines}} - {{$ctrl.footer.meters}} + {{$ctrl.footer.lines}} + {{$ctrl.footer.meters}} diff --git a/services/salix/server/boot/routes.js b/services/salix/server/boot/routes.js index aa509b034..a884ce8b2 100644 --- a/services/salix/server/boot/routes.js +++ b/services/salix/server/boot/routes.js @@ -85,6 +85,7 @@ module.exports = function (app) { //acl.userProfile = userProfile; acl.userProfile.id = userProfile.id; acl.userProfile.username = userProfile.username; + acl.userProfile.warehouseId = 1; sendACL(res, acl); }); }