From 072f88d1a502441caaf3b8c03f88cb7142bc3321 Mon Sep 17 00:00:00 2001 From: "LaptopVerdnatura\\Javi" Date: Mon, 23 Aug 2021 14:47:26 +0200 Subject: [PATCH] refactor --- modules/supplier/front/account/index.html | 41 +++++++++-------------- modules/supplier/front/account/index.js | 20 ++++++----- modules/supplier/front/card/index.js | 2 +- 3 files changed, 28 insertions(+), 35 deletions(-) diff --git a/modules/supplier/front/account/index.html b/modules/supplier/front/account/index.html index 6e0ad5a0f..1e52b6213 100644 --- a/modules/supplier/front/account/index.html +++ b/modules/supplier/front/account/index.html @@ -7,15 +7,6 @@ data="$ctrl.supplierAccounts" auto-load="true"> - - - + - + + + + - - - - - diff --git a/modules/supplier/front/account/index.js b/modules/supplier/front/account/index.js index b93f1080f..aa7b40727 100644 --- a/modules/supplier/front/account/index.js +++ b/modules/supplier/front/account/index.js @@ -52,19 +52,21 @@ class Controller extends Section { }; const query = `Suppliers/${this.$params.id}`; return this.$http.patch(query, values) - .then(this.$.watcher.notifySaved()); + .then(() => this.$.watcher.notifySaved()); } onSubmit() { this.$.watcher.check(); - this.$.model.save().then(() => { - if (this.supplier.payMethodFk != this.wireTransferFk) - this.$.payMethodToTransfer.show(); - - this.$.watcher.notifySaved(); - this.$.watcher.updateOriginalData(); - this.card.reload(); - }); + this.$.model.save() + .then(() => { + this.$.watcher.notifySaved(); + this.$.watcher.updateOriginalData(); + return this.card.reload(); + }) + .then(() => { + if (this.supplier.payMethodFk != this.wireTransferFk) + this.$.payMethodToTransfer.show(); + }); } } diff --git a/modules/supplier/front/card/index.js b/modules/supplier/front/card/index.js index 613b99cc9..13fc3d52d 100644 --- a/modules/supplier/front/card/index.js +++ b/modules/supplier/front/card/index.js @@ -37,7 +37,7 @@ class Controller extends ModuleCard { } ] }; - this.$http.get(`Suppliers/${this.$params.id}`, {filter}) + return this.$http.get(`Suppliers/${this.$params.id}`, {filter}) .then(response => this.supplier = response.data); } }