refs #5561 feat: add async functions
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-06-06 12:15:39 +02:00
parent 024cb1e3f4
commit 391dba6d2c
2 changed files with 21 additions and 26 deletions

View File

@ -21,7 +21,7 @@
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th field="isChecked" center>Is checked</vn-th>
<vn-th field="isChecked" center expand>Is checked</vn-th>
<vn-th field="itemFk" number>Item</vn-th>
<vn-th field="concept">Description</vn-th>
<vn-th field="quantity" number>Quantity</vn-th>
@ -31,7 +31,7 @@
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="sale in $ctrl.sales">
<vn-td center>
<vn-td center expand>
<vn-chip
ng-class="{
'pink': sale.hasSaleGroupDetail,

View File

@ -118,44 +118,39 @@ class Controller extends Section {
});
}
updateShelving(itemShelvingSale) {
async updateShelving(itemShelvingSale) {
const params = {
shelvingFk: itemShelvingSale.shelvingFk
};
this.$http.patch(`ItemShelvings/${itemShelvingSale.itemShelvingFk}`, params)
.then(res => {
const filter = {
fields: ['parkingFk'],
where: {
code: res.data.shelvingFk
}
};
this.$http.get(`Shelvings/findOne`, {filter})
.then(res => {
itemShelvingSale.parkingFk = res.data.parkingFk;
});
const res = await this.$http.patch(`ItemShelvings/${itemShelvingSale.itemShelvingFk}`, params);
const filter = {
fields: ['parkingFk'],
where: {
code: res.data.shelvingFk
}
};
this.$http.get(`Shelvings/findOne`, {filter})
.then(res => {
itemShelvingSale.parkingFk = res.data.parkingFk;
this.vnApp.showSuccess(this.$t('Data saved!'));
});
}
updateParking(itemShelvingSale) {
async updateParking(itemShelvingSale) {
const filter = {
fields: ['id'],
where: {
code: itemShelvingSale.shelvingFk
}
};
this.$http.get(`Shelvings/findOne`, {filter})
.then(res => {
const params = {
parkingFk: itemShelvingSale.parkingFk
};
this.$http.patch(`Shelvings/${res.data.id}`, params)
.then(() => {
this.vnApp.showSuccess(this.$t('Data saved!'));
});
});
const res = await this.$http.get(`Shelvings/findOne`, {filter});
const params = {
parkingFk: itemShelvingSale.parkingFk
};
this.$http.patch(`Shelvings/${res.data.id}`, params)
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
}
}