mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix addPerson feature with vue3+store+i18n
This commit is contained in:
parent
083338da8d
commit
3a0c25c871
@ -29,34 +29,32 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex';
|
||||
import PersonItem from "./PersonItem.vue"
|
||||
|
||||
let SimpsonId = 10000
|
||||
|
||||
export default {
|
||||
name: 'PersonsAssociated',
|
||||
components: {
|
||||
PersonItem
|
||||
},
|
||||
computed: {
|
||||
accompanying_course() {
|
||||
return this.$store.state.accompanying_course
|
||||
},
|
||||
participations() {
|
||||
return this.accompanying_course.participations
|
||||
},
|
||||
counter() {
|
||||
return this.participations.length
|
||||
}
|
||||
PersonItem,
|
||||
},
|
||||
computed: mapState({
|
||||
participations: state => state.accompanying_course.participations,
|
||||
counter: state => state.accompanying_course.participations.length
|
||||
}),
|
||||
methods: {
|
||||
addPerson() {
|
||||
this.$store.commit('addParticipation', {
|
||||
person: { firstName: "Lisa", lastName: "Simpson", },
|
||||
startDate: "1975-09-15", endDate: "2021-04-20"
|
||||
id: SimpsonId++,
|
||||
person: { firstName: "Lisa", lastName: "Simpson", id: SimpsonId },
|
||||
startDate: { datetime: "1975-09-15T00:00:00+0100" },
|
||||
endDate: { datetime: "1975-09-28T00:00:00+0100" },
|
||||
})
|
||||
return this.accompanying_course
|
||||
},
|
||||
removePerson(item) {
|
||||
this.$store.commit('removeParticipation', item)
|
||||
|
@ -11,6 +11,8 @@ let promise = getAccompanyingCourse(window.accompanyingCourseId)
|
||||
state: {
|
||||
accompanying_course: accompanying_course
|
||||
},
|
||||
getters: {
|
||||
},
|
||||
mutations: {
|
||||
removeParticipation(state, item) {
|
||||
console.log('remove item', item.id);
|
||||
@ -20,6 +22,8 @@ let promise = getAccompanyingCourse(window.accompanyingCourseId)
|
||||
console.log('add new item');
|
||||
state.accompanying_course.participations.push(item)
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
}
|
||||
});
|
||||
//console.log('store', store);
|
||||
|
Loading…
x
Reference in New Issue
Block a user