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

47 lines
1.0 KiB
JavaScript
Raw Normal View History

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