CourseLocation: change add-address key, cleaning add-address options

This commit is contained in:
Mathieu Jaumotte 2021-09-27 11:17:13 +02:00
parent 349a0e69f1
commit 82db55cfec

View File

@ -37,9 +37,9 @@
<li> <li>
<add-address <add-address
v-if="!isPersonLocation" v-if="!isPersonLocation"
:key="key"
:context="context" :context="context"
:key="addAddress.type" :options="options"
:options="addAddress.options"
:addressChangedCallback="submitTemporaryAddress" :addressChangedCallback="submitTemporaryAddress"
ref="addAddress"> ref="addAddress">
</add-address> </add-address>
@ -76,10 +76,7 @@ export default {
data() { data() {
return { return {
addAddress: { addAddress: {
type: 'accompanying_course_location',
options: { options: {
/// Options override default.
/// null value take default component value
button: { button: {
text: { text: {
create: 'courselocation.add_temporary_address', create: 'courselocation.add_temporary_address',
@ -90,12 +87,6 @@ export default {
create: 'courselocation.add_temporary_address', create: 'courselocation.add_temporary_address',
edit: 'courselocation.edit_temporary_address' edit: 'courselocation.edit_temporary_address'
}, },
/// Display each step in page or Modal
openPanesInModal: true,
// Use Date fields
//useDate: {
// validFrom: true
//},
hideAddress: true hideAddress: true
} }
} }
@ -109,6 +100,13 @@ export default {
...mapGetters([ ...mapGetters([
'isLocationValid' 'isLocationValid'
]), ]),
options() {
return this.addAddress.options;
},
key() {
return (this.context.edit) ? 'address_' + this.context.addressId
: this.accompanyingCourse.type + '_' + this.accompanyingCourse.id ;
},
isTemporaryAddress() { isTemporaryAddress() {
return this.accompanyingCourse.locationStatus === 'address'; return this.accompanyingCourse.locationStatus === 'address';
}, },