2019-03-08 08:41:53 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
2019-03-29 09:51:02 +00:00
|
|
|
class Controller {
|
2019-06-17 09:14:45 +00:00
|
|
|
constructor($scope, $http, vnApp, $translate) {
|
2019-03-29 09:51:02 +00:00
|
|
|
this.$scope = $scope;
|
|
|
|
this.$http = $http;
|
2019-06-17 09:14:45 +00:00
|
|
|
this.vnApp = vnApp;
|
|
|
|
this._ = $translate;
|
2019-03-29 09:51:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onSubmit() {
|
|
|
|
const sip = this.worker.sip;
|
|
|
|
const params = {
|
|
|
|
userFk: this.worker.userFk,
|
2019-06-17 09:14:45 +00:00
|
|
|
extension: sip.extension
|
2019-03-29 09:51:02 +00:00
|
|
|
};
|
|
|
|
this.$scope.watcher.check();
|
|
|
|
this.$http.patch('/api/Sips', params).then(() => {
|
|
|
|
this.$scope.watcher.updateOriginalData();
|
2019-06-17 09:14:45 +00:00
|
|
|
this.vnApp.showSuccess(this._.instant('Data saved! User must access web'));
|
2019-03-29 09:51:02 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-17 09:14:45 +00:00
|
|
|
Controller.$inject = ['$scope', '$http', 'vnApp', '$translate'];
|
2019-03-29 09:51:02 +00:00
|
|
|
|
2019-03-08 08:41:53 +00:00
|
|
|
ngModule.component('vnWorkerPbx', {
|
|
|
|
template: require('./index.html'),
|
2019-03-29 09:51:02 +00:00
|
|
|
controller: Controller,
|
2019-03-08 08:41:53 +00:00
|
|
|
bindings: {
|
|
|
|
worker: '<'
|
|
|
|
}
|
|
|
|
});
|