filtro principal y ajustes css

This commit is contained in:
Dani Herrero 2017-07-06 12:58:50 +02:00
parent 0339fdaef1
commit 25ac346b2b
2 changed files with 24 additions and 4 deletions

View File

@ -26,7 +26,7 @@
on-change = "$ctrl.onChangeWareHouse(item)"
label="Store">
</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-horizontal>
<vn-horizontal vn-one margin-large-bottom>

View File

@ -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;