From ae716a14533398e55fcccf2fc03e96404d1fd419 Mon Sep 17 00:00:00 2001 From: Joan Date: Tue, 10 Jul 2018 08:23:32 +0200 Subject: [PATCH] Reload descriptor #391 --- .../src/credit-insurance/create/index.js | 9 +++++++-- .../insurance/create/index.html | 3 +-- .../credit-insurance/insurance/create/index.js | 18 ++++++++++++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/client/client/src/credit-insurance/create/index.js b/client/client/src/credit-insurance/create/index.js index 221580b27..f812000ce 100644 --- a/client/client/src/credit-insurance/create/index.js +++ b/client/client/src/credit-insurance/create/index.js @@ -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: '<' } diff --git a/client/client/src/credit-insurance/insurance/create/index.html b/client/client/src/credit-insurance/insurance/create/index.html index f2f9efef3..802060da1 100644 --- a/client/client/src/credit-insurance/insurance/create/index.html +++ b/client/client/src/credit-insurance/insurance/create/index.html @@ -5,8 +5,7 @@ form="form" save="post"> -
+ New credit diff --git a/client/client/src/credit-insurance/insurance/create/index.js b/client/client/src/credit-insurance/insurance/create/index.js index 5f615bdb2..2c7670ff5 100644 --- a/client/client/src/credit-insurance/insurance/create/index.js +++ b/client/client/src/credit-insurance/insurance/create/index.js @@ -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: '<' }