diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index b4e95608f..dc1cd79e1 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -26,7 +26,7 @@ on-change = "$ctrl.onChangeWareHouse(item)" label="Store"> - + diff --git a/services/production/common/methods/fake-production/list.js b/services/production/common/methods/fake-production/list.js index f6f435bf1..41ae89a8b 100644 --- a/services/production/common/methods/fake-production/list.js +++ b/services/production/common/methods/fake-production/list.js @@ -11,14 +11,34 @@ module.exports = function(FakeProduction) { delete filter.limit; delete filter.page; + if(filter.where && filter.where.q){ + var newFilter = { + or: [ + {agency: {regexp: filter.where.q}}, + {state: {regexp: filter.where.q}} + ], + and: [] + }; + + delete filter.where.q; + + Object.keys(filter.where).forEach( + key => { + let field = new Object(); + field[key] = filter.where[key]; + newFilter.and.push(field); + } + ); + filter.where = newFilter; + } + FakeProduction.connectToService(ctx, "client"); - this.find(filter, function(err, tickets) { FakeProduction.disconnectFromService("client"); - (err) ? cb(err, null) : cb(null, (sum(tickets, limit, offset))); + (err) ? cb(err, null) : cb(null, (sum(tickets))); }); - function sum(tickets, limit, offset){ + function sum(tickets){ var obj = {lines: 0, m3: 0}; tickets.forEach(function(t) { obj.lines += t.lines;