From bd205418a018fd66f558e15aa2db4c9d30d4a369 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 11 Jul 2023 15:29:38 +0200 Subject: [PATCH] refs #5888 create address-autocomplete --- .../address-autocomplete/index.html | 48 +++++++++++-------- .../components/address-autocomplete/index.js | 30 ++++++++++-- modules/supplier/front/fiscal-data/index.html | 4 ++ 3 files changed, 57 insertions(+), 25 deletions(-) diff --git a/front/core/components/address-autocomplete/index.html b/front/core/components/address-autocomplete/index.html index 7e3ab3569..9bfd65fc6 100755 --- a/front/core/components/address-autocomplete/index.html +++ b/front/core/components/address-autocomplete/index.html @@ -1,21 +1,27 @@ - - - - - - - {{::street}}, {{::postCode}}, {{::city}}, {{::province.name}} - - - - - - + + + + + + {{::name}} + + + + + + + + diff --git a/front/core/components/address-autocomplete/index.js b/front/core/components/address-autocomplete/index.js index 34e91a7e1..cc4b7b52f 100755 --- a/front/core/components/address-autocomplete/index.js +++ b/front/core/components/address-autocomplete/index.js @@ -24,11 +24,32 @@ export default class AddressAutocomplete extends Component { } set addressData(value) { + if (!value) return; console.log(value); this._addressData = value; - this.url = 'Postcodes/location'; - // if (value) - // this.input.value = value.street; + } + + get locations() { + return this._locations; + } + + set locations(value) { + if (!value) return; + console.log('set locations'); + console.log(value); + for (let location of value) { + location.map(l => { + return { + name: l.code + ' ' + l.town.name + ', ' + l.town.province.name + ', ' + l.town.province.country.name, + postalCode: l.code, + townFk: l.town.id, + provinceFk: l.town.province.id, + countryFk: l.town.province.country.id, + }; + }); + } + console.log('location', location); + this._locations = value; } } @@ -36,6 +57,7 @@ ngModule.vnComponent('vnAddressAutocomplete', { template: require('./index.html'), controller: AddressAutocomplete, bindings: { - addressData: '