Address: pass useDatePane option in showPane addressRenderBox, display dates in showPane

This commit is contained in:
Mathieu Jaumotte 2021-09-23 11:04:25 +02:00
parent e7676c5c2e
commit 1c568a75ec
5 changed files with 26 additions and 8 deletions

View File

@ -7,6 +7,7 @@
v-bind:defaultz="this.defaultz"
v-bind:entity="this.entity"
v-bind:flag="this.flag"
v-bind:useDatePane="this.useDatePane"
@openEditPane="openEditPane"
ref="showAddress">
</show-pane>
@ -334,11 +335,6 @@ export default {
},
mounted() {
//console.log('options displayText', this.options.button.displayText);
//console.log('options bindModal.step1', this.options.bindModal.step1);
//console.log('options bindModal.step2', this.options.bindModal.step2);
//console.log('options useDate.validFrom', this.options.useDate.validFrom);
//console.log('options useDate.validTo', this.options.useDate.validTo);
console.log('useDatePane', this.useDatePane);
console.log('Mounted now !');

View File

@ -21,7 +21,7 @@
</p>
</div>
<address-render-box :address="address"></address-render-box>
<address-render-box :address="address" :useDatePane="useDatePane"></address-render-box>
</div>
<action-buttons
@ -56,7 +56,8 @@ export default {
'defaultz',
'flag',
'entity',
'errorMsg'
'errorMsg',
'useDatePane'
],
emits: ['openEditPane'],
computed: {

View File

@ -54,6 +54,19 @@
</div>
</div>
<div v-if="useDatePane === true" class="address-more">
<div v-if="address.validFrom">
<span class="validFrom">
<b>{{ $t('validFrom') }}</b>: {{ $d(address.validFrom.date) }}
</span>
</div>
<div v-if="address.validTo">
<span class="validTo">
<b>{{ $t('validTo') }}</b>: {{ $d(address.validTo.date) }}
</span>
</div>
</div>
</component>
</template>
@ -67,6 +80,10 @@ export default {
isMultiline: {
default: true,
type: Boolean
},
useDatePane: {
default: false,
type: Boolean
}
},
computed: {

View File

@ -13,6 +13,7 @@ class AddressNormalizer implements NormalizerAwareInterface, NormalizerInterface
public function normalize($address, string $format = null, array $context = [])
{
/** @var Address $address */
$data['address_id'] = $address->getId();
$data['text'] = $address->isNoAddress() ? '' : $address->getStreetNumber().', '.$address->getStreet();
$data['street'] = $address->getStreet();
@ -30,6 +31,8 @@ class AddressNormalizer implements NormalizerAwareInterface, NormalizerInterface
$data['buildingName'] = $address->getBuildingName();
$data['distribution'] = $address->getDistribution();
$data['extra'] = $address->getExtra();
$data['validFrom'] = $address->getValidFrom();
$data['validTo'] = $address->getValidTo();
return $data;
}

View File

@ -30,9 +30,10 @@
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'person', id: person.id },
stickyActions: true,
useValidFrom: true, useValidTo: true,
useValidFrom: true,
} %}
{#
useValidTo: true,
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
openPanesInModal: false,
#}