From f10092d2cf26763d8b1856d49eae759ae71fdf1b Mon Sep 17 00:00:00 2001 From: Jorge Padawan Date: Wed, 17 Feb 2021 12:07:04 +0100 Subject: [PATCH] Added autocomplete on bank entity --- front/salix/components/bank-entity/index.js | 5 +++-- modules/supplier/front/account/index.html | 4 ++-- modules/supplier/front/account/index.js | 11 +++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/front/salix/components/bank-entity/index.js b/front/salix/components/bank-entity/index.js index e42e5a6ea..192ebe046 100644 --- a/front/salix/components/bank-entity/index.js +++ b/front/salix/components/bank-entity/index.js @@ -6,6 +6,7 @@ class Controller extends Component { open() { this.$.bankEntityDialog.show(); } + resetData() { this.data = {}; } @@ -15,9 +16,9 @@ class Controller extends Component { if (!this.data.countryFk) throw new Error(`The country can't be empty`); - this.$http.post(`bankEntities`, this.data).then(() => { + this.$http.post(`bankEntities`, this.data).then(res => { this.vnApp.showMessage(this.$t('The bank entity has been created. You can save the data now')); - this.emit('response', {$response: this.data}); + this.emit('response', {$response: res.data}); }); } catch (e) { this.vnApp.showError(this.$t(e.message)); diff --git a/modules/supplier/front/account/index.html b/modules/supplier/front/account/index.html index 6248da2e2..577fa4e87 100644 --- a/modules/supplier/front/account/index.html +++ b/modules/supplier/front/account/index.html @@ -32,7 +32,7 @@ + ng-click="$ctrl.showBankEntity($event, $index)"> @@ -62,6 +62,6 @@ \ No newline at end of file diff --git a/modules/supplier/front/account/index.js b/modules/supplier/front/account/index.js index 85b00d25c..2a2fa0069 100644 --- a/modules/supplier/front/account/index.js +++ b/modules/supplier/front/account/index.js @@ -19,14 +19,17 @@ class Controller extends Section { } onResponse(response) { - this.name = response.name; - console.log(this.name); + console.log(response); + const data = this.$.model.data; + const supplierAccount = data[this.currentRowIndex]; + supplierAccount.bankEntityFk = response.id; } - showBankEntity(event) { + showBankEntity(event, $index) { if (event.defaultPrevented) return; event.preventDefault(); - this.$.bankEntity.show(); + this.currentRowIndex = $index; + this.$.bankEntity.open(); } onBankEntityAccept() {