mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-23 16:13:50 +00:00
rdv: add my calendar + checkbox
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
<calendar-user-selector
|
||||
v-bind:users="users"
|
||||
v-bind:calendarEvents="calendarEvents"
|
||||
v-bind:updateEventsSource="updateEventsSource">
|
||||
v-bind:updateEventsSource="updateEventsSource"
|
||||
v-bind:showMyCalendar="showMyCalendar"
|
||||
v-bind:toggleMyCalendar="toggleMyCalendar" >
|
||||
</calendar-user-selector>
|
||||
<h2 class="chill-red">{{ $t('choose_your_date') }}</h2>
|
||||
<FullCalendar ref="fullCalendar" :options="calendarOptions">
|
||||
@@ -51,15 +53,16 @@ export default {
|
||||
calendarEvents: {
|
||||
loaded: [],
|
||||
selected: [],
|
||||
user: [], //TODO load user calendar events
|
||||
user: [],
|
||||
current: currentEvent
|
||||
},
|
||||
showMyCalendar: true,
|
||||
calendarOptions: {
|
||||
locale: frLocale,
|
||||
plugins: [ dayGridPlugin, interactionPlugin, timeGridPlugin, listPlugin ],
|
||||
initialView: 'timeGridWeek',
|
||||
initialDate: window.startDate !== undefined ? window.startDate : new Date(),
|
||||
eventSources: window.startDate !== undefined ? [currentEvent] : [],
|
||||
eventSource: [],
|
||||
selectable: true,
|
||||
select: this.onDateSelect,
|
||||
eventChange: this.onEventChange,
|
||||
@@ -79,19 +82,21 @@ export default {
|
||||
methods: {
|
||||
init() {
|
||||
console.log(window.startDate)
|
||||
// let calendar = this.$refs.fullCalendar.getApi()
|
||||
// console.log(calendar)
|
||||
this.calendarEvents.selected.push(this.calendarEvents.user);
|
||||
this.calendarOptions.eventSources = this.calendarEvents.selected;
|
||||
console.log(this.calendarOptions.eventSources)
|
||||
|
||||
this.updateEventsSource()
|
||||
},
|
||||
toggleMyCalendar(value) {
|
||||
this.showMyCalendar = value;
|
||||
},
|
||||
updateEventsSource() {
|
||||
this.calendarOptions.eventSources = [];
|
||||
this.calendarOptions.eventSources.push(...this.calendarEvents.selected);
|
||||
console.log(this.calendarOptions.eventSources)
|
||||
if (window.startDate !== undefined) {
|
||||
this.calendarEvents.selected.push(currentEvent);
|
||||
this.calendarOptions.eventSources.push(currentEvent);
|
||||
}
|
||||
if (this.showMyCalendar) {
|
||||
this.calendarOptions.eventSources.push(this.calendarEvents.user);
|
||||
}
|
||||
this.calendarEvents.selected.push(this.calendarEvents.user);
|
||||
this.calendarOptions.eventSources = this.calendarEvents.selected;
|
||||
console.log(this.calendarOptions.eventSources)
|
||||
},
|
||||
onDateSelect(payload) {
|
||||
|
Reference in New Issue
Block a user