2019-01-28 15:24:45 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
|
|
|
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-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;
|
2020-02-03 13:03:09 +00:00
|
|
|
|
2019-01-28 15:24:45 +00:00
|
|
|
event.preventDefault();
|
2019-11-10 10:08:44 +00:00
|
|
|
event.stopPropagation();
|
|
|
|
|
2019-01-28 15:24:45 +00:00
|
|
|
this.selectedWorker = worker;
|
|
|
|
this.$.preview.show();
|
|
|
|
}
|
2019-03-12 14:04:09 +00:00
|
|
|
|
2020-02-03 13:03:09 +00:00
|
|
|
|
|
|
|
goToTimeControl(event, workerId) {
|
|
|
|
if (event.defaultPrevented) return;
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
event.stopPropagation();
|
|
|
|
this.$state.go('worker.card.timeControl', {id: workerId}, {absolute: true});
|
|
|
|
}
|
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
|
|
|
|
});
|