salix/modules/worker/front/index/index.js

42 lines
967 B
JavaScript
Raw Normal View History

2019-01-28 15:24:45 +00:00
import ngModule from '../module';
2019-03-12 14:04:09 +00:00
import './style.scss';
2019-01-28 15:24:45 +00:00
export default class Controller {
2019-03-12 14:04:09 +00:00
constructor($, $state) {
this.$state = $state;
2019-01-28 15:24:45 +00:00
Object.assign(this, {
$,
2019-01-29 15:37:59 +00:00
selectedWorker: null,
2019-01-28 15:24:45 +00:00
});
2019-03-12 14:04:09 +00:00
this.moreOptions = [
{callback: () => this.$state.go('worker.department'), name: 'Departments'}
];
2019-01-28 15:24:45 +00:00
}
2019-03-11 07:00:49 +00:00
onSearch(params) {
if (params)
this.$.model.applyFilter(null, params);
else
this.$.model.clear();
2019-01-28 15:24:45 +00:00
}
preview(event, worker) {
if (event.defaultPrevented) return;
event.preventDefault();
this.selectedWorker = worker;
this.$.preview.show();
event.stopImmediatePropagation();
}
2019-03-12 14:04:09 +00:00
onMoreChange(callback) {
callback.call(this);
}
2019-01-28 15:24:45 +00:00
}
2019-03-12 14:04:09 +00:00
Controller.$inject = ['$scope', '$state'];
2019-01-28 15:24:45 +00:00
ngModule.component('vnWorkerIndex', {
template: require('./index.html'),
controller: Controller
});