mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
Merge branch 'improve_address' into person_renderbox_thirdparty_onthefly
This commit is contained in:
commit
fa9b571d6b
@ -98,6 +98,9 @@ section.chill-entity {
|
|||||||
&.date-since {}
|
&.date-since {}
|
||||||
&.date-until {}
|
&.date-until {}
|
||||||
}
|
}
|
||||||
|
.address-more {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// used for comment-embeddable
|
// used for comment-embeddable
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
v-bind:defaultz="this.defaultz"
|
v-bind:defaultz="this.defaultz"
|
||||||
v-bind:entity="this.entity"
|
v-bind:entity="this.entity"
|
||||||
v-bind:flag="this.flag"
|
v-bind:flag="this.flag"
|
||||||
|
v-bind:useDatePane="this.useDatePane"
|
||||||
@openEditPane="openEditPane"
|
@openEditPane="openEditPane"
|
||||||
ref="showAddress">
|
ref="showAddress">
|
||||||
</show-pane>
|
</show-pane>
|
||||||
@ -101,10 +102,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<button class="btn btn-cancel change-icon" @click="resetPane">
|
<!--<button class="btn btn-cancel change-icon" @click="resetPane">{{ $t('action.cancel') }}</button>-->
|
||||||
{{ $t('action.cancel') }}
|
<button v-if="!this.context.edit && this.useDatePane" class="btn btn-update change-icon" @click="closeEditPane">
|
||||||
</button>
|
|
||||||
<button v-if="useDatePane" class="btn btn-misc" @click="closeEditPane">
|
|
||||||
{{ $t('nav.next')}}
|
{{ $t('nav.next')}}
|
||||||
<i class="fa fa-fw fa-arrow-right"></i>
|
<i class="fa fa-fw fa-arrow-right"></i>
|
||||||
</button>
|
</button>
|
||||||
@ -132,8 +131,8 @@
|
|||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:action>
|
<template v-slot:action>
|
||||||
<li v-if="useDatePane">
|
<li v-if="!this.context.edit && this.useDatePane">
|
||||||
<button class="btn btn-misc" @click="closeEditPane">
|
<button class="btn btn-update change-icon" @click="closeEditPane">
|
||||||
{{ $t('nav.next')}}
|
{{ $t('nav.next')}}
|
||||||
<i class="fa fa-fw fa-arrow-right"></i>
|
<i class="fa fa-fw fa-arrow-right"></i>
|
||||||
</button>
|
</button>
|
||||||
@ -175,14 +174,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<button class="btn btn-update" @click="openEditPane">
|
<button class="btn btn-misc" @click="openEditPane">
|
||||||
{{ $t('action.edit')}}
|
<i class="fa fa-fw fa-arrow-left"></i>
|
||||||
|
{{ $t('nav.previous')}}
|
||||||
</button>
|
</button>
|
||||||
<!--
|
<button class="btn btn-save" @click="closeDatePane">
|
||||||
<button class="btn btn-save">
|
|
||||||
{{ $t('action.save')}}
|
{{ $t('action.save')}}
|
||||||
</button>
|
</button>
|
||||||
-->
|
<!-- -->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</modal>
|
</modal>
|
||||||
@ -197,10 +196,16 @@
|
|||||||
v-bind:insideModal="false"
|
v-bind:insideModal="false"
|
||||||
ref="dateAddress">
|
ref="dateAddress">
|
||||||
|
|
||||||
|
<template v-slot:before>
|
||||||
|
<button class="btn btn-misc" @click="openEditPane">
|
||||||
|
<i class="fa fa-fw fa-arrow-left"></i>
|
||||||
|
{{ $t('nav.previous')}}
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
<template v-slot:action>
|
<template v-slot:action>
|
||||||
<li>
|
<li>
|
||||||
<button class="btn btn-update" @click="closeDatePane">
|
<button class="btn btn-save" @click="closeDatePane">
|
||||||
{{ $t('action.edit')}}
|
{{ $t('action.save')}}
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
@ -276,7 +281,7 @@ export default {
|
|||||||
},
|
},
|
||||||
valid: {
|
valid: {
|
||||||
from: new Date(),
|
from: new Date(),
|
||||||
to: new Date()
|
to: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addressMap: {
|
addressMap: {
|
||||||
@ -330,11 +335,6 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
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('useDatePane', this.useDatePane);
|
||||||
|
|
||||||
console.log('Mounted now !');
|
console.log('Mounted now !');
|
||||||
@ -380,7 +380,9 @@ export default {
|
|||||||
console.log('displaySuggestions');
|
console.log('displaySuggestions');
|
||||||
this.openSuggestPane();
|
this.openSuggestPane();
|
||||||
} else {
|
} else {
|
||||||
this.initForm();
|
if (this.flag.datePane === false) {
|
||||||
|
this.initForm(); // reset form except if we come back from datePane
|
||||||
|
}
|
||||||
this.getCountries(); // will open editPane when resolve promise
|
this.getCountries(); // will open editPane when resolve promise
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -456,11 +458,14 @@ export default {
|
|||||||
fetchCountries().then(
|
fetchCountries().then(
|
||||||
countries => new Promise((resolve, reject) => {
|
countries => new Promise((resolve, reject) => {
|
||||||
this.entity.loaded.countries = countries.results;
|
this.entity.loaded.countries = countries.results;
|
||||||
|
if (this.flag.showPane === true) {
|
||||||
|
this.closeShowPane();
|
||||||
|
}
|
||||||
if (this.flag.suggestPane === true) {
|
if (this.flag.suggestPane === true) {
|
||||||
this.closeSuggestPane();
|
this.closeSuggestPane();
|
||||||
}
|
}
|
||||||
if (this.flag.showPane === true) {
|
if (this.flag.datePane === true) {
|
||||||
this.closeShowPane();
|
this.flag.datePane = false;
|
||||||
}
|
}
|
||||||
console.log('step2: open the Edit panel');
|
console.log('step2: open the Edit panel');
|
||||||
this.flag.editPane = true;
|
this.flag.editPane = true;
|
||||||
@ -600,8 +605,10 @@ export default {
|
|||||||
if (this.context.target.name === 'person') { // !!! maintain here ?
|
if (this.context.target.name === 'person') { // !!! maintain here ?
|
||||||
postcodeBody = Object.assign(postcodeBody, {'origin': 3});
|
postcodeBody = Object.assign(postcodeBody, {'origin': 3});
|
||||||
}
|
}
|
||||||
|
console.log('juste before post new postcode', postcodeBody);
|
||||||
return postPostalCode(postcodeBody)
|
return postPostalCode(postcodeBody)
|
||||||
.then(postalCode => {
|
.then(postalCode => {
|
||||||
|
console.log('new postcode created', postalCode.id);
|
||||||
payload.postcode = {'id': postalCode.id };
|
payload.postcode = {'id': postalCode.id };
|
||||||
return this.postNewAddress(payload);
|
return this.postNewAddress(payload);
|
||||||
});
|
});
|
||||||
|
@ -9,29 +9,31 @@
|
|||||||
{{ errorMsg }}
|
{{ errorMsg }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<address-render-box :address="address"></address-render-box>
|
<address-render-box :address="selectedAddress"></address-render-box>
|
||||||
|
|
||||||
<div v-if="showDateFrom" class='address-valid date-since'>
|
<div class="row">
|
||||||
<h3>{{ $t(getValidFromDateText) }}</h3>
|
<div v-if="showDateFrom" class='col-lg-6 address-valid date-since'>
|
||||||
<div class="input-group mb-3">
|
<h3>{{ $t(getValidFromDateText) }}</h3>
|
||||||
<span class="input-group-text" id="validFrom"><i class="fa fa-fw fa-calendar"></i></span>
|
<div class="input-group mb-3">
|
||||||
<input type="date" class="form-control form-control-lg" name="validFrom"
|
<span class="input-group-text" id="validFrom"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
v-bind:placeholder="$t(getValidFromDateText)"
|
<input type="date" class="form-control form-control-lg" name="validFrom"
|
||||||
v-model="validFrom"
|
v-bind:placeholder="$t(getValidFromDateText)"
|
||||||
aria-describedby="validFrom"
|
v-model="validFrom"
|
||||||
/>
|
aria-describedby="validFrom"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="showDateTo" class='address-valid date-until'>
|
<div v-if="showDateTo" class='col-lg-6 address-valid date-until'>
|
||||||
<h3>{{ $t(getValidToDateText) }}</h3>
|
<h3>{{ $t(getValidToDateText) }}</h3>
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<span class="input-group-text" id="validTo"><i class="fa fa-fw fa-calendar"></i></span>
|
<span class="input-group-text" id="validTo"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
<input type="date" class="form-control form-control-lg" name="validTo"
|
<input type="date" class="form-control form-control-lg" name="validTo"
|
||||||
v-bind:placeholder="$t(getValidToDateText)"
|
v-bind:placeholder="$t(getValidToDateText)"
|
||||||
v-model="validTo"
|
v-model="validTo"
|
||||||
aria-describedby="validTo"
|
aria-describedby="validTo"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -88,7 +90,7 @@ export default {
|
|||||||
this.entity.selected.valid.to = ISOToDate(value);
|
this.entity.selected.valid.to = ISOToDate(value);
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return dateToISO(this.entity.selected.valid.from);
|
return dateToISO(this.entity.selected.valid.to);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getValidFromDateText() {
|
getValidFromDateText() {
|
||||||
@ -102,6 +104,35 @@ export default {
|
|||||||
},
|
},
|
||||||
showDateTo() {
|
showDateTo() {
|
||||||
return !this.context.edit && this.options.useDate.validTo;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<address-render-box :address="address"></address-render-box>
|
<address-render-box :address="address" :useDatePane="useDatePane"></address-render-box>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<action-buttons
|
<action-buttons
|
||||||
@ -56,7 +56,8 @@ export default {
|
|||||||
'defaultz',
|
'defaultz',
|
||||||
'flag',
|
'flag',
|
||||||
'entity',
|
'entity',
|
||||||
'errorMsg'
|
'errorMsg',
|
||||||
|
'useDatePane'
|
||||||
],
|
],
|
||||||
emits: ['openEditPane'],
|
emits: ['openEditPane'],
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -54,6 +54,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</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>
|
</component>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -67,6 +80,10 @@ export default {
|
|||||||
isMultiline: {
|
isMultiline: {
|
||||||
default: true,
|
default: true,
|
||||||
type: Boolean
|
type: Boolean
|
||||||
|
},
|
||||||
|
useDatePane: {
|
||||||
|
default: false,
|
||||||
|
type: Boolean
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -13,6 +13,7 @@ class AddressNormalizer implements NormalizerAwareInterface, NormalizerInterface
|
|||||||
|
|
||||||
public function normalize($address, string $format = null, array $context = [])
|
public function normalize($address, string $format = null, array $context = [])
|
||||||
{
|
{
|
||||||
|
/** @var Address $address */
|
||||||
$data['address_id'] = $address->getId();
|
$data['address_id'] = $address->getId();
|
||||||
$data['text'] = $address->isNoAddress() ? '' : $address->getStreetNumber().', '.$address->getStreet();
|
$data['text'] = $address->isNoAddress() ? '' : $address->getStreetNumber().', '.$address->getStreet();
|
||||||
$data['street'] = $address->getStreet();
|
$data['street'] = $address->getStreet();
|
||||||
@ -30,6 +31,8 @@ class AddressNormalizer implements NormalizerAwareInterface, NormalizerInterface
|
|||||||
$data['buildingName'] = $address->getBuildingName();
|
$data['buildingName'] = $address->getBuildingName();
|
||||||
$data['distribution'] = $address->getDistribution();
|
$data['distribution'] = $address->getDistribution();
|
||||||
$data['extra'] = $address->getExtra();
|
$data['extra'] = $address->getExtra();
|
||||||
|
$data['validFrom'] = $address->getValidFrom();
|
||||||
|
$data['validTo'] = $address->getValidTo();
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -89,9 +89,9 @@ export default {
|
|||||||
/// Display each step in page or Modal
|
/// Display each step in page or Modal
|
||||||
openPanesInModal: true,
|
openPanesInModal: true,
|
||||||
// Use Date fields
|
// Use Date fields
|
||||||
useDate: {
|
//useDate: {
|
||||||
validFrom: true
|
// validFrom: true
|
||||||
},
|
//},
|
||||||
hideAddress: true
|
hideAddress: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,12 @@
|
|||||||
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
|
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
|
||||||
targetEntity: { name: 'person', id: person.id },
|
targetEntity: { name: 'person', id: person.id },
|
||||||
stickyActions: true,
|
stickyActions: true,
|
||||||
|
useValidFrom: true,
|
||||||
} %}
|
} %}
|
||||||
{#
|
{#
|
||||||
|
useValidTo: true,
|
||||||
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
|
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
|
||||||
openPanesInModal: false,
|
openPanesInModal: false,
|
||||||
useValidFrom: true,
|
|
||||||
#}
|
#}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user