2018-06-26 07:41:27 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
|
|
|
class Controller {
|
2018-08-30 06:50:03 +00:00
|
|
|
constructor($scope, $stateParams, $translate) {
|
2018-06-26 07:41:27 +00:00
|
|
|
this.$scope = $scope;
|
2018-07-16 06:00:04 +00:00
|
|
|
this.$stateParams = $stateParams;
|
2018-06-26 07:41:27 +00:00
|
|
|
this.$translate = $translate;
|
2018-08-27 09:22:59 +00:00
|
|
|
}
|
2018-06-26 07:41:27 +00:00
|
|
|
|
2018-08-27 09:22:59 +00:00
|
|
|
add() {
|
2018-08-30 06:50:03 +00:00
|
|
|
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-30 06:50:03 +00:00
|
|
|
});
|
2018-06-26 07:41:27 +00:00
|
|
|
}
|
|
|
|
|
2018-08-27 09:22:59 +00:00
|
|
|
onSubmit() {
|
|
|
|
this.$scope.watcher.check();
|
2018-08-30 06:50:03 +00:00
|
|
|
this.$scope.model.save().then(() => {
|
|
|
|
this.$scope.watcher.notifySaved();
|
|
|
|
this.$scope.model.refresh();
|
|
|
|
});
|
2018-06-26 07:41:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-30 06:50:03 +00:00
|
|
|
Controller.$inject = ['$scope', '$stateParams', '$translate'];
|
2018-06-26 07:41:27 +00:00
|
|
|
|
2018-07-31 09:08:22 +00:00
|
|
|
ngModule.component('vnClientContact', {
|
2018-06-26 07:41:27 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
|
|
|
client: '<'
|
|
|
|
}
|
|
|
|
});
|