mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
Address: fetch POST valid dates when applying changes from datePane
This commit is contained in:
parent
463b615595
commit
9f07e6a272
@ -53,32 +53,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
|
||||||
* Patch date
|
|
||||||
* TO MOVE in DatePane
|
|
||||||
addDateToAddressAndPostAddressTo(payload) {
|
|
||||||
payload.body = {
|
|
||||||
validFrom: {
|
|
||||||
datetime: `${this.context.valid.from.toISOString().split('T')[0]}T00:00:00+0100`
|
|
||||||
}
|
|
||||||
};
|
|
||||||
console.log('addDateToAddress', payload);
|
|
||||||
|
|
||||||
this.$refs.addAddress.flag.loading = true;
|
|
||||||
return patchAddress(payload.addressId, payload.body)
|
|
||||||
.then(address => new Promise((resolve, reject) => {
|
|
||||||
this.context.valid.from = address.validFrom;
|
|
||||||
resolve();
|
|
||||||
})
|
|
||||||
.then(this.postAddressTo(payload))
|
|
||||||
)
|
|
||||||
.catch((error) => {
|
|
||||||
this.$refs.addAddress.errorMsg.push(error);
|
|
||||||
this.$refs.addAddress.flag.loading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Post new created address to targetEntity
|
* Post new created address to targetEntity
|
||||||
*/
|
*/
|
||||||
|
@ -299,14 +299,16 @@ export default {
|
|||||||
return (typeof this.options.openPanesInModal !== 'undefined') ?
|
return (typeof this.options.openPanesInModal !== 'undefined') ?
|
||||||
this.options.openPanesInModal : this.defaultz.openPanesInModal;
|
this.options.openPanesInModal : this.defaultz.openPanesInModal;
|
||||||
},
|
},
|
||||||
useDatePane() {
|
validFrom() {
|
||||||
let vFrom = (typeof this.options.useDate !== 'undefined'
|
return (typeof this.options.useDate !== 'undefined' && typeof this.options.useDate.validFrom !== 'undefined') ?
|
||||||
&& typeof this.options.useDate.validFrom !== 'undefined') ?
|
this.options.useDate.validFrom : this.defaultz.useDate.validFrom;
|
||||||
this.options.useDate.validFrom : this.defaultz.useDate.validFrom ;
|
},
|
||||||
let vTo = (typeof this.options.useDate !== 'undefined'
|
validTo() {
|
||||||
&& typeof this.options.useDate.validTo !== 'undefined') ?
|
return (typeof this.options.useDate !== 'undefined' && typeof this.options.useDate.validTo !== 'undefined') ?
|
||||||
this.options.useDate.validTo : this.defaultz.useDate.validTo ;
|
this.options.useDate.validTo : this.defaultz.useDate.validTo ;
|
||||||
return (vFrom || vTo) ? true : false;
|
},
|
||||||
|
useDatePane() {
|
||||||
|
return (this.validFrom || this.validTo) ? true : false;
|
||||||
},
|
},
|
||||||
hasSuggestions() {
|
hasSuggestions() {
|
||||||
// TODO
|
// TODO
|
||||||
@ -335,6 +337,8 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
|
console.log('validFrom', this.validFrom);
|
||||||
|
console.log('validTo', this.validTo);
|
||||||
console.log('useDatePane', this.useDatePane);
|
console.log('useDatePane', this.useDatePane);
|
||||||
|
|
||||||
console.log('Mounted now !');
|
console.log('Mounted now !');
|
||||||
@ -566,6 +570,22 @@ export default {
|
|||||||
'point': this.entity.selected.address.point.coordinates
|
'point': this.entity.selected.address.point.coordinates
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (this.validFrom) {
|
||||||
|
console.log('add validFrom in fetch body', this.entity.selected.valid.from);
|
||||||
|
newAddress = Object.assign(newAddress, {
|
||||||
|
'validFrom': {
|
||||||
|
datetime: `${this.entity.selected.valid.from.toISOString().split('T')[0]}T00:00:00+0100`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (this.validTo && null !== this.entity.selected.valid.to) {
|
||||||
|
console.log('add validTo in fetch body', this.entity.selected.valid.to);
|
||||||
|
newAddress = Object.assign(newAddress, {
|
||||||
|
'validTo': {
|
||||||
|
datetime: `${this.entity.selected.valid.to.toISOString().split('T')[0]}T00:00:00+0100`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
if (this.entity.selected.writeNew.postcode) {
|
if (this.entity.selected.writeNew.postcode) {
|
||||||
let newPostcode = this.entity.selected.postcode;
|
let newPostcode = this.entity.selected.postcode;
|
||||||
newPostcode = Object.assign(newPostcode, {
|
newPostcode = Object.assign(newPostcode, {
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { dateToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date.js';
|
import { dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date.js';
|
||||||
import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue';
|
import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue';
|
||||||
import ActionButtons from './ActionButtons.vue';
|
import ActionButtons from './ActionButtons.vue';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user