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

34 lines
869 B
JavaScript

import ngModule from '../module';
class Controller {
constructor($scope, $http, vnApp, $translate) {
this.$scope = $scope;
this.$http = $http;
this.vnApp = vnApp;
this._ = $translate;
}
onSubmit() {
const sip = this.worker.sip;
const params = {
userFk: this.worker.userFk,
extension: sip.extension
};
this.$scope.watcher.check();
this.$http.patch('/api/Sips', params).then(() => {
this.$scope.watcher.updateOriginalData();
this.vnApp.showSuccess(this._.instant('Data saved! User must access web'));
});
}
}
Controller.$inject = ['$scope', '$http', 'vnApp', '$translate'];
ngModule.component('vnWorkerPbx', {
template: require('./index.html'),
controller: Controller,
bindings: {
worker: '<'
}
});