diff --git a/frontend/src/components/Calendar/CalendarEventPanel.vue b/frontend/src/components/Calendar/CalendarEventPanel.vue index d1e65b8b..0113a141 100644 --- a/frontend/src/components/Calendar/CalendarEventPanel.vue +++ b/frontend/src/components/Calendar/CalendarEventPanel.vue @@ -229,7 +229,13 @@ const emit = defineEmits(['save', 'edit', 'delete', 'details', 'close']) const show = defineModel() -const title = ref('New event') +const title = computed(() => { + if (props.mode === 'details') return __('Event details') + if (props.mode === 'edit') return __('Editing event') + if (props.mode === 'create') return __('New event') + return __('Duplicate event') +}) + const _event = ref({}) const eventTitle = ref(null) @@ -240,16 +246,6 @@ watch( (newEvent) => { error.value = null - if (props.mode === 'details') { - title.value = 'Event details' - } else if (props.mode === 'edit') { - title.value = 'Editing event' - } else if (props.mode === 'create') { - title.value = 'New event' - } else { - title.value = 'Duplicate event' - } - nextTick(() => { if (props.mode === 'create' && _event.value.id === 'new-event') { _event.value.fromDate = newEvent.fromDate diff --git a/frontend/src/pages/Calendar.vue b/frontend/src/pages/Calendar.vue index 78150ddd..e502dcac 100644 --- a/frontend/src/pages/Calendar.vue +++ b/frontend/src/pages/Calendar.vue @@ -157,7 +157,11 @@ const events = createListResource({ }) function saveEvent(_event) { - if (!event.id || event.id === 'new-event' || event.id === 'duplicate-event') { + if ( + !_event.id || + _event.id === 'new-event' || + _event.id === 'duplicate-event' + ) { createEvent(_event) } else { updateEvent(_event) @@ -193,16 +197,23 @@ function updateEvent(_event) { if (!_event.id) return if (!mode.value || mode.value === 'edit' || mode.value === 'details') { - events.setValue.submit({ - name: _event.id, - subject: _event.title, - description: _event.description, - starts_on: _event.fromDateTime, - ends_on: _event.toDateTime, - all_day: _event.isFullDay, - event_type: _event.eventType, - color: _event.color, - }) + events.setValue.submit( + { + name: _event.id, + subject: _event.title, + description: _event.description, + starts_on: _event.fromDateTime, + ends_on: _event.toDateTime, + all_day: _event.isFullDay, + event_type: _event.eventType, + color: _event.color, + }, + { + onSuccess: () => { + mode.value = 'details' + }, + }, + ) } event.value = _event