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

65 lines
1.5 KiB
JavaScript

import ngModule from '../module';
export default class Controller {
constructor($scope) {
this.$ = $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 'agencyModeFk':
case 'warehouseOutFk':
case 'warehouseInFk':
case 'totalEntries':
return {[param]: value};
}
}
preview(event, travel) {
this.travelSelected = travel;
this.$.summary.show();
event.preventDefault();
event.stopImmediatePropagation();
}
}
Controller.$inject = ['$scope'];
ngModule.component('vnTravelIndex', {
template: require('./index.html'),
controller: Controller
});