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

40 lines
950 B
JavaScript
Raw Normal View History

2018-12-04 12:18:27 +00:00
import ngModule from '../module';
2018-09-19 13:05:07 +00:00
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}
2019-02-04 11:14:07 +00:00
: {name: {like: `%${value}%`}};
2018-09-19 13:05:07 +00:00
case 'warehouseFk':
case 'agencyModeFk':
return {[param]: value};
}
}
2018-09-25 07:28:55 +00:00
preview(event, zone) {
event.preventDefault();
event.stopImmediatePropagation();
2019-01-21 10:45:53 +00:00
this.zoneSelected = zone;
this.$scope.summary.show();
2018-09-25 07:28:55 +00:00
}
2018-09-19 13:05:07 +00:00
}
Controller.$inject = ['$scope'];
ngModule.component('vnZoneIndex', {
template: require('./index.html'),
controller: Controller
});