address nickname now gets updated when client or address updates

This commit is contained in:
Carlos Jimenez Ruiz 2021-06-18 15:54:33 +02:00
parent b906a8e91d
commit 1afae3d56d
2 changed files with 24 additions and 15 deletions

View File

@ -6,14 +6,6 @@
</vn-crud-model>
<form name="form">
<vn-card class="vn-w-md vn-pa-lg">
<vn-horizontal>
<vn-textfield
vn-one
label="Alias"
required="true"
ng-model="$ctrl.ticket.nickname">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
@ -28,6 +20,16 @@
initial-data="$ctrl.clientId"
order="id">
</vn-autocomplete>
<vn-autocomplete vn-one
required="true"
url="Warehouses"
label="Warehouse"
show-field="name"
value-field="id"
ng-model="$ctrl.warehouseId">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
required="true"
@ -52,14 +54,12 @@
</vn-icon-button>
</append>
</vn-autocomplete>
<vn-autocomplete vn-one
<vn-textfield
vn-one
label="Alias"
required="true"
url="Warehouses"
label="Warehouse"
show-field="name"
value-field="id"
ng-model="$ctrl.warehouseId">
</vn-autocomplete>
ng-model="$ctrl.ticket.nickname">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete

View File

@ -40,6 +40,7 @@ class Controller extends Component {
set addressId(value) {
if (value != this.ticket.addressFk) {
this.ticket.addressFk = value;
this.onChangeAddress(value);
this.getShipped({
landed: this.ticket.landed,
addressFk: value,
@ -179,6 +180,14 @@ class Controller extends Component {
});
}
onChangeAddress(addressId) {
this.ticket.nickname = null;
const query = `Addresses/${addressId}`;
this.$http.get(query).then(res => {
this.ticket.nickname = res.data.nickname;
});
}
async onStepChange() {
if (this.isFormInvalid()) {
return this.vnApp.showError(