mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
AddAddress final submit, managed by callback and not an event
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
v-bind:context="context"
|
||||
v-bind:options="addAddress.options"
|
||||
v-bind:result="addAddress.result"
|
||||
@submitAddress="submitAddress"
|
||||
v-bind:addressChanged="submitAddress"
|
||||
ref="addAddress">
|
||||
</add-address>
|
||||
</template>
|
||||
@@ -73,13 +73,11 @@ export default {
|
||||
displayErrors() {
|
||||
return this.$refs.addAddress.errorMsg;
|
||||
},
|
||||
submitAddress() {
|
||||
console.log('@@@ click on Submit Address Button');
|
||||
let payload = this.$refs.addAddress.submitNewAddress(); // Cast child method
|
||||
this.addDateToAddressAndPostAddressTo(payload);
|
||||
submitAddress(payload) {
|
||||
console.log('@@@ click on Submit Address Button', payload);
|
||||
this.addDateToAddressAndPostAddressTo(payload); // !!
|
||||
},
|
||||
addDateToAddressAndPostAddressTo(payload)
|
||||
{
|
||||
addDateToAddressAndPostAddressTo(payload) {
|
||||
payload.body = {
|
||||
validFrom: {
|
||||
datetime: `${this.context.valid.from.toISOString().split('T')[0]}T00:00:00+0100`
|
||||
@@ -100,11 +98,9 @@ export default {
|
||||
this.$refs.addAddress.flag.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
postAddressTo(payload)
|
||||
{
|
||||
postAddressTo(payload) {
|
||||
console.log('postAddressTo', payload.entity);
|
||||
if (!this.context.edit) {
|
||||
if (!this.context.edit) { // !!
|
||||
switch (payload.entity) {
|
||||
case 'household':
|
||||
postAddressToHousehold(payload.entityId, payload.addressId)
|
||||
@@ -141,7 +137,7 @@ export default {
|
||||
}
|
||||
} else {
|
||||
// address is already linked, just finish !
|
||||
window.location.assign(this.context.backUrl);
|
||||
//window.location.assign(this.context.backUrl);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user