allow to select a date on a calendar

This commit is contained in:
2022-05-23 22:26:39 +02:00
parent d32a69a657
commit d8e7a7f1af
4 changed files with 74 additions and 18 deletions

View File

@@ -141,12 +141,19 @@ export default {
}
},
onDateSelect(payload) {
console.log(payload)
this.unSelectPreviousEvent(this.selectedEvent);
Object.assign(payload, {users: this.users});
Object.assign(payload, {title: 'Choisir cette plage'}); //TODO does not display
//payload.event.setProp('title', 'Choisir cette plage');
this.$store.dispatch('createEvent', payload);
console.log('onDateSelect', payload);
// show an alert if changing mainUser
if (this.$store.getters.getMainUser !== null
&& this.$store.state.me.id !== this.$store.getters.getMainUser.id) {
if (!window.confirm(this.$t('will_change_main_user_for_me'))) {
return;
} else {
this.$store.commit('showUserOnCalendar', {user: this.$store.state.me, remotes: true, ranges: true})
}
}
this.$store.dispatch('setEventTimes', {start: payload.start, end: payload.end});
},
onEventChange(payload) {
this.$store.dispatch('updateEvent', payload);
@@ -158,8 +165,8 @@ export default {
}
// show an alert if changing mainUser
if (this.$store.state.activity.mainUser !== null
&& payload.event.extendedProps.userId !== this.$store.state.activity.mainUser.id) {
if (this.$store.getters.getMainUser !== null
&& payload.event.extendedProps.userId !== this.$store.getMainUser.id) {
if (!window.confirm(this.$t('this_calendar_range_will_change_main_user'))) {
return;
}