Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
5929b8be32
|
@ -26,7 +26,7 @@
|
||||||
on-change = "$ctrl.onChangeWareHouse(item)"
|
on-change = "$ctrl.onChangeWareHouse(item)"
|
||||||
label="Store">
|
label="Store">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-icon-button vn-none pad-ten-top margin-small-left icon="refresh" ng-click="$ctrl.refreshTickets()"></vn-icon-button>
|
<vn-icon-button vn-none pad-ten-top margin-medium-left icon="refresh" ng-click="$ctrl.refreshTickets()"></vn-icon-button>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal vn-one margin-large-bottom>
|
<vn-horizontal vn-one margin-large-bottom>
|
||||||
|
|
|
@ -11,14 +11,34 @@ module.exports = function(FakeProduction) {
|
||||||
delete filter.limit;
|
delete filter.limit;
|
||||||
delete filter.page;
|
delete filter.page;
|
||||||
|
|
||||||
FakeProduction.connectToService(ctx, "client");
|
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) {
|
this.find(filter, function(err, tickets) {
|
||||||
FakeProduction.disconnectFromService("client");
|
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};
|
var obj = {lines: 0, m3: 0};
|
||||||
tickets.forEach(function(t) {
|
tickets.forEach(function(t) {
|
||||||
obj.lines += t.lines;
|
obj.lines += t.lines;
|
||||||
|
|
Loading…
Reference in New Issue