Submitting address, and validFrom field

This commit is contained in:
2021-08-05 22:04:41 +02:00
parent 884de5c19e
commit 01cc230136
3 changed files with 134 additions and 65 deletions

View File

@@ -1,10 +1,19 @@
<template>
<div v-for="error in displayErrors"
class="alert alert-danger my-2">
{{ error }}
</div>
<pre v-if="addAddress.result">
{{ addAddress.result.address_id }}
</pre>
<add-address
v-bind:key="addAddress.type"
v-bind:context="context"
v-bind:key="addAddress.key"
v-bind:options="addAddress.options"
@submitAddress="submitAddress"
v-bind:result="addAddress.result"
ref="addAddress">
</add-address>
</template>
@@ -24,10 +33,8 @@ export default {
personId: window.personId,
addressId: window.addressId,
backUrl: `/fr/person/${window.personId}/address/list`, //TODO better way to pass this
validFrom: new Date().toISOString().split('T')[0]
},
addAddress: {
key: 'person',
options: {
/// Options override default
@@ -39,19 +46,15 @@ export default {
/// Display each step in page or Modal
//bindModal: { step1: false, step2: false } //TODO true-false must not be possible
}
},
type: 'person',
result: null // <== returned from addAddress component
}
}
},
methods: {
submitAddress({ submited, flag }) {
console.log('@@@ CLICK button submitAddress');
console.log('address to post:', submited);
console.log('datas by refs: ', this.$refs.addAddress.entity.address.text);
this.$refs.addAddress.initForm(); // to cast child method
flag.showPane = false;
displayErrors() {
return this.$refs.addAddress.errorMsg;
}
}
}