From c20e9507d516a0dea0e2d2cd801b9eb4a69d90fe Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 5 May 2021 15:03:58 +0200 Subject: [PATCH] prepare close participation button (wip) --- .../AccompanyingCourse/components/PersonItem.vue | 15 +++++++++++++-- .../components/PersonsAssociated.vue | 10 ++++++---- .../vuejs/AccompanyingCourse/store/index.js | 11 +++++++---- .../public/vuejs/_components/AddPersons.vue | 14 +++----------- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonItem.vue index 93b3b1d6e..2df932e0f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonItem.vue @@ -24,10 +24,16 @@
  • +
  • + +
  • @@ -45,6 +51,11 @@ export default { } } }, - emits: ['remove'] + emits: ['remove'], + methods: { + closeParticiapation() { + + } + } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue index 22fae5d79..6827ea585 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue @@ -17,17 +17,17 @@ v-for="participation in participations" v-bind:participation="participation" v-bind:key="participation.id" - @remove="removePerson"> + @remove="removeParticipation"> @@ -48,12 +48,14 @@ export default { counter: state => state.accompanying_course.participations.length }), methods: { - removePerson(item) { + removeParticipation(item) { this.$store.dispatch('removeParticipation', item) }, + /* savePersons() { console.log('[wip] saving persons'); } +*/ } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js index c3a868950..e69fab0d2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -25,10 +25,13 @@ let getDataPromise = getAccompanyingCourse(id) }, mutations: { removeParticipation(state, item) { - //console.log('remove item', item.id); - state.accompanying_course.participations = state.accompanying_course.participations.filter( - participation => participation !== item - ); + //console.log('mutation: remove item', item.id); + state.accompanying_course.participations = state.accompanying_course.participations.filter(participation => participation !== item); + }, + closeParticipation(state, item) { + console.log('mutation: close item', item.id); + let participation = state.accompanying_course.participations.filter(participation => participation === item); + console.log('participation', participation); }, addParticipation(state, item) { //console.log('add new item'); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 7367d1406..8c472157a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -43,6 +43,9 @@ v-bind:item="item" v-bind:key="item.id"> + @@ -112,17 +115,6 @@ export default { addPersons() { console.log('add persons'); // code here - /* - addPerson() { - console.log('[wip] opening add persons modal'); - this.$store.dispatch('addParticipation', { - 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" }, - }) - }, - */ this.modal.showModal = false; } }