fix: reload event after editing event
This commit is contained in:
parent
c69a468e35
commit
92b79c2195
@ -426,6 +426,8 @@ const eventTitle = ref(null)
|
|||||||
const error = ref(null)
|
const error = ref(null)
|
||||||
const showAllParticipants = ref(false)
|
const showAllParticipants = ref(false)
|
||||||
|
|
||||||
|
const eventResource = ref({})
|
||||||
|
|
||||||
const oldEvent = ref(null)
|
const oldEvent = ref(null)
|
||||||
const dirty = computed(() => {
|
const dirty = computed(() => {
|
||||||
return JSON.stringify(oldEvent.value) !== JSON.stringify(_event.value)
|
return JSON.stringify(oldEvent.value) !== JSON.stringify(_event.value)
|
||||||
@ -452,7 +454,7 @@ function fetchEvent() {
|
|||||||
event.value.id !== 'new-event' &&
|
event.value.id !== 'new-event' &&
|
||||||
event.value.id !== 'duplicate-event'
|
event.value.id !== 'duplicate-event'
|
||||||
) {
|
) {
|
||||||
let e = createDocumentResource({
|
eventResource.value = createDocumentResource({
|
||||||
doctype: 'Event',
|
doctype: 'Event',
|
||||||
name: event.value.id,
|
name: event.value.id,
|
||||||
fields: ['*'],
|
fields: ['*'],
|
||||||
@ -461,9 +463,11 @@ function fetchEvent() {
|
|||||||
oldEvent.value = { ..._event.value }
|
oldEvent.value = { ..._event.value }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if (e.doc) {
|
if (eventResource.value.doc && !event.value.reloadEvent) {
|
||||||
_event.value = parseEvent(e.doc)
|
_event.value = parseEvent(eventResource.value.doc)
|
||||||
oldEvent.value = { ..._event.value }
|
oldEvent.value = { ..._event.value }
|
||||||
|
} else {
|
||||||
|
eventResource.value.reload()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_event.value = event.value
|
_event.value = event.value
|
||||||
|
|||||||
@ -190,12 +190,12 @@ function removeTempEvents() {
|
|||||||
events.data = events.data.filter((ev) => !isTempEvent(ev.id))
|
events.data = events.data.filter((ev) => !isTempEvent(ev.id))
|
||||||
}
|
}
|
||||||
|
|
||||||
function openEvent(e, nextMode) {
|
function openEvent(e, nextMode, reloadEvent = false) {
|
||||||
const _e = e?.calendarEvent || e
|
const _e = e?.calendarEvent || e
|
||||||
if (!_e?.id || isTempEvent(_e.id)) return
|
if (!_e?.id || isTempEvent(_e.id)) return
|
||||||
removeTempEvents()
|
removeTempEvents()
|
||||||
showEventPanel.value = true
|
showEventPanel.value = true
|
||||||
event.value = { id: _e.id }
|
event.value = { id: _e.id, reloadEvent }
|
||||||
activeEvent.value = _e.id
|
activeEvent.value = _e.id
|
||||||
mode.value = nextMode
|
mode.value = nextMode
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ async function updateEvent(_event, afterDrag = false) {
|
|||||||
{
|
{
|
||||||
onSuccess: async (e) => {
|
onSuccess: async (e) => {
|
||||||
await events.reload()
|
await events.reload()
|
||||||
showEventPanel.value && showDetails({ id: e.name })
|
showEventPanel.value && showDetails({ id: e.name }, true)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -315,8 +315,8 @@ onMounted(() => {
|
|||||||
showEventPanel.value = false
|
showEventPanel.value = false
|
||||||
})
|
})
|
||||||
|
|
||||||
function showDetails(e) {
|
function showDetails(e, reloadEvent = false) {
|
||||||
openEvent(e, 'details')
|
openEvent(e, 'details', reloadEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
function editDetails(e) {
|
function editDetails(e) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user