61 lines
1.5 KiB
JavaScript
61 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 'shippedFrom':
|
|
return {shipped: {gte: value}};
|
|
case 'shippedTo':
|
|
return {shipped: {lte: value}};
|
|
case 'landedFrom':
|
|
return {landed: {gte: value}};
|
|
case 'landedTo':
|
|
return {landed: {lte: 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
|
|
});
|