import ngModule from '../module';
import Section from 'salix/components/section';

class Controller extends Section {
    onSubmit() {
        const sip = this.worker.sip;
        const params = {
            userFk: this.worker.id,
            extension: sip.extension
        };
        this.$.watcher.check();
        this.$http.patch('Sips', params).then(() => {
            this.$.watcher.updateOriginalData();
            this.vnApp.showSuccess(this.$t('Data saved! User must access web'));
        });
    }
}

ngModule.vnComponent('vnWorkerPbx', {
    template: require('./index.html'),
    controller: Controller,
    bindings: {
        worker: '<'
    }
});