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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapState } from 'vuex';
|
||||||
import PersonItem from "./PersonItem.vue"
|
import PersonItem from "./PersonItem.vue"
|
||||||
|
|
||||||
|
let SimpsonId = 10000
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PersonsAssociated',
|
name: 'PersonsAssociated',
|
||||||
components: {
|
components: {
|
||||||
PersonItem
|
PersonItem,
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
accompanying_course() {
|
|
||||||
return this.$store.state.accompanying_course
|
|
||||||
},
|
|
||||||
participations() {
|
|
||||||
return this.accompanying_course.participations
|
|
||||||
},
|
|
||||||
counter() {
|
|
||||||
return this.participations.length
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
computed: mapState({
|
||||||
|
participations: state => state.accompanying_course.participations,
|
||||||
|
counter: state => state.accompanying_course.participations.length
|
||||||
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
addPerson() {
|
addPerson() {
|
||||||
this.$store.commit('addParticipation', {
|
this.$store.commit('addParticipation', {
|
||||||
person: { firstName: "Lisa", lastName: "Simpson", },
|
id: SimpsonId++,
|
||||||
startDate: "1975-09-15", endDate: "2021-04-20"
|
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) {
|
removePerson(item) {
|
||||||
this.$store.commit('removeParticipation', item)
|
this.$store.commit('removeParticipation', item)
|
||||||
|
@ -11,6 +11,8 @@ let promise = getAccompanyingCourse(window.accompanyingCourseId)
|
|||||||
state: {
|
state: {
|
||||||
accompanying_course: accompanying_course
|
accompanying_course: accompanying_course
|
||||||
},
|
},
|
||||||
|
getters: {
|
||||||
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
removeParticipation(state, item) {
|
removeParticipation(state, item) {
|
||||||
console.log('remove item', item.id);
|
console.log('remove item', item.id);
|
||||||
@ -20,6 +22,8 @@ let promise = getAccompanyingCourse(window.accompanyingCourseId)
|
|||||||
console.log('add new item');
|
console.log('add new item');
|
||||||
state.accompanying_course.participations.push(item)
|
state.accompanying_course.participations.push(item)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//console.log('store', store);
|
//console.log('store', store);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user