#853 order.new debería rellenar el consignatario por defecto del cliente

This commit is contained in:
Gerard 2018-11-22 13:56:35 +01:00
parent 98429a95f7
commit 7ada4b7f14
1 changed files with 12 additions and 4 deletions

View File

@ -10,9 +10,8 @@ class Controller {
}
set order(value) {
if (value) {
if (value)
this._order = value;
}
}
get order() {
@ -21,7 +20,16 @@ class Controller {
set clientFk(value) {
this.order.clientFk = value;
this.addressFk = null;
if (value) {
let filter = {where: {clientFk: value, isDefaultAddress: true}};
filter = encodeURIComponent(JSON.stringify(filter));
let query = `/api/Addresses?filter=${filter}`;
this.$http.get(query).then(res => {
this.addressFk = res.data[0].id;
});
} else
this.addressFk = null;
}
get clientFk() {
@ -74,7 +82,7 @@ class Controller {
};
this.$http.post(`order/api/Orders/new`, params).then(res => {
this.vnApp.showSuccess(this.translate.instant('Data saved!'));
this.$state.go("order.card.catalog", {id: res.data});
this.$state.go('order.card.catalog', {id: res.data});
});
}
}