salix/modules/agency/front/index/index.js

40 lines
951 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: {regexp: value}};
case 'warehouseFk':
case 'agencyModeFk':
return {[param]: value};
}
}
preview(event, zone) {
event.preventDefault();
event.stopImmediatePropagation();
this.$scope.summary.zone = zone;
this.$scope.dialog.show();
}
}
Controller.$inject = ['$scope'];
ngModule.component('vnZoneIndex', {
template: require('./index.html'),
controller: Controller
});