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

36 lines
829 B
JavaScript
Raw Normal View History

import ngModule from '../module';
class Controller {
constructor($scope, $stateParams, $translate) {
this.$scope = $scope;
2018-07-16 06:00:04 +00:00
this.$stateParams = $stateParams;
this.$translate = $translate;
2018-08-27 09:22:59 +00:00
}
2018-08-27 09:22:59 +00:00
add() {
this.$scope.model.insert({
2018-08-27 09:22:59 +00:00
clientFk: this.client.id,
name: this.$translate.instant('Phone'),
phone: null
});
}
2018-08-27 09:22:59 +00:00
onSubmit() {
this.$scope.watcher.check();
this.$scope.model.save().then(() => {
this.$scope.watcher.notifySaved();
this.$scope.model.refresh();
});
}
}
Controller.$inject = ['$scope', '$stateParams', '$translate'];
2018-07-31 09:08:22 +00:00
ngModule.component('vnClientContact', {
template: require('./index.html'),
controller: Controller,
bindings: {
client: '<'
}
});