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

49 lines
1006 B
JavaScript
Raw Normal View History

2019-10-18 06:36:33 +00:00
import ngModule from '../module';
class Controller {
2019-10-18 11:52:15 +00:00
constructor($scope) {
2019-10-18 06:36:33 +00:00
this.$scope = $scope;
}
get worker() {
return this._worker;
}
set worker(value) {
this._worker = value;
2019-10-18 11:52:15 +00:00
if (value)
this.setLink(value);
}
setLink(value) {
this.$scope.$applyAsync(()=> {
this.$scope.model.link = {userFk: value.userFk};
this.$scope.model.refresh();
});
2019-10-18 06:36:33 +00:00
}
onSubmit() {
this.$scope.watcher.check();
2019-12-12 11:23:31 +00:00
return this.$scope.model.save().then(() => {
2019-10-18 06:36:33 +00:00
this.$scope.watcher.updateOriginalData();
this.$scope.watcher.notifySaved();
this.card.reload();
});
}
add() {
this.$scope.model.insert();
}
}
2019-10-18 11:52:15 +00:00
Controller.$inject = ['$scope'];
2019-10-18 06:36:33 +00:00
ngModule.component('vnWorkerPhones', {
template: require('./index.html'),
controller: Controller,
require: {card: '^vnWorkerCard'},
bindings: {
worker: '<'
}
});