Address datePane: convert selectedAddress to pass and view it with addressRenderBox

This commit is contained in:
Mathieu Jaumotte 2021-09-23 11:44:22 +02:00
parent 1c568a75ec
commit 0808f5a6f3
2 changed files with 33 additions and 1 deletions

View File

@ -98,6 +98,9 @@ section.chill-entity {
&.date-since {}
&.date-until {}
}
.address-more {
margin-bottom: 1em;
}
}
// used for comment-embeddable

View File

@ -9,7 +9,7 @@
{{ errorMsg }}
</div>
<address-render-box :address="entity.selected.address"></address-render-box>
<address-render-box :address="selectedAddress"></address-render-box>
<div class="row">
<div v-if="showDateFrom" class='col-lg-6 address-valid date-since'>
@ -104,6 +104,35 @@ export default {
},
showDateTo() {
return !this.context.edit && this.options.useDate.validTo;
},
selectedAddress() {
let address = {};
address['country'] = (this.entity.selected.country) ? this.entity.selected.country : null;
address['postcode'] = (this.entity.selected.postcode) ? this.entity.selected.postcode : null;
if (this.entity.selected.address) {
let number = (this.entity.selected.address.streetNumber) ? this.entity.selected.address.streetNumber : null;
let street = (this.entity.selected.address.street) ? this.entity.selected.address.street : null;
address['text'] = number + ', ' + street;
address['street'] = (this.entity.selected.address.street) ? this.entity.selected.address.street : null;
address['streetNumber'] = (this.entity.selected.address.streetNumber) ? this.entity.selected.address.streetNumber : null;
address['floor'] = (this.entity.selected.address.floor) ? this.entity.selected.address.floor : null;
address['corridor'] = (this.entity.selected.address.corridor) ? this.entity.selected.address.corridor : null;
address['steps'] = (this.entity.selected.address.steps) ? this.entity.selected.address.steps : null;
address['flat'] = (this.entity.selected.address.flat) ? this.entity.selected.address.flat : null;
address['buildingName'] = (this.entity.selected.address.buildingName) ? this.entity.selected.address.buildingName : null;
address['distribution'] = (this.entity.selected.address.distribution) ? this.entity.selected.address.distribution : null;
address['extra'] = (this.entity.selected.address.extra) ? this.entity.selected.address.extra : null;
}
if (this.entity.selected.valid) {
address['validFrom'] = (this.entity.selected.valid.from) ? dateToISO(this.entity.selected.valid.from) : null;
address['validTo'] = (this.entity.selected.valid.to) ? dateToISO(this.entity.selected.valid.to) : null;
}
return address;
}
}
}