salix/modules/travel/front/index/index.js

58 lines
1.4 KiB
JavaScript

import ngModule from '../module';
export default class Controller {
constructor($scope) {
this.$scope = $scope;
this.ticketSelected = null;
this.filter = {
include: [
{
relation: 'agency',
scope: {
fields: ['name']
}
},
{
relation: 'warehouseIn',
scope: {
fields: ['name']
}
},
{
relation: 'warehouseOut',
scope: {
fields: ['name']
}
}
]
};
}
exprBuilder(param, value) {
switch (param) {
case 'search':
return {id: value};
case 'ref':
return {[param]: {regexp: value}};
case 'shipped':
return {shipped: {lte: value}};
case 'landed':
return {landed: {gte: value}};
case 'id':
case 'agencyFk':
case 'warehouseOutFk':
case 'warehouseInFk':
case 'totalEntries':
return {[param]: value};
}
}
}
Controller.$inject = ['$scope'];
ngModule.component('vnTravelIndex', {
template: require('./index.html'),
controller: Controller
});