Address, city/address selector: update writeNew flag when choose existing or create new

This commit is contained in:
Mathieu Jaumotte 2021-09-04 12:40:42 +02:00
parent f2248a1e9c
commit d51752fa41
2 changed files with 8 additions and 2 deletions

View File

@ -97,6 +97,7 @@ export default {
this.entity.selected.address = value;
this.entity.selected.address.street = value.street;
this.entity.selected.address.streetNumber = value.streetNumber;
this.entity.selected.writeNew.address = false;
this.updateMapCenter(value.point);
},
listenInputSearch(query) {
@ -107,6 +108,7 @@ export default {
let addr = this.splitAddress(this.$data.value.text);
this.entity.selected.address.street = addr.street;
this.entity.selected.address.streetNumber = addr.number;
this.entity.selected.writeNew.address = true;
}
},
splitAddress(address) {
@ -136,6 +138,7 @@ export default {
}
},
addAddress() {
console.log('addAddress: pass here ?? never, it seems');
this.entity.selected.writeNew.address = true;
}
}

View File

@ -95,11 +95,12 @@ export default {
this.entity.selected.city = value;
this.entity.selected.postcode.name = value.name;
this.entity.selected.postcode.code = value.code;
this.entity.selected.writeNew.postcode = false;
this.$emit('getReferenceAddresses', value);
this.focusOnAddress();
},
listenInputSearch(query) {
console.log('listenInputSearch', query, this.isCitySelectorOpen);
//console.log('listenInputSearch', query, this.isCitySelectorOpen);
if (this.isCitySelectorOpen) {
this.$data.value = { text: query };
} else if (this.isEnteredCustomCity) {
@ -108,6 +109,7 @@ export default {
this.entity.selected.city = city;
this.entity.selected.postcode.name = city.name;
this.entity.selected.postcode.code = city.code;
this.entity.selected.writeNew.postcode = true;
}
},
splitCity(city) {
@ -117,7 +119,7 @@ export default {
if (substr.length === 1) {
substr = city.split(' ');
}
console.log('substr', substr);
//console.log('substr', substr);
let decimal = [];
substr.forEach((s, i) => { decimal[i] = /^\d+$/.test(s) });
if (decimal[0] === true) {
@ -138,6 +140,7 @@ export default {
}
},
addPostcode() {
console.log('addPostcode: pass here ?? never, it seems');
this.entity.selected.writeNew.postcode = true;
}
}