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

View File

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

View File

@ -1,18 +1,32 @@
import ngModule from '../../../module'; import ngModule from '../../../module';
class Controller { class Controller {
constructor($filter) { constructor($scope, $state, $filter) {
this.$scope = $scope;
this.$state = $state;
this.insurance = { this.insurance = {
created: $filter('date')(new Date(), 'yyyy-MM-dd HH:mm:ss') 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', { ngModule.component('vnClientCreditInsuranceInsuranceCreate', {
template: require('./index.html'), template: require('./index.html'),
controller: Controller, controller: Controller,
require: {
card: '^vnClientCard'
},
bindings: { bindings: {
client: '<' client: '<'
} }