Address datePane: validTo date display and format

This commit is contained in:
Mathieu Jaumotte 2021-09-22 17:20:31 +02:00
parent d994612987
commit a8024ba38f
3 changed files with 26 additions and 22 deletions

View File

@ -280,7 +280,7 @@ export default {
}, },
valid: { valid: {
from: new Date(), from: new Date(),
to: new Date() to: null
} }
}, },
addressMap: { addressMap: {
@ -609,8 +609,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);
}); });

View File

@ -11,27 +11,29 @@
<address-render-box :address="address"></address-render-box> <address-render-box :address="address"></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() {

View File

@ -30,11 +30,11 @@
{% 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 %}