mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
Submitting address, and validFrom field
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user