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

61 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-11-13 06:44:03 +00:00
import ngModule from '../module';
export default class Controller {
constructor($scope) {
2019-10-24 10:49:18 +00:00
this.$ = $scope;
2018-11-13 06:44:03 +00:00
this.ticketSelected = null;
this.filter = {
include: [
{
relation: 'agency',
2019-11-22 12:23:43 +00:00
scope: {fields: ['name']}
}, {
2018-11-13 06:44:03 +00:00
relation: 'warehouseIn',
2019-11-22 12:23:43 +00:00
scope: {fields: ['name']}
}, {
2018-11-13 06:44:03 +00:00
relation: 'warehouseOut',
2019-11-22 12:23:43 +00:00
scope: {fields: ['name']}
2018-11-13 06:44:03 +00:00
}
]
};
}
exprBuilder(param, value) {
switch (param) {
case 'search':
return {id: value};
case 'ref':
return {[param]: {regexp: value}};
2019-11-22 12:23:43 +00:00
case 'shippedFrom':
return {shipped: {gte: value}};
case 'shippedTo':
2019-01-21 10:45:53 +00:00
return {shipped: {lte: value}};
2019-11-22 12:23:43 +00:00
case 'landedFrom':
2019-01-21 10:45:53 +00:00
return {landed: {gte: value}};
2019-11-22 12:23:43 +00:00
case 'landedTo':
return {landed: {lte: value}};
2018-11-13 06:44:03 +00:00
case 'id':
2019-10-25 11:29:05 +00:00
case 'agencyModeFk':
2018-11-13 06:44:03 +00:00
case 'warehouseOutFk':
case 'warehouseInFk':
2019-01-21 10:45:53 +00:00
case 'totalEntries':
2018-11-13 06:44:03 +00:00
return {[param]: value};
}
}
2019-10-24 10:49:18 +00:00
preview(event, travel) {
this.travelSelected = travel;
this.$.summary.show();
event.preventDefault();
event.stopImmediatePropagation();
}
2018-11-13 06:44:03 +00:00
}
Controller.$inject = ['$scope'];
ngModule.component('vnTravelIndex', {
template: require('./index.html'),
controller: Controller
});