Reload descriptor #391

This commit is contained in:
Joan Sanchez 2018-07-10 08:23:32 +02:00
parent 303290af53
commit ae716a1453
3 changed files with 24 additions and 6 deletions

View File

@ -20,9 +20,11 @@ class Controller {
let data = this.creditClassification;
data.clientFk = this.client.id;
this.$http.post(query, data).then((res, err) => {
if (res.data)
this.$http.post(query, data).then(res => {
if (res.data) {
this.card.reload();
this.$state.go('client.card.creditInsurance.index');
}
});
}
}
@ -32,6 +34,9 @@ Controller.$inject = ['$http', '$filter', '$state', '$scope', '$translate', 'vnA
ngModule.component('vnClientCreditInsuranceCreate', {
template: require('./index.html'),
controller: Controller,
require: {
card: '^vnClientCard'
},
bindings: {
client: '<'
}

View File

@ -5,8 +5,7 @@
form="form"
save="post">
</vn-watcher>
<form name="form"
ng-submit="watcher.submitGo('client.card.creditInsurance.insurance.index', {classificationId: post.params.classificationId})">
<form name="form" ng-submit="$ctrl.onSubmit()">
<vn-card pad-large>
<vn-title>New credit</vn-title>
<vn-horizontal>

View File

@ -1,18 +1,32 @@
import ngModule from '../../../module';
class Controller {
constructor($filter) {
constructor($scope, $state, $filter) {
this.$scope = $scope;
this.$state = $state;
this.insurance = {
created: $filter('date')(new Date(), 'yyyy-MM-dd HH:mm:ss')
};
}
onSubmit() {
let params = {classificationId: this.$state.params.classificationId};
let state = 'client.card.creditInsurance.insurance.index';
this.$scope.watcher.submitGo(state, params).then(() => {
this.card.reload();
});
}
}
Controller.$inject = ['$filter'];
Controller.$inject = ['$scope', '$state', '$filter'];
ngModule.component('vnClientCreditInsuranceInsuranceCreate', {
template: require('./index.html'),
controller: Controller,
require: {
card: '^vnClientCard'
},
bindings: {
client: '<'
}