refactor: streamline event handling and improve onSuccess callbacks in Calendar
This commit is contained in:
parent
1c432d8610
commit
f9f1c2a437
@ -112,7 +112,7 @@ import {
|
|||||||
dayjs,
|
dayjs,
|
||||||
CalendarActiveEvent as activeEvent,
|
CalendarActiveEvent as activeEvent,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
|
|
||||||
const { user } = sessionStore()
|
const { user } = sessionStore()
|
||||||
const { $dialog } = globalStore()
|
const { $dialog } = globalStore()
|
||||||
@ -149,22 +149,13 @@ const events = createListResource({
|
|||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
insert: {
|
insert: {
|
||||||
onSuccess: async () => {
|
onSuccess: () => events.reload(),
|
||||||
await events.reload()
|
|
||||||
calendar.value.reloadEvents()
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
delete: {
|
delete: {
|
||||||
onSuccess: async () => {
|
onSuccess: () => events.reload(),
|
||||||
await events.reload()
|
|
||||||
calendar.value.reloadEvents()
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
setValue: {
|
setValue: {
|
||||||
onSuccess: async () => {
|
onSuccess: () => events.reload(),
|
||||||
await events.reload()
|
|
||||||
calendar.value.reloadEvents()
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -212,9 +203,13 @@ function updateEvent(_event) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
showEventPanel.value = false
|
showEventPanel.value = false
|
||||||
showEventDetails.value = true
|
|
||||||
|
if (showEventPanel.value) {
|
||||||
|
showEventPanel.value = true
|
||||||
|
activeEvent.value = _event.id
|
||||||
|
}
|
||||||
|
|
||||||
event.value = _event
|
event.value = _event
|
||||||
activeEvent.value = _event.id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteEvent(eventID) {
|
function deleteEvent(eventID) {
|
||||||
@ -243,6 +238,12 @@ function deleteEvent(eventID) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
activeEvent.value = ''
|
||||||
|
showEventPanel.value = false
|
||||||
|
showEventDetails.value = false
|
||||||
|
})
|
||||||
|
|
||||||
const showEventPanel = ref(false)
|
const showEventPanel = ref(false)
|
||||||
const showEventDetails = ref(false)
|
const showEventDetails = ref(false)
|
||||||
const event = ref({})
|
const event = ref({})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user