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

View File

@ -4,7 +4,7 @@
<ViewBreadcrumbs routeName="Calendar" />
</template>
<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>
</Button>
</template>
@ -261,7 +261,10 @@ function getFromToTime(time) {
let fromTime = `${h}:${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
time = time.trim().replace(' ', '')
const ampm = time.slice(-2)