mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
rdv: edition plage de disponibilités: copy events to next day (WIP)
This commit is contained in:
parent
25b85fcc68
commit
e1ccc8aba5
@ -16,6 +16,18 @@
|
||||
@click.prevent="onClickSave">
|
||||
{{ $t('action.save')}}
|
||||
</button>
|
||||
<div class="form-check">
|
||||
<input type="checkbox" id="myCalendar" class="form-check-input" v-model="showMyCalendarWidget" />
|
||||
<label class="form-check-label" for="myCalendar">{{ $t('show_my_calendar') }}</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input type="checkbox" id="weekends" class="form-check-input" @click="toggleWeekends" />
|
||||
<label class="form-check-label" for="weekends">{{ $t('show_weekends') }}</label>
|
||||
</div>
|
||||
<button class="btn btn-action"
|
||||
@click.prevent="copyDay">
|
||||
{{ $t('copy_range_to_next_day')}}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -68,6 +80,17 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showMyCalendarWidget: {
|
||||
set(value) {
|
||||
this.toggleMyCalendar(value);
|
||||
this.updateEventsSource();
|
||||
},
|
||||
get() {
|
||||
return this.showMyCalendar;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.fetchData()
|
||||
@ -143,12 +166,50 @@ export default {
|
||||
payload.event.setProp('color', '#3788d8');
|
||||
this.$store.dispatch('updateRange', payload);
|
||||
},
|
||||
onClickSave(payload){
|
||||
onClickSave(payload) {
|
||||
this.$store.dispatch('saveRanges', payload);
|
||||
},
|
||||
onDelete(payload){
|
||||
onDelete(payload) {
|
||||
payload.setProp('color', '#dddddd');
|
||||
this.$store.dispatch('deleteRange', payload);
|
||||
},
|
||||
copyDay(payload) {
|
||||
console.log(payload);
|
||||
// TODO get current day, or get current new events
|
||||
console.log(this.calendarEvents.new);
|
||||
if (this.calendarEvents.new.events) {
|
||||
// TODO copy all events of the **LAST** day and create a array of events for the next day
|
||||
// TODO if showWeekends, copy on the next day always, else, skip weekends
|
||||
let events = this.calendarEvents.new.events.map(i => {
|
||||
let startDate = new Date(new Date(i.start).getTime() + 24*60*60*1000);
|
||||
let endDate = new Date(new Date(i.end).getTime() + 24*60*60*1000);
|
||||
return ({
|
||||
start: startDate.toISOString(),
|
||||
end: endDate.toISOString()
|
||||
})
|
||||
}
|
||||
|
||||
);
|
||||
let copiedEvents = {
|
||||
events: events,
|
||||
color: "#3788d8"
|
||||
};
|
||||
console.log(copiedEvents)
|
||||
//TODO in a loop : this.$store.dispatch('createRange', payload);
|
||||
|
||||
let newEvents = this.calendarEvents.new.events;
|
||||
newEvents.push(...copiedEvents.events);
|
||||
this.calendarEvents.new = {
|
||||
events: newEvents,
|
||||
color: "#3788d8"
|
||||
};
|
||||
|
||||
console.log(this.calendarEvents.new.events)
|
||||
this.updateEventsSource();
|
||||
} else {
|
||||
console.log('no new events to copy-paste!')
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -1,5 +1,10 @@
|
||||
const appMessages = {
|
||||
fr: {
|
||||
edit_your_calendar_range: "Planifiez vos plages de disponibilités",
|
||||
show_my_calendar: "Afficher mon calendrier",
|
||||
show_weekends: "Afficher les week-ends",
|
||||
copy_range_to_next_day: "Copier les plages du jour au jour suivant",
|
||||
copy_range_to_next_week: "Copier les plages de la semaine à la semaine suivante"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user