fix: update event handling in CalendarEventPanel and adjust button action in Calendar

This commit is contained in:
Shariq Ansari 2025-08-05 10:21:09 +05:30
parent 60b5665981
commit b73bca354a
2 changed files with 7 additions and 4 deletions

View File

@ -136,7 +136,7 @@ import {
Dropdown, Dropdown,
dayjs, dayjs,
} from 'frappe-ui' } from 'frappe-ui'
import { ref, computed, watch } from 'vue' import { ref, computed, watch, nextTick } from 'vue'
const props = defineProps({ const props = defineProps({
event: { event: {
@ -163,7 +163,6 @@ watch(
() => props.event, () => props.event,
(newEvent) => { (newEvent) => {
error.value = null error.value = null
_event.value = { ...newEvent }
if (newEvent && newEvent.id) { if (newEvent && newEvent.id) {
title.value = 'Event details' title.value = 'Event details'
@ -171,6 +170,7 @@ watch(
title.value = 'New event' title.value = 'New event'
} }
nextTick(() => (_event.value = { ...newEvent }))
setTimeout(() => eventTitle.value?.el?.focus(), 100) setTimeout(() => eventTitle.value?.el?.focus(), 100)
}, },
{ immediate: true }, { immediate: true },

View File

@ -4,7 +4,7 @@
<ViewBreadcrumbs routeName="Calendar" /> <ViewBreadcrumbs routeName="Calendar" />
</template> </template>
<template #right-header> <template #right-header>
<Button variant="solid" :label="__('Create')" @click="createEvent"> <Button variant="solid" :label="__('Create')" @click="showEventPanelArea">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button> </Button>
</template> </template>
@ -261,7 +261,10 @@ function getFromToTime(time) {
let fromTime = `${h}:${m}` let fromTime = `${h}:${m}`
let toTime = `${parseInt(h) + 1}:${m}` let toTime = `${parseInt(h) + 1}:${m}`
if (time.toLowerCase().includes('am') || time.toLowerCase().includes('pm')) { if (
time?.toLowerCase().includes('am') ||
time?.toLowerCase().includes('pm')
) {
// 12 hour format // 12 hour format
time = time.trim().replace(' ', '') time = time.trim().replace(' ', '')
const ampm = time.slice(-2) const ampm = time.slice(-2)