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

class Controller extends Section {
    add() {
        this.$.model.insert({
            supplierFk: this.supplier.id
        });
    }

    onSubmit() {
        this.$.watcher.check();
        this.$.model.save().then(() => {
            this.$.watcher.notifySaved();
            this.$.watcher.updateOriginalData();
        });
    }
}

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