mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
rdv: fullcalendar vue: use store and add an event on date select
This commit is contained in:
parent
f508971b6a
commit
0585455bbe
@ -29,6 +29,7 @@ const store = createStore({
|
|||||||
strict: debug,
|
strict: debug,
|
||||||
state: {
|
state: {
|
||||||
activity: mapEntity(window.entity),
|
activity: mapEntity(window.entity),
|
||||||
|
events: []
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
|
||||||
@ -60,6 +61,11 @@ const store = createStore({
|
|||||||
state.activity.users = state.activity.users.filter(user => user !== payload);
|
state.activity.users = state.activity.users.filter(user => user !== payload);
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
// Calendar
|
||||||
|
onDateSelect(state, payload) {
|
||||||
|
console.log(payload)
|
||||||
|
state.events.push( {start: payload.start, end: payload.end})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@ -98,6 +104,12 @@ const store = createStore({
|
|||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
commit('removePersonInvolved', payload);
|
commit('removePersonInvolved', payload);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Calendar
|
||||||
|
onDateSelect({ commit }, payload) {
|
||||||
|
console.log('### action onDateSelect', payload);
|
||||||
|
commit('onDateSelect', payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<h2 class="chill-red">{{ $t('choose_your_date') }}</h2>
|
||||||
<FullCalendar :options="calendarOptions" />
|
<FullCalendar :options="calendarOptions" />
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -9,15 +10,22 @@ import interactionPlugin from '@fullcalendar/interaction'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
FullCalendar // make the <FullCalendar> tag available
|
FullCalendar
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
calendarOptions: {
|
calendarOptions: {
|
||||||
plugins: [ dayGridPlugin, interactionPlugin ],
|
plugins: [ dayGridPlugin, interactionPlugin ],
|
||||||
initialView: 'dayGridMonth'
|
initialView: 'dayGridMonth',
|
||||||
|
selectable: true,
|
||||||
|
select: this.onDateSelect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onDateSelect(payload) {
|
||||||
|
this.$store.dispatch('onDateSelect', payload);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user