From 0585455bbe4f3d72bc0e4830f3bd23a05847332a Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 21 Jul 2021 13:59:31 +0200 Subject: [PATCH] rdv: fullcalendar vue: use store and add an event on date select --- .../Resources/public/vuejs/Calendar/store.js | 12 ++++++++++++ .../_components/CalendarRange/CalendarRange.vue | 12 ++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store.js index 99a9da5d8..77a9344c7 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store.js @@ -29,6 +29,7 @@ const store = createStore({ strict: debug, state: { activity: mapEntity(window.entity), + events: [] }, mutations: { @@ -60,6 +61,11 @@ const store = createStore({ state.activity.users = state.activity.users.filter(user => user !== payload); break; }; + }, + // Calendar + onDateSelect(state, payload) { + console.log(payload) + state.events.push( {start: payload.start, end: payload.end}) } }, actions: { @@ -98,6 +104,12 @@ const store = createStore({ break; }; commit('removePersonInvolved', payload); + }, + + // Calendar + onDateSelect({ commit }, payload) { + console.log('### action onDateSelect', payload); + commit('onDateSelect', payload); } } }); diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_components/CalendarRange/CalendarRange.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_components/CalendarRange/CalendarRange.vue index 1085aef0c..1e941f8bd 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_components/CalendarRange/CalendarRange.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_components/CalendarRange/CalendarRange.vue @@ -1,4 +1,5 @@