salix/modules/client/front/contact/index.js

36 lines
829 B
JavaScript

import ngModule from '../module';
class Controller {
constructor($scope, $stateParams, $translate) {
this.$scope = $scope;
this.$stateParams = $stateParams;
this.$translate = $translate;
}
add() {
this.$scope.model.insert({
clientFk: this.client.id,
name: this.$translate.instant('Phone'),
phone: null
});
}
onSubmit() {
this.$scope.watcher.check();
this.$scope.model.save().then(() => {
this.$scope.watcher.notifySaved();
this.$scope.model.refresh();
});
}
}
Controller.$inject = ['$scope', '$stateParams', '$translate'];
ngModule.component('vnClientContact', {
template: require('./index.html'),
controller: Controller,
bindings: {
client: '<'
}
});