diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index f392dba87..c2ba547c1 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -44,6 +44,10 @@ module.exports = Self => { arg: 'description', type: 'String', description: 'The item description', + }, { + arg: 'stemMultiplier', + type: 'Integer', + description: 'The item multiplier', } ], returns: { @@ -82,14 +86,22 @@ module.exports = Self => { return {'i.id': value}; case 'description': return {'i.description': {like: `%${value}%`}}; - case 'categoryFk': - return {'ic.id': value}; + case 'category': + return {'ic.name': value}; case 'salesPersonFk': return {'t.workerFk': value}; - case 'typeFk': + case 'type': return {'i.typeFk': value}; case 'isActive': return {'i.isActive': value}; + case 'multiplier': + return {'i.stemMultiplier': value}; + case 'origin': + return {'ori.code': value}; + case 'niche': + return {'itn.code': value}; + case 'intrastat': + return {'intr.description': value}; } }); filter = mergeFilters(filter, {where}); @@ -112,6 +124,7 @@ module.exports = Self => { i.subName, i.isActive, t.name type, + i.typeFk as type, t.workerFk buyerFk, u.name userName, intr.description AS intrastat, diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js index cafa3e475..b9d626e50 100644 --- a/modules/item/front/index/index.js +++ b/modules/item/front/index/index.js @@ -11,6 +11,37 @@ class Controller extends Section { }; } + exprBuilder(param, value) { + switch (param) { + case 'category': + return {'ic.name': value}; + case 'salesPersonFk': + return {'t.workerFk': value}; + case 'grouping': + return {'b.grouping': value}; + case 'packing': + return {'b.packing': value}; + case 'origin': + return {'ori.code': value}; + case 'niche': + return {'itn.code': value}; + case 'type': + return {'i.typeFk': value}; + case 'intrastat': + return {'intr.description': value}; + case 'id': + case 'description': + case 'size': + case 'name': + case 'subname': + case 'isActive': + case 'density': + case 'stemMultiplier': + case 'stems': + return {[`i.${param}`]: value}; + } + } + onCloneAccept(itemFk) { return this.$http.post(`Items/${itemFk}/clone`) .then(res => {