mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
courseLocation: init Address context in the store
This commit is contained in:
@@ -27,8 +27,8 @@
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<add-address
|
||||
v-bind:key="addAddress.type"
|
||||
v-bind:context="context"
|
||||
v-bind:key="addAddress.type"
|
||||
v-bind:options="addAddress.options"
|
||||
v-bind:result="addAddress.result"
|
||||
ref="addAddress">
|
||||
@@ -41,6 +41,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex";
|
||||
import AddAddress from 'ChillMainAssets/vuejs/Address/components/AddAddress.vue';
|
||||
|
||||
export default {
|
||||
@@ -50,25 +51,21 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
context: {
|
||||
edit: true, //dynamic //window.mode === 'edit',
|
||||
personId: null, //window.personId,
|
||||
addressId: null, //window.addressId,
|
||||
backUrl: null //window.backUrl,
|
||||
},
|
||||
addAddress: {
|
||||
options: {
|
||||
|
||||
/// Options override default.
|
||||
/// null value take default component value
|
||||
button: {
|
||||
text: { create: null, edit: null },
|
||||
type: null,
|
||||
size: null,
|
||||
//display: false
|
||||
text: {
|
||||
create: 'courselocation.add_temporary_address',
|
||||
edit: 'courselocation.edit_temporary_address'
|
||||
},
|
||||
},
|
||||
title: {
|
||||
create: 'courselocation.add_temporary_address',
|
||||
edit: 'courselocation.edit_temporary_address'
|
||||
},
|
||||
/// Modal title text if create or edit address (trans chain, see i18n)
|
||||
title: { create: null, edit: null },
|
||||
/// Display each step in page or Modal
|
||||
bindModal: {
|
||||
//step1: false, step2: false
|
||||
@@ -77,15 +74,39 @@ export default {
|
||||
displayResult: true,
|
||||
redirectToBackUrl: false
|
||||
},
|
||||
type: 'courseLocation',
|
||||
type: 'accompanying_course_location',
|
||||
result: null // <== returned from addAddress component
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
accompanyingCourse: state => state.accompanyingCourse,
|
||||
context: state => state.addressContext
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
initAddressContext() {
|
||||
let ac = {
|
||||
entity: {
|
||||
type: this.accompanyingCourse.type,
|
||||
id: this.accompanyingCourse.id
|
||||
},
|
||||
edit: false,
|
||||
addressId: null,
|
||||
backUrl: null
|
||||
}
|
||||
this.$store.commit('setAddressContext', ac);
|
||||
},
|
||||
displayErrors() {
|
||||
return this.$refs.addAddress.errorMsg;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initAddressContext();
|
||||
console.log('ac.locationStatus', this.accompanyingCourse.locationStatus);
|
||||
console.log('ac.location (temporary location)', this.accompanyingCourse.location);
|
||||
console.log('ac.personLocation', this.accompanyingCourse.personLocation);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user