40 lines
950 B
JavaScript
40 lines
950 B
JavaScript
import ngModule from '../module';
|
|
|
|
export default class Controller {
|
|
constructor($scope) {
|
|
this.$scope = $scope;
|
|
this.filter = {
|
|
include: [
|
|
{relation: 'agencyMode', fields: ['name']},
|
|
{relation: 'warehouse', fields: ['name']}
|
|
]
|
|
};
|
|
}
|
|
|
|
exprBuilder(param, value) {
|
|
switch (param) {
|
|
case 'search':
|
|
return /^\d+$/.test(value)
|
|
? {id: value}
|
|
: {name: {like: `%${value}%`}};
|
|
case 'warehouseFk':
|
|
case 'agencyModeFk':
|
|
return {[param]: value};
|
|
}
|
|
}
|
|
|
|
preview(event, zone) {
|
|
event.preventDefault();
|
|
event.stopImmediatePropagation();
|
|
this.zoneSelected = zone;
|
|
this.$scope.summary.show();
|
|
}
|
|
}
|
|
|
|
Controller.$inject = ['$scope'];
|
|
|
|
ngModule.component('vnZoneIndex', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|