diff --git a/client/client/src/address/edit/index.html b/client/client/src/address/edit/index.html index 9ccdd5fb2..40a932dc4 100644 --- a/client/client/src/address/edit/index.html +++ b/client/client/src/address/edit/index.html @@ -75,20 +75,20 @@ - - + - - + ng-click="$ctrl.removeObservation($index)" + tabindex="-1"> + + + +
- - - - - + + + - + + ng-repeat="client in clients track by client.id" + client="::client"> - - + +
@@ -30,4 +35,4 @@ - + \ No newline at end of file diff --git a/client/client/src/index/index.js b/client/client/src/index/index.js index 57a109c03..175ddb7d2 100644 --- a/client/client/src/index/index.js +++ b/client/client/src/index/index.js @@ -2,23 +2,42 @@ import ngModule from '../module'; import './item-client'; export default class Controller { - constructor($scope) { - this.$scope = $scope; + this.$ = $scope; this.clientSelected = null; } - search(index) { - index.accept(); - /* this.clients = []; - index.accept().then(res => { - this.clients = res.instances; - }); */ + exprBuilder(param, value) { + switch (param) { + case 'search': + return { + or: [ + {id: value}, + {name: {regexp: value}} + ] + }; + case 'phone': + return { + or: [ + {phone: value}, + {mobile: value} + ] + }; + case 'name': + case 'socialName': + case 'city': + return {[param]: {regexp: value}}; + case 'id': + case 'fi': + case 'postcode': + case 'email': + return {[param]: value}; + } } openSummary(client) { this.clientSelected = client; - this.$scope.dialogSummaryClient.show(); + this.$.dialogSummaryClient.show(); } } Controller.$inject = ['$scope']; diff --git a/client/client/src/index/locale/es.yml b/client/client/src/index/locale/es.yml index c221de7f6..97ad69ac3 100644 --- a/client/client/src/index/locale/es.yml +++ b/client/client/src/index/locale/es.yml @@ -2,4 +2,5 @@ Client id: Id cliente Phone: Teléfono Town/City: Ciudad Email: Correo electrónico -Create client: Crear cliente \ No newline at end of file +Create client: Crear cliente +View client: Ver cliente \ No newline at end of file diff --git a/client/client/src/search-panel/index.html b/client/client/src/search-panel/index.html index 2cb6a5aeb..de772afe3 100644 --- a/client/client/src/search-panel/index.html +++ b/client/client/src/search-panel/index.html @@ -1,22 +1,22 @@
- - + + - + - + - - + + - - + + diff --git a/client/client/src/search-panel/index.js b/client/client/src/search-panel/index.js index 5033dcb65..2ed83601a 100644 --- a/client/client/src/search-panel/index.js +++ b/client/client/src/search-panel/index.js @@ -1,18 +1,7 @@ import ngModule from '../module'; - -export default class Controller { - constructor() { - // onSubmit() is defined by @vnSearchbar - this.onSubmit = () => {}; - } - - onSearch() { - this.onSubmit(this.filter); - } -} -Controller.$inject = []; +import SearchPanel from 'core/src/components/searchbar/search-panel'; ngModule.component('vnClientSearchPanel', { template: require('./index.html'), - controller: Controller + controller: SearchPanel }); diff --git a/client/core/src/components/icon-button/icon-button.js b/client/core/src/components/icon-button/icon-button.js index 2da16cf1e..eb0e3dd49 100644 --- a/client/core/src/components/icon-button/icon-button.js +++ b/client/core/src/components/icon-button/icon-button.js @@ -3,7 +3,8 @@ import './style.scss'; export default class IconButton { constructor($element) { - $element[0].tabIndex = 0; + if ($element[0].getAttribute('tabindex') == null) + $element[0].tabIndex = 0; $element.on("keyup", event => this.onKeyDown(event, $element)); } diff --git a/client/core/src/components/icon-button/style.scss b/client/core/src/components/icon-button/style.scss index e748a4ba4..bd1f3f142 100644 --- a/client/core/src/components/icon-button/style.scss +++ b/client/core/src/components/icon-button/style.scss @@ -2,32 +2,16 @@ vn-icon-button { display: inline-block; - text-align: center; color: rgba($main-01, 0.7); + font-size: 18pt; transition: color 200ms ease-in-out; cursor: pointer; - &.button { - background-color: $main-01; - color: white; - width: 64px; - height: 36px; - box-shadow: rgba(0, 0, 0, 0.14) 0px 2px 2px 0px, rgba(0, 0, 0, 0.2) 0px 3px 1px -2px, rgba(0, 0, 0, 0.12) 0px 1px 5px 0px; - border-radius: 2px; - } - &.button:focus { - will-change: box-shadow; - box-shadow: 0 0 8px rgba(0,0,0,.18),0 8px 16px rgba(0,0,0,.36); - transition: box-shadow .2s cubic-bezier(.4,0,1,1),background-color .2s cubic-bezier(.4,0,.2,1),color .2s cubic-bezier(.4,0,.2,1); - } - &.button i { - margin-top: 6px; - } - & > i, - & > i.material-icons { + & > vn-icon { display: block; font-size: inherit; color: inherit; + margin: 0 auto; } &:not(.button):hover { color: $main-01; diff --git a/client/core/src/components/index.js b/client/core/src/components/index.js index fb18d0eaa..84ced2ea1 100644 --- a/client/core/src/components/index.js +++ b/client/core/src/components/index.js @@ -3,7 +3,6 @@ import './rest-model/crud-model'; import './rest-model/rest-model'; import './watcher/watcher'; import './textfield/textfield'; -import './paging/paging'; import './icon/icon'; import './dialog/dialog'; import './confirm/confirm'; @@ -34,4 +33,7 @@ import './switch/switch'; import './float-button/float-button'; import './step-control/step-control'; import './label-value/label-value'; +import './paging/paging'; import './auto-paging/auto-paging'; +import './pagination/pagination'; +import './searchbar/searchbar'; diff --git a/client/core/src/components/label-value/label-value.js b/client/core/src/components/label-value/label-value.js index 09a6b28d6..60fcb4548 100644 --- a/client/core/src/components/label-value/label-value.js +++ b/client/core/src/components/label-value/label-value.js @@ -2,7 +2,7 @@ import ngModule from '../../module'; import './style.scss'; ngModule.component('vnLabelValue', { - template: require('../label-value/label-value.html'), + template: require('./label-value.html'), replace: true, transclude: true, bindings: { diff --git a/client/core/src/components/model-proxy/model-proxy.js b/client/core/src/components/model-proxy/model-proxy.js index ab010d651..d0fdff939 100644 --- a/client/core/src/components/model-proxy/model-proxy.js +++ b/client/core/src/components/model-proxy/model-proxy.js @@ -12,13 +12,17 @@ export default class ModelProxy { set orgData(value) { this._orgData = value; - this._data = []; // this._data.splice(0, this._data.length); - for (let i = 0; i < value.length; i++) { - let row = new this.Row(value[i], i); - this._data.push(row); - } + if (this.Row) { + this._data = []; + + for (let i = 0; i < value.length; i++) { + let row = new this.Row(value[i], i); + this._data.push(row); + } + } else + this._data = value; this.resetChanges(); } @@ -112,6 +116,11 @@ export default class ModelProxy { this.resetChanges(); } + + dataChanged() { + if (this.onDataChange) + this.onDataChange(); + } } ngModule.component('vnModelProxy', { @@ -120,6 +129,7 @@ ngModule.component('vnModelProxy', { orgData: ' + + + + +
\ No newline at end of file diff --git a/client/core/src/components/pagination/pagination.js b/client/core/src/components/pagination/pagination.js new file mode 100644 index 000000000..604e37b01 --- /dev/null +++ b/client/core/src/components/pagination/pagination.js @@ -0,0 +1,75 @@ +import ngModule from '../../module'; +import Component from '../../lib/component'; +import './style.scss'; + +/** + * Pagination component that automatically loads more rows when + * the user scrolls down an element. + * + * @property {CrudModel} model The model used for pagination + * @property {String} scrollSelector The the scrollable element selector + * @property {HTMLElement} scrollElement The scrollable element + * @property {Number} scrollOffset The distance, in pixels, until the end that activates the loading of the next rows + */ +class Pagination extends Component { + constructor($element, $scope) { + super($element, $scope); + this.scrollOffset = 20; + this.scrollHandler = e => this.onScroll(e); + } + + $onInit() { + if (!this._scrollElement) + this.scrollElement = document.body; + } + + set scrollSelector(value) { + this._scrollSelector = value; + this.scrollElement = document.querySelector(value); + } + + get scrollSelector() { + return this._scrollSelector; + } + + set scrollElement(value) { + if (this._scrollElement) + this._scrollElement.removeEventListener('scroll', this.scrollHandler); + + this._scrollElement = value; + + if (value) + this._scrollElement.addEventListener('scroll', this.scrollHandler); + } + + get scrollElement() { + return this._scrollElement; + } + + onScroll() { + let scrollElement = this.scrollElement; + let shouldLoad = + scrollElement.scrollTop + scrollElement.clientHeight >= (scrollElement.scrollHeight - this.scrollOffset) + && !this.model.isLoading; + + if (shouldLoad) { + this.model.loadMore(); + this.$.$apply(); + } + } + + $onDestroy() { + this.scrollElement = null; + } +} + +ngModule.component('vnPagination', { + template: require('./pagination.html'), + bindings: { + model: '<', + scrollSelector: '@?', + scrollElement: ' div > vn-icon-button { + font-size: 2em; + } +} \ No newline at end of file diff --git a/client/core/src/components/rest-model/crud-model.js b/client/core/src/components/rest-model/crud-model.js index 3133257d0..3bdac37c8 100644 --- a/client/core/src/components/rest-model/crud-model.js +++ b/client/core/src/components/rest-model/crud-model.js @@ -10,32 +10,80 @@ export default class CrudModel extends ModelProxy { this.autoLoad = true; } + get isLoading() { + return this.canceler != null; + } + $onInit() { if (this.autoLoad) this.refresh(); } - refresh() { + refresh(usFilter, usData) { if (!this.url) return; + let myFilter = { + fields: this.fields, + where: mergeWhere(this.link, this.where), + include: this.include, + order: this.order, + limit: this.limit, + userData: this.userData + }; + let filter = this.filter; + filter = mergeFilters(myFilter, filter); + filter = mergeFilters(usFilter, filter); + return this.sendRequest(filter); + } - if (!filter) { - let where = Object.assign({}, this.link, this.where); - filter = { - fields: this.fields, - where: where, - include: this.include, - order: this.order, - limit: this.limit - }; + cancelRequest() { + if (this.canceler) { + this.canceler.resolve(); + this.canceler = null; } + } - let urlFilter = encodeURIComponent(JSON.stringify(filter)); + sendRequest(filter, append) { + this.cancelRequest(); + this.canceler = this.$q.defer(); + let options = {timeout: this.canceler.promise}; + let json = encodeURIComponent(JSON.stringify(filter)); + return this.$http.get(`${this.url}?filter=${json}`, options).then( + json => this.onRemoteDone(json, filter, append), + json => this.onRemoteError(json) + ); + } - return this.$http.get(`${this.url}?filter=${urlFilter}`).then(res => { - this.orgData = res.data; - }); + onRemoteDone(json, filter, append) { + let data = json.data; + + if (append) + this.orgData = this.orgData.concat(data); + else + this.orgData = data; + + this.currentFilter = filter; + this.moreRows = filter.limit && data.length == filter.limit; + this.onRequestEnd(); + this.dataChanged(); + } + + onRemoteError(err) { + this.onRequestEnd(); + throw err; + } + + onRequestEnd() { + this.canceler = null; + } + + loadMore() { + if (this.moreRows) { + let filter = Object.assign({}, this.currentFilter); + filter.skip = (filter.skip || 0) + filter.limit; + this.sendRequest(filter, true); + } } getChanges() { @@ -97,7 +145,87 @@ ngModule.component('vnCrudModel', { order: '@?', limit: ' 1 ? {and} : and[0]; +} + +/** + * Merges two loopback filters returning the merged filter. + * + * @param {Object} src The source filter + * @param {Object} dst The destination filter + * @return {Object} The result filter + */ +function mergeFilters(src, dst) { + let res = Object.assign({}, dst); + + if (!src) + return res; + + if (src.fields) + res.fields = mergeFields(src.fields, res.fields); + if (src.where) + res.where = mergeWhere(res.where, src.where); + if (src.include) + res.include = src.include; + if (src.order) + res.order = src.order; + if (src.limit) + res.limit = src.limit; + if (src.userData) + res.userData = src.userData; + + return res; +} diff --git a/client/core/src/components/searchbar/search-panel.js b/client/core/src/components/searchbar/search-panel.js new file mode 100644 index 000000000..96dc67ed5 --- /dev/null +++ b/client/core/src/components/searchbar/search-panel.js @@ -0,0 +1,18 @@ +import Component from '../../lib/component'; + +export default class extends Component { + set filter(value) { + this.$.filter = value; + } + + get filter() { + return this.$.filter; + } + + onSearch() { + if (!this.onSubmit) + throw new Error('SearchPanel::onSubmit() method not defined'); + + this.onSubmit(this.filter); + } +} diff --git a/client/salix/src/components/searchbar/searchbar.html b/client/core/src/components/searchbar/searchbar.html similarity index 73% rename from client/salix/src/components/searchbar/searchbar.html rename to client/core/src/components/searchbar/searchbar.html index 72d5dad90..9bc053f1b 100644 --- a/client/salix/src/components/searchbar/searchbar.html +++ b/client/core/src/components/searchbar/searchbar.html @@ -5,11 +5,11 @@ ng-click="$ctrl.clearFilter(); $ctrl.onSubmit()" style="cursor: pointer; padding-top: 23px">
- + diff --git a/client/core/src/components/searchbar/searchbar.js b/client/core/src/components/searchbar/searchbar.js new file mode 100644 index 000000000..8db621933 --- /dev/null +++ b/client/core/src/components/searchbar/searchbar.js @@ -0,0 +1,200 @@ +import ngModule from '../../module'; +import Component from '../../lib/component'; +import './style.scss'; + +/** + * An input specialized to perform searches, it allows to use a panel + * for advanced searches when the panel property is defined. + * When model and exprBuilder properties are used, the model is updated + * automatically with an and-filter exprexion in which each operand is built + * by calling the exprBuilder function for each non-null parameter. + * + * @property {Object} filter A key-value object with filter parameters + * @property {Function} onSearch Function to call when search is submited + * @property {SearchPanel} panel The panel used for advanced searches + * @property {CrudModel} model The model used for searching + * @property {Function} exprBuilder If defined, is used to build each non-null param expresion + */ +export default class Controller extends Component { + constructor($element, $scope, $compile, $state, $transitions) { + super($element, $scope); + this.$compile = $compile; + this.$state = $state; + this.deregisterCallback = $transitions.onStart({}, + transition => this.changeState(transition)); + + this.filter = {}; + this.searchString = ''; + } + + $onInit() { + if (this.$state.params.q) + this.filter = JSON.parse(decodeURIComponent(this.$state.params.q)); + + this.refreshString(); + this.doSearch(); + } + + changeState(transition) { + return transition._targetState._identifier.name !== this.$state.current.name; + } + + openPanel(event) { + if (event.defaultPrevented) return; + event.preventDefault(); + + this.$panel = this.$compile(`<${this.panel}/>`)(this.$.$new()); + let panel = this.$panel.isolateScope().$ctrl; + panel.filter = this.filter; + panel.onSubmit = filter => this.onPanelSubmit(filter); + + this.$.popover.parent = this.element; + this.$.popover.child = this.$panel[0]; + this.$.popover.show(); + } + + onPopoverClose() { + this.$panel.scope().$destroy(); + this.$panel.remove(); + this.$panel = null; + } + + onPanelSubmit(filter) { + this.$.popover.hide(); + + for (let param in filter) + if (filter[param] == null) + delete filter[param]; + + this.filter = filter; + this.refreshString(); + this.doSearch(); + } + + refreshString() { + this.searchString = this.getStringFromObject(this.filter); + } + + onSubmit() { + this.filter = this.getObjectFromString(this.searchString); + this.doSearch(); + } + + doSearch() { + this.pushFilterToState(this.filter); + + if (this.onSearch) + this.onSearch({filter: this.filter}); + + if (this.model) { + if (!this.exprBuilder) + throw new Error('exprBuilder property should be defined when model is assigned'); + + let and = []; + + for (let param in this.filter) { + let value = this.filter[param]; + if (value == null) continue; + let expr = this.exprBuilder({param, value}); + if (expr) and.push(expr); + } + + let lbFilter = and.length > 0 ? {where: {and}} : null; + this.model.refresh(lbFilter); + } + } + + pushFilterToState(filter) { + let history = window.history || {pushState: () => { + console.error('Error in history.pushState(): Browser incompatibility error'); + }}; + let aux = window.location.hash.split('?q='); + if (Object.keys(filter).length) + history.pushState({}, null, `${aux[0]}?q=${encodeURIComponent(JSON.stringify(filter))}`); + else + history.pushState({}, null, aux[0]); + } + + /** + * Finds pattern key:value or key:(extra value) and passes it to object. + * + * @param {String} searchString The search string + * @return {Object} The parsed object + */ + getObjectFromString(searchString) { + let result = {}; + if (searchString) { + let regex = /((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi; + let findPattern = searchString.match(regex); + let remnantString = searchString.replace(regex, '').trim(); + if (findPattern) { + for (let i = 0; i < findPattern.length; i++) { + let aux = findPattern[i].split(':'); + let property = aux[0]; + let value = aux[1].replace(/\(|\)/g, ''); + result[property] = value.trim(); + } + } + if (remnantString) + result.search = remnantString; + } + return result; + } + + /** + * Passes an object to pattern key:value or key:(extra value). + * + * @param {Object} searchObject The search object + * @return {String} The passed string + */ + getStringFromObject(searchObject) { + let search = []; + + if (searchObject) { + let keys = Object.keys(searchObject); + keys.forEach(key => { + if (key == 'search') return; + + let value = searchObject[key]; + let valueString; + + if (typeof value === 'string' && value.indexOf(' ') !== -1) + valueString = `(${value})`; + else if (value instanceof Date) + valueString = value.toJSON(); + else + switch (typeof value) { + case 'number': + case 'string': + case 'boolean': + valueString = `${value}`; + } + + if (valueString) + search.push(`${key}:${valueString}`); + }); + + if (searchObject.search) + search.unshift(searchObject.search); + } + + return search.length ? search.join(' ') : ''; + } + + $onDestroy() { + this.deregisterCallback(); + } +} +Controller.$inject = ['$element', '$scope', '$compile', '$state', '$transitions']; + +ngModule.component('vnSearchbar', { + template: require('./searchbar.html'), + bindings: { + filter: ' form > vn-horizontal > vn-icon-button { color: black; diff --git a/client/core/src/locale/en.yml b/client/core/src/locale/en.yml index 3a06f2bd0..613eda985 100644 --- a/client/core/src/locale/en.yml +++ b/client/core/src/locale/en.yml @@ -11,4 +11,5 @@ Hide: Hide Next: Next Finalize: Finalize Previous: Back +Load more: Load more Auto-scroll interrupted, please adjust the search: Auto-scroll interrupted, please adjust the search \ No newline at end of file diff --git a/client/core/src/locale/es.yml b/client/core/src/locale/es.yml index 4e826330b..47a10ab21 100644 --- a/client/core/src/locale/es.yml +++ b/client/core/src/locale/es.yml @@ -11,4 +11,5 @@ Hide: Ocultar Next: Siguiente Finalize: Finalizar Previous: Anterior +Load more: Cargar más Auto-scroll interrupted, please adjust the search: Auto-scroll interrumpido, por favor ajusta la búsqueda \ No newline at end of file diff --git a/client/item/src/filter-panel/index.html b/client/item/src/filter-panel/index.html deleted file mode 100644 index 5dd64bb28..000000000 --- a/client/item/src/filter-panel/index.html +++ /dev/null @@ -1,77 +0,0 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/client/item/src/filter-panel/index.js b/client/item/src/filter-panel/index.js deleted file mode 100644 index 695a4710f..000000000 --- a/client/item/src/filter-panel/index.js +++ /dev/null @@ -1,16 +0,0 @@ -import ngModule from '../module'; - -class Controller { - constructor() { - this.onSubmit = () => {}; - } - - onSearch() { - this.onSubmit(this.filter); - } -} - -ngModule.component('vnItemFilterPanel', { - template: require('./index.html'), - controller: Controller -}); diff --git a/client/item/src/index/index.html b/client/item/src/index/index.html index 0879b5627..e206015e7 100644 --- a/client/item/src/index/index.html +++ b/client/item/src/index/index.html @@ -1,26 +1,30 @@ - + +
- - - - - + + + - + + ng-repeat="item in items track by item.id" + item="::item"> - - + +
diff --git a/client/item/src/index/index.js b/client/item/src/index/index.js index 8ddc7ada4..d772e810c 100644 --- a/client/item/src/index/index.js +++ b/client/item/src/index/index.js @@ -3,46 +3,68 @@ import './product'; import './style.scss'; class Controller { - constructor($http, $state, $scope) { this.$http = $http; this.$state = $state; - this.$scope = $scope; - this.model = {}; + this.$ = $scope; this.itemSelected = null; - this.items = []; + + this.filter = { + include: [ + {relation: 'itemType', + scope: { + fields: ['name', 'workerFk'], + include: { + relation: 'worker', + fields: ['firstName', 'name'] + } + } + } + ], + order: 'name ASC' + }; } - search(index) { - index.accept(); - /* this.items = []; - index.accept().then(res => { - this.items = res.instances; - }); */ + exprBuilder(param, value) { + switch (param) { + case 'search': + return { + or: [ + {id: value}, + {name: {regexp: value}} + ] + }; + case 'name': + case 'description': + return {[param]: {regexp: value}}; + case 'id': + case 'typeFk': + return {[param]: value}; + } } cloneItem(item) { this.itemSelected = item; - this.$scope.clone.show(); + this.$.clone.show(); } onCloneAccept(response) { - if (response == 'ACCEPT' && this.itemSelected) { - this.$http.post(`/item/api/Items/${this.itemSelected.id}/clone`).then(res => { - if (res && res.data && res.data.id) { - this.$state.go('item.card.tags', {id: res.data.id}); - } - }); - } + if (!(response == 'ACCEPT' && this.itemSelected)) + return; + + this.$http.post(`/item/api/Items/${this.itemSelected.id}/clone`).then(res => { + if (res && res.data && res.data.id) + this.$state.go('item.card.tags', {id: res.data.id}); + }); + this.itemSelected = null; } - + showItemPreview(item) { this.itemSelected = item; - this.$scope.preview.show(); + this.$.preview.show(); } } - Controller.$inject = ['$http', '$state', '$scope']; ngModule.component('vnItemIndex', { diff --git a/client/item/src/index/style.scss b/client/item/src/index/style.scss index 86f7f3ea1..9c6e97761 100644 --- a/client/item/src/index/style.scss +++ b/client/item/src/index/style.scss @@ -1,3 +1,4 @@ +@import "./colors"; vn-item-product { display: block; @@ -12,4 +13,4 @@ vn-item-product { border-radius: .2em; } } -} \ No newline at end of file +} diff --git a/client/item/src/item.js b/client/item/src/item.js index 384e91661..1382580b5 100644 --- a/client/item/src/item.js +++ b/client/item/src/item.js @@ -2,7 +2,7 @@ export * from './module'; import './index'; import './filter-item-list'; -import './filter-panel'; +import './search-panel'; import './create'; import './card'; import './descriptor'; diff --git a/client/item/src/locale/es.yml b/client/item/src/locale/es.yml index b6a3eca94..9d2d7a0a2 100644 --- a/client/item/src/locale/es.yml +++ b/client/item/src/locale/es.yml @@ -42,4 +42,5 @@ Remove niche: Quitar nicho Add barcode: Añadir código de barras Remove barcode: Quitar código de barras Buyer: Comprador -No results: Sin resultados \ No newline at end of file +No results: Sin resultados +Tag: Etiqueta \ No newline at end of file diff --git a/client/item/src/search-panel/index.html b/client/item/src/search-panel/index.html new file mode 100644 index 000000000..5b545d8bc --- /dev/null +++ b/client/item/src/search-panel/index.html @@ -0,0 +1,84 @@ + +
+
+ + + + + + + + + + + + + + + + +
+
diff --git a/client/item/src/search-panel/index.js b/client/item/src/search-panel/index.js new file mode 100644 index 000000000..b752e34e7 --- /dev/null +++ b/client/item/src/search-panel/index.js @@ -0,0 +1,32 @@ +import ngModule from '../module'; +import SearchPanel from 'core/src/components/searchbar/search-panel'; + +class Controller extends SearchPanel { + set filter(value) { + if (!value.tags) + value.tags = [{}]; + + this.$.filter = value; + } + + get filter() { + return this.$.filter; + } + + getSourceTable(selection) { + if (!selection || selection.isFree === true) + return null; + + if (selection.sourceTable) + return '/api/' + + selection.sourceTable.charAt(0).toUpperCase() + + selection.sourceTable.substring(1) + 's'; + else if (selection.sourceTable == null) + return `/api/ItemTags/filterItemTags/${selection.id}`; + } +} + +ngModule.component('vnItemSearchPanel', { + template: require('./index.html'), + controller: Controller +}); diff --git a/client/item/src/filter-panel/locale/es.yml b/client/item/src/search-panel/locale/es.yml similarity index 100% rename from client/item/src/filter-panel/locale/es.yml rename to client/item/src/search-panel/locale/es.yml diff --git a/client/item/src/tags/index.html b/client/item/src/tags/index.html index 18eaa613c..e20093813 100644 --- a/client/item/src/tags/index.html +++ b/client/item/src/tags/index.html @@ -48,14 +48,16 @@ rule="itemTag.priority" vn-acl="buyer"> - + - + ng-click="$ctrl.removeTag($index)" + tabindex="-1"> + + this.changeState(transition)); - } - - clearFilter() { - this.index.filter = { - page: 1, - size: 20 - }; - } - - setFilter(filterObject) { - this.clearFilter(); - Object.assign(this.index.filter, filterObject); - } - - getFiltersFromString(stringSearch) { - let result = {}; - if (stringSearch) { - // find pattern key:value or key:(extra value) and returns array - let findPattern = stringSearch.match(/((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi); - let remnantString = (stringSearch.replace(/((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi, '')).trim(); - if (findPattern) { - for (let i = 0; i < findPattern.length; i++) { - let aux = findPattern[i].split(':'); - let property = aux[0]; - let value = aux[1].replace(/\(|\)/g, ''); - result[property] = value.trim(); - } - } - if (remnantString) { - result.search = remnantString; - } - } - return result; - } - - createStringFromObject(filterObject) { - let search = []; - let keys = Object.keys(filterObject); - if (keys.length) { - keys.forEach(k => { - let ignore = (this.ignoreKeys && this.ignoreKeys instanceof Array && this.ignoreKeys.indexOf(k) !== -1); - if (!ignore) { - let value = filterObject[k]; - - if (typeof value === 'string' && value.indexOf(' ') !== -1) { - search.push(`${k}:(${value})`); - } else if (typeof value !== 'object') { - search.push(`${k}:${value}`); - } - } - }); - - if (filterObject.search) - search.unshift(filterObject.search); - } - return (search.length) ? search.join(' ') : ''; - } - - changeState(transition) { - return !(transition._targetState._identifier.name === this.$state.current.name); - } - - pushFiltersToState(filters) { - let history = window.history || {pushState: () => { - console.error('Error in history.pushState(): Browser incompatibility error'); - }}; - let aux = window.location.hash.split('?q='); - if (Object.keys(filters).length) - history.pushState({}, null, `${aux[0]}?q=${encodeURIComponent(JSON.stringify(filters))}`); - else - history.pushState({}, null, aux[0]); - } - - onpenFilters(event) { - let filter = {}; - if (this.stringSearch) { - filter = this.getFiltersFromString(this.stringSearch); - } - - this.$child = this.$compile(`<${this.popover}/>`)(this.$.$new()); - - var childCtrl = this.$child.isolateScope().$ctrl; - childCtrl.filter = Object.assign({}, filter); - childCtrl.onSubmit = filter => this.onChildSubmit(filter); - if (this.data) - childCtrl.data = Object.assign({}, this.data); - - event.preventDefault(); - - this.$.popover.parent = this.element; - this.$.popover.child = this.$child[0]; - this.$.popover.show(); - } - - onPopoverClose() { - this.$child.scope().$destroy(); - this.$child.remove(); - this.$child = null; - } - - onChildSubmit(filter) { - this.$.popover.hide(); - this.stringSearch = this.createStringFromObject(filter); - this.clearFilter(); - this.$timeout(() => this.onSubmit()); - } - - onSubmit() { - let filter = {}; - if (this.stringSearch) { - filter = this.getFiltersFromString(this.stringSearch); - } - this.setFilter(filter); - - if (this.onSearch) - this.onSearch(); - - this.pushFiltersToState(filter); - } - - $onDestroy() { - this.clearFilter(); - this.deregisterCallback(); - } - - $onInit() { - if (this.$state.params.q) { - let filter = JSON.parse(decodeURIComponent(this.$state.params.q)); - this.stringSearch = this.createStringFromObject(filter); - } - this.$timeout(() => this.onSubmit()); - } -} -Controller.$inject = ['$element', '$scope', '$compile', '$timeout', '$state', '$transitions']; - -ngModule.component('vnSearchbar', { - template: require('./searchbar.html'), - bindings: { - index: '<', - onSearch: '&', - advanced: '=', - popover: '@', - ignoreKeys: ' -
-
- - TICKETS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ID TicketComercialDateHoraAliasProvinciaEstadoAgenciaAlmacenFacturaRuta
- - {{::ticket.id}}{{::ticket.client.salesPerson.name | dashIfEmpty}}{{::ticket.shipped | date:'dd/MM/yyyy'}}{{::ticket.shipped | date:'HH:MM'}}{{::ticket.nickname}}{{::ticket.address.province.name}}{{::ticket.tracking.state.name}}{{::ticket.agencyMode.name}}{{::ticket.warehouse.name}}{{::ticket.refFk | dashIfEmpty}}{{::ticket.routeFk | dashIfEmpty}} - - -
-
+ + +
+
+ + + - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IdSalespersonDateHourAliasProvinceStateAgencyWarehouseInvoiceRoute
{{::ticket.id}}{{::ticket.client.salesPerson.name | dashIfEmpty}}{{::ticket.shipped | date:'dd/MM/yyyy'}}{{::ticket.shipped | date:'HH:MM'}}{{::ticket.nickname}}{{::ticket.address.province.name}}{{::ticket.tracking.state.name}}{{::ticket.agencyMode.name}}{{::ticket.warehouse.name}}{{::ticket.refFk | dashIfEmpty}}{{::ticket.routeFk | dashIfEmpty}} + + +
+
+ +
diff --git a/client/ticket/src/index/index.js b/client/ticket/src/index/index.js index fe75368e3..813165403 100644 --- a/client/ticket/src/index/index.js +++ b/client/ticket/src/index/index.js @@ -1,11 +1,82 @@ import ngModule from '../module'; -import './ticket-item'; -import './style.scss'; export default class Controller { constructor($scope) { - this.$scope = $scope; + this.$ = $scope; this.ticketSelected = null; + + this.filter = { + include: [ + { + relation: 'address', + scope: { + fields: ['provinceFk'], + include: { + relation: 'province', + scope: { + fields: ['name'] + } + } + } + }, { + relation: 'warehouse', + scope: { + fields: ['name'] + } + }, { + relation: 'agencyMode', + scope: { + fields: ['name'] + } + }, { + relation: 'tracking', + scope: { + fields: ['stateFk'], + include: { + relation: 'state', + scope: { + fields: ['name'] + } + } + } + }, { + relation: 'client', + scope: { + fields: ['salesPersonFk'], + include: { + relation: 'salesPerson', + scope: { + fields: ['name'] + } + } + } + } + ], + order: 'shipped DESC' + }; + } + + exprBuilder(param, value) { + switch (param) { + case 'search': + return { + or: [ + {id: value}, + {nickname: {regexp: value}} + ] + }; + case 'from': + return {shipped: {gte: value}}; + case 'to': + return {shipped: {lte: value}}; + case 'nickname': + return {[param]: {regexp: value}}; + case 'id': + case 'clientFk': + case 'agencyModeFk': + case 'warehouseFk': + return {[param]: value}; + } } compareDate(date) { @@ -26,17 +97,9 @@ export default class Controller { preview(event, ticket) { event.preventDefault(); event.stopImmediatePropagation(); - this.$scope.dialogSummaryTicket.show(); + this.$.dialogSummaryTicket.show(); this.ticketSelected = ticket; } - - search(index) { - index.accept(); - /* this.tickets = []; - index.accept().then(res => { - this.tickets = res.instances; - }); */ - } } Controller.$inject = ['$scope']; diff --git a/client/ticket/src/index/ticket-index.spec.js b/client/ticket/src/index/index.spec.js similarity index 86% rename from client/ticket/src/index/ticket-index.spec.js rename to client/ticket/src/index/index.spec.js index f6a004948..a6cd7d18c 100644 --- a/client/ticket/src/index/ticket-index.spec.js +++ b/client/ticket/src/index/index.spec.js @@ -34,14 +34,14 @@ describe('ticket', () => { it('should call preventDefault and stopImmediatePropagation from event and show', () => { let event = jasmine.createSpyObj('event', ['preventDefault', 'stopImmediatePropagation']); - controller.$scope = {dialogSummaryTicket: {show: () => {}}}; - spyOn(controller.$scope.dialogSummaryTicket, 'show'); + controller.$ = {dialogSummaryTicket: {show: () => {}}}; + spyOn(controller.$.dialogSummaryTicket, 'show'); let ticket = {}; controller.preview(event, ticket); expect(event.preventDefault).toHaveBeenCalledWith(); expect(event.stopImmediatePropagation).toHaveBeenCalledWith(); - expect(controller.$scope.dialogSummaryTicket.show).toHaveBeenCalledWith(); + expect(controller.$.dialogSummaryTicket.show).toHaveBeenCalledWith(); }); }); }); diff --git a/client/ticket/src/index/style.scss b/client/ticket/src/index/style.scss deleted file mode 100644 index eb363a9a7..000000000 --- a/client/ticket/src/index/style.scss +++ /dev/null @@ -1,3 +0,0 @@ -vn-ticket-item { - display: block; -} \ No newline at end of file diff --git a/client/ticket/src/index/ticket-item.html b/client/ticket/src/index/ticket-item.html deleted file mode 100644 index 9b9d25440..000000000 --- a/client/ticket/src/index/ticket-item.html +++ /dev/null @@ -1,20 +0,0 @@ - - - -
{{::$ctrl.ticket.nickname}}
- - -
- - - - -
-
diff --git a/client/ticket/src/index/ticket-item.js b/client/ticket/src/index/ticket-item.js deleted file mode 100644 index c62a989d9..000000000 --- a/client/ticket/src/index/ticket-item.js +++ /dev/null @@ -1,24 +0,0 @@ -import ngModule from '../module'; - -class Controller { - onClick(event) { - if (event.defaultPrevented) - event.stopImmediatePropagation(); - } - - preview(event) { - event.preventDefault(); - this.index.openSummary(this.ticket); - } -} - -ngModule.component('vnTicketItem', { - controller: Controller, - template: require('./ticket-item.html'), - bindings: { - ticket: '<' - }, - require: { - index: '^vnTicketIndex' - } -}); diff --git a/client/ticket/src/search-panel/index.html b/client/ticket/src/search-panel/index.html new file mode 100644 index 000000000..e8ddd290e --- /dev/null +++ b/client/ticket/src/search-panel/index.html @@ -0,0 +1,58 @@ +
+
+ + + + + + + + + + + + + + + + + + + {{name}} + + + + + + + +
+
diff --git a/client/ticket/src/search-panel/index.js b/client/ticket/src/search-panel/index.js new file mode 100644 index 000000000..be63116ef --- /dev/null +++ b/client/ticket/src/search-panel/index.js @@ -0,0 +1,7 @@ +import ngModule from '../module'; +import SearchPanel from 'core/src/components/searchbar/search-panel'; + +ngModule.component('vnTicketSearchPanel', { + template: require('./index.html'), + controller: SearchPanel +}); diff --git a/client/ticket/src/search-panel/locale/es.yml b/client/ticket/src/search-panel/locale/es.yml new file mode 100644 index 000000000..1f892a742 --- /dev/null +++ b/client/ticket/src/search-panel/locale/es.yml @@ -0,0 +1,7 @@ +Ticket id: Id ticket +Client id: Id cliente +Nickname: Alias +From: Desde +To: Hasta +Agency: Agencia +Warehouse: Almacén \ No newline at end of file diff --git a/client/ticket/src/ticket.js b/client/ticket/src/ticket.js index 6719d535f..aae0d2005 100644 --- a/client/ticket/src/ticket.js +++ b/client/ticket/src/ticket.js @@ -1,5 +1,6 @@ export * from './module'; +import './search-panel'; import './index'; import './create'; import './card'; diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 294677ce2..ffbf88db2 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -192,7 +192,7 @@ export default { itemTags: { goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', tagsButton: `vn-menu-item a[ui-sref="item.card.tags"]`, - firstRemoveTagButton: `vn-item-tags vn-horizontal:nth-child(2) > vn-icon[icon="remove_circle_outline"]`, + firstRemoveTagButton: `vn-item-tags vn-horizontal:nth-child(2) vn-icon-button[icon="remove_circle_outline"]`, firstTagSelect: `vn-item-tags vn-horizontal:nth-child(2) > vn-autocomplete[field="itemTag.tagFk"] input`, firstTagDisabled: `vn-item-tags vn-horizontal:nth-child(2) > vn-autocomplete > div > div > input`, firstTagSelectOptionOne: `vn-item-tags vn-horizontal:nth-child(2) > vn-autocomplete[field="itemTag.tagFk"] vn-drop-down ul > li:nth-child(1)`, @@ -218,7 +218,7 @@ export default { fifthTagSelectOptionFive: `vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[field="itemTag.tagFk"] vn-drop-down ul > li:nth-child(5)`, fifthValueInput: `vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Value"] > div > input`, fifthRelevancyInput: `vn-horizontal:nth-child(6) > vn-textfield[label="Relevancy"] > div > input`, - addItemTagButton: `vn-icon[icon="add_circle"]`, + addItemTagButton: `vn-icon-button[icon="add_circle"]`, submitItemTagsButton: `${components.vnSubmit}` }, itemTax: { diff --git a/e2e/paths/ticket-module/01_create_ticket_observations.spec.js b/e2e/paths/ticket-module/01_create_ticket_observations.spec.js index 9905145d8..0e7b27975 100644 --- a/e2e/paths/ticket-module/01_create_ticket_observations.spec.js +++ b/e2e/paths/ticket-module/01_create_ticket_observations.spec.js @@ -23,7 +23,7 @@ describe('Ticket', () => { it('should search for the ticket with id 1', () => { return nightmare .wait(selectors.ticketsIndex.searchTicketInput) - .type(selectors.ticketsIndex.searchTicketInput, '1') + .type(selectors.ticketsIndex.searchTicketInput, 'id:1') .click(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .countSearchResults(selectors.ticketsIndex.searchResult) diff --git a/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js b/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js index 559358439..38900da9d 100644 --- a/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js +++ b/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js @@ -23,7 +23,7 @@ describe('Ticket', () => { it('should search for the ticket with id 1', () => { return nightmare .wait(selectors.ticketsIndex.searchTicketInput) - .type(selectors.ticketsIndex.searchTicketInput, '1') + .type(selectors.ticketsIndex.searchTicketInput, 'id:1') .click(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .countSearchResults(selectors.ticketsIndex.searchResult) diff --git a/e2e/paths/ticket-module/03_list_sale.spec.js b/e2e/paths/ticket-module/03_list_sale.spec.js index 4e1ec4e3e..0c1fc77c9 100644 --- a/e2e/paths/ticket-module/03_list_sale.spec.js +++ b/e2e/paths/ticket-module/03_list_sale.spec.js @@ -25,7 +25,7 @@ describe('Ticket', () => { it('should search for the ticket 1', () => { return nightmare .wait(selectors.ticketsIndex.searchResult) - .type(selectors.ticketsIndex.searchTicketInput, 1) + .type(selectors.ticketsIndex.searchTicketInput, 'id:1') .click(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .countSearchResults(selectors.ticketsIndex.searchResult) diff --git a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js b/e2e/paths/ticket-module/04_create_ticket_packages.spec.js index 1b98f9190..c87b99705 100644 --- a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js +++ b/e2e/paths/ticket-module/04_create_ticket_packages.spec.js @@ -25,7 +25,7 @@ // it('should search for the ticket 1', () => { // return nightmare // .wait(selectors.ticketsIndex.searchResult) -// .type(selectors.ticketsIndex.searchTicketInput, 1) +// .type(selectors.ticketsIndex.searchTicketInput, 'id:1') // .click(selectors.ticketsIndex.searchButton) // .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) // .countSearchResults(selectors.ticketsIndex.searchResult) diff --git a/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js b/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js index 87bc5281d..ce44e1b26 100644 --- a/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js +++ b/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js @@ -25,7 +25,7 @@ describe('Ticket', () => { it('should search for the ticket 1', () => { return nightmare .wait(selectors.ticketsIndex.searchResult) - .type(selectors.ticketsIndex.searchTicketInput, 1) + .type(selectors.ticketsIndex.searchTicketInput, 'id:1') .click(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .countSearchResults(selectors.ticketsIndex.searchResult) diff --git a/package.json b/package.json index b1e2d6781..8ad42c02e 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "angular-translate-loader-partial": "^2.18.1", "flatpickr": "^4.4.6", "fs-extra": "^5.0.0", + "js-yaml": "^3.10.0", "material-design-lite": "^1.3.0", "mg-crud": "^1.1.2", "npm": "^5.8.0", @@ -55,7 +56,6 @@ "html-loader": "^0.4.4", "jasmine": "^2.9.0", "jasmine-spec-reporter": "^4.2.1", - "js-yaml": "^3.10.0", "karma": "^1.7.1", "karma-chrome-launcher": "^2.2.0", "karma-firefox-launcher": "^1.1.0", diff --git a/services/loopback/common/methods/client/createWithUser.js b/services/loopback/common/methods/client/createWithUser.js index 59aa2c8e8..9b56d7c29 100644 --- a/services/loopback/common/methods/client/createWithUser.js +++ b/services/loopback/common/methods/client/createWithUser.js @@ -40,6 +40,7 @@ module.exports = function(Self) { street: data.street, city: data.city, provinceFk: data.provinceFk, + countryFk: data.countryFk, isEqualizated: data.isEqualizated }; newClient = await Self.create(client); diff --git a/services/loopback/common/methods/client/filter.js b/services/loopback/common/methods/client/filter.js deleted file mode 100644 index bb1288630..000000000 --- a/services/loopback/common/methods/client/filter.js +++ /dev/null @@ -1,61 +0,0 @@ -module.exports = function(Client) { - Client.installMethod('filter', filterClients); - - function filterClients(params) { - let filters = { - where: {}, - skip: (params.page - 1) * params.size, - limit: params.size - }; - - delete params.page; - delete params.size; - - if (params.search) { - filters.where.and = [ - { - or: [ - {id: params.search}, - {name: {regexp: params.search}} - ] - } - ]; - delete params.search; - } - - if (params.phone) { - let phones = [ - {phone: params.phone}, - {mobile: params.phone} - ]; - if (filters.where.and) { - filters.where.and.push( - { - or: phones - } - ); - } else { - filters.where.or = phones; - } - delete params.phone; - } - - let properties = Object.keys(params); - if (properties.length) { - properties.forEach( - property => { - let propertyToBeEqual = (property === 'postcode' || property === 'fi' || property === 'id'); - if (filters.where.and) { - let filter = {}; - filter[property] = propertyToBeEqual ? params[property] : {regexp: params[property]}; - filters.where.and.push(filter); - } else { - filters.where[property] = propertyToBeEqual ? params[property] : {regexp: params[property]}; - } - } - ); - } - - return filters; - } -}; diff --git a/services/loopback/common/methods/item/filter.js b/services/loopback/common/methods/item/filter.js deleted file mode 100644 index 3f2273f97..000000000 --- a/services/loopback/common/methods/item/filter.js +++ /dev/null @@ -1,62 +0,0 @@ -module.exports = Self => { - Self.installMethod('filter', filterParams); - - function filterParams(params) { - let filter = { - where: {}, - skip: (params.page - 1) * params.size, - limit: params.size, - order: params.order || 'name ASC', // name, relevancy DESC - include: [ - {relation: 'itemType', - scope: { - fields: ['name', 'workerFk'], - include: { - relation: 'worker', - fields: ['firstName', 'name'] - } - } - }, - {relation: 'origin'}, - {relation: 'ink'}, - {relation: 'producer'}, - {relation: 'intrastat'}, - {relation: 'expence'} - ] - }; - - delete params.page; - delete params.size; - delete params.order; - - if (params.search) { - filter.where.and = [ - { - or: [ - {id: params.search}, - {name: {regexp: params.search}} - ] - } - ]; - delete params.search; - } - - if (params.itemSize) { - params.size = params.itemSize; - delete params.itemSize; - } - - Object.keys(params).forEach( - key => { - if (filter.where.and) { - let filter = {}; - filter[key] = (key === 'description' || key === 'name') ? {regexp: params[key]} : params[key]; - filter.where.and.push(filter); - } else { - filter.where[key] = (key === 'description' || key === 'name') ? {regexp: params[key]} : params[key]; - } - } - ); - return filter; - } -}; diff --git a/services/loopback/common/methods/ticket/filter.js b/services/loopback/common/methods/ticket/filter.js deleted file mode 100644 index 8c0ba8c52..000000000 --- a/services/loopback/common/methods/ticket/filter.js +++ /dev/null @@ -1,87 +0,0 @@ -module.exports = Self => { - Self.installMethod('filter', filterParams); - - function filterParams(params) { - let filters = { - where: {}, - skip: (params.page - 1) * params.size, - limit: params.size, - order: params.order || 'created DESC', - include: [ - { - relation: 'address', - scope: { - fields: ['provinceFk'], - include: { - relation: 'province', - scope: { - fields: ['name'] - } - } - } - }, { - relation: 'warehouse', - scope: { - fields: ['name'] - } - }, { - relation: 'agencyMode', - scope: { - fields: ['name'] - } - }, { - relation: 'tracking', - scope: { - fields: ['stateFk'], - include: { - relation: 'state', - scope: { - fields: ['name'] - } - } - } - }, { - relation: 'client', - scope: { - fields: ['salesPersonFk'], - include: { - relation: 'salesPerson', - scope: { - fields: ['name'] - } - } - } - } - ] - }; - - delete params.page; - delete params.size; - delete params.order; - - if (params.search) { - filters.where.and = [ - { - or: [ - {id: params.search}, - {name: {regexp: params.search}} - ] - } - ]; - delete params.search; - } - - Object.keys(params).forEach( - key => { - if (filters.where.and) { - let filter = {}; - filter[key] = (key === 'nickname') ? {regexp: params[key]} : params[key]; - filters.where.and.push(filter); - } else { - filters.where[key] = (key === 'nickname') ? {regexp: params[key]} : params[key]; - } - } - ); - return filters; - } -}; diff --git a/services/loopback/common/models/client.js b/services/loopback/common/models/client.js index 667916de4..762cbe2f5 100644 --- a/services/loopback/common/models/client.js +++ b/services/loopback/common/models/client.js @@ -10,7 +10,6 @@ module.exports = Self => { require('../methods/client/card')(Self); require('../methods/client/createWithUser')(Self); require('../methods/client/listWorkers')(Self); - require('../methods/client/filter')(Self); require('../methods/client/hasCustomerRole')(Self); require('../methods/client/isValidClient')(Self); require('../methods/client/activeSalesPerson')(Self); diff --git a/services/loopback/common/models/item.js b/services/loopback/common/models/item.js index 1186c5ce3..8e39494ca 100644 --- a/services/loopback/common/models/item.js +++ b/services/loopback/common/models/item.js @@ -1,7 +1,6 @@ let UserError = require('../helpers').UserError; module.exports = Self => { - require('../methods/item/filter')(Self); require('../methods/item/clone')(Self); require('../methods/item/updateTaxes')(Self); diff --git a/services/loopback/common/models/ticket.js b/services/loopback/common/models/ticket.js index a2897354c..0b8150dd9 100644 --- a/services/loopback/common/models/ticket.js +++ b/services/loopback/common/models/ticket.js @@ -1,7 +1,6 @@ module.exports = Self => { require('../methods/ticket/changeTime')(Self); require('../methods/ticket/changeWorker')(Self); - require('../methods/ticket/filter')(Self); require('../methods/ticket/getVolume')(Self); require('../methods/ticket/getTotalVolume')(Self); require('../methods/ticket/summary')(Self);