salix/client/agency/src/zone/index/index.js

40 lines
954 B
JavaScript
Raw Normal View History

2018-09-19 13:05:07 +00:00
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: {regexp: value}};
case 'warehouseFk':
case 'agencyModeFk':
return {[param]: value};
}
}
2018-09-25 07:28:55 +00:00
preview(event, zone) {
event.preventDefault();
event.stopImmediatePropagation();
this.$scope.summary.zone = zone;
this.$scope.dialog.show();
}
2018-09-19 13:05:07 +00:00
}
Controller.$inject = ['$scope'];
ngModule.component('vnZoneIndex', {
template: require('./index.html'),
controller: Controller
});