refs #5888 remove duplicate code
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2023-07-17 08:05:21 +02:00
parent a7e6050250
commit 699535880a
2 changed files with 0 additions and 78 deletions

View File

@ -224,7 +224,3 @@
message="Found a client with this data"
on-accept="$ctrl.onAcceptDuplication()">
</vn-confirm>
<vn-geo-postcode
vn-id="postcode"
on-response="$ctrl.onResponse($response)">
</vn-geo-postcode>

View File

@ -103,80 +103,6 @@ export default class Controller extends Section {
this.$.$apply();
}
get province() {
return this._province;
}
// Province auto complete
set province(selection) {
const oldValue = this._province;
this._province = selection;
if (!selection || !oldValue) return;
const country = selection.country;
if (!this.client.countryFk)
this.client.countryFk = country.id;
}
get town() {
return this._town;
}
// Town auto complete
set town(selection) {
const oldValue = this._town;
this._town = selection;
if (!selection || !oldValue) return;
const province = selection.province;
const country = province.country;
const postcodes = selection.postcodes;
if (!this.client.provinceFk)
this.client.provinceFk = province.id;
if (!this.client.countryFk)
this.client.countryFk = country.id;
if (!this.client.postcode && postcodes.length === 1)
this.client.postcode = postcodes[0].code;
}
get postcode() {
return this._postcode;
}
// Postcode auto complete
set postcode(selection) {
const oldValue = this._postcode;
this._postcode = selection;
if (!selection || !oldValue) return;
const town = selection.town;
const province = town.province;
const country = province.country;
if (!this.client.city)
this.client.city = town.name;
if (!this.client.provinceFk)
this.client.provinceFk = province.id;
if (!this.client.countryFk)
this.client.countryFk = country.id;
}
onResponse(response) {
this.client.postcode = response.code;
this.client.city = response.city;
this.client.provinceFk = response.provinceFk;
this.client.countryFk = response.countryFk;
}
}
ngModule.vnComponent('vnClientFiscalData', {