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

40 lines
945 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.zoneSelected = zone;
this.$scope.summary.show();
}
}
Controller.$inject = ['$scope'];
ngModule.component('vnZoneIndex', {
template: require('./index.html'),
controller: Controller
});