From 0808f5a6f3a1d6d2a6638824d98a085ae2e1045f Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 23 Sep 2021 11:44:22 +0200 Subject: [PATCH] Address datePane: convert selectedAddress to pass and view it with addressRenderBox --- .../public/chill/scss/render_box.scss | 3 ++ .../vuejs/Address/components/DatePane.vue | 31 ++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss index 31d2c8d09..6100bc842 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss @@ -98,6 +98,9 @@ section.chill-entity { &.date-since {} &.date-until {} } + .address-more { + margin-bottom: 1em; + } } // used for comment-embeddable diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/DatePane.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/DatePane.vue index b14ac6ce8..69e4ccea6 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/DatePane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/DatePane.vue @@ -9,7 +9,7 @@ {{ errorMsg }} - +
@@ -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; } } }